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/FograCT1/pbnCT22.php
<!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>Fogra39 (M0) TVI Check</title>
<style type="text/css">
<!--
body { tetst fggit test x2
	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'];
$color= $_GET['color'];
$company= $_GET['company'];

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



include 'sp38XYZ.php';
include 'spXYZ.php';
include 'lab2xyz.php';
//include 'SCCA51.php';
include 'xyz2lab01.php';
include 'xyz2lab.php';
//include 'DensityV38.php';
include 'DensityV.php';


include 'Density395.php';

include 'vXYZ.php';
$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;



function DensitySp38S($V,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8,$s9,$s10,$s11,$s12,$s13,$s14,$s15,$s16,$s17,$s18,$s19,$s20,$s21,$s22,$s23,$s24,$s25,$s26,$s27,$s28,$s29,$s30,$s31,$s32,$s33,$s34,$s35,$s36,$ft0,$ft1,	$ft2,	$ft3,	$ft4,	$ft5,	$ft6,	$ft7,	$ft8,	$ft9,	$ft10,	$ft11,	$ft12,	$ft13,	$ft14,	$ft15,	$ft16,	$ft17,	$ft18,	$ft19,	$ft20,	$ft21,	$ft22,	$ft23,	$ft24,	$ft25,	$ft26,	$ft27,	$ft28,	$ft29,	$ft30,	$ft31,	$ft32,	$ft33,	$ft34,	$ft35) {
	
	$values=array("34" => 0.0,"35" => 0.0,"36" => 0.0,"37" => 0.0,"38" => $s1,"39" =>$s2,"40" => $s3,"41" => $s4,"42" => $s5,"43" => $s6,"44" => $s7,"45" => $s8,"46" => $s9,"47" => $s10,"48" => $s11,"49" => $s12,"50" => $s13,"51" => $s14,"52" => $s15,"53" => $s16,"54" => $s17,"55" => $s18,"56" => $s19,"57" => $s20,"58" => $s21,"59" => $s22,"60" => $s23,"61" => $s24,"62" => $s25,"63" => $s26,"64" => $s27,"65" => $s28,"66" => $s29,"67" => $s30,"68" => $s31,"69" => $s32,"70" => $s33, "71" => $s34,"72" => $s35,"73" => $s36,"74" => 0.0,"75" => 0.0,"76" => 0.0,"77" => 0.0,"78" => 0.0,"79" => 0.0,"80" => 0.0,"81" => 0.0,"82" => 0.0,"83" => 0.0);

	
	$SpectraU=array(0,0,0,0,$ft0,$ft1,	$ft2,	$ft3,	$ft4,	$ft5,	$ft6,	$ft7,	$ft8,	$ft9,	$ft10,	$ft11,	$ft12,	$ft13,	$ft14,	$ft15,	$ft16,	$ft17,	$ft18,	$ft19,	$ft20,	$ft21,	$ft22,	$ft23,	$ft24,	$ft25,	$ft26,	$ft27,	$ft28,	$ft29,	$ft30,	$ft31,	$ft32,	$ft33,	$ft34,	$ft35);
 

//-LOG10(SUMPRODUCT(AZ2:AZ51,AV2:AV51)/SUM(AV2:AV51))   =-LOG10(SUMPRODUCT(Sample,TT)/SUM(Den_StatusT_R))
$sPSum=0;
$sProduct=0;
if ($V=="U") {
for ( $i = 34; $i <= 83; $i += 1) {
$sProduct=$values[$i]*$SpectraU[$i-34];
$sPSum=$sProduct+$sPSum;}
$sumV=array_sum($SpectraU);} 


 //$sumduct=$values[40]; 
 
 $den=-log10($sPSum/($sumV));
 return round($den,4);
	}


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

  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
	
	echo "Plate Checking form! " . $color. "<br />";
    //echo "Upload: " . $_FILES["file"]["name"] . "<br />";
	$filename=substr($f321,7,60);
    //echo "Type: " . $_FILES["file"]["type"] . "<br />";
   // echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
   // echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";


	 //  move_uploaded_file($_FILES["file"]["tmp_name"],
     // "upload/" .$dStr. $_FILES["file"]["name"]);
	  
	  $contents = file($f321);
	  	  $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($contents);
		//echo $stringC;
		$fMark = strrpos($stringC,'i1Profiler');
		//echo "fMark:".$fMark."<br>";
		$fMarkC = strrpos($stringC,'ColorPort');
		//echo "fMarkC:".$fMarkC."<br>";
		
if ($fMark>0) { ////////////////////////////////////////////////////////////// i1 profiler  go 437
		 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'BEGIN_DATA_FORMAT');
//echo "cols:".$cols."_zz<br>";
		//echo $contents[20]; 
		//echo $stringC; 
$string = implode($contents);		
$p = str_replace("\r\n", "\n", $string);
$p = str_replace("\n", ',', $p);
//echo $p;

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;
}

$snstring=get_between($p,"Serial number ","\"");


$dotS = explode(",", $snstring);////Measure upload

//print_r ($dotS);

$snstring=substr($dotS[0],0,-1);
echo "sn:".$snstring;





$datastring=get_between($p,"BEGIN_DATA,",",END_DATA");

$dot = explode("\t", $datastring);
//echo "dot".$dot[6]."<br>";

print_r($dot);

$cols=42;
$Pdot=21;

 //if ($dot[20]>0.5 and $dot[11]>0.4) {  //paper lead
 if (abs($dot[37]- $dot[17])<0.1 and  $dot[17]>0.5 ) {  //paper lead
 $Pdot=21;} 
