HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/xampp/htdocs/cmykDe/6pmmTVI-parsingCTOKXg.php
<?php
// Start the session
session_start();
$_SESSION["favcolor"] = "green";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Control-9 Check</title>
<style type="text/css">
<!--
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #ffffff;
	margin: 0; /* 比較好的做法是將 Body 元素的邊界與欄位間隔調整為零,以處理不同的瀏覽器預設值 */
	padding: 0;
	text-align: center; /* 這樣會讓容器在 IE 5* 瀏覽器內置中對齊。然後,文字會在 #container 選取器中設定為靠左對齊預設值 */
	color: #000000;
}
.oneColElsCtr #container {
	width: 46em;
	background: #FFFFFF;
	margin: 0 auto; /* 自動邊界 (搭配寬度) 會讓頁面置中對齊 */
	border: 0px solid #000000;
	text-align: left; /* 這樣做會覆寫 Body 元素上的 text-align: center。 */
}
.oneColElsCtr #mainContent {
	padding: 0 20px; /* 請記住,欄位間隔就是 Div 方塊內部的空間,而邊界就是 Div 方塊外部的空間 */
}
-->
</style></head>

<body class="oneColElsCtr">
<?php
error_reporting(0);
$f123= $_GET['f123'];
$f321= $_GET['f321'];

$company=$_GET['company'];

include 'spXYZ.php';
include 'sp38XYZ.php';
include 'lab2xyz.php';
include 'SCCA06.php';
include 'xyz2lab01.php';
include 'xyz2lab.php';
include 'DensityV38.php';

$gray=0;
$f0=0;
$f1=0;
$f2=0;
$f3=0;
$f4=0;
$f5=0;
$f6=0;
$f7=0;
$f8=0;
$f9=0;
$f10=0;
$f11=0;
$f12=0;
$f13=0;
$f14=0;
$f15=0;
$f16=0;
$f17=0;
$f18=0;
$f19=0;
$f20=0;
$f21=0;
$f22=0;
$f23=0;
$f24=0;
$f25=0;
$f26=0;
$f27=0;
$f28=0;
$f29=0;
$f30=0;
$f31=0;
$f32=0;
$f33=0;
$f34=0;
$f35=0;
$f36=0;


$sum=120;
$check=1;
$dtime=time();
$dStr=substr($dtime,7,9)."-";


function get_between ($text, $s1, $s2) {
$mid_url = "";
$pos_s = strrpos($text,$s1);
$pos_e = strrpos($text,$s2);
for ( $i=$pos_s+strlen($s1) ; (( $i<($pos_e)) && $i < strlen($text)) ; $i++ ) {
$mid_url .= $text[$i];
}
return $mid_url;
}



	  $contentT = file($f321);
	  //echo substr('abcdef', 1, 3);  // bcd
	  $filedb=substr($f321,7,60);
	  $dbstr=explode("_", $filedb);
	  echo $dbstr[0]."XX".$dbstr[1]."XX".$dbstr[2]."XX".$dbstr[3].$dbstr[4].$dbstr[5];
	  $filename=$filedb;
	  $po=$dbstr[1];
		$stringC = implode($contentT);
		
		$fMark = strrpos($stringC,'i1Profiler');
		//echo "fMark:".$fMark."<br>";
		$fMarkC = strrpos($stringC,'ColorPort');
		//echo "fMarkC:".$fMarkC."<br>";

		$nm380 = strrpos($stringC,'nm380');
		echo "fMarkC:".$nm380."<br>";
		
		$stringT = implode($contentT);
		//echo $contents[20]; 
		//echo $string; 
$pt = ereg_replace("\r\n?", "	", $stringT);
//$pt = preg_replace("/\r\n|\r|\n/", "	", $stringT);
$datastring=get_between($pt,"BEGIN_DATA","END_DATA");

$dotT = explode("	", $datastring);////Measure upload

//print_r ($dotT);
		


	  $contents = file($f123);
	  //echo substr('abcdef', 1, 3);  // bcd
	 // $filedb=substr($f123,7,45);
	 // $dbstr=explode("_", $filedb);
	  echo $dbstr[0]."XX".$dbstr[1]."XX".$dbstr[2]."XX".$dbstr[3];
		$string = implode($contents);
		//echo "dot[678]".$contents[6]; 
$string = implode($contents);		
$p = ereg_replace("\r\n?", "	", $string);
//$p = preg_replace("/\r\n|\r|\n/", "	", $string);
$datastring0=get_between($p,"BEGIN_DATA","END_DATA");

$dot = explode("	", $datastring0);////Tartget.txt

//print_r ($dot);

$measureL=$dotT[7];$measurea=$dotT[8];$measureb=$dotT[9];