else {
	$Pdot=0;
}


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

	$C100Z=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	$c100l=xyz2lab01("l",$C100X,$C100Y,$C100Z);
	$c100a=xyz2lab01("a",$C100X,$C100Y,$C100Z);
	$c100b=xyz2lab01("b",$C100X,$C100Y,$C100Z);
echo "<br>lab:".$c100l."_".$c100a."_".$c100b."_";

$ch=pow((pow($c100a,2)+pow($c100b,2)),0.5);
echo "<br>ch:".$ch."<br>";
$PnC='';

//$FC=$dot[870];$FM=$dot[864];$FY=$dot[851];
//$FC=$dot[870+42];$FM=$dot[864+42];$FY=$dot[851+42];//for CT22
 if (abs($dot[37]- $dot[17])<0.1 and  $dot[17]>0.5 ){  //paper lead
 $FC=$dot[870+42];$FM=$dot[864+42];$FY=$dot[851+42];
 } 
else {
$FC=$dot[30];$FM=$dot[24];$FY=$dot[11];
}




}

if ($color=='')
{
	$color='K';
}


?>

	<p><p>
	

  


  <?php
  //////////////////////////////////////////////////Fogra Media Check
  $psum=20;
 // $pl=95; $pa=-0.01;$pb=-2;

  
?>



<?php




if ($fMark>0) { /////////////////////////////color port


 

$Pdot=21;////TV 100  
 if (abs($dot[37]- $dot[17])<0.1 and  $dot[17]>0.5 ) {  //paper lead
 $Pdot=21;} 
else {
	$Pdot=0;
}
  
 $avalues=array($dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
//$min_value_key=array_keys($avalues, max($avalues));
//echo "<br>Check:".$min_value_key;

// $Pdot=20;  





$min = min($avalues);
$index = array_search($min, $avalues);
//echo "<br>min Check:".$index;

$max = max($avalues);
$mindex = array_search($max, $avalues);
//echo "<br>max Check:".$mindex;


$nm=380+$mindex*10;

if ($index>17) {
$fn=$index;}
else {
$fn=$index;}

${'f'.$fn}=14.0388;
 
 
 $uvD=DensitySp38S("U",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35],$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);
 
 echo "<br>uvd:".$uvD."<br>";
 
   $Pdot=0;  
   if (abs($dot[37]- $dot[17])<0.1 and  $dot[17]>0.5 ) {  //paper lead
 $Pdot=0;} 
else {
	$Pdot=21;
} 
 $PXm=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);	

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

$PZm=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);	
 
 	$Plm=xyz2lab01("l",$PXm,$PYm,$PZm);
	$Pam=xyz2lab01("a",$PXm,$PYm,$PZm);
	$Pbm=xyz2lab01("b",$PXm,$PYm,$PZm);
 
 
 	$p0d=DensitySp38("K",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);	
	
	//$p0d=DensitySp38S("U",$dot[9+$cols*$Pdot-$Pdot],$dot[9+$cols*$Pdot-$Pdot+1],$dot[9+$cols*$Pdot-$Pdot+2],$dot[9+$cols*$Pdot-$Pdot+3],$dot[9+$cols*$Pdot-$Pdot+4],$dot[9+$cols*$Pdot-$Pdot+5],$dot[9+$cols*$Pdot-$Pdot+6],$dot[9+$cols*$Pdot-$Pdot+7],$dot[9+$cols*$Pdot-$Pdot+8],$dot[9+$cols*$Pdot-$Pdot+9],$dot[9+$cols*$Pdot-$Pdot+10],$dot[9+$cols*$Pdot-$Pdot+11],$dot[9+$cols*$Pdot-$Pdot+12],$dot[9+$cols*$Pdot-$Pdot+13],$dot[9+$cols*$Pdot-$Pdot+14],$dot[9+$cols*$Pdot-$Pdot+15],$dot[9+$cols*$Pdot-$Pdot+16],$dot[9+$cols*$Pdot-$Pdot+17],$dot[9+$cols*$Pdot-$Pdot+18],$dot[9+$cols*$Pdot-$Pdot+19],$dot[9+$cols*$Pdot-$Pdot+20],$dot[9+$cols*$Pdot-$Pdot+21],$dot[9+$cols*$Pdot-$Pdot+22],$dot[9+$cols*$Pdot-$Pdot+23],$dot[9+$cols*$Pdot-$Pdot+24],$dot[9+$cols*$Pdot-$Pdot+25],$dot[9+$cols*$Pdot-$Pdot+26],$dot[9+$cols*$Pdot-$Pdot+27],$dot[9+$cols*$Pdot-$Pdot+28],$dot[9+$cols*$Pdot-$Pdot+29],$dot[9+$cols*$Pdot-$Pdot+30],$dot[9+$cols*$Pdot-$Pdot+31],$dot[9+$cols*$Pdot-$Pdot+32],$dot[9+$cols*$Pdot-$Pdot+33],$dot[9+$cols*$Pdot-$Pdot+34],$dot[9+$cols*$Pdot-$Pdot+35],$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);
	
	echo "p0d=".$p0d."<br>";
//$Plm=80;
if ($Plm<87) {
	$PnC='plate';}
elseif ($ch<17) { 
	$color='K';	}
elseif ($FC==min($FC,$FM,$FY)) {
	$color='C';}
elseif ($FM==min($FC,$FM,$FY)) {
	$color='M';}
elseif ($FY==min($FC,$FM,$FY)) {
	$color='Y';}

if ($PnC<>'plate'){$PnC='press';}
echo "<br>filter:".$color."<br>";	
echo "<br>Type:".$PnC."<br>";





	

$Pdot=21;  ///
 if (abs($dot[37]- $dot[17])<0.1 and  $dot[17]>0.5 ) {  //paper lead
 $Pdot=21;} 
else {
	$Pdot=0;
}
 
 

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

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

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

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


	$Sl=xyz2lab01("l",$SXm,$SYm,$SZm);
	$Sa=xyz2lab01("a",$SXm,$SYm,$SZm);
	$Sb=xyz2lab01("b",$SXm,$SYm,$SZm);
	
	//echo "dot[]=".$dot[9+$cols*$Pdot]."-".(9+$cols*$Pdot)."<br>";
	echo "c100d=".$c100d."<br>";


$Pdot=1;  
 if (abs($dot[37]- $dot[17])<0.1 and  $dot[17]>0.5 ) {  //paper lead
 $Pdot=1;} 
else {
	$Pdot=20;
}

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

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

	$c2l=xyz2lab01("l",$c2X,$c2Y,$c2Z);
	$c2a=xyz2lab01("a",$c2X,$c2Y,$c2Z);
	$c2b=xyz2lab01("b",$c2X,$c2Y,$c2Z);
	
	$c2d=DensitySp38($color,$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	$c2ds=DensitySp38S("U",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35],$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);
	
	
	
	//${'c'.($i*5).'dv'}=(((1-(pow(10,(-(${'c'.($i*5).'ds'}-$p0d)))))/(1-(pow(10,(-($uvD-$p0d)))))))*100;//p17DV
	if ($PnC<>'plate') {
	$c2dv=(((1-(pow(10,(-($c2d-$p0d)))))/(1-(pow(10,(-($c100d-$p0d)))))))*100;//den tv
	echo "<br>c2dv press:".$c2dv;
	}
	else {$c2dv=100*pow(((pow(($c2X-$PXm),2)+pow(($c2Y-$PYm),2)+pow(($c2Z-$PZm),2))/(pow(($SXm-$PXm),2)+pow(($SYm-$PYm),2)+pow(($SZm-$PZm),2))),0.5); //sctv
	echo "<br>c2dv plate:".$c2dv."Lab:".$c2l."_".$c2a."_".$c2b;
	}
	//$sctv=100*pow(((pow(($StXm-$PXm),2)+pow(($StYm-$PYm),2)+pow(($StZm-$PZm),2))/(pow(($SXm-$PXm),2)+pow(($SYm-$PYm),2)+pow(($SZm-$PZm),2))),0.5);
	
	//echo "dC".($i*5).":".${'c'.($i*5).'d'}."zz";
	//echo "dv".($i*5).":".${'c'.($i*5).'dv'}."zz<br>";

 if (abs($dot[37]- $dot[17])<0.1 and  $dot[17]>0.5 ) {  //paper lead
 //echo "<br>paper lead";
 for ( $i = 2; $i <= 20; $i += 1) {////C
$Pdot=$i;  
 ${'c'.$i.'X'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'c'.$i.'Y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);

	${'c'.$i.'Z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);

	${'c'.(($i-1)*5).'l'}=xyz2lab01("l",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.(($i-1)*5).'a'}=xyz2lab01("a",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.(($i-1)*5).'b'}=xyz2lab01("b",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	
	${'c'.(($i-1)*5).'d'}=DensitySp38($color,$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	${'c'.(($i-1)*5).'ds'}=DensitySp38S("U",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35],$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);
	
	
	
	//${'c'.($i*5).'dv'}=(((1-(pow(10,(-(${'c'.($i*5).'ds'}-$p0d)))))/(1-(pow(10,(-($uvD-$p0d)))))))*100;//p17DV
	if ($PnC<>'plate') {
	${'c'.(($i-1)*5).'dv'}=(((1-(pow(10,(-(${'c'.(($i-1)*5).'d'}-$p0d)))))/(1-(pow(10,(-($c100d-$p0d)))))))*100;//den tv
	}
	else {${'c'.(($i-1)*5).'dv'}=100*pow(((pow((${'c'.$i.'X'}-$PXm),2)+pow((${'c'.$i.'Y'}-$PYm),2)+pow((${'c'.$i.'Z'}-$PZm),2))/(pow(($SXm-$PXm),2)+pow(($SYm-$PYm),2)+pow(($SZm-$PZm),2))),0.5); //sctv
	//echo "<br>c2dv plate:".${'c'.(($i-1)*5).'dv'}."Lab:".${'c'.(($i-1)*5).'X'}."_".${'c'.(($i-1)*5).'Y'}."_".${'c'.(($i-1)*5).'Z'};
	}
	//$sctv=100*pow(((pow(($StXm-$PXm),2)+pow(($StYm-$PYm),2)+pow(($StZm-$PZm),2))/(pow(($SXm-$PXm),2)+pow(($SYm-$PYm),2)+pow(($SZm-$PZm),2))),0.5);
	
	//echo "dC".($i*5).":".${'c'.($i*5).'d'}."zz";
	//echo "dv".($i*5).":".${'c'.($i*5).'dv'}."zz<br>";
 } 
  }
  
  	//for ( $i = 19; $i >= 1; $i=$i-1) {
//$Pdot=(20-$i); 
 else {
	// echo "<br>paper end";
 for ( $i = 20; $i >= 2; $i=$i-1) {////C
// echo "<br>paper end loop";
//$Pdot=$i;  
$Pdot=(21-$i); 
 ${'c'.$i.'X'}=sp38XYZ("X",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
//	 echo "<br> cx loop: ".${'c'.$i.'X'};
	${'c'.$i.'Y'}=sp38XYZ("Y",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);

	${'c'.$i.'Z'}=sp38XYZ("Z",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);

	${'c'.(($i-1)*5).'l'}=xyz2lab01("l",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.(($i-1)*5).'a'}=xyz2lab01("a",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	${'c'.(($i-1)*5).'b'}=xyz2lab01("b",${'c'.$i.'X'},${'c'.$i.'Y'},${'c'.$i.'Z'});
	
	${'c'.(($i-1)*5).'d'}=DensitySp38($color,$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35]);
	
	//echo "<br>tviC".(($i-1)*5).":".${'c'.(($i-1)*5).'l'}."_".${'c'.(($i-1)*5).'d'};
	
	
	${'c'.(($i-1)*5).'ds'}=DensitySp38S("U",$dot[6+$cols*$Pdot],$dot[6+$cols*$Pdot+1],$dot[6+$cols*$Pdot+2],$dot[6+$cols*$Pdot+3],$dot[6+$cols*$Pdot+4],$dot[6+$cols*$Pdot+5],$dot[6+$cols*$Pdot+6],$dot[6+$cols*$Pdot+7],$dot[6+$cols*$Pdot+8],$dot[6+$cols*$Pdot+9],$dot[6+$cols*$Pdot+10],$dot[6+$cols*$Pdot+11],$dot[6+$cols*$Pdot+12],$dot[6+$cols*$Pdot+13],$dot[6+$cols*$Pdot+14],$dot[6+$cols*$Pdot+15],$dot[6+$cols*$Pdot+16],$dot[6+$cols*$Pdot+17],$dot[6+$cols*$Pdot+18],$dot[6+$cols*$Pdot+19],$dot[6+$cols*$Pdot+20],$dot[6+$cols*$Pdot+21],$dot[6+$cols*$Pdot+22],$dot[6+$cols*$Pdot+23],$dot[6+$cols*$Pdot+24],$dot[6+$cols*$Pdot+25],$dot[6+$cols*$Pdot+26],$dot[6+$cols*$Pdot+27],$dot[6+$cols*$Pdot+28],$dot[6+$cols*$Pdot+29],$dot[6+$cols*$Pdot+30],$dot[6+$cols*$Pdot+31],$dot[6+$cols*$Pdot+32],$dot[6+$cols*$Pdot+33],$dot[6+$cols*$Pdot+34],$dot[6+$cols*$Pdot+35],$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);
	
	
	//$PnC="plate";
	//${'c'.($i*5).'dv'}=(((1-(pow(10,(-(${'c'.($i*5).'ds'}-$p0d)))))/(1-(pow(10,(-($uvD-$p0d)))))))*100;//p17DV
	if ($PnC<>'plate') {
	${'c'.(($i-1)*5).'dv'}=(((1-(pow(10,(-(${'c'.(($i-1)*5).'d'}-$p0d)))))/(1-(pow(10,(-($c100d-$p0d)))))))*100;//den tv
	}
	else {
	${'c'.(($i-1)*5).'dv'}=100*pow(((pow((${'c'.$i.'X'}-$PXm),2)+pow((${'c'.$i.'Y'}-$PYm),2)+pow((${'c'.$i.'Z'}-$PZm),2))/(pow(($SXm-$PXm),2)+pow(($SYm-$PYm),2)+pow(($SZm-$PZm),2))),0.5); //sctv
	
	${'c'.(($i-1)*5).'dv'}=-0.9126893294 +1.1532038338*${'c'.(($i-1)*5).'dv'}-0.0013856052*pow((${'c'.(($i-1)*5).'dv'}),2);
	//echo "<br>c2dv plate:".${'c'.(($i-1)*5).'dv'}."Lab:".${'c'.(($i-1)*5).'X'}."_".${'c'.(($i-1)*5).'Y'}."_".${'c'.(($i-1)*5).'Z'};
	}
	//$sctv=100*pow(((pow(($StXm-$PXm),2)+pow(($StYm-$PYm),2)+pow(($StZm-$PZm),2))/(pow(($SXm-$PXm),2)+pow(($SYm-$PYm),2)+pow(($SZm-$PZm),2))),0.5);
	
	//echo "dC".($i*5).":".${'c'.($i*5).'d'}."zz";
	//echo "dv".($i*5).":".${'c'.($i*5).'dv'}."zz<br>";
 }	 

 } 
  
  
  

//$sctv=100*pow(((pow(($StXm-$PXm),2)+pow(($StYm-$PYm),2)+pow(($StZm-$PZm),2))/(pow(($SXm-$PXm),2)+pow(($SYm-$PYm),2)+pow(($SZm-$PZm),2))),0.5);
	}//colorport
	
 
 if ($color=='Y'){
	$c40dv=($c35dv+$c45dv)/2;
}
 


if ($color=='C') {
$ftcolor="#7effff";}
elseif ($color=='M') {
$ftcolor="#ff88ff";}
elseif ($color=='Y') {
$ftcolor="#ffff66";}
elseif ($color=='K') {
$ftcolor="#cccccc";}
elseif ($color=='B') {
$ftcolor="#3345f8";}
elseif ($color=='R') {
$ftcolor="#f96054";}
elseif ($color=='O') {
$ftcolor="#f9a654";}
?>
<!--
<tr>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="center"></div></td>

<?php  //////////////////////////////////////////C
//(0,2,4,6,7.6,9.3,10.7,12,13,13.8,14.3,14.6,14.5,14.1,13.4,12.3,10.7,8.7,6.3,3.4,0);
if ($color=='K') {
$TTV5=5+3;$TTV10=10+5.6;$TTV15=15+8.1;$TTV20=20+10.2;$TTV25=25+12.1;$TTV30=30+13.7;$TTV35=35+15;$TTV40=40+16;$TTV45=45+16.8;
$TTV50=50+17;$TTV55=55+17;$TTV60=60+16.6;$TTV65=65+15.9;$TTV70=70+14.9;$TTV75=75+13.4;$TTV80=80+11.5;$TTV85=85+9.3;$TTV90=90+6.6;$TTV95=95+3.5;}
else {
$TTV5=5+2;$TTV10=10+4;$TTV15=15+6;$TTV20=20+7.6;$TTV25=25+9.3;$TTV30=30+10.7;$TTV35=35+12;$TTV40=40+13;$TTV45=45+13.8;
$TTV50=50+14.3;$TTV55=55+14.6;$TTV60=60+14.5;$TTV65=65+14.1;$TTV70=70+13.4;$TTV75=75+12.3;$TTV80=80+10.7;$TTV85=85+8.7;$TTV90=90+6.3;$TTV95=95+3.4;	
}

for ( $t = 5; $t <= 95; $t += 5) {
//
$rounddv=${'TTV'.$t}-${'c'.$t.'dv'};
echo "rr:".$rounddv;
?><td bgcolor="<?php echo $ftcolor; ?>"><div align="right"  <?php if (abs($rounddv)>3.5){echo "<font color='red'>" ; }?>><?php
echo round(${'c'.($t).'dv'},2);
	?> </td><?php
	}
	?>
</tr>
-->  

<?php
//for ( $t = 5; $t <= 85; $t += 5) {
//if ((${'c'.($t+5).'dv'}-${'c'.($t).'dv'})>1) {
//${'c'.($t).'dv'}=${'c'.($t).'dv'};}
//else {
//${'c'.($t+5).'dv'}=(${'c'.($t).'dv'}+${'c'.($t+10).'dv'})/2;
//${'c'.($t).'dv'}=${'c'.($t).'dv'};
//$t=$t+5;
//}

//}

?>

<?php 
/*  
if ($PnC=='plate') { //icPlate2 compensate
$c5dv=$c5dv-0.38; $c10dv=$c10dv-0.7;$c15dv=$c15dv-1.02;$c20dv=$c20dv-1.28;$c25dv=$c25dv-1.5;  $c30dv=$c30dv-1.68;$c35dv=$c35dv-1.82; $c40dv=$c40dv-1.92;$c45dv=$c45dv-1.98;$c50dv=$c50dv-2;$c55dv=$c55dv-1.98;$c60dv=$c60dv-1.92; $c65dv=$c65dv-1.82; $c70dv=$c70dv-1.68; $c75dv=$c75dv-1.5; $c80dv=$c80dv-1.28; $c85dv=$c85dv-1.02; $c90dv=$c90dv-0.7;$c95dv=$c95dv-0.38;}
*/
?>

<?php  //////////////////////////////////////////C
//(0,2,4,6,7.6,9.3,10.7,12,13,13.8,14.3,14.6,14.5,14.1,13.4,12.3,10.7,8.7,6.3,3.4,0);
if ($color=='K') {
$TTV5=5+3;$TTV10=10+5.6;$TTV15=15+8.1;$TTV20=20+10.2;$TTV25=25+12.1;$TTV30=30+13.7;$TTV35=35+15;$TTV40=40+16;$TTV45=45+16.8;
$TTV50=50+17;$TTV55=55+17;$TTV60=60+16.6;$TTV65=65+15.9;$TTV70=70+14.9;$TTV75=75+13.4;$TTV80=80+11.5;$TTV85=85+9.3;$TTV90=90+6.6;$TTV95=95+3.5;}
else {
$TTV5=5+2;$TTV10=10+4;$TTV15=15+6;$TTV20=20+7.6;$TTV25=25+9.3;$TTV30=30+10.7;$TTV35=35+12;$TTV40=40+13;$TTV45=45+13.8;
$TTV50=50+14.3;$TTV55=55+14.6;$TTV60=60+14.5;$TTV65=65+14.1;$TTV70=70+13.4;$TTV75=75+12.3;$TTV80=80+10.7;$TTV85=85+8.7;$TTV90=90+6.3;$TTV95=95+3.4;	
}

for ( $t = 5; $t <= 95; $t += 5) {
//
${'rounddv'.$t}=${'TTV'.$t}-${'c'.($t).'dv'};
//echo "rr:".${'rounddv'.$t};
}



	
?>

	<table width="200" border="1" align="center">
  <tr>
  	<td><div align="center">主色</div></td>
	<td><font color="<?php if ($PnC<>'plate' and abs($rounddv5)>3){echo 'red';} else {echo '#aaaaaa';}?>">2%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv5)>3){echo 'red';} else {echo '#aaaaaa';}?>">5%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv10)>3){echo 'red';} else {echo '#aaaaaa';}?>">10%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv15)>3){echo 'red';} else {echo '#aaaaaa';}?>">15%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv20)>3){echo 'red';} else {echo '#aaaaaa';}?>">20%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv25)>3){echo 'red';} else {echo '#aaaaaa';}?>">25%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv30)>4){echo 'red';} else {echo '#666666';}?>">30%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv35)>4){echo 'red';} else {echo '#666666';}?>">35%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv40)>4){echo 'red';} else {echo '#666666';}?>">40%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv45)>4){echo 'red';} else {echo '#666666';}?>">45%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv50)>4){echo 'red';} else {echo '#666666';}?>">50%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv55)>4){echo 'red';} else {echo '#666666';}?>">55%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv60)>4){echo 'red';} else {echo '#666666';}?>">60%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv65)>4){echo 'red';} else {echo '#666666';}?>">65%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv70)>3){echo 'red';} else {echo '#000000';}?>">70%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv75)>3){echo 'red';} else {echo '#000000';}?>">75%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv80)>3){echo 'red';} else {echo '#000000';}?>">80%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv85)>3){echo 'red';} else {echo '#000000';}?>">85%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv90)>3){echo 'red';} else {echo '#000000';}?>">90%</td>
    <td><font color="<?php if ($PnC<>'plate' and abs($rounddv95)>3){echo 'red';} else {echo '#000000';}?>">95%</td>
  </tr>