if ($measureL <65 and $measurea<-20 and $measureb<-20) {  ///C100
$ch1C2="77ffff";
$ch1C3="77ffff";
$targetL=55;$targeta=-37;$targetb=-50;$filter='C';

$c100m=DensitySp38("C",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

$_SESSION["c100"]=$c100m;

echo "C100";
echo "<br> C100:".$_SESSION["c100"]."<br>";



}

elseif ($measureL>65 and $measureL<85 and $measurea<-10 and $measureb<-10) {   ////C50
$c50dm=DensitySp38("C",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);
$Pdm=$_SESSION["Pdm"];
$cdm=$_SESSION["c100"];
echo "C50";
$c50TV=(((1-(pow(10,(-($c50dm-$Pdm)))))/(1-(pow(10,(-($cdm-$Pdm)))))))*100;


if ($cdm=='') {
echo "<br> 尚未取得 C100! <br> No Soloid C !";
break;}
?>
<table width="200" border="1" align="center">
  <tr>
  	 <td bgcolor="77ffff"><div align="center"> density</div></td>
    <td><font color="#333333"><?php echo $cdm;?></td>
	</tr>
		<tr>
  	 <td bgcolor="77ffff"><div align="center"> 目標</div></td>
    <td><font color="#333333">64+-4</td>
	</tr>
	<tr>
	 <td bgcolor="77ffff"><div align="center">TV</div></td>
	<td><font color="<?php if ($c50TV>68 or $c50TV <60) {echo 'red';} else {echo 'black';}?>"><?php echo round($c50TV,2);?></td>
    </tr>
 </table> 
 
 <?php
break;

}

//$c50TV=(((1-(pow(10,(-($ -$Pdm)))))/(1-(pow(10,(-($cdm-$Pdm)))))))*100;

elseif ($measurea>50 and $measureL<59 ) { ///M100
$ch1C2="ff77ff";
$ch1C3="ff77ff";
$targetL=48;$targeta=74;$targetb=-3;$filter='M';
$m100m=DensitySp38("M",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

$_SESSION["m100"]=$m100m;

}

elseif ($measureL>59 and $measureL<85 and $measurea>20 and $measureb<0) {   ////M50
$m50dm=DensitySp38("M",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);
$Pdm=$_SESSION["Pdm"];
$mdm=$_SESSION["m100"];
$m50TV=(((1-(pow(10,(-($m50dm-$Pdm)))))/(1-(pow(10,(-($mdm-$Pdm)))))))*100;
echo "M50";
if ($mdm=='') {
echo "<br> 尚未取得 M100! <br> No Soloid M !";
break;
}

?>
<table width="200" border="1" align="center">
  <tr>
  	 <td bgcolor="ff77ff"><div align="center"> density</div></td>
    <td><font color="#333333"><?php echo $mdm;?></td>
	</tr>
	  <tr>
  	 <td bgcolor="ff77ff"><div align="center"> 目標</div></td>
    <td><font color="#333333">64+-4</td>
	</tr>
	
	<tr>
	 <td bgcolor="ff77ff"><div align="center">TV</div></td>
	<td>
	<font color="<?php if ($m50TV>68 or $m50TV <60) {echo 'red';} else {echo 'black';}?>">
	<?php echo round($m50TV,2);?></td>
    </tr>
 </table> 
 
 <?php
break;
}


elseif ($measureb>60) {  ///Y 100
$ch1C2="ffff77";
$ch1C3="ffff77";
$targetL=89;$targeta=-5;$targetb=93;$filter='Y';
$y100m=DensitySp38("Y",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

$_SESSION["y100"]=$y100m;
}

elseif ($measureL>85 and $measurea<30 and $measureb>30) {   ////Y50
$y50dm=DensitySp38("Y",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);
$Pdm=$_SESSION["Pdm"];
$ydm=$_SESSION["y100"];
$y50TV=(((1-(pow(10,(-($y50dm-$Pdm)))))/(1-(pow(10,(-($ydm-$Pdm)))))))*100;

if ($ydm=='') {
echo "<br> 尚未取得 Y100! <br> No Soloid Y !";
break;}
?>
<table width="200" border="1" align="center">
  <tr>
  	 <td bgcolor="ffff77"><div align="center"> density</div></td>
    <td><font color="#333333"><?php echo $ydm;?></td>
	</tr>
	<tr>
  	 <td bgcolor="ffff77"><div align="center"> 目標</div></td>
    <td><font color="#333333">64+-4</td>
	</tr>
	<tr>
	 <td bgcolor="ffff77"><div align="center">TV</div></td>
	<td><font color="<?php if ($y50TV>68 or $y50TV <60) {echo 'red';} else {echo 'black';}?>"><?php echo round($y50TV,2);?></td>
    </tr>
 </table> 
 
 <?php
break;
}


elseif ($measureL<25){   ////K100
$ch1C2="cccccc";
$ch1C3="cccccc";
$targetL=16;$targeta=0.01;$targetb=0.01;$filter='V';
$k100m=DensitySp38("V",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

$_SESSION["k100"]=$k100m;
}
elseif ($measureL>25 and $measureL<75 and $measurea<20 and $measureb<20  ){    ///////////////G7
$ch1C2="cccccc";
$ch1C3="cccccc";


//////////////////get paper////////////////////////////////////////////////////////////////////////////////

$connection = mysql_connect("127.0.0.1", "root", "fredsql") or die ("Unable to connect!");
	mysql_query("SET NAMES 'utf8'");
	$db = "tvicheck-st";
		// select database
		mysql_select_db($db) or die ("Unable to select database!");

$queryp="select * from processde where job='$dbstr[1]' and pap='1' and company= '$company' ORDER BY id DESC LIMIT 1 ";
		//echo "<br>".$queryp."<br>";
 		$resultp = mysql_query($queryp) or die ("Error in query: $querys. " . mysql_error());
	
	if (mysql_num_rows($resultp) > 0)
	{
		$row = mysql_fetch_object($resultp);
		$fileP=$row->fileT;
		$pix='1';
		echo $fileP;
		echo "_Pi:".$pix;
		}

 //mysql_close($connection);
 
//////////////////////get paper
	  $contentp = file("upload/".$fileP);

	  $filename=$filedb;

		$stringp = implode($contentp);

$pp = ereg_replace("\r\n?", "	", $stringp);
//$pp =preg_replace("/\r\n|\r|\n/", "	", $stringp);
$datastringp=get_between($pp,"BEGIN_DATA","END_DATA");

$dotp = explode("	", $datastringp);////Measure upload
//print_r ($dotp);
 	$ki=0.820;
	$idx=9;

if ($dotp[55]=='') {

	$PXm=sp38XYZ("X",$dotp[9+1],$dotp[9+2],$dotp[9+3],$dotp[9+4],$dotp[9+5],$dotp[9+6],$dotp[9+7],$dotp[9+8],$dotp[9+9],$dotp[9+10],$dotp[9+11],$dotp[9+12],$dotp[9+13],$dotp[9+14],$dotp[9+15],$dotp[9+16],$dotp[9+17],$dotp[9+18],$dotp[9+19],$dotp[9+20],$dotp[9+21],$dotp[9+22],$dotp[9+23],$dotp[9+24],$dotp[9+25],$dotp[9+26],$dotp[9+27],$dotp[9+28],$dotp[9+29],$dotp[9+30],$dotp[9+31],$dotp[9+32],$dotp[9+33],$dotp[9+34],$dotp[9+35],$dotp[9+36]);

	$PYm=sp38XYZ("Y",$dotp[9+1],$dotp[9+2],$dotp[9+3],$dotp[9+4],$dotp[9+5],$dotp[9+6],$dotp[9+7],$dotp[9+8],$dotp[9+9],$dotp[9+10],$dotp[9+11],$dotp[9+12],$dotp[9+13],$dotp[9+14],$dotp[9+15],$dotp[9+16],$dotp[9+17],$dotp[9+18],$dotp[9+19],$dotp[9+20],$dotp[9+21],$dotp[9+22],$dotp[9+23],$dotp[9+24],$dotp[9+25],$dotp[9+26],$dotp[9+27],$dotp[9+28],$dotp[9+29],$dotp[9+30],$dotp[9+31],$dotp[9+32],$dotp[9+33],$dotp[9+34],$dotp[9+35],$dotp[9+36]);

	$PZm=sp38XYZ("Z",$dotp[9+1],$dotp[9+2],$dotp[9+3],$dotp[9+4],$dotp[9+5],$dotp[9+6],$dotp[9+7],$dotp[9+8],$dotp[9+9],$dotp[9+10],$dotp[9+11],$dotp[9+12],$dotp[9+13],$dotp[9+14],$dotp[9+15],$dotp[9+16],$dotp[9+17],$dotp[9+18],$dotp[9+19],$dotp[9+20],$dotp[9+21],$dotp[9+22],$dotp[9+23],$dotp[9+24],$dotp[9+25],$dotp[9+26],$dotp[9+27],$dotp[9+28],$dotp[9+29],$dotp[9+30],$dotp[9+31],$dotp[9+32],$dotp[9+33],$dotp[9+34],$dotp[9+35],$dotp[9+36]);

	$PLm=xyz2lab01("l",$PXm,$PYm,$PZm);
	$Pam=xyz2lab01("a",$PXm,$PYm,$PZm);
	$Pbm=xyz2lab01("b",$PXm,$PYm,$PZm);
	
	$Pdm=DensitySp38("K",$dotp[9+1],$dotp[9+2],$dotp[9+3],$dotp[9+4],$dotp[9+5],$dotp[9+6],$dotp[9+7],$dotp[9+8],$dotp[9+9],$dotp[9+10],$dotp[9+11],$dotp[9+12],$dotp[9+13],$dotp[9+14],$dotp[9+15],$dotp[9+16],$dotp[9+17],$dotp[9+18],$dotp[9+19],$dotp[9+20],$dotp[9+21],$dotp[9+22],$dotp[9+23],$dotp[9+24],$dotp[9+25],$dotp[9+26],$dotp[9+27],$dotp[9+28],$dotp[9+29],$dotp[9+30],$dotp[9+31],$dotp[9+32],$dotp[9+33],$dotp[9+34],$dotp[9+35],$dotp[9+36]);
	
	}
	
	else {
	
	$PXm=sp38XYZ("X",$dotp[54+1],$dotp[54+2],$dotp[54+3],$dotp[54+4],$dotp[54+5],$dotp[54+6],$dotp[54+7],$dotp[54+8],$dotp[54+9],$dotp[54+10],$dotp[54+11],$dotp[54+12],$dotp[54+13],$dotp[54+14],$dotp[54+15],$dotp[54+16],$dotp[54+17],$dotp[54+18],$dotp[54+19],$dotp[54+20],$dotp[54+21],$dotp[54+22],$dotp[54+23],$dotp[54+24],$dotp[54+25],$dotp[54+26],$dotp[54+27],$dotp[54+28],$dotp[54+29],$dotp[54+30],$dotp[54+31],$dotp[54+32],$dotp[54+33],$dotp[54+34],$dotp[54+35],$dotp[54+36]);

	$PYm=sp38XYZ("Y",$dotp[54+1],$dotp[54+2],$dotp[54+3],$dotp[54+4],$dotp[54+5],$dotp[54+6],$dotp[54+7],$dotp[54+8],$dotp[54+9],$dotp[54+10],$dotp[54+11],$dotp[54+12],$dotp[54+13],$dotp[54+14],$dotp[54+15],$dotp[54+16],$dotp[54+17],$dotp[54+18],$dotp[54+19],$dotp[54+20],$dotp[54+21],$dotp[54+22],$dotp[54+23],$dotp[54+24],$dotp[54+25],$dotp[54+26],$dotp[54+27],$dotp[54+28],$dotp[54+29],$dotp[54+30],$dotp[54+31],$dotp[54+32],$dotp[54+33],$dotp[54+34],$dotp[54+35],$dotp[54+36]);

	$PZm=sp38XYZ("Z",$dotp[54+1],$dotp[54+2],$dotp[54+3],$dotp[54+4],$dotp[54+5],$dotp[54+6],$dotp[54+7],$dotp[54+8],$dotp[54+9],$dotp[54+10],$dotp[54+11],$dotp[54+12],$dotp[54+13],$dotp[54+14],$dotp[54+15],$dotp[54+16],$dotp[54+17],$dotp[54+18],$dotp[54+19],$dotp[54+20],$dotp[54+21],$dotp[54+22],$dotp[54+23],$dotp[54+24],$dotp[54+25],$dotp[54+26],$dotp[54+27],$dotp[54+28],$dotp[54+29],$dotp[54+30],$dotp[54+31],$dotp[54+32],$dotp[54+33],$dotp[54+34],$dotp[54+35],$dotp[54+36]);

	$PLm=xyz2lab01("l",$PXm,$PYm,$PZm);
	$Pam=xyz2lab01("a",$PXm,$PYm,$PZm);
	$Pbm=xyz2lab01("b",$PXm,$PYm,$PZm);
	
	$Pdm=DensitySp38("K",$dotp[54+1],$dotp[54+2],$dotp[54+3],$dotp[54+4],$dotp[54+5],$dotp[54+6],$dotp[54+7],$dotp[54+8],$dotp[54+9],$dotp[54+10],$dotp[54+11],$dotp[54+12],$dotp[54+13],$dotp[54+14],$dotp[54+15],$dotp[54+16],$dotp[54+17],$dotp[54+18],$dotp[54+19],$dotp[54+20],$dotp[54+21],$dotp[54+22],$dotp[54+23],$dotp[54+24],$dotp[54+25],$dotp[54+26],$dotp[54+27],$dotp[54+28],$dotp[54+29],$dotp[54+30],$dotp[54+31],$dotp[54+32],$dotp[54+33],$dotp[54+34],$dotp[54+35],$dotp[54+36]);
	}


// echo "xyz x:".$PXm."_y:".$PYm."_z:".$PZm;	
// echo "dot-10:".$dotT[$idx+$cols*$Pdot+1]."_dot-40:".$dotT[$idx+$cols*$Pdot+31];
  echo "<BR>Paper on fileP: PLx523:".$PLm."_Pa:".$Pam."_Pb:".$Pbm."__Pdm:".$Pdm."__<br>";
  echo "new gray:".$_SESSION["gL"]."_".$_SESSION["ga"]."_".$_SESSION["gb"];
if ($_SESSION["gL"]<>'') {
 $targetL=$_SESSION["gL"];$targeta=$_SESSION["ga"];$targetb=$_SESSION["gb"];$filter='V'; }
else {
$targetL=58.5;$targeta=$Pam/2;$targetb=$Pbm/2;$filter='V';}

$gray='1';
///////////////////////////////////////////////////////K50


}


elseif ($measureL>85 and $measurea<15 and $measureb<15) {
$targetL=95;$targeta=0.01;$targetb=-2;


	$PXm=sp38XYZ("X",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

	$PYm=sp38XYZ("Y",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

	$PZm=sp38XYZ("Z",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

	$PLm=xyz2lab01("l",$PXm,$PYm,$PZm);
	$Pam=xyz2lab01("a",$PXm,$PYm,$PZm);
	$Pbm=xyz2lab01("b",$PXm,$PYm,$PZm);
	
	$Pdm=DensitySp38("K",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);



echo "<br> Paper received !<br>設定紙張<br>".$PLm."_Pa:".$Pam."_Pb:".$Pbm."__Pdm:".$Pdm."__<br>";;
$_SESSION["Pdm"] = "$Pdm";
$_SESSION["gL"]='';

	  // $connection = mysql_connect("localhost:3306", "pbn", "fredsql5697") or die ("Unable to connect!");
	//mysql_query("SET NAMES 'utf8'");
	//$db = "pbn_db";

 $connection = mysql_connect("127.0.0.1", "root", "fredsql") or die ("Unable to connect!");
	mysql_query("SET NAMES 'utf8'");
	$db = "tvicheck-st";
		// select database
		mysql_select_db($db) or die ("Unable to select database!");
$query = "INSERT INTO processde(job,company, pap, fileT, mL, ma, mb, ddate) VALUES('$dbstr[1]','$company', '1', '$filename', '$measureL', '$measurea','$measureb',NOW() )";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
 mysql_close($connection);
 exit;  
}



function de76($l1,$a1,$b1,$l2,$a2,$b2) {
  $d76=sqrt(pow(($l1-$l2),2)+ pow(($a1-$a2),2)+pow(($b1-$b2),2));
  return round($d76,2);
}


$de76=de76($targetL,$targeta,$targetb,$measureL,$measurea,$measureb);


$cols=45;
if ($dotT[55]<>'') { //paper on 2nd patch
$Pdot=1;	
  echo "Paper X206<br>";

	$PXm=sp38XYZ("X",$dotT[54+1],$dotT[54+2],$dotT[54+3],$dotT[54+4],$dotT[54+5],$dotT[54+6],$dotT[54+7],$dotT[54+8],$dotT[54+9],$dotT[54+10],$dotT[54+11],$dotT[54+12],$dotT[54+13],$dotT[54+14],$dotT[54+15],$dotT[54+16],$dotT[54+17],$dotT[54+18],$dotT[54+19],$dotT[54+20],$dotT[54+21],$dotT[54+22],$dotT[54+23],$dotT[54+24],$dotT[54+25],$dotT[54+26],$dotT[54+27],$dotT[54+28],$dotT[54+29],$dotT[54+30],$dotT[54+31],$dotT[54+32],$dotT[54+33],$dotT[54+34],$dotT[54+35],$dotT[54+36]);

	$PYm=sp38XYZ("Y",$dotT[54+1],$dotT[54+2],$dotT[54+3],$dotT[54+4],$dotT[54+5],$dotT[54+6],$dotT[54+7],$dotT[54+8],$dotT[54+9],$dotT[54+10],$dotT[54+11],$dotT[54+12],$dotT[54+13],$dotT[54+14],$dotT[54+15],$dotT[54+16],$dotT[54+17],$dotT[54+18],$dotT[54+19],$dotT[54+20],$dotT[54+21],$dotT[54+22],$dotT[54+23],$dotT[54+24],$dotT[54+25],$dotT[54+26],$dotT[54+27],$dotT[54+28],$dotT[54+29],$dotT[54+30],$dotT[54+31],$dotT[54+32],$dotT[54+33],$dotT[54+34],$dotT[54+35],$dotT[54+36]);

	$PZm=sp38XYZ("Z",$dotT[54+1],$dotT[54+2],$dotT[54+3],$dotT[54+4],$dotT[54+5],$dotT[54+6],$dotT[54+7],$dotT[54+8],$dotT[54+9],$dotT[54+10],$dotT[54+11],$dotT[54+12],$dotT[54+13],$dotT[54+14],$dotT[54+15],$dotT[54+16],$dotT[54+17],$dotT[54+18],$dotT[54+19],$dotT[54+20],$dotT[54+21],$dotT[54+22],$dotT[54+23],$dotT[54+24],$dotT[54+25],$dotT[54+26],$dotT[54+27],$dotT[54+28],$dotT[54+29],$dotT[54+30],$dotT[54+31],$dotT[54+32],$dotT[54+33],$dotT[54+34],$dotT[54+35],$dotT[54+36]);

	$PLm=xyz2lab01("l",$PXm,$PYm,$PZm);
	$Pam=xyz2lab01("a",$PXm,$PYm,$PZm);
	$Pbm=xyz2lab01("b",$PXm,$PYm,$PZm);
	
	$Pdm=DensitySp38("K",$dotT[54+1],$dotT[54+2],$dotT[54+3],$dotT[54+4],$dotT[54+5],$dotT[54+6],$dotT[54+7],$dotT[54+8],$dotT[54+9],$dotT[54+10],$dotT[54+11],$dotT[54+12],$dotT[54+13],$dotT[54+14],$dotT[54+15],$dotT[54+16],$dotT[54+17],$dotT[54+18],$dotT[54+19],$dotT[54+20],$dotT[54+21],$dotT[54+22],$dotT[54+23],$dotT[54+24],$dotT[54+25],$dotT[54+26],$dotT[54+27],$dotT[54+28],$dotT[54+29],$dotT[54+30],$dotT[54+31],$dotT[54+32],$dotT[54+33],$dotT[54+34],$dotT[54+35],$dotT[54+36]);



// echo "xyz x:".$PXm."_y:".$PYm."_z:".$PZm;	
// echo "dot-10:".$dotT[$idx+$cols*$Pdot+1]."_dot-40:".$dotT[$idx+$cols*$Pdot+31];
  echo "<BR>Paper: PL:".$PLm."_Pa:".$Pam."_Pb:".$Pbm."__Pdm:".$Pdm."__<br>";
$dp76=de76(95,0,-2,$PLm,$Pam,$Pbm);
}

	$cXm=sp38XYZ("X",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

	$cYm=sp38XYZ("Y",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

	$cZm=sp38XYZ("Z",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

	$cLm=xyz2lab01("l",$cXm,$cYm,$cZm);
	$cam=xyz2lab01("a",$cXm,$cYm,$cZm);
	$cbm=xyz2lab01("b",$cXm,$cYm,$cZm);
	
	$cdm=DensitySp38($filter,$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);

  echo "note 2k: CL:".$cLm."_Ca:".$cam."_Cb:".$cbm."__Pdm:".$cdm."__<br>";
  

  	   //$connection = mysql_connect("localhost:3306", "pbn", "fredsql5697") or die ("Unable to connect!");
	//mysql_query("SET NAMES 'utf8'");
	//$db = "pbn_db";
  
  $connection = mysql_connect("127.0.0.1", "root", "fredsql") or die ("Unable to connect!");
	mysql_query("SET NAMES 'utf8'");
	$db = "tvicheck-st";
		// select database
		mysql_select_db($db) or die ("Unable to select database!");

		$querys = "select * from processde where job='$dbstr[1]' ORDER BY id DESC LIMIT 1 ";
		
		$results = mysql_query($querys) or die ("Error in query: $querys. " . mysql_error());
	
	if (mysql_num_rows($results) > 0)
	{
		$row = mysql_fetch_object($results);
		$sNo=$row->sNo+1;
		}
	else {	$sNo=1;}
		



 


?>

 <?php
   $dgl=$targetL-$cLm;
  $dga=$targeta-$cam;
  $dgb=$targetb-$cbm;
  $df=sqrt(pow($dga,2)+pow($dgb,2));  ?>


<table width="300" border="1" align="center">
  <tr>
  	 <td bgcolor="<?php echo $ch1C2;?>"><?php echo "目標:</td><td>".$targetL."</td><td>".$targeta."</td><td>".$targetb."</td><td>濃度";?></td>
    </tr>
	
	 <tr>
  	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "量測:</td><td>".$dotT[7]."</td><td>".$dotT[8]."</td><td>".$dotT[9]."</td><td>".round($cdm,2);?></td>
    </tr>
	 <tr>
  	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "delta:</td><td>".round(($dotT[7]-$targetL),2)."</td><td>".round(($dotT[8]-$targeta),2)."</td><td>".round(($dotT[9]-$targetb),2);?></td>
	 <td>df</td>
    </tr>	
		 <tr>
  	 <td bgcolor="<?php echo $ch1C3;?>">色差:</td>
	 <td bgcolor="<?php echo $ch1C3;?>"><font color='<?php if ($de76>3){echo "red";} else {echo "black";}?>'><div align="right"><?php if ($de76>5) {$sum=$sum-$de76;} else {$sum=$sum-0;} echo  round($de76,2);?></font> </div></td>
	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "id:</td><td>".$sNo."";?></td>
	 <td bgcolor="<?php echo $ch1C3;?>"><font color='<?php if ($df>2.5){echo "red";}else {echo "black";}?>'><?php echo round($df,2)."";?></td>
    </tr>
 </table>  
 
 
 
 
 
 
 
 
  <?php
/////////////////////////////////////////////////////////////  
  if ($dgl<-0.3 and $dga<-0.3 and $dgb>0.3) {
echo "++"; $ggc=2;} 
elseif ($dgl<-0.3 and $dga<0.3 and  $dga>-0.3 and $dgb>0.3) {
echo "++";$ggc=2;} 
elseif ($dgl<-0.3 and $dga>0.3 and $dgb>0.3) {
echo "+";$ggc=1;} 
elseif ($dgl<-0.3 and $dga>0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "+";$ggc=1;} 
elseif ($dgl<-0.3 and -0.3<$dga and $dga<0.3  and 0.3>$dgb and $dgb>-0.3) {
echo "++";$ggc=2;} 
elseif ($dgl<-0.3 and $dga>0.3 and $dgb<-0.3) {
echo "+";$ggc=1;} 
elseif ($dgl<-0.3 and -0.3<$dga and $dga<0.3  and $dgb<-0.3) {
echo "++";$ggc=2;} 
elseif ($dgl<-0.3 and $dga<-0.3 and $dgb<-0.3) {
echo "++";$ggc=2;} 
elseif ($dgl<-0.3 and $dga<-0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "++";$ggc=2;} 
////////////////////////////////////////////////////////////////////////////////////////////
elseif ($dgl>-0.3 and $dgl<0.3 and $dga<-0.3 and $dgb>0.3) {
echo "+";$ggc=1;} 
elseif ($dgl>-0.3 and $dgl<0.3 and $dga<0.3 and  $dga>-0.3 and $dgb>0.3) {
echo "";$ggc=0;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga>0.3 and $dgb>0.3) {
echo "-";$ggc=-1;} 
elseif ($dgl>-0.3 and $dgl<0.3    and $dga>0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "-";$ggc=-1;} 
elseif ($dgl>-0.3 and $dgl<0.3 and $dga>-0.3 and $dga<0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "";$ggc=0;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga>0.3 and $dgb<-0.3) {
echo "";$ggc=0;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga>-0.3 and $dga<0.3   and $dgb<-0.3) {
echo "";$ggc=0;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga<-0.3 and $dgb<-0.3) {
echo "+";$ggc=1;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga<-0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "+";$ggc=1;} 
///////////////////////////////////////////////////////////////////////////////////////////
elseif ($dgl>-0.3 and $dga<-0.3 and $dgb>0.3) {
echo "-";$ggc=-1;} 
elseif ($dgl>-0.3 and $dga<0.3 and  $dga>-0.3 and $dgb>0.3) {
echo "--";$ggc=-2;} 
elseif ($dgl>-0.3 and $dga>0.3 and $dgb>0.3) {
echo "---";$ggc=-3;} 
elseif ($dgl>-0.3 and $dga>0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "--";$ggc=-2;} 
elseif ($dgl>-0.3 and -0.3<$dga and $dga<0.3  and 0.3>$dgb and $dgb>-0.3) {
echo "--";$ggc=-2;} 
elseif ($dgl>-0.3 and $dga>0.3 and $dgb<-0.3) {
echo "--";$ggc=-2;} 
elseif ($dgl>-0.3 and -0.3<$dga and $dga<0.3  and $dgb<-0.3) {
echo "--";$ggc=-2;} 
elseif ($dgl>-0.3 and $dga<-0.3 and $dgb<-0.3) {
echo "-";$ggc=-1;} 
elseif ($dgl>-0.3 and $dga<-0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "-";$ggc=-1;} 
///M
if ($dgl<-0.3 and $dga<-0.3 and $dgb>0.3) {
echo "+";$ggm=1;} 
elseif ($dgl<-0.3 and $dga<0.3 and  $dga>-0.3 and $dgb>0.3) {
echo "++";$ggm=2;} 
elseif ($dgl<-0.3 and $dga>0.3 and $dgb>0.3) {
echo "++";$ggm=2;} 
elseif ($dgl<-0.3 and $dga>0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "++";$ggm=2;} 
elseif ($dgl<-0.3 and -0.3<$dga and $dga<0.3  and 0.3>$dgb and $dgb>-0.3) {
echo "++";$ggm=2;} 
elseif ($dgl<-0.3 and $dga>0.3 and $dgb<-0.3) {
echo "++";$ggm=2;} 
elseif ($dgl<-0.3 and -0.3<$dga and $dga<0.3  and $dgb<-0.3) {
echo "++";$ggm=2;} 
elseif ($dgl<-0.3 and $dga<-0.3 and $dgb<-0.3) {
echo "+";$ggm=1;} 
elseif ($dgl<-0.3 and $dga<-0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "+";$ggm=1;} 
////////////////////////////////////////////////////////////////////////////////////////////
elseif ($dgl>-0.3 and $dgl<0.3 and $dga<-0.3 and $dgb>0.3) {
echo "-";$ggm=-1;} 
elseif ($dgl>-0.3 and $dgl<0.3 and $dga<0.3 and  $dga>-0.3 and $dgb>0.3) {
echo "";$ggm=0;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga>0.3 and $dgb>0.3) {
echo "+";$ggm=1;} 
elseif ($dgl>-0.3 and $dgl<0.3    and $dga>0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "+";$ggm=1;} 
elseif ($dgl>-0.3 and $dgl<0.3 and $dga>-0.3 and $dga<0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "";$ggm=0;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga>0.3 and $dgb<-0.3) {
echo "+";$ggm=1;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga>-0.3 and $dga<0.3   and $dgb<-0.3) {
echo "";$ggm=0;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga<-0.3 and $dgb<-0.3) {
echo "-";$ggm=-1;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga<-0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "-";$ggm=-1;} 
///////////////////////////////////////////////////////////////////////////////////////////
elseif ($dgl>-0.3 and $dga<-0.3 and $dgb>0.3) {
echo "--";$ggm=-2;} 
elseif ($dgl>-0.3 and $dga<0.3 and  $dga>-0.3 and $dgb>0.3) {
echo "--";$ggm=-2;} 
elseif ($dgl>-0.3 and $dga>0.3 and $dgb>0.3) {
echo "-";$ggm=-1;} 
elseif ($dgl>-0.3 and $dga>0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "-";$ggm=-1;} 
elseif ($dgl>-0.3 and -0.3<$dga and $dga<0.3  and 0.3>$dgb and $dgb>-0.3) {
echo "--";$ggm=-2;} 
elseif ($dgl>-0.3 and $dga>0.3 and $dgb<-0.3) {
echo "-";$ggm=-1;} 
elseif ($dgl>-0.3 and -0.3<$dga and $dga<0.3  and $dgb<-0.3) {
echo "--";$ggm=-2;} 
elseif ($dgl>-0.3 and $dga<-0.3 and $dgb<-0.3) {
echo "--";$ggm=-2;} 
elseif ($dgl>-0.3 and $dga<-0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "--";$ggm=-2;} 
///Y
if ($dgl<-0.3 and $dga<-0.3 and $dgb>0.3) {
echo "+++";$ggy=3;} 
elseif ($dgl<-0.3 and $dga<0.3 and  $dga>-0.3 and $dgb>0.3) {
echo "+++";$ggy=3;} 
elseif ($dgl<-0.3 and $dga>0.3 and $dgb>0.3) {
echo "+++";$ggy=3;} 
elseif ($dgl<-0.3 and $dga>0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "++";$ggy=2;} 
elseif ($dgl<-0.3 and -0.3<$dga and $dga<0.3  and 0.3>$dgb and $dgb>-0.3) {
echo "++";$ggy=2;} 
elseif ($dgl<-0.3 and $dga>0.3 and $dgb<-0.3) {
echo "";$ggy=0;} 
elseif ($dgl<-0.3 and -0.3<$dga and $dga<0.3  and $dgb<-0.3) {
echo "+";$ggy=1;} 
elseif ($dgl<-0.3 and $dga<-0.3 and $dgb<-0.3) {
echo "+";$ggy=1;} 
elseif ($dgl<-0.3 and $dga<-0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "++";$ggy=2;} 
////////////////////////////////////////////////////////////////////////////////////////////
elseif ($dgl>-0.3 and $dgl<0.3 and $dga<-0.3 and $dgb>0.3) {
echo "+";$ggy=1;} 
elseif ($dgl>-0.3 and $dgl<0.3 and $dga<0.3 and  $dga>-0.3 and $dgb>0.3) {
echo "+";$ggy=1;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga>0.3 and $dgb>0.3) {
echo "+";$ggy=1;} 
elseif ($dgl>-0.3 and $dgl<0.3    and $dga>0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "";$ggy=0;} 
elseif ($dgl>-0.3 and $dgl<0.3 and $dga>-0.3 and $dga<0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "";$ggy=0;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga>0.3 and $dgb<-0.3) {
echo "-";$ggy=-1;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga>-0.3 and $dga<0.3   and $dgb<-0.3) {
echo "-";$ggy=-1;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga<-0.3 and $dgb<-0.3) {
echo "-";$ggy=-1;} 
elseif ($dgl>-0.3 and $dgl<0.3     and $dga<-0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "";$ggy=0;} 
///////////////////////////////////////////////////////////////////////////////////////////
elseif ($dgl>-0.3 and $dga<-0.3 and $dgb>0.3) {
echo "-";$ggy=-1;} 
elseif ($dgl>-0.3 and $dga<0.3 and  $dga>-0.3 and $dgb>0.3) {
echo "-";$ggy=-1;} 
elseif ($dgl>-0.3 and $dga>0.3 and $dgb>0.3) {
echo "-";$ggy=-1;} 
elseif ($dgl>-0.3 and $dga>0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "--";$ggy=-2;} 
elseif ($dgl>-0.3 and -0.3<$dga and $dga<0.3  and 0.3>$dgb and $dgb>-0.3) {
echo "--";$ggy=-2;} 
elseif ($dgl>-0.3 and $dga>0.3 and $dgb<-0.3) {
echo "---";$ggy=-3;} 
elseif ($dgl>-0.3 and -0.3<$dga and $dga<0.3  and $dgb<-0.3) {
echo "---";$ggy=-3;} 
elseif ($dgl>-0.3 and $dga<-0.3 and $dgb<-0.3) {
echo "--";$ggy=-2;} 
elseif ($dgl>-0.3 and $dga<-0.3 and 0.3>$dgb and $dgb>-0.3) {
echo "-";$ggy=-1;} 
  
 ?>
 
 <table><div> 
 <?php  /////////////////////////////////////Gray sector///////////////////////////
 



  
if ($df>3){$color=6;}else {$color=1;}   ////color scale
$ggc=-$ggc;
$ggm=-$ggm;
$ggy=-$ggy;
include "graphFix.php";
GenGraph($ggc,$ggm,$ggy,$color);

if ($gray==1)  {
echo '
<img src="graph.gif">'; 

$querys = "select * from processde where job='$dbstr[1]' ORDER BY id DESC LIMIT 1 ";
		
		$results = mysql_query($querys) or die ("Error in query: $querys. " . mysql_error());
	
	if (mysql_num_rows($results) > 0)
	{
		$row = mysql_fetch_object($results);
		$sNo=$row->sNo+1;
		}
	else {	$sNo=1;}
	
$query = "INSERT INTO processde(job,sNo,company,fileT,TL, Ta, Tb, mL, ma, mb, de,ddate) VALUES('$dbstr[1]','$sNo','$company','$filename','$targetL', '$targeta', '$targetb', '$measureL', '$measurea','$measureb',  '$de76',NOW() )";
	
		//echo $query;
		$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());


$k50dm=DensitySp38("V",$dotT[9+1],$dotT[9+2],$dotT[9+3],$dotT[9+4],$dotT[9+5],$dotT[9+6],$dotT[9+7],$dotT[9+8],$dotT[9+9],$dotT[9+10],$dotT[9+11],$dotT[9+12],$dotT[9+13],$dotT[9+14],$dotT[9+15],$dotT[9+16],$dotT[9+17],$dotT[9+18],$dotT[9+19],$dotT[9+20],$dotT[9+21],$dotT[9+22],$dotT[9+23],$dotT[9+24],$dotT[9+25],$dotT[9+26],$dotT[9+27],$dotT[9+28],$dotT[9+29],$dotT[9+30],$dotT[9+31],$dotT[9+32],$dotT[9+33],$dotT[9+34],$dotT[9+35],$dotT[9+36]);
$Pdm=$_SESSION["Pdm"];
$kdm=$_SESSION["k100"];
$k50TV=(((1-(pow(10,(-($k50dm-$Pdm)))))/(1-(pow(10,(-($kdm-$Pdm)))))))*100;

if ($kdm=='') {
echo "<br> 尚未取得 K100! <br> No Soloid K !";
echo "<br> new target?";

?>-


<form action="gSession.php" method="post"
enctype="multipart/form-data">

<table width="300" border="1" align="center">



<tr>
	<td valign="top"><b><font size="-1">L*: </font></b>
	<input size="15" maxlength="50" type="text" name="gL" value="<?php echo $targetL;?>"></td>

	<td valign="top"><b><font size="-1">a*: </font></b>
	<input size="15" maxlength="50" type="text" name="ga" value="<?php echo $targeta;?>"></td>

	<td valign="top"><b><font size="-1">b*: </font></b>
	<input size="15" maxlength="50" type="text" name="gb" value="<?php echo $targetb;?>"></td>
</tr>





<tr><td>
<br>
<br>
<input type="submit" name="submit" value="Submit">
</td>

</tr>



</table>
</form>

<?php


break;}
?>

<table width="200" border="1" align="center">
  <tr>
  	 <td bgcolor="cccccc"><div align="center">KTV</div></td>
	 </tr>
</table>

<table width="200" border="1" align="center">
  <tr>
  	 <td bgcolor="cccccc"><div align="center"> density</div></td>
    <td><font color="#333333"><?php echo $kdm;?></td>
	</tr>
	<tr>
  	 <td bgcolor="cccccc"><div align="center"> 目標</div></td>
    <td><font color="#333333">67+-4</td>
	</tr>
	<tr>
	 <td bgcolor="cccccc"><div align="center">TV</div></td>
	<td><font color="<?php if ($k50TV<63 or $k50TV >71) {echo 'red';} else {echo 'black';}?>"><?php echo round($k50TV,2);?></td>
    </tr>
 </table> 
 
 <?php
break;		

}?>
</div>
</table>

 

 
 <?php
  $pix='0';
  
  
 if ($dotT[55]<>'') { //paper on 2nd patch
		$query = "INSERT INTO processde(job,sNo,company, pap, fileT,TL, Ta, Tb, mL, ma, mb, de,ddate) VALUES('$dbstr[1]','$sNo','$company', '1', '$filename','$targetL', '$targeta', '$targetb', '$measureL', '$measurea','$measureb',  '$de76',NOW() )";}
		else { //paper on 2nd patch
		$query = "INSERT INTO processde(job,sNo,company,fileT,TL, Ta, Tb, mL, ma, mb, de,ddate) VALUES('$dbstr[1]','$sNo','$company','$filename','$targetL', '$targeta', '$targetb', '$measureL', '$measurea','$measureb',  '$de76',NOW() )";}
	
		//echo $query;
		$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
 $pp='';

 /////////////////////////////////////////////////////////////////////////////////////////
 
 
 if ($dotT[55]=='') { //paper not on 2nd patch
		$queryp="select * from processde where job='$dbstr[1]' and pap='1' and company= '$company' ORDER BY id DESC LIMIT 1 ";
		//echo "<br>".$queryp."<br>";
 		$resultp = mysql_query($queryp) or die ("Error in query: $querys. " . mysql_error());
	
	if (mysql_num_rows($resultp) > 0)
	{
		$row = mysql_fetch_object($resultp);
		$fileP=$row->fileT;
		$pix='1';
		echo $fileP;
		echo "_Pi:".$pix;
		}

 mysql_close($connection);
 
//////////////////////get paper
	  $contentp = file("upload/".$fileP);

	  $filename=$filedb;

		$stringp = implode($contentp);

$pp = ereg_replace("\r\n?", "	", $stringp);
//$pp =preg_replace("/\r\n|\r|\n/", "	", $stringp);
$datastringp=get_between($pp,"BEGIN_DATA","END_DATA");

$dotp = explode("	", $datastringp);////Measure upload
//print_r ($dotp);
 	$ki=0.820;
	$idx=9;

if ($dotp[55]=='') {

	$PXm=sp38XYZ("X",$dotp[9+1],$dotp[9+2],$dotp[9+3],$dotp[9+4],$dotp[9+5],$dotp[9+6],$dotp[9+7],$dotp[9+8],$dotp[9+9],$dotp[9+10],$dotp[9+11],$dotp[9+12],$dotp[9+13],$dotp[9+14],$dotp[9+15],$dotp[9+16],$dotp[9+17],$dotp[9+18],$dotp[9+19],$dotp[9+20],$dotp[9+21],$dotp[9+22],$dotp[9+23],$dotp[9+24],$dotp[9+25],$dotp[9+26],$dotp[9+27],$dotp[9+28],$dotp[9+29],$dotp[9+30],$dotp[9+31],$dotp[9+32],$dotp[9+33],$dotp[9+34],$dotp[9+35],$dotp[9+36]);

	$PYm=sp38XYZ("Y",$dotp[9+1],$dotp[9+2],$dotp[9+3],$dotp[9+4],$dotp[9+5],$dotp[9+6],$dotp[9+7],$dotp[9+8],$dotp[9+9],$dotp[9+10],$dotp[9+11],$dotp[9+12],$dotp[9+13],$dotp[9+14],$dotp[9+15],$dotp[9+16],$dotp[9+17],$dotp[9+18],$dotp[9+19],$dotp[9+20],$dotp[9+21],$dotp[9+22],$dotp[9+23],$dotp[9+24],$dotp[9+25],$dotp[9+26],$dotp[9+27],$dotp[9+28],$dotp[9+29],$dotp[9+30],$dotp[9+31],$dotp[9+32],$dotp[9+33],$dotp[9+34],$dotp[9+35],$dotp[9+36]);

	$PZm=sp38XYZ("Z",$dotp[9+1],$dotp[9+2],$dotp[9+3],$dotp[9+4],$dotp[9+5],$dotp[9+6],$dotp[9+7],$dotp[9+8],$dotp[9+9],$dotp[9+10],$dotp[9+11],$dotp[9+12],$dotp[9+13],$dotp[9+14],$dotp[9+15],$dotp[9+16],$dotp[9+17],$dotp[9+18],$dotp[9+19],$dotp[9+20],$dotp[9+21],$dotp[9+22],$dotp[9+23],$dotp[9+24],$dotp[9+25],$dotp[9+26],$dotp[9+27],$dotp[9+28],$dotp[9+29],$dotp[9+30],$dotp[9+31],$dotp[9+32],$dotp[9+33],$dotp[9+34],$dotp[9+35],$dotp[9+36]);

	$PLm=xyz2lab01("l",$PXm,$PYm,$PZm);
	$Pam=xyz2lab01("a",$PXm,$PYm,$PZm);
	$Pbm=xyz2lab01("b",$PXm,$PYm,$PZm);
	
	$Pdm=DensitySp38("K",$dotp[9+1],$dotp[9+2],$dotp[9+3],$dotp[9+4],$dotp[9+5],$dotp[9+6],$dotp[9+7],$dotp[9+8],$dotp[9+9],$dotp[9+10],$dotp[9+11],$dotp[9+12],$dotp[9+13],$dotp[9+14],$dotp[9+15],$dotp[9+16],$dotp[9+17],$dotp[9+18],$dotp[9+19],$dotp[9+20],$dotp[9+21],$dotp[9+22],$dotp[9+23],$dotp[9+24],$dotp[9+25],$dotp[9+26],$dotp[9+27],$dotp[9+28],$dotp[9+29],$dotp[9+30],$dotp[9+31],$dotp[9+32],$dotp[9+33],$dotp[9+34],$dotp[9+35],$dotp[9+36]);
	
	}
	
	else {
	
	$PXm=sp38XYZ("X",$dotp[54+1],$dotp[54+2],$dotp[54+3],$dotp[54+4],$dotp[54+5],$dotp[54+6],$dotp[54+7],$dotp[54+8],$dotp[54+9],$dotp[54+10],$dotp[54+11],$dotp[54+12],$dotp[54+13],$dotp[54+14],$dotp[54+15],$dotp[54+16],$dotp[54+17],$dotp[54+18],$dotp[54+19],$dotp[54+20],$dotp[54+21],$dotp[54+22],$dotp[54+23],$dotp[54+24],$dotp[54+25],$dotp[54+26],$dotp[54+27],$dotp[54+28],$dotp[54+29],$dotp[54+30],$dotp[54+31],$dotp[54+32],$dotp[54+33],$dotp[54+34],$dotp[54+35],$dotp[54+36]);

	$PYm=sp38XYZ("Y",$dotp[54+1],$dotp[54+2],$dotp[54+3],$dotp[54+4],$dotp[54+5],$dotp[54+6],$dotp[54+7],$dotp[54+8],$dotp[54+9],$dotp[54+10],$dotp[54+11],$dotp[54+12],$dotp[54+13],$dotp[54+14],$dotp[54+15],$dotp[54+16],$dotp[54+17],$dotp[54+18],$dotp[54+19],$dotp[54+20],$dotp[54+21],$dotp[54+22],$dotp[54+23],$dotp[54+24],$dotp[54+25],$dotp[54+26],$dotp[54+27],$dotp[54+28],$dotp[54+29],$dotp[54+30],$dotp[54+31],$dotp[54+32],$dotp[54+33],$dotp[54+34],$dotp[54+35],$dotp[54+36]);

	$PZm=sp38XYZ("Z",$dotp[54+1],$dotp[54+2],$dotp[54+3],$dotp[54+4],$dotp[54+5],$dotp[54+6],$dotp[54+7],$dotp[54+8],$dotp[54+9],$dotp[54+10],$dotp[54+11],$dotp[54+12],$dotp[54+13],$dotp[54+14],$dotp[54+15],$dotp[54+16],$dotp[54+17],$dotp[54+18],$dotp[54+19],$dotp[54+20],$dotp[54+21],$dotp[54+22],$dotp[54+23],$dotp[54+24],$dotp[54+25],$dotp[54+26],$dotp[54+27],$dotp[54+28],$dotp[54+29],$dotp[54+30],$dotp[54+31],$dotp[54+32],$dotp[54+33],$dotp[54+34],$dotp[54+35],$dotp[54+36]);

	$PLm=xyz2lab01("l",$PXm,$PYm,$PZm);
	$Pam=xyz2lab01("a",$PXm,$PYm,$PZm);
	$Pbm=xyz2lab01("b",$PXm,$PYm,$PZm);
	
	$Pdm=DensitySp38("K",$dotp[54+1],$dotp[54+2],$dotp[54+3],$dotp[54+4],$dotp[54+5],$dotp[54+6],$dotp[54+7],$dotp[54+8],$dotp[54+9],$dotp[54+10],$dotp[54+11],$dotp[54+12],$dotp[54+13],$dotp[54+14],$dotp[54+15],$dotp[54+16],$dotp[54+17],$dotp[54+18],$dotp[54+19],$dotp[54+20],$dotp[54+21],$dotp[54+22],$dotp[54+23],$dotp[54+24],$dotp[54+25],$dotp[54+26],$dotp[54+27],$dotp[54+28],$dotp[54+29],$dotp[54+30],$dotp[54+31],$dotp[54+32],$dotp[54+33],$dotp[54+34],$dotp[54+35],$dotp[54+36]);
	}


// echo "xyz x:".$PXm."_y:".$PYm."_z:".$PZm;	
// echo "dot-10:".$dotT[$idx+$cols*$Pdot+1]."_dot-40:".$dotT[$idx+$cols*$Pdot+31];
  echo "<BR>Paper on fileP: PLx523:".$PLm."_Pa:".$Pam."_Pb:".$Pbm."__Pdm:".$Pdm."__<br>";
$dp76=de76(95,0,-2,$PLm,$Pam,$Pbm);


	
	
for ( $i = 1; $i <= 30; $i+= 1) {
	$Pdot=0;////C line
	$si=0;
 
 for ($s=380; $s<=730; $s+=10) {
 if ($dotp[55]=='') {
 	${'p'.$s}=abs($dotp[9+$si+1]);
	$ppdot="dotp";}
 elseif ($dotp[55]<>'') {
 	${'p'.$s}=abs($dotp[54+$si+1]);
	$ppdot="dotp";}	
	
 	${'m'.$s}=abs($dotT[9+$si+1]);
	${'r'.$s}=pow(10,-((((-log10(${'m'.$s}))-(-log10(${'p'.$s})))*$ki)+(-log10(${'p'.$s}))))*1;
	$si=$si+1;
	
	}
		$ki=$ki+0.015;
		
	${'c'.$i.'X'}=sp38XYZ("X",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	${'c'.$i.'Y'}=sp38XYZ("Y",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);

	${'c'.$i.'Z'}=sp38XYZ("Z",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);	

	//echo "KX1=".round($k1X,3).",".round($k1Y,3).",".round($c1Z,3)."<br>";
	
	${'c'.$i.'l'}=xyz2lab01("l",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'a'}=xyz2lab01("a",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'b'}=xyz2lab01("b",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	
	//echo "K1L=".round($c1l,3).",".round($c1a,3).",".round($c1b,3);
	//${'c'.$i.'dd'}=DensitySp38("C",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	//echo "K1L=".round(${'c'.$i.'l'},3);
	
		${'c'.$i.'dd'}=DensitySp38($filter,$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	//echo "KxD=".round(${'c'.$i.'dd'},3);
	
 } 

}


else {  //paper on dotT
$PXm=sp38XYZ("X",$dotT[54+1],$dotT[54+2],$dotT[54+3],$dotT[54+4],$dotT[54+5],$dotT[54+6],$dotT[54+7],$dotT[54+8],$dotT[54+9],$dotT[54+10],$dotT[54+11],$dotT[54+12],$dotT[54+13],$dotT[54+14],$dotT[54+15],$dotT[54+16],$dotT[54+17],$dotT[54+18],$dotT[54+19],$dotT[54+20],$dotT[54+21],$dotT[54+22],$dotT[54+23],$dotT[54+24],$dotT[54+25],$dotT[54+26],$dotT[54+27],$dotT[54+28],$dotT[54+29],$dotT[54+30],$dotT[54+31],$dotT[54+32],$dotT[54+33],$dotT[54+34],$dotT[54+35],$dotT[54+36]);

	$PYm=sp38XYZ("Y",$dotT[54+1],$dotT[54+2],$dotT[54+3],$dotT[54+4],$dotT[54+5],$dotT[54+6],$dotT[54+7],$dotT[54+8],$dotT[54+9],$dotT[54+10],$dotT[54+11],$dotT[54+12],$dotT[54+13],$dotT[54+14],$dotT[54+15],$dotT[54+16],$dotT[54+17],$dotT[54+18],$dotT[54+19],$dotT[54+20],$dotT[54+21],$dotT[54+22],$dotT[54+23],$dotT[54+24],$dotT[54+25],$dotT[54+26],$dotT[54+27],$dotT[54+28],$dotT[54+29],$dotT[54+30],$dotT[54+31],$dotT[54+32],$dotT[54+33],$dotT[54+34],$dotT[54+35],$dotT[54+36]);

	$PZm=sp38XYZ("Z",$dotT[54+1],$dotT[54+2],$dotT[54+3],$dotT[54+4],$dotT[54+5],$dotT[54+6],$dotT[54+7],$dotT[54+8],$dotT[54+9],$dotT[54+10],$dotT[54+11],$dotT[54+12],$dotT[54+13],$dotT[54+14],$dotT[54+15],$dotT[54+16],$dotT[54+17],$dotT[54+18],$dotT[54+19],$dotT[54+20],$dotT[54+21],$dotT[54+22],$dotT[54+23],$dotT[54+24],$dotT[54+25],$dotT[54+26],$dotT[54+27],$dotT[54+28],$dotT[54+29],$dotT[54+30],$dotT[54+31],$dotT[54+32],$dotT[54+33],$dotT[54+34],$dotT[54+35],$dotT[54+36]);

	$PLm=xyz2lab01("l",$PXm,$PYm,$PZm);
	$Pam=xyz2lab01("a",$PXm,$PYm,$PZm);
	$Pbm=xyz2lab01("b",$PXm,$PYm,$PZm);
	
	$Pdm=DensitySp38("K",$dotT[54+1],$dotT[54+2],$dotT[54+3],$dotT[54+4],$dotT[54+5],$dotT[54+6],$dotT[54+7],$dotT[54+8],$dotT[54+9],$dotT[54+10],$dotT[54+11],$dotT[54+12],$dotT[54+13],$dotT[54+14],$dotT[54+15],$dotT[54+16],$dotT[54+17],$dotT[54+18],$dotT[54+19],$dotT[54+20],$dotT[54+21],$dotT[54+22],$dotT[54+23],$dotT[54+24],$dotT[54+25],$dotT[54+26],$dotT[54+27],$dotT[54+28],$dotT[54+29],$dotT[54+30],$dotT[54+31],$dotT[54+32],$dotT[54+33],$dotT[54+34],$dotT[54+35],$dotT[54+36]);

  echo "<BR>Paper not on fileP: PLx393:".$PLm."_Pa:".$Pam."_Pb:".$Pbm."__Pdm:".$Pdm."__<br>";
$dp76=de76(95,0,-2,$PLm,$Pam,$Pbm);


$ki=0.820;
	$idx=9;
	
	
for ( $i = 1; $i <= 30; $i+= 1) {
	$Pdot=0;////C line
	$si=0;
 
 for ($s=380; $s<=730; $s+=10) {
 
 	${'p'.$s}=abs($dotT[54+$si+1]);
	$ppdot="dotp";
 	${'m'.$s}=abs($dotT[9+$si+1]);
	${'r'.$s}=pow(10,-((((-log10(${'m'.$s}))-(-log10(${'p'.$s})))*$ki)+(-log10(${'p'.$s}))))*1;
	$si=$si+1;
	
	}
		$ki=$ki+0.015;
		
	${'c'.$i.'X'}=sp38XYZ("X",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	${'c'.$i.'Y'}=sp38XYZ("Y",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);

	${'c'.$i.'Z'}=sp38XYZ("Z",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);	

	//echo "KX1=".round($k1X,3).",".round($k1Y,3).",".round($c1Z,3)."<br>";
	
	${'c'.$i.'l'}=xyz2lab01("l",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'a'}=xyz2lab01("a",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'b'}=xyz2lab01("b",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	
	//echo "K1L=".round($c1l,3).",".round($c1a,3).",".round($c1b,3);
	//${'c'.$i.'dd'}=DensitySp38("C",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	//echo "K1L=".round(${'c'.$i.'l'},3);
	
		${'c'.$i.'dd'}=DensitySp38($filter,$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	//echo "KxD=".round(${'c'.$i.'dd'},3);
	
 } 



}//else dotT[55]






//////////////////////////////// 
 

 

 if ($dotT[55]<>'' || $pix=='1') {
 echo "<br> paper pix:".$pix;

	//echo "<br>";
///////////////////
  $dec00=de76($targetL,$targeta,$targetb,$cLm,$cam,$cbm);
 $dc176=de76($targetL,$targeta,$targetb,$c1l,$c1a,$c1b);
  $dc276=de76($targetL,$targeta,$targetb,$c2l,$c2a,$c2b);
  $dc376=de76($targetL,$targeta,$targetb,$c3l,$c3a,$c3b);
  $dc476=de76($targetL,$targeta,$targetb,$c4l,$c4a,$c4b);
  $dc576=de76($targetL,$targeta,$targetb,$c5l,$c5a,$c5b);
  $dc676=de76($targetL,$targeta,$targetb,$c6l,$c6a,$c6b);
  $dc776=de76($targetL,$targeta,$targetb,$c7l,$c7a,$c7b);
  $dc876=de76($targetL,$targeta,$targetb,$c8l,$c8a,$c8b);
  $dc976=de76($targetL,$targeta,$targetb,$c9l,$c9a,$c9b);
  $dc1076=de76($targetL,$targeta,$targetb,$c10l,$c10a,$c10b);
  $dc1176=de76($targetL,$targeta,$targetb,$c11l,$c11a,$c11b);
  $dc1276=de76($targetL,$targeta,$targetb,$c12l,$c12a,$c12b);
  $dc1376=de76($targetL,$targeta,$targetb,$c13l,$c13a,$c13b);
  $dc1476=de76($targetL,$targeta,$targetb,$c14l,$c14a,$c14b);
  $dc1576=de76($targetL,$targeta,$targetb,$c15l,$c15a,$c15b);
  $dc1676=de76($targetL,$targeta,$targetb,$c16l,$c16a,$c16b);
  $dc1776=de76($targetL,$targeta,$targetb,$c17l,$c17a,$c17b);
  $dc1876=de76($targetL,$targeta,$targetb,$c18l,$c18a,$c18b);
  $dc1976=de76($targetL,$targeta,$targetb,$c19l,$c19a,$c19b);
  $dc2076=de76($targetL,$targeta,$targetb,$c20l,$c20a,$c20b);
  $dc2176=de76($targetL,$targeta,$targetb,$c21l,$c21a,$c21b);
  $dc2276=de76($targetL,$targeta,$targetb,$c22l,$c22a,$c22b);
  $dc2376=de76($targetL,$targeta,$targetb,$c23l,$c23a,$c23b);
  $dc2476=de76($targetL,$targeta,$targetb,$c24l,$c24a,$c24b);
  $dc2576=de76($targetL,$targeta,$targetb,$c25l,$c25a,$c25b);
  $dc2676=de76($targetL,$targeta,$targetb,$c26l,$c26a,$c26b);
  $dc2776=de76($targetL,$targeta,$targetb,$c27l,$c27a,$c27b);
  $dc2876=de76($targetL,$targeta,$targetb,$c28l,$c28a,$c28b);
  $dc2976=de76($targetL,$targeta,$targetb,$c29l,$c29a,$c29b);
  $dc3076=de76($targetL,$targeta,$targetb,$c30l,$c30a,$c30b);
  $cmin=min($dc176,$dc276,$dc376,$dc476,$dc576,$dc676,$dc776,$dc876,$dc976,$dc1076,$dc1176,$dc1276,$dc1376,$dc1476,$dc1576,$dc1676,$dc1776,$dc1876,$dc1976,$dc2076,$dc2176,$dc2276,$dc2376,$dc2476,$dc2576,$dc2676,$dc2776,$dc2876,$dc2976,$dc3076);
  

if ($dc176==$cmin){ $copt='1';$coptD=$c1dd;}
if ($dc276==$cmin){ $copt='2';$coptD=$c2dd;}
if ($dc376==$cmin){ $copt='3';$coptD=$c3dd;}
if ($dc476==$cmin){ $copt='4';$coptD=$c4dd;}
if ($dc576==$cmin){ $copt='5';$coptD=$c5dd;}
if ($dc676==$cmin){ $copt='6';$coptD=$c6dd;}
if ($dc776==$cmin){ $copt='7';$coptD=$c7dd;}
if ($dc876==$cmin){ $copt='8';$coptD=$c8dd; }
if ($dc976==$cmin){ $copt='9';$coptD=$c9dd;}
if ($dc1076==$cmin){ $copt='10';$coptD=$c10dd;}
if ($dc1176==$cmin){ $copt='11';$coptD=$c11dd;}
if ($dc1276==$cmin){ $copt='12';$coptD=$c12dd;}
if ($dc1376==$cmin){ $copt='13';$coptD=$c13dd;}
if ($dc1476==$cmin){ $copt='14';$coptD=$c14dd;}
if ($dc1576==$cmin){ $copt='15';$coptD=$c15dd;}
if ($dc1676==$cmin){ $copt='16';$coptD=$c16dd;}
if ($dc1776==$cmin){ $copt='17';$coptD=$c17dd;}
if ($dc1876==$cmin){ $copt='18';$coptD=$c18dd;}
if ($dc1976==$cmin){ $copt='19';$coptD=$c19dd;}
if ($dc2076==$cmin){ $copt='20';$coptD=$c20dd;}
if ($dc2176==$cmin){ $copt='21';$coptD=$c21dd;}
if ($dc2276==$cmin){ $copt='22';$coptD=$c22dd;}
if ($dc2376==$cmin){ $copt='23';$coptD=$c23dd;}
if ($dc2476==$cmin){ $copt='24';$coptD=$c24dd;}
if ($dc2576==$cmin){ $copt='25';$coptD=$c25dd;}
if ($dc2676==$cmin){ $copt='26';$coptD=$c26dd;}
if ($dc2776==$cmin){ $copt='27';$coptD=$c27dd;}
if ($dc2876==$cmin){ $copt='28';$coptD=$c28dd;}
if ($dc2976==$cmin){ $copt='29';$coptD=$c29dd;}
if ($dc3076==$cmin){ $copt='30';$coptD=$c30dd;}
 
 

?>

<table width="200" border="1" align="center">
<tr>

<?php // content="text/plain; charset=utf-8"


require_once ('../jpgraph/jpgraph_plotline.php'); 



?>

<td>
<div align="center">
<?php // content="text/plain; charset=utf-8"
unlink('scatterC.png');
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_scatter.php');

$datax = array($c1dd,$c2dd,$c3dd,$c4dd,$c5dd,$c6dd,$c7dd,$c8dd,$c9dd,$c10dd,$c11dd,$c12dd,$c13dd,$c14dd,$c15dd,$c16dd,$c17dd,$c18dd,$c19dd,$c20dd,$c21dd,$c22dd,$c23dd,$c24dd,$c25dd,$c26dd,$c27dd,$c28dd,$c29dd,$c30dd);
$datay = array($dc176,$dc276,$dc376,$dc476,$dc576,$dc676,$dc776,$dc876,$dc976,$dc1076,$dc1176,$dc1276,$dc1376,$dc1476,$dc1576,$dc1676,$dc1776,$dc1876,$dc1976,$dc2076,$dc2176,$dc2276,$dc2376,$dc2476,$dc2576,$dc2676,$dc2776,$dc2876,$dc2976,$dc3076);
$dataxT = array($coptD,$cdm);
$datayT = array($cmin,$dec00);

$graph = new Graph(300,200);
$graph->SetScale("linint",0,8,0,0);

$graph->img->SetMargin(40,40,40,40);		
$graph->SetShadow();

$graph->title->Set("C scatter plot");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
//$graph->xgrid->Show();

$sp1 = new ScatterPlot($datayT,$dataxT);
$sp1->mark->SetType(MARK_SQUARE);
$sp1->SetImpuls();

$sp2 = new ScatterPlot($datay,$datax);
$sp2->SetLinkPoints(true,"#".$ch1C3,2);
$sp2->mark->SetType(MARK_FILLEDCIRCLE);
$sp2->mark->SetFillColor("#".$ch1C3);
$sp2->mark->SetWidth(3);

$sline = new PlotLine(HORIZONTAL,1.5,'black'); 
$sline2 = new PlotLine(HORIZONTAL,2.5,'#00ccff'); 
$sline3 = new PlotLine(HORIZONTAL,4.5,'#ff9900'); 
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);

$graph->Add($sp1);
$graph->Add($sp2);
$graph->Stroke('scatterC.png');

?>
<img src="scatterC.png">
</div>
</td>
</tr>
</table>

<?php

  
  
  
  
  ?>


	<table width="400" border="1" align="center">
  <tr>
  	<td><div align="center"> id<?php echo $sNo;?></div></td>
	<td><font color="#666666">紙張色差</td>
   <td><font color="#666666">色差</td>
    <td><font color='<?php if ($de76>5){echo "red";}else {echo "black";}?>'>量測濃度</td>

	<td>預測濃度</td>
	<td>最佳色差</td>
  </tr>
    



	
<tr bgcolor="#aaaaaa">
<td><div align="center">P</div></td>
<td bgcolor="#cccccc"><font color='<?php if ($dp76>3){echo "red";}else {echo "black";}?>'><div align="right"><a href=" " title="<?php echo round($PLm,0).",".round($Pam,0).",".round($Pbm,0);?>"><?php  echo  round($dp76,2);?></a> </div></td>

<td bgcolor="<?php echo $ch1C3;?>"><font color='<?php if ($de76>5){echo "red";}else {echo "black";}?>'><div align="right"><a href="../deltae/indexE.php?mL=<?php echo round($cLm,0)."&ma=".round($cam,0)."&mb=".round($cbm,0);?> " title="<?php echo round($cLm,0).",".round($cam,0).",".round($cbm,0);?>"><?php if ($de76>5) {$sum=$sum-$de76;} else {$sum=$sum-0;} echo  round($de76,2);?></a> </div></td>

<td bgcolor="<?php echo $ch1C3;?>"><div align="right"><font color='<?php if ($de76>5){echo "red";}else {echo "black";}?>'><?php echo round($cdm,2);?></div></td>

<td bgcolor="<?php echo $ch1C3;?>"><div align="right"><?php echo round($coptD,2);?></div></td>

<td bgcolor="<?php echo $ch1C3;?>"><div align="right"><?php if ($cmin>5) {?><font color="red"><?php } echo round($cmin,2);?></div></td>
</tr>


</table>










<?php 
//include 'SCCA06.php';  
$target='Fogra39';
    $PTL=95;$PTa=0;$PTb=-2;
  $RPCCl=55;$RPCCa=-37;$RPCCb=-50;
  $RPCMl=48;$RPCMa=74;$RPCMb=-3;
  $RPCYl=89;$RPCYa=-4;$RPCYb=93;
  $RPCKl=16;$RPCKa=0.01;$RPCKb=0.01;

$Xp=$PXm*100;
$Yp=$PYm*100;
$Zp=$PZm*100;
//////////////////////////////////////////////////////////////
$RPCCX=lab2xyz("x",$targetL,$targeta,$targetb);
$RPCCY=lab2xyz("y",$targetL,$targeta,$targetb);
$RPCCZ=lab2xyz("z",$targetL,$targeta,$targetb);

$scCX=SCCA06("x",$RPCCX,$Xp,$target);
$scCY=SCCA06("y",$RPCCY,$Yp,$target);
$scCZ=SCCA06("z",$RPCCZ,$Zp,$target);

$scCL=round(xyz2lab("l",$scCX,$scCY,$scCZ),2);
$scCa=round(xyz2lab("a",$scCX,$scCY,$scCZ),2);
$scCb=round(xyz2lab("b",$scCX,$scCY,$scCZ),2);
/////////////////////////////////////////////////////////////
$de76s=de76($scCL,$scCa,$scCb,$measureL,$measurea,$measureb);
?>

<table width="300" border="1" align="center">
<br><br>
<tr><td>SCCA</td></tr>
</table>

<table width="300" border="1" align="center">
  <tr>
     <td><?php echo "紙張:</td><td>".$PLm."</td><td>".$Pam."</td><td>".$Pbm;?></td>
    </tr>
  	 <td bgcolor="<?php echo $ch1C2;?>"><?php echo "目標:</td><td>".$scCL."</td><td>".$scCa."</td><td>".$scCb;?></td>
    </tr>
	
	 <tr>
  	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "量測:</td><td>".$dotT[7]."</td><td>".$dotT[8]."</td><td>".$dotT[9];?></td>
    </tr>
	 <tr>
  	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "delta:</td><td>".round(($dotT[7]-$scCL),2)."</td><td>".round(($dotT[8]-$scCa),2)."</td><td>".round(($dotT[9]-$scCb),2);?></td>
    </tr>	
		 <tr>
  	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "色差:</td><td>".$de76s."";?></td>
	 <td bgcolor="<?php echo $ch1C3;?>"><?php echo "id:</td><td>".$sNo."";?></td>
    </tr>
 </table>  

 
 
<?php
 ///////////////////////////////SCCA/////////////////////////

 echo "pixx:".$pix;
//////////////////////sec C
	$ki=0.820;
	$idx=9;
	for ( $i = 1; $i <= 30; $i+= 1) {
	$Pdot=0;////C line
	$si=0;
	
	
	for ($s=380; $s<=730; $s+=10) {
	

	if ($pix=='1' and $dotT[55]=='' and $dotp[55]=='') {
	${'p'.$s}=abs($dotp[9+$si+1]);
	$ppdot="dotp";
	//echo "ppx:".${'p'.$s};
	}
	elseif ($pix=='1' and $dotT[55]=='' and $dotp[55]<>'') {
	${'p'.$s}=abs($dotp[54+$si+1]);
	$ppdot="dotp";
	//echo "px:".${'p'.$s};
	}
	elseif ($pix=='1' and $dotT[55]<>'') {
	${'p'.$s}=abs($dotT[54+$si+1]);
	$ppdot="dotp";
	//echo "px:".${'p'.$s};
	}
	else {
	${'p'.$s}=abs($dotT[54+$si+1]);
	$ppdot="dotT";
	}
	
	${'m'.$s}=abs($dotT[$idx+$si+1]);
	${'r'.$s}=pow(10,-((((-log10(${'m'.$s}))-(-log10(${'p'.$s})))*$ki)+(-log10(${'p'.$s}))))*1;
	$si=$si+1;
	
	}

	$ki=$ki+0.015;
		if ($cols==45) { 
	${'c'.$i.'X'}=sp38XYZ("X",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	${'c'.$i.'Y'}=sp38XYZ("Y",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);

	${'c'.$i.'Z'}=sp38XYZ("Z",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);	

	//echo "KX1=".round($k1X,3).",".round($k1Y,3).",".round($c1Z,3)."<br>";
	
	${'c'.$i.'l'}=xyz2lab01("l",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'a'}=xyz2lab01("a",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'b'}=xyz2lab01("b",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	
	//echo "K1L=".round($c1l,3).",".round($c1a,3).",".round($c1b,3);
	//${'c'.$i.'dd'}=DensitySp38("C",$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730);
	//echo "K1D=".round($k1dd,3);
	
		${'c'.$i.'dd'}=DensitySp38($filter,$r380,	$r390,	$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700,	$r710,	$r720,	$r730,$f0,$f1,	$f2,	$f3,	$f4,	$f5,	$f6,	$f7,	$f8,	$f9,	$f10,	$f11,	$f12,	$f13,	$f14,	$f15,	$f16,	$f17,	$f18,	$f19,	$f20,	$f21,	$f22,	$f23,	$f24,	$f25,	$f26,	$f27,	$f28,	$f29,	$f30,	$f31,	$f32,	$f33,	$f34,	$f35);
	
	}
	else { 
	${'c'.$i.'X'}=spXYZ("X",$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700);
	${'c'.$i.'Y'}=spXYZ("Y",$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700);

	${'c'.$i.'Z'}=spXYZ("Z",$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700);	

	//echo "KX1=".round($k1X,3).",".round($k1Y,3).",".round($c1Z,3)."<br>";
	
	${'c'.$i.'l'}=xyz2lab01("l",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'a'}=xyz2lab01("a",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.$i.'b'}=xyz2lab01("b",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	
	//echo "K1L=".round($c1l,3).",".round($c1a,3).",".round($c1b,3);
	${'c'.$i.'dd'}=DensitySp("C",$r400,	$r410,	$r420,	$r430,	$r440,	$r450,	$r460,	$r470,	$r480,	$r490,	$r500,	$r510,	$r520,	$r530,	$r540,	$r550,	$r560,	$r570,	$r580,	$r590,	$r600,	$r610,	$r620,	$r630,	$r640,	$r650,	$r660,	$r670,	$r680,	$r690,	$r700);

	}	
	//echo "c1D=".round(${'c'.$i.'dd'},3);
	}
	//echo "<br>";
///////////////////
  $dec00=de76($scCL,$scCa,$scCb,$cLm,$cam,$cbm);
 $dc176=de76($scCL,$scCa,$scCb,$c1l,$c1a,$c1b);
  $dc276=de76($scCL,$scCa,$scCb,$c2l,$c2a,$c2b);
  $dc376=de76($scCL,$scCa,$scCb,$c3l,$c3a,$c3b);
  $dc476=de76($scCL,$scCa,$scCb,$c4l,$c4a,$c4b);
  $dc576=de76($scCL,$scCa,$scCb,$c5l,$c5a,$c5b);
  $dc676=de76($scCL,$scCa,$scCb,$c6l,$c6a,$c6b);
  $dc776=de76($scCL,$scCa,$scCb,$c7l,$c7a,$c7b);
  $dc876=de76($scCL,$scCa,$scCb,$c8l,$c8a,$c8b);
  $dc976=de76($scCL,$scCa,$scCb,$c9l,$c9a,$c9b);
  $dc1076=de76($scCL,$scCa,$scCb,$c10l,$c10a,$c10b);
  $dc1176=de76($scCL,$scCa,$scCb,$c11l,$c11a,$c11b);
  $dc1276=de76($scCL,$scCa,$scCb,$c12l,$c12a,$c12b);
  $dc1376=de76($scCL,$scCa,$scCb,$c13l,$c13a,$c13b);
  $dc1476=de76($scCL,$scCa,$scCb,$c14l,$c14a,$c14b);
  $dc1576=de76($scCL,$scCa,$scCb,$c15l,$c15a,$c15b);
  $dc1676=de76($scCL,$scCa,$scCb,$c16l,$c16a,$c16b);
  $dc1776=de76($scCL,$scCa,$scCb,$c17l,$c17a,$c17b);
  $dc1876=de76($scCL,$scCa,$scCb,$c18l,$c18a,$c18b);
  $dc1976=de76($scCL,$scCa,$scCb,$c19l,$c19a,$c19b);
  $dc2076=de76($scCL,$scCa,$scCb,$c20l,$c20a,$c20b);
  $dc2176=de76($scCL,$scCa,$scCb,$c21l,$c21a,$c21b);
  $dc2276=de76($scCL,$scCa,$scCb,$c22l,$c22a,$c22b);
  $dc2376=de76($scCL,$scCa,$scCb,$c23l,$c23a,$c23b);
  $dc2476=de76($scCL,$scCa,$scCb,$c24l,$c24a,$c24b);
  $dc2576=de76($scCL,$scCa,$scCb,$c25l,$c25a,$c25b);
  $dc2676=de76($scCL,$scCa,$scCb,$c26l,$c26a,$c26b);
  $dc2776=de76($scCL,$scCa,$scCb,$c27l,$c27a,$c27b);
  $dc2876=de76($scCL,$scCa,$scCb,$c28l,$c28a,$c28b);
  $dc2976=de76($scCL,$scCa,$scCb,$c29l,$c29a,$c29b);
  $dc3076=de76($scCL,$scCa,$scCb,$c30l,$c30a,$c30b);
  $cmin=min($dc176,$dc276,$dc376,$dc476,$dc576,$dc676,$dc776,$dc876,$dc976,$dc1076,$dc1176,$dc1276,$dc1376,$dc1476,$dc1576,$dc1676,$dc1776,$dc1876,$dc1976,$dc2076,$dc2176,$dc2276,$dc2376,$dc2476,$dc2576,$dc2676,$dc2776,$dc2876,$dc2976,$dc3076);
  

if ($dc176==$cmin){ $copt='1';$coptD=$c1dd;}
if ($dc276==$cmin){ $copt='2';$coptD=$c2dd;}
if ($dc376==$cmin){ $copt='3';$coptD=$c3dd;}
if ($dc476==$cmin){ $copt='4';$coptD=$c4dd;}
if ($dc576==$cmin){ $copt='5';$coptD=$c5dd;}
if ($dc676==$cmin){ $copt='6';$coptD=$c6dd;}
if ($dc776==$cmin){ $copt='7';$coptD=$c7dd;}
if ($dc876==$cmin){ $copt='8';$coptD=$c8dd; }
if ($dc976==$cmin){ $copt='9';$coptD=$c9dd;}
if ($dc1076==$cmin){ $copt='10';$coptD=$c10dd;}
if ($dc1176==$cmin){ $copt='11';$coptD=$c11dd;}
if ($dc1276==$cmin){ $copt='12';$coptD=$c12dd;}
if ($dc1376==$cmin){ $copt='13';$coptD=$c13dd;}
if ($dc1476==$cmin){ $copt='14';$coptD=$c14dd;}
if ($dc1576==$cmin){ $copt='15';$coptD=$c15dd;}
if ($dc1676==$cmin){ $copt='16';$coptD=$c16dd;}
if ($dc1776==$cmin){ $copt='17';$coptD=$c17dd;}
if ($dc1876==$cmin){ $copt='18';$coptD=$c18dd;}
if ($dc1976==$cmin){ $copt='19';$coptD=$c19dd;}
if ($dc2076==$cmin){ $copt='20';$coptD=$c20dd;}
if ($dc2176==$cmin){ $copt='21';$coptD=$c21dd;}
if ($dc2276==$cmin){ $copt='22';$coptD=$c22dd;}
if ($dc2376==$cmin){ $copt='23';$coptD=$c23dd;}
if ($dc2476==$cmin){ $copt='24';$coptD=$c24dd;}
if ($dc2576==$cmin){ $copt='25';$coptD=$c25dd;}
if ($dc2676==$cmin){ $copt='26';$coptD=$c26dd;}
if ($dc2776==$cmin){ $copt='27';$coptD=$c27dd;}
if ($dc2876==$cmin){ $copt='28';$coptD=$c28dd;}
if ($dc2976==$cmin){ $copt='29';$coptD=$c29dd;}
if ($dc3076==$cmin){ $copt='30';$coptD=$c30dd;}
 
 
 
 

?>

 <table width="200" border="1" align="center">
<tr>

<?php // content="text/plain; charset=utf-8"


require_once ('../jpgraph/jpgraph_plotline.php'); 



?>

<td>
<div align="center">
<?php // content="text/plain; charset=utf-8"
unlink('scatterCs.png');
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_scatter.php');

$datax = array($c1dd,$c2dd,$c3dd,$c4dd,$c5dd,$c6dd,$c7dd,$c8dd,$c9dd,$c10dd,$c11dd,$c12dd,$c13dd,$c14dd,$c15dd,$c16dd,$c17dd,$c18dd,$c19dd,$c20dd,$c21dd,$c22dd,$c23dd,$c24dd,$c25dd,$c26dd,$c27dd,$c28dd,$c29dd,$c30dd);
$datay = array($dc176,$dc276,$dc376,$dc476,$dc576,$dc676,$dc776,$dc876,$dc976,$dc1076,$dc1176,$dc1276,$dc1376,$dc1476,$dc1576,$dc1676,$dc1776,$dc1876,$dc1976,$dc2076,$dc2176,$dc2276,$dc2376,$dc2476,$dc2576,$dc2676,$dc2776,$dc2876,$dc2976,$dc3076);
$dataxT = array($coptD,$cdm);
$datayT = array($cmin,$dec00);

$graph = new Graph(300,200);
$graph->SetScale("linint",0,8,0,0);

$graph->img->SetMargin(40,40,40,40);		
$graph->SetShadow();

$graph->title->Set("C scatter plot");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
//$graph->xgrid->Show();

$sp1 = new ScatterPlot($datayT,$dataxT);
$sp1->mark->SetType(MARK_SQUARE);
$sp1->SetImpuls();

$sp2 = new ScatterPlot($datay,$datax);
$sp2->SetLinkPoints(true,"#".$ch1C3,2);
$sp2->mark->SetType(MARK_FILLEDCIRCLE);
$sp2->mark->SetFillColor("#".$ch1C3);
$sp2->mark->SetWidth(3);

$sline = new PlotLine(HORIZONTAL,1.5,'black'); 
$sline2 = new PlotLine(HORIZONTAL,2.5,'#00ccff'); 
$sline3 = new PlotLine(HORIZONTAL,4.5,'#ff9900'); 
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);

$graph->Add($sp1);
$graph->Add($sp2);
$graph->Stroke('scatterCs.png');

?>
<img src="scatterCs.png">
</div>
</td>
</tr>
</table>
 
 
 
 
 




	<table width="400" border="1" align="center">
  <tr>
  	<td><div align="center"> id<?php echo $sNo;?></div></td>
	<td><font color="#666666">紙張色差</td>
   <td><font color="#666666">色差</td>
    <td><font color='<?php if ($de76>5){echo "red";}else {echo "black";}?>'>量測濃度</td>

	<td>預測濃度</td>
	<td>最佳色差</td>
  </tr>
    



	
<tr bgcolor="#aaaaaa">
<td><div align="center">P</div></td>
<td bgcolor="#cccccc"><font color='<?php if ($dp76>3){echo "red";}else {echo "black";}?>'><div align="right"><a href=" " title="<?php echo round($PLm,0).",".round($Pam,0).",".round($Pbm,0);?>"><?php  echo  round($dp76,2);?></a> </div></td>

<td bgcolor="<?php echo $ch1C3;?>"><font color='<?php if ($de76s>5){echo "red";}else {echo "black";}?>'><div align="right"><a href=" " title="<?php echo round($cLm,0).",".round($cam,0).",".round($cbm,0);?>"><?php if ($de76s>5) {$sum=$sum-$de76s;} else {$sum=$sum-0;} echo  round($de76s,2);?></a> </div></td>

<td bgcolor="<?php echo $ch1C3;?>"><div align="right"><font color='<?php if ($de76s>5){echo "red";}else {echo "black";}?>'><?php echo round($cdm,2);?></div></td>

<td bgcolor="<?php echo $ch1C3;?>"><div align="right"><?php echo round($coptD,2);?></div></td>

<td bgcolor="<?php echo $ch1C3;?>"><div align="right"><?php if ($cmin>5) {?><font color="red"><?php } echo round($cmin,2);?></div></td>
</tr>


</table>






<?php } //paper section 
?>
<br><br>
<tr>
<td align="center"><font size="-2"> &copy; <a href="mailto:[email protected]">Fred Kuo</a>, 2015. All rights reserved.<br><a href="http://www.fredkuo.idv.tw/wordpress/?p=1025">Read more.</a><br>
</td>
</tr>
</body>


</html>