<br>
<!-- -->
<tr>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="center"></div></td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c2dv,2); ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c5dv,2); ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c10dv,2); ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c15dv,2); ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c20dv,2); ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c25dv,2); ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c30dv,2); ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c35dv,2);?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c40dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c45dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c50dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c55dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c60dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c65dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c70dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c75dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c80dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c85dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c90dv,2);  ?> </td>
<td bgcolor="<?php echo $ftcolor; ?>"><div align="right"><?php echo round($c95dv,2); ?> </td>
</tr>






<br>
<table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
$gfname= $company."-";
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');


unlink("./graph/".$gfname."scatterDR.png");
$datay1 = array(0,round($c5dv,2),round($c10dv,2),round($c15dv,2),round($c20dv,2),round($c25dv,2),round($c30dv,2),round($c35dv,2),round($c40dv,2),round($c45dv,2),round($c50dv,2),round($c55dv,2),round($c60dv,2),round($c65dv,2),round($c70dv,2),round($c75dv,2),round($c80dv,2),round($c85dv,2),round($c90dv,2),round($c95dv,2),100);
$datay2 = array(0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100);

// Setup the graph
$graph = new Graph(550,430);
$graph->SetScale("textlin");

$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);

$graph->title->Set('Tone Curve');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

$graph->xaxis->SetTickLabels(array('0','5','10','15','20','25','30','35','40','45','50','55','60','65','70','75','80','85','90','95','100'));
$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=$c21l-$a21l;
$BDR=$ct21l-$at21l;

$p1->SetColor("red");
$p1->SetLegend('Measured='. $ADR);
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('red');
$p1->mark->SetFillColor('red');
$p1->SetCenter();

$p2->SetColor("#aaaaaa");
$p2->SetLegend('Line='. $BDR);
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#aaaaaa');
$p2->mark->SetFillColor('#aaaaaa');
$p2->value->SetMargin(14);
$p2->SetCenter();

$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);

$graph->xaxis->title->Set("板掉Input Tone Value");
$graph->yaxis->title->Set("Output Tone Value");

$graph->title->Set('Using chinese charecters');
#$graph->title->SetFont(FF_VERDANA,FS_BOLD,12);
$graph->title->SetColor('navy');
$graph->subtitle->Set('(板掉Free type plot)');
#$graph->subtitle->SetFont(FF_VERDANA,FS_ITALIC,10);
$graph->subtitle->SetColor('navy');

// Output line
$graph->Stroke("./graph/".$gfname."scatterDR.png");
?>

<img src="./graph/<?php echo $gfname;?>scatterDR.png?nocache=<?php echo time(); ?>">
</div></td>

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


unlink("./graph/".$gfname."scatterDR2.png");
$datay1 = array(0,round($c5dv-5,2),round($c10dv-10,2),round($c15dv-15,2),round($c20dv-20,2),round($c25dv-25,2),round($c30dv-30,2),round($c35dv-35,2),round($c40dv-40,2),round($c45dv-45,2),round($c50dv-50,2),round($c55dv-55,2),round($c60dv-60,2),round($c65dv-65,2),round($c70dv-70,2),round($c75dv-75,2),round($c80dv-80,2),round($c85dv-85,2),round($c90dv-90,2),round($c95dv-95,2),0);
$datay2 = array(0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100);
if ($color<>'K') {
$datay3 = array(0,2,4,6,7.6,9.3,10.7,12,13,13.8,14.3,14.6,14.5,14.1,13.4,12.3,10.7,8.7,6.3,3.4,0);}
else {
$datay3 = array(0,3,5.6,8.1,10.2,12.1,13.7,15,16,16.7,17,17,16.6,15.9,14.9,13.4,11.5,9.3,6.6,3.5,0);	
}
// Setup the graph
$graph = new Graph(550,430);
$graph->SetScale("textlin");

$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);

$graph->title->Set('Tone Curve');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

$graph->xaxis->SetTickLabels(array('0','5','10','15','20','25','30','35','40','45','50','55','60','65','70','75','80','85','90','95','100'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

$p1 = new LinePlot($datay1);
$graph->Add($p1);

if ($PnC<>'plate') {
$p3 = new LinePlot($datay3);
$graph->Add($p3);
$p3->SetColor("green");
$p3->SetLegend('F39');
$p3->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p3->mark->SetColor('green');
$p3->mark->SetFillColor('green');
$p3->SetCenter();

}

$p1->SetColor("red");
$p1->SetLegend('Measured='. $ADR);
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('red');
$p1->mark->SetFillColor('red');
$p1->SetCenter();



$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);


// Output line
$graph->Stroke("./graph/".$gfname."scatterDR2.png");
?>

<img src="./graph/<?php echo $gfname;?>scatterDR2.png?nocache=<?php echo time(); ?>">
</div></td>

</tr>
</table>



<?php 
  $Tsum=(($sum/260)*60)+(($psum/20)*40);
  $Rsum=round($Tsum,2);
  if (($check==0) && ($sid==0)){
	$passbit=1;}
  if(!empty($_SERVER['HTTP_CLIENT_IP'])){
   $myip = $_SERVER['HTTP_CLIENT_IP'];
}else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
   $myip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
   $myip= $_SERVER['REMOTE_ADDR'];
}
  
 $T50=round($c50dv,4); 
 $T5=round($c5dv,4);
 $T10=round($c10dv,4);
 $T15=round($c15dv,4);
 $T20=round($c20dv,4);
 $T25=round($c25dv,4);
 $T30=round($c30dv,4);
 $T35=round($c35dv,4);
 $T40=round($c40dv,4);
 $T45=round($c45dv,4);
  $T55=round($c55dv,4);
 $T60=round($c60dv,4);
  $T65=round($c65dv,4);
   $T70=round($c70dv,4);
 $T75=round($c75dv,4);
 $T80=round($c80dv,4);
 $T85=round($c85dv,4);
 $T90=round($c90dv,4);
 $T95=round($c95dv,4);
 
   if(!empty($_SERVER['HTTP_CLIENT_IP'])){
   $myip = $_SERVER['HTTP_CLIENT_IP'];
}else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
   $myip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
   $myip= $_SERVER['REMOTE_ADDR'];
}
 
////////////////////////////////////////////////////////////// 
 require_once( 'PolynomialRegression.php' );

  $data =
    //array
   // (
    //  array( 0.00, 0.0 ), array( 25, $c25dv ),
    //  array( 50, $c50dv ), array( 75, $c75dv ),
    //  array( 100, 100  )
   // );
	array
    (
       array( 0.00, 0.0 ), array( 5, $c5dv ), 
	   array( 10, $c10dv ), array( 15, $c15dv ), 
	   array( 20, $c20dv ), array( 25, $c25dv ), 
	   array( 30, $c30dv ), array( 35, $c35dv ), 
	   array( 40, $c40dv ), array( 45, $c45dv ),
	   array( 50, $c50dv ), array( 55, $c55dv ), 
	   array( 60, $c60dv ), array( 65, $c65dv ),
	   array( 70, $c70dv ), array( 75, $c75dv ), 
	   array( 80, $c80dv ), array( 85, $c85dv ), 
	   array( 90, $c90dv), array( 95, $c95dv ),
	   array( 100, 100  )
    );
	
	
	
	

  // Precision digits in BC math.
  bcscale( 10 );

  // Start a regression class of order 2--linear regression.
  $leastSquareRegression = new PolynomialRegression( 3 );

  // Add all the data to the regression analysis.
  foreach ( $data as $dataPoint )
    $leastSquareRegression->addData( $dataPoint[ 0 ], $dataPoint[ 1 ] );

  // Get coefficients for the polynomial.
  $coefficients = $leastSquareRegression->getCoefficients();

  // Print slope and intercept of linear regression.
 // echo "Slope : " . round( $coefficients[ 1 ], 2 ) . "<br />\n";
 // echo "Y-intercept : " . round( $coefficients[ 0 ], 2 ) . "<br />\n";

  //
  // Get average of Y-data.
  //
  $Y_Average = 0.0;
  foreach ( $data as $dataPoint )
    $Y_Average += $dataPoint[ 1 ];

  $Y_Average /= count( $data );

  //
  // Calculate R Squared.
  //

  $Y_MeanSum  = 0.0;
  $Y_ErrorSum = 0.0;
  foreach ( $data as $dataPoint )
  {
    $x = $dataPoint[ 0 ];
    $y = $dataPoint[ 1 ];
    $error  = $y;
    $error -= $leastSquareRegression->interpolate( $coefficients, $x );
    $Y_ErrorSum += $error * $error;

    $error  = $y;
    $error -= $Y_Average;
    $Y_MeanSum += $error * $error;
  }

  $R_SquaredPT = 1.0 - ( $Y_ErrorSum / $Y_MeanSum );

 // echo "R Squared : $R_SquaredPP<br />\n";
 
     $data2 =	
	 array
    (
       array( 0.00, 0.0 ), array( 5, $c5dv-5 ), 
	   array( 10, $c10dv-10 ), array( 15, $c15dv-15 ), 
	   array( 20, $c20dv-20 ), array( 25, $c25dv-25 ), 
	   array( 30, $c30dv-30 ), array( 35, $c35dv-35 ), 
	   array( 40, $c40dv-40 ), array( 45, $c45dv-45 ),
	   array( 50, $c50dv-50 ), array( 55, $c55dv-55 ), 
	   array( 60, $c60dv-60 ), array( 65, $c65dv-65 ),
	   array( 70, $c70dv-70 ), array( 75, $c75dv-75 ), 
	   array( 80, $c80dv-80 ), array( 85, $c85dv-85 ), 
	   array( 90, $c90dv-90), array( 95, $c95dv-95 ),
	   array( 100, 0  )
    );

	

  // Precision digits in BC math.
  bcscale( 10 );

  // Start a regression class of order 2--linear regression.
  $leastSquareRegression = new PolynomialRegression( 3 );

  // Add all the data to the regression analysis.
  foreach ( $data2 as $dataPoint )
    $leastSquareRegression->addData( $dataPoint[ 0 ], $dataPoint[ 1 ] );

  // Get coefficients for the polynomial.
  $coefficients = $leastSquareRegression->getCoefficients();

  // Print slope and intercept of linear regression.
  ///echo "Slope : " . round( $coefficients[ 1 ], 2 ) . "<br />\n";
  //echo "Y-intercept : " . round( $coefficients[ 0 ], 2 ) . "<br />\n";

  //
  // Get average of Y-data.
  //
  $Y_Average = 0.0;
  foreach ( $data2 as $dataPoint )
    $Y_Average += $dataPoint[ 1 ];

  $Y_Average /= count( $data2 );

  //
  // Calculate R Squared.
  //

  $Y_MeanSum  = 0.0;
  $Y_ErrorSum = 0.0;
  foreach ( $data2 as $dataPoint )
  {
    $x = $dataPoint[ 0 ];
    $y = $dataPoint[ 1 ];
    $error  = $y;
    $error -= $leastSquareRegression->interpolate( $coefficients, $x );
    $Y_ErrorSum += $error * $error;

    $error  = $y;
    $error -= $Y_Average;
    $Y_MeanSum += $error * $error;
  }

  $R_SquaredPP = 1.0 - ( $Y_ErrorSum / $Y_MeanSum );

  //echo "R Squared : $R_Squared<br />\n";
 
////////////////F39 rsquare/////////
$datay3 = array(0,2,4,6,7.6,9.3,10.7,12,13,13.8,14.3,14.6,14.5,14.1,13.4,12.3,10.7,8.7,6.3,3.4,0);
$data =
    //array
   // (
    //  array( 0.00, 0.0 ), array( 25, $c25dv ),
    //  array( 50, $c50dv ), array( 75, $c75dv ),
    //  array( 100, 100  )
   // );
	array
    (
       array( 0.00, 0.0 ), array( 5, 2 ), 
	   array( 10, 4 ), array( 15, 6 ), 
	   array( 20, 7.6 ), array( 25, 9.3 ), 
	   array( 30, 10.7 ), array( 35, 12 ), 
	   array( 40, 13 ), array( 45, 13.8 ),
	   array( 50, 14.3 ), array( 55, 14.6 ), 
	   array( 60, 14.5 ), array( 65, 14.1 ),
	   array( 70, 13.4 ), array( 75, 12.3 ), 
	   array( 80, 10.7 ), array( 85, 8.7 ), 
	   array( 90, 6.3), array( 95, 3.4 ),
	   array( 100, 0  )
    );
	
	
	
	

  // Precision digits in BC math.
  bcscale( 10 );

  // Start a regression class of order 2--linear regression.
  $leastSquareRegression = new PolynomialRegression( 3 );

  // Add all the data to the regression analysis.
  foreach ( $data as $dataPoint )
    $leastSquareRegression->addData( $dataPoint[ 0 ], $dataPoint[ 1 ] );

  // Get coefficients for the polynomial.
  $coefficients = $leastSquareRegression->getCoefficients();

  // Print slope and intercept of linear regression.
 // echo "Slope : " . round( $coefficients[ 1 ], 2 ) . "<br />\n";
 // echo "Y-intercept : " . round( $coefficients[ 0 ], 2 ) . "<br />\n";

  //
  // Get average of Y-data.
  //
  $Y_Average = 0.0;
  foreach ( $data as $dataPoint )
    $Y_Average += $dataPoint[ 1 ];

  $Y_Average /= count( $data );

  //
  // Calculate R Squared.
  //

  $Y_MeanSum  = 0.0;
  $Y_ErrorSum = 0.0;
  foreach ( $data as $dataPoint )
  {
    $x = $dataPoint[ 0 ];
    $y = $dataPoint[ 1 ];
    $error  = $y;
    $error -= $leastSquareRegression->interpolate( $coefficients, $x );
    $Y_ErrorSum += $error * $error;

    $error  = $y;
    $error -= $Y_Average;
    $Y_MeanSum += $error * $error;
  }

  $R_SquaredPF = 1.0 - ( $Y_ErrorSum / $Y_MeanSum );
  ///////////////////////////////////////////////


 
  if ($PnC<>'plate') {
 echo "<table align='center'><tr><td  bgcolor='#bbFFFF'><div align='center'>Press R squared:".round($R_SquaredPP,4)."</div></td></tr></table><br />\n";
  echo "<table align='center'><tr><td  bgcolor='#bbFFbb'><div align='center'>F39 R squared:".round($R_SquaredPF,4)."</div></td></tr></table><br />\n";
 }
 else {
 echo "<table align='center'><tr><td  bgcolor='#bbFFFF'><div align='center'>Plate R squared:".round($R_SquaredPT,4)."</div></td></tr></table><br />\n";	 
 }
 ////////////////////////////////////////////////////////////////


		// generate and execute query

} ?>

<tr>
	<td bgcolor="#DDDDDD"><div align="center"><a href="../FograPC10/rankL.php?color=<?php echo $color;?>&c5=<?php echo $T5;?>&c10=<?php echo $T10;?>&c15=<?php echo $T15;?>&c20=<?php echo $T20;?>&c25=<?php echo $T25;?>&c30=<?php echo $T30;?>&c35=<?php echo $T35;?>&c40=<?php echo $T40;?>&c45=<?php echo $T45;?>&c50=<?php echo $T50;?>&c55=<?php echo $T55;?>&c60=<?php echo $T60;?>&c65=<?php echo $T65;?>&c70=<?php echo $T70;?>&c75=<?php echo $T75;?>&c80=<?php echo $T80;?>&c85=<?php echo $T85;?>&c90=<?php echo $T90;?>&c95=<?php echo $T95;?>&st=<?php echo "press";?>&company=<?php echo $company;?>">
	 <?php  echo "Compare";?>  </a></div></td>

<td align="center"> <a href="rank22.php?company=<?php echo $company;?>">Report</a><br>
</td>

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


</html>