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/PSATR16/TVI-parsing13.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>CRPC6 TR016 Report</title>
<style type="text/css">
<!--
body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	background: #ffffff;
	margin: 0; /* 比較好的做法是將 Body 元素的邊界與欄位間隔調整為零,以處理不同的瀏覽器預設值 */
	padding: 0;
	text-align: right; /* 這樣會讓容器在 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 方塊外部的空間 */
}
.oneColElsCtr table {
	text-align: right;
}
.oneColElsCtr {
	text-align: center;
}
-->
</style></head>

<body class="oneColElsCtr">
<?php

function GetBetweenTT($var1="",$var2="",$pool){
$temp1 = strpos($pool,$var1)+strlen($var1);
$result = substr($pool,$temp1,strlen($pool));
$dd=strpos($result,$var2);
if($dd == 0){
$dd = strlen($result);
}

return substr($result,0,$dd);
}

//echo "Get:".GetBetweenTT("a",",","abc efg h i,jk")."_zz<br>"; // returns: b


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

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

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

  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
	echo "CRPC6 TR016 Report" .  "<br />";
    echo "Upload: " . $_FILES["file"]["name"] . "<br />";
	$filename=$dStr.$_FILES["file"]["name"];
	$fileP=$dStr.$_FILES["fileP"]["name"];
    //echo "Type: " . $_FILES["file"]["type"] . "<br />";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
   // echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";

    if (file_exists("upload/" .$dStr. $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ". "<br />";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" .$dStr. $_FILES["file"]["name"]);
	   echo "upload sucess! " .  "<br />";
	  
	   echo "Report start: " .  "<br />";
     // echo "Stored in: " . "upload/" . $_FILES["file"]["name"]. "<br />";
	  
	  ///parsing start
	  

	  
	  $contents = file("upload/".$dStr.$_FILES["file"]["name"]);
	   $stringC = implode($contents);	
	   //echo $string."<br>";
	 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'WEIGHTING_FUNCTION ');
echo "cols:".$cols."_zz<br>";
	  
	  //$col=get_between($contents,"BEGIN_DATA","END_DATA");
	  $key = array_search('BEGIN_DATA
', $contents); 
	  $key2 = array_search('END_DATA
', $contents); 



 for ( $i = 0; $i <= $key; $i += 1) {
unset($contents[$i]);
} 
unset($contents[$key2]);

	  //$key = 2;
	  
		//$string = implode($contents);
		natsort($contents);
		//echo $contents[15]."xx".$key."xx".$key2."<br>"; 
		//print_r(array_values($contents));
		//echo $string; 
//find paper 648
		
		
		
 $string = implode($contents);		
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", ',', $p);
$p = ereg_replace("\r\n?", "\n", $p);
$p = str_replace(",", '	', $p);
//echo $p;



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

$dot = explode("\t", $p);
//print_r(array_values($dot));

$Pdot=0;
$PL=$dot[6+$cols*$Pdot];
$Pa=$dot[6+$cols*$Pdot+1];
$Pb=$dot[6+$cols*$Pdot+2];

$Pdot=8;
$mml=$dot[6+$cols*$Pdot];
$mma=$dot[6+$cols*$Pdot+1];
$mmb=$dot[6+$cols*$Pdot+2];

$Pdot=1306;
$mml2=$dot[6+$cols*$Pdot];
$mma2=$dot[6+$cols*$Pdot+1];
$mmb2=$dot[6+$cols*$Pdot+2];

$Pdot=72;
$mcl=$dot[6+$cols*$Pdot];
$mca=$dot[6+$cols*$Pdot+1];
$mcb=$dot[6+$cols*$Pdot+2];

$Pdot=1286;
$mcl2=$dot[6+$cols*$Pdot];
$mca2=$dot[6+$cols*$Pdot+1];
$mcb2=$dot[6+$cols*$Pdot+2];

$Pdot=648;
$myl=$dot[6+$cols*$Pdot];
$mya=$dot[6+$cols*$Pdot+1];
$myb=$dot[6+$cols*$Pdot+2];

$Pdot=1326;
$myl2=$dot[6+$cols*$Pdot];
$mya2=$dot[6+$cols*$Pdot+1];
$myb2=$dot[6+$cols*$Pdot+2];

$Pdot=1259;
$mkl=$dot[6+$cols*$Pdot];
$mka=$dot[6+$cols*$Pdot+1];
$mkb=$dot[6+$cols*$Pdot+2];

$Pdot=1346;
$mkl2=$dot[6+$cols*$Pdot];
$mka2=$dot[6+$cols*$Pdot+1];
$mkb2=$dot[6+$cols*$Pdot+2];

$Pdot=1295;
$mc50l=$dot[6+$cols*$Pdot];
$mc50a=$dot[6+$cols*$Pdot+1];
$mc50b=$dot[6+$cols*$Pdot+2];

$Pdot=1315;
$mm50l=$dot[6+$cols*$Pdot];
$mm50a=$dot[6+$cols*$Pdot+1];
$mm50b=$dot[6+$cols*$Pdot+2];

$Pdot=1335;
$my50l=$dot[6+$cols*$Pdot];
$my50a=$dot[6+$cols*$Pdot+1];
$my50b=$dot[6+$cols*$Pdot+2];

$Pdot=1355;
$mk50l=$dot[6+$cols*$Pdot];
$mk50a=$dot[6+$cols*$Pdot+1];
$mk50b=$dot[6+$cols*$Pdot+2];


$Pdot=1610;
$mcmyl=$dot[6+$cols*$Pdot];
$mcmya=$dot[6+$cols*$Pdot+1];
$mcmyb=$dot[6+$cols*$Pdot+2];


$Pdot=0;
$p1l=$dot[6+$cols*$Pdot];
$p1a=$dot[6+$cols*$Pdot+1];
$p1b=$dot[6+$cols*$Pdot+2];

$Pdot=1366;
$pp1l=$dot[6+$cols*$Pdot];
$pp1a=$dot[6+$cols*$Pdot+1];
$pp1b=$dot[6+$cols*$Pdot+2];

$Pdot=81;
$p2l=$dot[6+$cols*$Pdot];
$p2a=$dot[6+$cols*$Pdot+1];
$p2b=$dot[6+$cols*$Pdot+2];

$Pdot=1341;
$pp2l=$dot[6+$cols*$Pdot];
$pp2a=$dot[6+$cols*$Pdot+1];
$pp2b=$dot[6+$cols*$Pdot+2];

$Pdot=162;
$p3l=$dot[6+$cols*$Pdot];
$p3a=$dot[6+$cols*$Pdot+1];
$p3b=$dot[6+$cols*$Pdot+2];

$Pdot=1339;
$pp3l=$dot[6+$cols*$Pdot];
$pp3a=$dot[6+$cols*$Pdot+1];
$pp3b=$dot[6+$cols*$Pdot+2];

$Pdot=243;
$p4l=$dot[6+$cols*$Pdot];
$p4a=$dot[6+$cols*$Pdot+1];
$p4b=$dot[6+$cols*$Pdot+2];

$Pdot=1337;
$pp4l=$dot[6+$cols*$Pdot];
$pp4a=$dot[6+$cols*$Pdot+1];
$pp4b=$dot[6+$cols*$Pdot+2];

$Pdot=324;
$p5l=$dot[6+$cols*$Pdot];
$p5a=$dot[6+$cols*$Pdot+1];
$p5b=$dot[6+$cols*$Pdot+2];

$Pdot=1336;
$pp5l=$dot[6+$cols*$Pdot];
$pp5a=$dot[6+$cols*$Pdot+1];
$pp5b=$dot[6+$cols*$Pdot+2];

$Pdot=486;
$p6l=$dot[6+$cols*$Pdot];
$p6a=$dot[6+$cols*$Pdot+1];
$p6b=$dot[6+$cols*$Pdot+2];

$Pdot=1333;
$pp6l=$dot[6+$cols*$Pdot];
$pp6a=$dot[6+$cols*$Pdot+1];
$pp6b=$dot[6+$cols*$Pdot+2];

$Pdot=567;
$p7l=$dot[6+$cols*$Pdot];
$p7a=$dot[6+$cols*$Pdot+1];
$p7b=$dot[6+$cols*$Pdot+2];

$Pdot=1330;
$pp7l=$dot[6+$cols*$Pdot];
$pp7a=$dot[6+$cols*$Pdot+1];
$pp7b=$dot[6+$cols*$Pdot+2];

$Pdot=648;
$p8l=$dot[6+$cols*$Pdot];
$p8a=$dot[6+$cols*$Pdot+1];
$p8b=$dot[6+$cols*$Pdot+2];

$Pdot=1326;
$pp8l=$dot[6+$cols*$Pdot];
$pp8a=$dot[6+$cols*$Pdot+1];
$pp8b=$dot[6+$cols*$Pdot+2];

$Pdot=1;
$p9l=$dot[6+$cols*$Pdot];
$p9a=$dot[6+$cols*$Pdot+1];
$p9b=$dot[6+$cols*$Pdot+2];

$Pdot=1321;
$pp9l=$dot[6+$cols*$Pdot];
$pp9a=$dot[6+$cols*$Pdot+1];
$pp9b=$dot[6+$cols*$Pdot+2];

$Pdot=2;
$p10l=$dot[6+$cols*$Pdot];
$p10a=$dot[6+$cols*$Pdot+1];
$p10b=$dot[6+$cols*$Pdot+2];

$Pdot=1319;
$pp10l=$dot[6+$cols*$Pdot];
$pp10a=$dot[6+$cols*$Pdot+1];
$pp10b=$dot[6+$cols*$Pdot+2];

$Pdot=3;
$p11l=$dot[6+$cols*$Pdot];
$p11a=$dot[6+$cols*$Pdot+1];
$p11b=$dot[6+$cols*$Pdot+2];

$Pdot=1317;
$pp11l=$dot[6+$cols*$Pdot];
$pp11a=$dot[6+$cols*$Pdot+1];
$pp11b=$dot[6+$cols*$Pdot+2];

$Pdot=4;
$p12l=$dot[6+$cols*$Pdot];
$p12a=$dot[6+$cols*$Pdot+1];
$p12b=$dot[6+$cols*$Pdot+2];

$Pdot=1316;
$pp12l=$dot[6+$cols*$Pdot];
$pp12a=$dot[6+$cols*$Pdot+1];
$pp12b=$dot[6+$cols*$Pdot+2];

$Pdot=6;
$p13l=$dot[6+$cols*$Pdot];
$p13a=$dot[6+$cols*$Pdot+1];
$p13b=$dot[6+$cols*$Pdot+2];

$Pdot=1313;
$pp13l=$dot[6+$cols*$Pdot];
$pp13a=$dot[6+$cols*$Pdot+1];
$pp13b=$dot[6+$cols*$Pdot+2];

$Pdot=7;
$p14l=$dot[6+$cols*$Pdot];
$p14a=$dot[6+$cols*$Pdot+1];
$p14b=$dot[6+$cols*$Pdot+2];

$Pdot=1310;
$pp14l=$dot[6+$cols*$Pdot];
$pp14a=$dot[6+$cols*$Pdot+1];
$pp14b=$dot[6+$cols*$Pdot+2];

$Pdot=8;
$p15l=$dot[6+$cols*$Pdot];
$p15a=$dot[6+$cols*$Pdot+1];
$p15b=$dot[6+$cols*$Pdot+2];

$Pdot=1306;
$pp15l=$dot[6+$cols*$Pdot];
$pp15a=$dot[6+$cols*$Pdot+1];
$pp15b=$dot[6+$cols*$Pdot+2];

$Pdot=9;
$p16l=$dot[6+$cols*$Pdot];
$p16a=$dot[6+$cols*$Pdot+1];
$p16b=$dot[6+$cols*$Pdot+2];

$Pdot=1301;
$pp16l=$dot[6+$cols*$Pdot];
$pp16a=$dot[6+$cols*$Pdot+1];
$pp16b=$dot[6+$cols*$Pdot+2];

$Pdot=18;
$p17l=$dot[6+$cols*$Pdot];
$p17a=$dot[6+$cols*$Pdot+1];
$p17b=$dot[6+$cols*$Pdot+2];

$Pdot=1299;
$pp17l=$dot[6+$cols*$Pdot];
$pp17a=$dot[6+$cols*$Pdot+1];
$pp17b=$dot[6+$cols*$Pdot+2];

$Pdot=27;
$p18l=$dot[6+$cols*$Pdot];
$p18a=$dot[6+$cols*$Pdot+1];
$p18b=$dot[6+$cols*$Pdot+2];

$Pdot=1297;
$pp18l=$dot[6+$cols*$Pdot];
$pp18a=$dot[6+$cols*$Pdot+1];
$pp18b=$dot[6+$cols*$Pdot+2];

$Pdot=36;
$p19l=$dot[6+$cols*$Pdot];
$p19a=$dot[6+$cols*$Pdot+1];
$p19b=$dot[6+$cols*$Pdot+2];

$Pdot=1296;
$pp19l=$dot[6+$cols*$Pdot];
$pp19a=$dot[6+$cols*$Pdot+1];
$pp19b=$dot[6+$cols*$Pdot+2];

$Pdot=54;
$p20l=$dot[6+$cols*$Pdot];
$p20a=$dot[6+$cols*$Pdot+1];
$p20b=$dot[6+$cols*$Pdot+2];

$Pdot=1293;
$pp20l=$dot[6+$cols*$Pdot];
$pp20a=$dot[6+$cols*$Pdot+1];
$pp20b=$dot[6+$cols*$Pdot+2];

$Pdot=63;
$p21l=$dot[6+$cols*$Pdot];
$p21a=$dot[6+$cols*$Pdot+1];
$p21b=$dot[6+$cols*$Pdot+2];

$Pdot=1290;
$pp21l=$dot[6+$cols*$Pdot];
$pp21a=$dot[6+$cols*$Pdot+1];
$pp21b=$dot[6+$cols*$Pdot+2];

$Pdot=72;
$p22l=$dot[6+$cols*$Pdot];
$p22a=$dot[6+$cols*$Pdot+1];
$p22b=$dot[6+$cols*$Pdot+2];

$Pdot=1286;
$pp22l=$dot[6+$cols*$Pdot];
$pp22a=$dot[6+$cols*$Pdot+1];
$pp22b=$dot[6+$cols*$Pdot+2];

$Pdot=646;
$p23l=$dot[6+$cols*$Pdot];
$p23a=$dot[6+$cols*$Pdot+1];
$p23b=$dot[6+$cols*$Pdot+2];

$Pdot=1367;
$pp23l=$dot[6+$cols*$Pdot];
$pp23a=$dot[6+$cols*$Pdot+1];
$pp23b=$dot[6+$cols*$Pdot+2];

$Pdot=1361;
$p24l=$dot[6+$cols*$Pdot];
$p24a=$dot[6+$cols*$Pdot+1];
$p24b=$dot[6+$cols*$Pdot+2];

$Pdot=1485;
$pp24l=$dot[6+$cols*$Pdot];
$pp24a=$dot[6+$cols*$Pdot+1];
$pp24b=$dot[6+$cols*$Pdot+2];

$Pdot=729;
$p25l=$dot[6+$cols*$Pdot];
$p25a=$dot[6+$cols*$Pdot+1];
$p25b=$dot[6+$cols*$Pdot+2];

$Pdot=1359;
$pp25l=$dot[6+$cols*$Pdot];
$pp25a=$dot[6+$cols*$Pdot+1];
$pp25b=$dot[6+$cols*$Pdot+2];

$Pdot=945;
$p26l=$dot[6+$cols*$Pdot];
$p26a=$dot[6+$cols*$Pdot+1];
$p26b=$dot[6+$cols*$Pdot+2];

$Pdot=1356;
$pp26l=$dot[6+$cols*$Pdot];
$pp26a=$dot[6+$cols*$Pdot+1];
$pp26b=$dot[6+$cols*$Pdot+2];

$Pdot=1070;
$p27l=$dot[6+$cols*$Pdot];
$p27a=$dot[6+$cols*$Pdot+1];
$p27b=$dot[6+$cols*$Pdot+2];

$Pdot=1354;
$pp27l=$dot[6+$cols*$Pdot];
$pp27a=$dot[6+$cols*$Pdot+1];
$pp27b=$dot[6+$cols*$Pdot+2];

$Pdot=1195;
$p28l=$dot[6+$cols*$Pdot];
$p28a=$dot[6+$cols*$Pdot+1];
$p28b=$dot[6+$cols*$Pdot+2];

$Pdot=1351;
$pp28l=$dot[6+$cols*$Pdot];
$pp28a=$dot[6+$cols*$Pdot+1];
$pp28b=$dot[6+$cols*$Pdot+2];

$Pdot=1259;
$p29l=$dot[6+$cols*$Pdot];
$p29a=$dot[6+$cols*$Pdot+1];
$p29b=$dot[6+$cols*$Pdot+2];

$Pdot=1346;
$pp29l=$dot[6+$cols*$Pdot];
$pp29a=$dot[6+$cols*$Pdot+1];
$pp29b=$dot[6+$cols*$Pdot+2];

echo "CRPC6 paper: L:95,  a:1,  b:-4<br />";
echo "paper measured: L:".$PL.",  a:".$Pa.",  b:".$Pb.  "<br />";


include 'lab2xyz.php';

include 'SCCA06.php';

include 'xyz2lab.php';


$RPCCl=56;$RPCCa=-37;$RPCCb=-50;
$RPCMl=48;$RPCMa=75;$RPCMb=-4;
$RPCYl=89;$RPCYa=-4;$RPCYb=93;
$RPCKl=16;$RPCKa=0.01;$RPCKb=0.01;

$RPCC50l=75.14;$RPCC50a=-16.63;$RPCC50b=-27.88;
$RPCM50l=70.07;$RPCM50a=35.98;$RPCM50b=-7.49;
$RPCY50l=91.49;$RPCY50a=-2.75;$RPCY50b=41.34;
$RPCK50l=60.4;$RPCK50a=0.46;$RPCK50b=-2.59;

$RPCcmyl=57.46;$RPCcmya=0.38;$RPCcmyb=-2.03;


$Xp=lab2xyz("x",$PL,$Pa,$Pb);
$Yp=lab2xyz("y",$PL,$Pa,$Pb);
$Zp=lab2xyz("z",$PL,$Pa,$Pb);
//////////////////////////////////////////////////////////////
$RPCcmyX=lab2xyz("x",$RPCcmyl,$RPCcmya,$RPCcmyb);
$RPCcmyY=lab2xyz("y",$RPCcmyl,$RPCcmya,$RPCcmyb);
$RPCcmyZ=lab2xyz("z",$RPCcmyl,$RPCcmya,$RPCcmyb);

$sccmyX=SCCA06("x",$RPCcmyX,$Xp);
$sccmyY=SCCA06("y",$RPCcmyY,$Yp);
$sccmyZ=SCCA06("z",$RPCcmyZ,$Zp);

$sccmyL=xyz2lab("l",$sccmyX,$sccmyY,$sccmyZ);
$sccmya=xyz2lab("a",$sccmyX,$sccmyY,$sccmyZ);
$sccmyb=xyz2lab("b",$sccmyX,$sccmyY,$sccmyZ);


//////////////////////////////////////////////////////////////
$RPCCX=lab2xyz("x",$RPCCl,$RPCCa,$RPCCb);
$RPCCY=lab2xyz("y",$RPCCl,$RPCCa,$RPCCb);
$RPCCZ=lab2xyz("z",$RPCCl,$RPCCa,$RPCCb);

$RPCC50X=lab2xyz("x",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Y=lab2xyz("y",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Z=lab2xyz("z",$RPCC50l,$RPCC50a,$RPCC50b);


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

$scC50X=SCCA06("x",$RPCC50X,$Xp);
$scC50Y=SCCA06("y",$RPCC50Y,$Yp);
$scC50Z=SCCA06("z",$RPCC50Z,$Zp);

$scCL=xyz2lab("l",$scCX,$scCY,$scCZ);
$scCa=xyz2lab("a",$scCX,$scCY,$scCZ);
$scCb=xyz2lab("b",$scCX,$scCY,$scCZ);

$scC50L=xyz2lab("l",$scC50X,$scC50Y,$scC50Z);
$scC50a=xyz2lab("a",$scC50X,$scC50Y,$scC50Z);
$scC50b=xyz2lab("b",$scC50X,$scC50Y,$scC50Z);
/////////////////////////////////////////////////////////////
$RPCMX=lab2xyz("x",$RPCMl,$RPCMa,$RPCMb);
$RPCMY=lab2xyz("y",$RPCMl,$RPCMa,$RPCMb);
$RPCMZ=lab2xyz("z",$RPCMl,$RPCMa,$RPCMb);

$RPCM50X=lab2xyz("x",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Y=lab2xyz("y",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Z=lab2xyz("z",$RPCM50l,$RPCM50a,$RPCM50b);

$scMX=SCCA06("x",$RPCMX,$Xp);
$scMY=SCCA06("y",$RPCMY,$Yp);
$scMZ=SCCA06("z",$RPCMZ,$Zp);

$scM50X=SCCA06("x",$RPCM50X,$Xp);
$scM50Y=SCCA06("y",$RPCM50Y,$Yp);
$scM50Z=SCCA06("z",$RPCM50Z,$Zp);

$scML=xyz2lab("l",$scMX,$scMY,$scMZ);
$scMa=xyz2lab("a",$scMX,$scMY,$scMZ);
$scMb=xyz2lab("b",$scMX,$scMY,$scMZ);

$scM50L=xyz2lab("l",$scM50X,$scM50Y,$scM50Z);
$scM50a=xyz2lab("a",$scM50X,$scM50Y,$scM50Z);
$scM50b=xyz2lab("b",$scM50X,$scM50Y,$scM50Z);
////////////////////////////////////////////////////////////////
$RPCYX=lab2xyz("x",$RPCYl,$RPCYa,$RPCYb);
$RPCYY=lab2xyz("y",$RPCYl,$RPCYa,$RPCYb);
$RPCYZ=lab2xyz("z",$RPCYl,$RPCYa,$RPCYb);

$RPCY50X=lab2xyz("x",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Y=lab2xyz("y",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Z=lab2xyz("z",$RPCY50l,$RPCY50a,$RPCY50b);

$scYX=SCCA06("x",$RPCYX,$Xp);
$scYY=SCCA06("y",$RPCYY,$Yp);
$scYZ=SCCA06("z",$RPCYZ,$Zp);

$scY50X=SCCA06("x",$RPCY50X,$Xp);
$scY50Y=SCCA06("y",$RPCY50Y,$Yp);
$scY50Z=SCCA06("z",$RPCY50Z,$Zp);

$scYL=xyz2lab("l",$scYX,$scYY,$scYZ);
$scYa=xyz2lab("a",$scYX,$scYY,$scYZ);
$scYb=xyz2lab("b",$scYX,$scYY,$scYZ);

$scY50L=xyz2lab("l",$scY50X,$scY50Y,$scY50Z);
$scY50a=xyz2lab("a",$scY50X,$scY50Y,$scY50Z);
$scY50b=xyz2lab("b",$scY50X,$scY50Y,$scY50Z);
////////////////////////////////////////////////////////////////////
$RPCKX=lab2xyz("x",$RPCKl,$RPCKa,$RPCKb);
$RPCKY=lab2xyz("y",$RPCKl,$RPCKa,$RPCKb);
$RPCKZ=lab2xyz("z",$RPCKl,$RPCKa,$RPCKb);

$RPCK50X=lab2xyz("x",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Y=lab2xyz("y",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Z=lab2xyz("z",$RPCK50l,$RPCK50a,$RPCK50b);

$scKX=SCCA06("x",$RPCKX,$Xp);
$scKY=SCCA06("y",$RPCKY,$Yp);
$scKZ=SCCA06("z",$RPCKZ,$Zp);

$scK50X=SCCA06("x",$RPCK50X,$Xp);
$scK50Y=SCCA06("y",$RPCK50Y,$Yp);
$scK50Z=SCCA06("z",$RPCK50Z,$Zp);

$scKL=xyz2lab("l",$scKX,$scKY,$scKZ);
$scKa=xyz2lab("a",$scKX,$scKY,$scKZ);
$scKb=xyz2lab("b",$scKX,$scKY,$scKZ);

$scK50L=xyz2lab("l",$scK50X,$scK50Y,$scK50Z);
$scK50a=xyz2lab("a",$scK50X,$scK50Y,$scK50Z);
$scK50b=xyz2lab("b",$scK50X,$scK50Y,$scK50Z);
///////////////////////////////////////////////////the whole SCCA
$contents6 = file("CRPC6.txt");
		$string6= implode($contents6);
		//echo $contents[20]; 
		//echo $string; 
$p6 = ereg_replace("\r\n?", "\n", $string6);
$p6 = str_replace("\n", '	', $p6);
//echo $p;


$datastring6=get_between($p6,"BEGIN_DATA","END_DATA");
//echo $datastring;
$dot6 = explode("	", $datastring6);

for ( $i = 0; $i <= 1615; $i+= 1) {

$line=$i+2 ."	";
//fwrite($fh, $line);
  // echo $dot[0]."x_";
	  $DataC =  $dot6[$line*8+1]."	";
	  $DataM =  $dot6[$line*8+2]."	";
	  $DataY =  $dot6[$line*8+3]."	";
	  $DataK =  $dot6[$line*8+4]."	";
	  $DataL =  $dot6[$line*8+5]."	";
	  $Dataa =  $dot6[$line*8+6]."	";
	  $Datab =  $dot6[$line*8+7]."	";
	  
	  $X=lab2xyz("x",$DataL,$Dataa,$Datab);
	  $Y=lab2xyz("y",$DataL,$Dataa,$Datab);
	  $Z=lab2xyz("z",$DataL,$Dataa,$Datab);
	  
	  $scX=SCCA06("x",$X,$Xp);
	  $scY=SCCA06("y",$Y,$Yp);
	  $scZ=SCCA06("z",$Z,$Zp);

	  $scL=round(xyz2lab("l",$scX,$scY,$scZ),2)."	";
	  $sca=round(xyz2lab("a",$scX,$scY,$scZ),2)."	";
	  $scb=round(xyz2lab("b",$scX,$scY,$scZ),2);
	  ${'sc'.($i+2).'l'}=$scL;
	  ${'sc'.($i+2).'a'}=$sca;
	  ${'sc'.($i+2).'b'}=$scb;
	  }
	  
	for ( $i = 1; $i <= 1617; $i+= 1) {
	${'m'.$i.'l'}=$dot[6+$cols*($i-1)];
	${'m'.$i.'a'}=$dot[6+$cols*($i-1)+1];
	${'m'.$i.'b'}=$dot[6+$cols*($i-1)+2];}
	  
	include 'dE00.php';
	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);
}
	
	$desum=0;
		for ( $sm = 2; $sm <= 1617; $sm+= 1) {
	${'sc00'.$sm}=round(de00(${'sc'.$sm.'l'},${'sc'.$sm.'a'},${'sc'.$sm.'b'},${'m'.$sm.'l'},${'m'.$sm.'a'},${'m'.$sm.'b'}),2);
	
	$desum=${'sc00'.$sm}+$desum;
	}
	
	
		$desum76=0;
		for ( $sm = 2; $sm <= 1617; $sm+= 1) {
	${'sc76'.$sm}=round(de76(${'sc'.$sm.'l'},${'sc'.$sm.'a'},${'sc'.$sm.'b'},${'m'.$sm.'l'},${'m'.$sm.'a'},${'m'.$sm.'b'}),2);
	
	$desum76=${'sc76'.$sm}+$desum76;
	}

	//echo "set2=". $sc1617l."x".$sc1617a."x".$sc1617b."xx".$m1617l."x".$m1617a."x".$m1617b."de001617:".$sc761617."<br>";
	
    $avg00=round(($desum/1617),2);
	$avg76=round(($desum76/1617),2);
	
	$range76 = array() ;
	array_push($range76, 0);
 for ($s=2; $s <= 1617; $s += 1) {
$range76[$s] = ${'sc76'.$s};
}
sort($range76);
//echo "s76".$range76[1615];

	$range00 = array() ;
	array_push($range00, 0);
 for ($s=2; $s <= 1617; $s += 1) {
$range00[$s] = ${'sc00'.$s};
}
sort($range00);
//echo "s00".$range00[1615];

$sc7695 = $range76[round((95/100) * count($range76) -0.5)];	
$sc0095 = $range00[round((95/100) * count($range00) -0.5)];		
?>


<p><p>
	
	<table width="200" border="1" align="center">
  <tr>
  	<td bgcolor="#77FFFF"><div align="center">100C</div></td>
    <td><font color="#aaaaaa">L*</td>
    <td><font color="#aaaaaa">a*</td>
    <td><font color="#aaaaaa">b*</td>
	<td>
	 <td bgcolor="#FF77FF"><div align="center">100M</div></td>
    <td><font color="#aaaaaa">L*</td>
    <td><font color="#aaaaaa">a*</td>
    <td><font color="#aaaaaa">b*</td>
    <td>
	<td bgcolor="#FFFF77"><div align="center">100Y</div></td>
	<td><font color="#aaaaaa">L*</font></td>
	<td><font color="#aaaaaa">a*</font></td>
	<td><font color="#aaaaaa">b*</font></td>
	<td>
	<td bgcolor="#aaaaaa"><div align="center">100K</div></td>
	<td><font color="#aaaaaa">L*</font></td>
	<td><font color="#aaaaaa">a*</font></td>
	<td><font color="#aaaaaa">b*</font></td>  
  </tr>
  

  <?php
  //////////////////////////////////////////////////Fogra Media Check
  $psum=20;
 // $pl=95; $pa=-0.01;$pb=-2;
  $cl=$scCL; $ca=$scCa;$cb=$scCb;
  $ml=$scML; $ma=$scMa;$mb=$scMb;
  $yl=$scYL; $ya=$scYa;$yb=$scYb;
  $kl=$scKL; $ka=$scKa;$kb=$scKb;
  

?>


<?php
 
 $pa00=de00(95,1,-4,$PL,$Pa,$Pb);
 
 $mcl=($mcl+$mcl2)/2;$mca=($mca+$mca2)/2;$mcb=($mcb+$mcb2)/2;
  $mml=($mml+$mml2)/2;$mma=($mma+$mma2)/2;$mmb=($mmb+$mmb2)/2;
   $myl=($myl+$myl2)/2;$mya=($mya+$mya2)/2;$myb=($myb+$myb2)/2;
    $mkl=($mkl+$mkl2)/2;$mka=($mka+$mka2)/2;$mkb=($mkb+$mkb2)/2;
 
 $dc00=de00($cl,$ca,$cb,$mcl,$mca,$mcb);
 $dm00=de00($ml,$ma,$mb,$mml,$mma,$mmb);
 $dy00=de00($yl,$ya,$yb,$myl,$mya,$myb);
 $dk00=de00($kl,$ka,$kb,$mkl,$mka,$mkb);
 
 $dc50=de00($scC50L,$scC50a,$scC50b,$mc50l,$mc50a,$mc50b);
 $dm50=de00($scM50L,$scM50a,$scM50b,$mm50l,$mm50a,$mm50b);
 $dy50=de00($scY50L,$scY50a,$scY50b,$my50l,$my50a,$my50b);
 $dk50=de00($scK50L,$scK50a,$scK50b,$mk50l,$mk50a,$mk50b);
 
  $dcmy=de00($sccmyL,$sccmya,$sccmyb,$mcmyl,$mcmya,$mcmyb);
  
  
  //$dp1=de00($p1l,$p1a,$p1b,$pp1l,$pp1a,$pp1b);
  
  for ( $i = 1; $i <= 29; $i += 1) {
  ${'dp'.$i}=round(de00(${'p'.$i.'l'},${'p'.$i.'a'},${'p'.$i.'b'},${'pp'.$i.'l'},${'pp'.$i.'a'},${'pp'.$i.'b'}),2);
 }
 
$CRde = array() ;
 for ($s=1; $s <= 29; $s += 1) {
$CRde[$s] = ${'dp'.$s};
}
 
 //$CRde = array("lemon", "orange", "banana", "apple");
sort($CRde);
//echo "CR".$CRde[26];
 
  $CRF0=0;
 // $CRF1=$CRF0+1/29;
 // $CRF2=$CRF1+1/29;
  for ( $i = 1; $i <= 29; $i += 1) {
  ${'CRF'.$i}=${'CRF'.($i-1)}+(1/29);
  }


  
 ?>

<tr><td><div align="center">SCCA</div></td>
<td><div align="right"><?php echo round($cl,2);?></div></td>
<td><div align="right"><?php echo round($ca,2);?></div></td>
<td><div align="right"><?php echo round($cb,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center">SCCA</div></td>
<td><div align="right"><?php echo round($ml,2);?></div></td>
<td><div align="right"><?php echo round($ma,2);?></div></td>
<td><div align="right"><?php echo round($mb,2);?></div></td>
<td>
 <td><div align="center">SCCA</div></td>
	    <td><div align="right"><?php echo round($yl,2);?></div></td>
	    <td><div align="right"><?php echo round($ya,2);?></div></td>
	    <td><div align="right"><?php echo round($yb,2);?></div></td>
	    <td><div align="center"></div></td>
	    <td><div align="center">SCCA</div></td>
	    <td><div align="right"><?php echo round($kl,2);?></div></td>
	    <td><div align="right"><?php echo round($ka,2);?></div></td>
	    <td><div align="right"><?php echo round($kb,2);?></div></td>
</tr>

<tr><td><div align="center">Meas.</div></td>
<td><div align="right"><?php echo round($mcl,2);?></div></td>
<td><div align="right"><?php echo round($mca,2);?></div></td>
<td><div align="right"><?php echo round($mcb,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center">Meas.</div></td>
<td><div align="right"><?php echo round($mml,2);?></div></td>
<td><div align="right"><?php echo round($mma,2);?></div></td>
<td><div align="right"><?php echo round($mmb,2);?></div></td>
<td>
<td><div align="center">Meas.</div></td>
	    <td><div align="right"><?php echo round($myl,2);?></div></td>
	    <td><div align="right"><?php echo round($mya,2);?></div></td>
	    <td><div align="right"><?php echo round($myb,2);?></div></td>
	    <td><div align="center"></div></td>
	    <td><div align="center">Meas.</div></td>
	    <td><div align="right"><?php echo round($mkl,2);?></div></td>
	    <td><div align="right"><?php echo round($mka,2);?></div></td>
	    <td><div align="right"><?php echo round($mkb,2);?></div></td>
        <td>
</tr>

<tr><td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dc00,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dm00,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td>
    <td><div align="center">dE00.</div></td>
	    <td><div align="right"><?php echo round($dy00,2);?></div></td>
	    <td><div align="center"></div></td>
	    <td><div align="center"></div></td>
	    <td><div align="center"></div></td>
	    <td><div align="center">dE00.</div></td>
	    <td><div align="right"><?php echo round($dk00,2);?></div></td>
	    <td><div align="center"></div></td>
	    <td><div align="center"></div></td>
      </tr>
</table>
<br>


<table width="200" border="1" align="center">
  <tr>
  	<td bgcolor="#DDFFFF"><div align="center">50C</div></td>
    <td><font color="#aaaaaa">L*</td>
    <td><font color="#aaaaaa">a*</td>
    <td><font color="#aaaaaa">b*</td>
	<td>
	<td bgcolor="#FFDDFF"><div align="center">50M</div></td>
    <td><font color="#aaaaaa">L*</td>
    <td><font color="#aaaaaa">a*</td>
    <td><font color="#aaaaaa">b*</td>
    <td>
    <td bgcolor="#FFFFDD"><div align="center">50Y</div></td>
    <td><font color="#aaaaaa">L*</td>
    <td><font color="#aaaaaa">a*</td>
    <td><font color="#aaaaaa">b*</td>
	<td>
<td bgcolor="#DFDFDF"><div align="center">50K</div></td>
    <td><font color="#aaaaaa">L*</td>
    <td><font color="#aaaaaa">a*</td>
    <td><font color="#aaaaaa">b*</td>
  </tr>
<tr><td><div align="center">SCCA</div></td>
<td><div align="right"><?php echo round($scC50L,2);?></div></td>
<td><div align="right"><?php echo round($scC50a,2);?></div></td>
<td><div align="right"><?php echo round($scC50b,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center">SCCA</div></td>
<td><div align="right"><?php echo round($scM50L,2);?></div></td>
<td><div align="right"><?php echo round($scM50a,2);?></div></td>
<td><div align="right"><?php echo round($scM50b,2);?></div></td>
<td>
<td><div align="center">SCCA</div></td>
<td><div align="right"><?php echo round($scY50L,2);?></div></td>
<td><div align="right"><?php echo round($scY50a,2);?></div></td>
<td><div align="right"><?php echo round($scY50b,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center">SCCA</div></td>
<td><div align="right"><?php echo round($scK50L,2);?></div></td>
<td><div align="right"><?php echo round($scK50a,2);?></div></td>
<td><div align="right"><?php echo round($scK50b,2);?></div></td>
<td>

</tr>

<tr><td><div align="center">Meas.</div></td>
<td><div align="right"><?php echo round($mc50l,2);?></div></td>
<td><div align="right"><?php echo round($mc50a,2);?></div></td>
<td><div align="right"><?php echo round($mc50b,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center">Meas.</div></td>
<td><div align="right"><?php echo round($mm50l,2);?></div></td>
<td><div align="right"><?php echo round($mm50a,2);?></div></td>
<td><div align="right"><?php echo round($mm50b,2);?></div></td>
<td>
<td><div align="center">Meas.</div></td>
<td><div align="right"><?php echo round($my50l,2);?></div></td>
<td><div align="right"><?php echo round($my50a,2);?></div></td>
<td><div align="right"><?php echo round($my50b,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center">Meas.</div></td>
<td><div align="right"><?php echo round($mk50l,2);?></div></td>
<td><div align="right"><?php echo round($mk50a,2);?></div></td>
<td><div align="right"><?php echo round($mk50b,2);?></div></td>
</tr>

<tr><td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dc50,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dm50,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td>
<td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dy50,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dk50,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
</tr>
</table>
<br>


<table width="200" border="1" align="center">
  <tr>
<td bgcolor="#bbbbbf"><div align="center">CMY</div></td>
    <td><font color="#aaaaaa">L*</td>
    <td><font color="#aaaaaa">a*</td>
    <td><font color="#aaaaaa">b*</td>
	<td>
    <td><font color="#aaaaaa">IT8.7/4</td>
    <td><font color="#aaaaaa">∆E*ab</td>
    <td><font color="#aaaaaa">∆E00</td>
  </tr>
<tr><td><div align="center">SCCA</div></td>
<td><div align="right"><?php echo round($sccmyL,2);?></div></td>
<td><div align="right"><?php echo round($sccmya,2);?></div></td>
<td><div align="right"><?php echo round($sccmyb,2);?></div></td>
<td>
<td><font color="#aaaaaa"><div align="center"></div>Avg.</td>
    <td><?php echo $avg76;?></td>
    <td><?php echo $avg00;?></td>
</tr>

<tr><td><div align="center">Meas.</div></td>
<td><div align="right"><?php echo round($mcmyl,2);?></div></td>
<td><div align="right"><?php echo round($mcmya,2);?></div></td>
<td><div align="right"><?php echo round($mcmyb,2);?></div></td>
<td><div align="center"></div></td>
    <td><font color="#aaaaaa">Range</td>
        <td><?php echo $range76[1615];?></td>
		<td><?php echo $range00[1615];?></td>

</tr>

<tr><td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dcmy,2);?></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
<td><div align="center"></div></td>
    <td><font color="#aaaaaa">95%tile</td>
        <td><?php echo $sc7695;?></td>
		<td><?php echo $sc0095;?></td>
</tr>
</table>
<br>
<br>
<hr size="5"> 
<p>Within-sheet aspect<p>
<table width="200" border="1" align="center">
  <tr>
<td bgcolor="#bbbbbf"><div align="center">Patch</div></td>
    <td><font color="#aaaaaa">L*1</td>
    <td><font color="#aaaaaa">a*1</td>
    <td><font color="#aaaaaa">b*1</td>
	<td><font color="#aaaaaa">L*2</td>
    <td><font color="#aaaaaa">a*2</td>
    <td><font color="#aaaaaa">b*2</td>
	<td><font color="#aaaaaa">∆E00 (x)</td>
    <td><font color="#aaaaaa">CRF (y)</td>
    <td><font color="#aaaaaa">∆E00 (sort)</td>
  </tr>
 <?php   for ( $i = 1; $i <= 29; $i += 1) { ?>
<tr>
<td><div align="right"><?php echo $i;?></div></td>
<td><div align="right"><?php echo ${'p'.$i.'l'};?></div></td>
<td><div align="right"><?php echo ${'p'.$i.'a'};?></div></td>
<td><div align="right"><?php echo ${'p'.$i.'b'};?></div></td>
<td><div align="right"><?php echo ${'pp'.$i.'l'};?></div></td>
<td><div align="right"><?php echo ${'pp'.$i.'a'};?></div></td>
<td><div align="right"><?php echo ${'pp'.$i.'b'};?></div></td>
<td><div align="right"><?php echo ${'dp'.$i};?></div></td>
<td><div align="right"><?php echo round(${'CRF'.$i},2);?></div></td>
<td><div align="right"><?php echo $CRde[$i-1];?></div></td>
</tr>
<?php }  //${'CRF'.$i} IF(K33<1,"Level A",IF(K33<1.5,"Level B",IF(K33<3,"Level C","Fail")))
 $avg29=0;
 for ( $i = 1; $i <= 29; $i += 1) {
 $avg29=${'dp'.$i}+$avg29;
}
$avg29=($CRde[26]+$CRde[27])/2;
if ((($CRde[26]+$CRde[27])/2)<3) {$pass="Pass";}
else {$pass="Fail";}

if ($avg29<1) {$level="Level A";}
elseif ($avg29<1.5) {$level="Level B";}
elseif ($avg29<3) {$level="Level C";}
else {$level="Fail";}
?>
<tr>
<td><td><td><td><td><td><td><td>
<td>0.95</td>
<td><?php echo round(($CRde[26]+$CRde[27])/2,2);?></td>
</tr>
<tr>
<td><td><td><td><td><td><td>
<td>Pass/Fail</td>
<td><?php echo $pass;?></td>
<td><?php echo $level;?></td>
</table>
<hr size="5"> 
<p>TR016(2012)<p>

<?php 
  $Tsum=(($sum/260)*60)+(($psum/20)*40);
  $Rsum=round($Tsum,2);
  if (($check==0) && ($sid==0)){
	$passbit=1;}
  
  $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!");

		// generate and execute query
		$query = "INSERT INTO PSATR16(company, contact, email, type, filename,fileP, score, passbit, date, device, dsn, printer, paper, ink, rankbit) VALUES('$company', '$contact', '$email', '$type', '$filename','$fileP','$Rsum', '$passbit', NOW(), '$device', '$dsn', '$printer', '$paper', '$ink', '$rankbit')";
		
		//echo $query;
		$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
		
		sleep(1);
		
		$queryID="select id from PSATR16 ORDER BY id DESC limit 0,1";
		$resultID = mysql_query($queryID) or die ("Error in query: $query. " . mysql_error());
		while ($row=mysql_fetch_object($resultID))
		{
		$imgID=$row->id;
		}
		
  
		mysql_close($connection);
}} ?>





<table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
$scatterN="./image/".$imgID."-scatter.png";
//unlink('scatter00.png');
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_scatter.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 



$datax = $range00;
$datax2 = $range76;
$datax3 = $CRde;

  for ( $i = 1; $i <= 1617; $i += 1) {
  ${'CR00'.$i}=${'CR00'.($i-1)}+(1/1617);
  }
  
  
$CR00 = array() ;
 for ($s=0; $s <= 1616; $s += 1) {
$CR00[$s] = ${'CR00'.$s};
}

$datay = $CR00;

$CRFa = array() ;
 for ($s=0; $s <= 28; $s += 1) {
$CRFa[$s] = ${'CRF'.$s};
}

$datay2 = $CRFa;





$graph = new Graph(600,500);
$graph->SetScale("linlin");

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

$graph->title->Set("CRF de00 plot");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
//$graph->legend->SetFillColor("white");


$sp1 = new ScatterPlot($datay,$datax);
$sp2 = new ScatterPlot($datay,$datax2);
$sp3 = new ScatterPlot($datay2,$datax3);

$sp1->mark->SetType(MARK_X);


$sp2->mark->SetType(MARK_STAR);
$sp2->mark->SetColor('#999999');

$sp3->mark->SetType(MARK_DIAMOND);
$sp3->mark->SetColor('blue'); 

$sline = new PlotLine(HORIZONTAL,0.95,'red',1.1); 
$sline->SetLineStyle('dashed');

$sline2 = new PlotLine(VERTICAL,$sc0095,'red',1.1); 
$sline2->SetLineStyle('dashed');

$graph->Add($sp1);
$graph->Add($sp2);
$graph->Add($sp3);
$graph->Add($sline);
$graph->Add($sline2);

$sp1->SetLegend("dE00");
$sp2->SetLegend("dE*ab");
$sp3->SetLegend("Within-Sheet aspect");


$graph->Stroke($scatterN);

?>
<img src=<?php echo $scatterN;?>>
</div></td>
</tr>
</table>
<p>&nbsp;</p>
<table border="1" align="center" cellpadding="0" cellspacing="0">
  <col width="88" span="11" />
  <tr>
   <td colspan = "3">System capability CGATS 2012</td>
  
  <td><td><td><td><td><td><td><td><td>
  </tr>
  
  <tr>
    <td width="88">Tol. ∆E00</td>
    <td width="88">95%tile</td>
    <td width="88" bgcolor="#0099FF">100C</td>
    <td width="88" bgcolor="#CC66FF">100M</td>
    <td width="88" bgcolor="#FFFF33">100Y</td>
    <td width="88" bgcolor="#666666">100K</td>
    <td width="88" bgcolor="#00FFFF">50C</td>
    <td width="88" bgcolor="#FFCCFF">50M</td>
    <td width="88" bgcolor="#FFFF99">50Y</td>
    <td width="88" bgcolor="#CCCCCC">50K</td>
    <td width="88" bgcolor="#999999">50C40M40Y</td>
  </tr>
  <tr>
    <td>Level A</td>
    <td bgcolor="#008000">3.0</td>
    <td bgcolor="#008000">1.5</td>
    <td bgcolor="#008000">1.5</td>
    <td bgcolor="#008000">1.5</td>
    <td bgcolor="#008000">2.4</td>
    <td bgcolor="#008000">1.5</td>
    <td bgcolor="#008000">1.5</td>
    <td bgcolor="#008000">1.5</td>
    <td bgcolor="#008000">1.5</td>
    <td bgcolor="#008000">3.0</td>
  </tr>
  <tr>
    <td>Level B</td>
    <td bgcolor="#75923c">4.0</td>
    <td bgcolor="#75923c">2.4</td>
    <td bgcolor="#75923c">2.4</td>
    <td bgcolor="#75923c">2.4</td>
    <td bgcolor="#75923c">3.6</td>
    <td bgcolor="#75923c">2.0</td>
    <td bgcolor="#75923c">2.0</td>
    <td bgcolor="#75923c">2.0</td>
    <td bgcolor="#75923c">2.0</td>
    <td bgcolor="#75923c">3.5</td>
  </tr>
  <tr>
    <td>Level C</td>
    <td bgcolor="#d7e4bc">5.0</td>
    <td bgcolor="#d7e4bc">4.0</td>
    <td bgcolor="#d7e4bc">4.0</td>
    <td bgcolor="#d7e4bc">4.0</td>
    <td bgcolor="#d7e4bc">6.0</td>
    <td bgcolor="#d7e4bc">2.5</td>
    <td bgcolor="#d7e4bc">2.5</td>
    <td bgcolor="#d7e4bc">2.5</td>
    <td bgcolor="#d7e4bc">2.5</td>
    <td bgcolor="#d7e4bc">6.0</td>
  </tr>

  <tr>
    <td>∆E00</td>
    <?php 
	if ($sc0095<3.05) { 
	echo '<td bgcolor="#008000">';}
	elseif ($sc0095<4.05) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($sc0095<5.05) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo $sc0095;?></td>
	
       <?php 
	if ($dc00<1.55) { 
	echo '<td bgcolor="#008000">';}
	elseif ($dc00<2.45) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($dc00<4.05) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($dc00,2);?></td>
        <?php 
	if ($dm00<1.55) { 
	echo '<td bgcolor="#008000">';}
	elseif ($dm00<2.45) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($dm00<4.05) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($dm00,2);?></td>
        <?php 
	if ($dy00<1.55) { 
	echo '<td bgcolor="#008000">';}
	elseif ($dy00<2.45) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($dy00<4.05) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($dy00,2);?></td>
        <?php 
	if ($dk00<2.45) { 
	echo '<td bgcolor="#008000">';}
	elseif ($dk00<3.65) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($dk00<6.05) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($dk00,2);?></td>
        <?php 
	if ($dc50<1.55) { 
	echo '<td bgcolor="#008000">';}
	elseif ($dc50<2.05) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($dc50<2.55) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($dc50,2);?></td>
        <?php 
	if ($dm50<1.55) { 
	echo '<td bgcolor="#008000">';}
	elseif ($dm50<2.05) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($dm50<2.55) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($dm50,2);?></td>
        <?php 
	if ($dy50<1.55) { 
	echo '<td bgcolor="#008000">';}
	elseif ($dy50<2.05) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($dy50<2.55) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($dy50,2);?></td>
        <?php 
	if ($dk50<1.55) { 
	echo '<td bgcolor="#008000">';}
	elseif ($dk50<2.05) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($dk50<2.55) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($dk50,2);?></td>
        <?php 
	if ($dcmy<3.05) { 
	echo '<td bgcolor="#008000">';}
	elseif ($dcmy<3.55) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($dcmy<5.05) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($dcmy,2);?></td>
  </tr>
  <tr>
    <td>Level</td>
    <?php 
	if ($sc0095<3.05) { 
	echo '<td>A</td>';}
	elseif ($sc0095<4.05) { 
	echo '<td>B</td>';}
	elseif ($sc0095<5.05) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';}

	if ($dc00<1.55) { 
	echo '<td>A</td>';}
	elseif ($dc00<2.45) { 
	echo '<td>B</td>';}
	elseif ($dc00<4.05) { 
	echo '<td>C</td>';}
	else {'<td>F</td>';}

       
	if ($dm00<1.5) { 
	echo '<td>A</td>';}
	elseif ($dm00<2.45) { 
	echo '<td>B</td>';}
	elseif ($dm00<4.05) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';}
	
	if ($dy00<1.55) { 
	echo '<td>A</td>';}
	elseif ($dy00<2.45) { 
	echo '<td>B</td>';}
	elseif ($dy00<4.05) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';}
	
	if ($dk00<2.45) { 
	echo '<td>A</td>';}
	elseif ($dk00<3.65) { 
	echo '<td>B</td>';}
	elseif ($dk00<6.05) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';}
	
	if ($dc50<1.55) { 
	echo '<td>A</td>';}
	elseif ($dc50<2.05) { 
	echo '<td>B</td>';}
	elseif ($dc50<2.55) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';}
	
	if ($dm50<1.55) { 
	echo '<td>A</td>';}
	elseif ($dm50<2.05) { 
	echo '<td>B</td>';}
	elseif ($dm50<2.55) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';}
	
	if ($dy50<1.55) { 
	echo '<td>A</td>';}
	elseif ($dy50<2.05) { 
	echo '<td>B</td>';}
	elseif ($dy50<2.55) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';}
	
	if ($dk50<1.55) { 
	echo '<td>A</td>';}
	elseif ($dk50<2.05) { 
	echo '<td>B</td>';}
	elseif ($dk50<2.55) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';}
	
	if ($dcmy<3.05) { 
	echo '<td>A</td>';}
	elseif ($dcmy<3.55) { 
	echo '<td>B</td>';}
	elseif ($dcmy<5.05) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';}
	?>
  </tr>
  <tr>
    <td>Score</td>
   <?php 
	if ($sc0095<3.05) { 
	$sc0095S=3;echo '<td>3</td>';}
	elseif ($sc0095<4.05) { 
	$sc0095S=2;echo '<td>2</td>';}
	elseif ($sc0095<5.05) { 
	$sc0095S=1;echo '<td>1</td>';}
	else {$sc0095S=0;echo '<td>0</td>';}

	if ($dc00<1.55) { 
	$dc00S=3;echo '<td>3</td>';}
	elseif ($dc00<2.45) { 
	$dc00S=2;echo '<td>2</td>';}
	elseif ($dc00<4.05) { 
	$dc00S=1;echo '<td>1</td>';}
	else {$dc00S=0;echo '<td>0</td>';}

       
	if ($dm00<1.55) { 
	$dm00S=3;echo '<td>3</td>';}
	elseif ($dm00<2.45) { 
	$dm00S=2;echo '<td>2</td>';}
	elseif ($dm00<4.05) { 
	$dm00S=1;echo '<td>1</td>';}
	else {$dm00S=0;echo '<td>0</td>';}
	
	if ($dy00<1.55) { 
	$dy00S=3;echo '<td>3</td>';}
	elseif ($dy00<2.45) { 
	$dy00S=2;echo '<td>2</td>';}
	elseif ($dy00<4.05) { 
	$dy00S=1;echo '<td>1</td>';}
	else {$dy00S=0;echo '<td>0</td>';}
	
	if ($dk00<2.45) { 
	$dk00S=3;echo '<td>3</td>';}
	elseif ($dk00<3.65) { 
	$dk00S=2;echo '<td>2</td>';}
	elseif ($dk00<6.05) { 
	$dk00S=1;echo '<td>1</td>';}
	else {$dk00S=0;echo '<td>0</td>';}
	
	if ($dc50<1.55) { 
	$dc50S=3;echo '<td>3</td>';}
	elseif ($dc50<2.05) { 
	$dc50S=2;echo '<td>2</td>';}
	elseif ($dc50<2.55) { 
	$dc50S=1;echo '<td>1</td>';}
	else {$dc50S=0;echo '<td>0</td>';}
	
	if ($dm50<1.55) { 
	$dm50S=3;echo '<td>3</td>';}
	elseif ($dm50<2.05) { 
	$dm50S=2;echo '<td>2</td>';}
	elseif ($dm50<2.55) { 
	$dm50S=1;echo '<td>1</td>';}
	else {$dm50S=0;echo '<td>0</td>';}
	
	if ($dy50<1.55) { 
	$dy50S=3;echo '<td>3</td>';}
	elseif ($dy50<2.05) { 
	$dy50S=2;echo '<td>2</td>';}
	elseif ($dy50<2.55) { 
	$dy50S=1;echo '<td>1</td>';}
	else {$dy50S=0;echo '<td>0</td>';}
	
	if ($dk50<1.55) { 
	$dk50S=3;echo '<td>3</td>';}
	elseif ($dk50<2.05) { 
	$dk50S=2;echo '<td>2</td>';}
	elseif ($dk50<2.55) { 
	$dk50S=1;echo '<td>1</td>';}
	else {$dk50S=0;echo '<td>0</td>';}
	
	if ($dcmy<3.05) { 
	$dcmyS=3;echo '<td>3</td>';}
	elseif ($dcmy<3.55) { 
	$dcmyS=2;echo '<td>2</td>';}
	elseif ($dcmy<5.05) { 
	$dcmyS=1;echo '<td>1</td>';}
	else {$dcmyS=0;echo '<td>0</td>';}
	?>
  </tr>
</table>
<br>

<table border="1" align="center" cellpadding="0" cellspacing="0">
  <col width="88" span="2" />
  <tr>
 <td colspan = "2">Within-sheet aspect</td>
  
  </tr>
  <tr>
    <td width="88">Tol. ∆E00</td>
    <td width="88">95%tile</td>
</tr>
<tr>
	<td>Level A</td>
    <td bgcolor="#008000">1.0</td>
</tr>
 <tr>
    <td>Level B</td>
    <td bgcolor="#75923c">1.5</td>
	</tr>
	 <tr>
    <td>Level C</td>
    <td bgcolor="#d7e4bc">3.0</td>
	</tr>
<tr>
    <td>∆E00</td>
    <?php 
	$WS=($CRde[26]+$CRde[27])/2;
	if ($WS<1.05) { 
	echo '<td bgcolor="#008000">';}
	elseif ($WS<1.55) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($WS<3.05) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($WS,2);?></td>
</tr>

<tr>
    <td>Level</td>
    <?php 
	$WS=($CRde[26]+$CRde[27])/2;
	if ($WS<1.05) { 
	$WSS=3;echo '<td>A</td>';}
	elseif ($WS<1.55) { 
	$WSS=2;echo'<td>B</td>';}
	elseif ($WS<3.05) { 
	$WSS=1;echo '<td>C</td>';}
	else {$WSS=0;echo'<td>F</td>';}
	?>
</tr>
<tr>
    <td>Score</td>
    <?php 
	$WS=($CRde[26]+$CRde[27])/2;
	if ($WS<1.05) { 
	$WSS=3;echo '<td>3</td>';}
	elseif ($WS<1.55) { 
	$WSS=2;echo'<td>2</td>';}
	elseif ($WS<3.05) { 
	$WSS=1;echo '<td>1</td>';}
	else {$WSS=0;echo'<td>0</td>';}
	?>
</tr>

</table>	

<hr size="5"> 
<p>TR016(2012) Production<p>



<?php

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

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

  if ($_FILES["fileP"]["error"] > 0)
    {
    echo "Return Code: " . $_FILES["fileP"]["error"] . "<br />";
    }
  else
    {
	echo "<br>CRPC6 Production! (for Type 1 paper, white backing)" .  "<br />";
    echo "Upload: " . $_FILES["fileP"]["name"] . "<br />";
	$fileP=$dStr.$_FILES["fileP"]["name"];
    //echo "Type: " . $_FILES["fileP"]["type"] . "<br />";
    echo "Size: " . ($_FILES["fileP"]["size"] / 1024) . " Kb<br />";
   // echo "Temp fileP: " . $_FILES["fileP"]["tmp_name"] . "<br />";

    if (file_exists("upload/" .$dStr. $_FILES["fileP"]["name"]))
      {
      echo $_FILES["fileP"]["name"] . " already exists. ". "<br />";
      }
    else
      { 
	  
	  
	   move_uploaded_file($_FILES["fileP"]["tmp_name"],
      "upload/" .$dStr. $_FILES["fileP"]["name"]);
	   echo "upload sucess! " .  "<br />";
	  
	   echo "Report start: " .  "<br />";
     // echo "Stored in: " . "upload/" . $_FILES["fileP"]["name"]. "<br />";
	  
	  ///parsing start
	  
	  $contents = file("upload/".$dStr.$_FILES["fileP"]["name"]);
		$stringC = implode($contents);
		
		$fMark = strrpos($stringC,'i1Profiler');
		//echo "fMark:".$fMark."<br>";
		$fMarkC = strrpos($stringC,'ColorPort');
		//echo "fMarkC:".$fMarkC."<br>";
		
if ($fMark>0) { /////////////////////////////////////////////////////////////////////////////////////////// i1 profiler  go 572
		 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'BEGIN_DATA_FORMAT');
//echo "cols:".$cols."_zz<br>";
		//echo $contents[20]; 
		//echo $stringC; 
$string = implode($contents);		
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", ',', $p);
//echo $p;



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

$dot = explode("\t", $datastring);
//print_r ($dot);
echo "<br>";



$Pdot=0; //paper
//echo "take:".$dot[6+$cols*$Pdot];


$PX=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]);

$PY=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]);

$PZ=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]);


//echo "take PX:".$PX."_Y:".$PY."_Z:".$PZ;

$PL=xyz2lab01("l",$PX,$PY,$PZ);
$Pa=xyz2lab01("a",$PX,$PY,$PZ);
$Pb=xyz2lab01("b",$PX,$PY,$PZ);

//$depaper=sqrt(pow((95-$PL),2)+ pow((1-$Pa),2)+pow(((4)-$Pb),2));
echo "CRPC6 paper: L:95,  a:1,  b:-4<br />";
echo "paper measured: L:".$PL.",  a:".$Pa.",  b:".$Pb.  "<br />";
//echo "CRPC 6 Paper: 95	1	-4,<br> Cyan:56	-37	-50".", Magenta:48	75	-4".", Yellow:89	-4	93".", Black:16	0	0".  "<br />";




$RPCCl=56;$RPCCa=-37;$RPCCb=-50;
$RPCMl=48;$RPCMa=75;$RPCMb=-4;
$RPCYl=89;$RPCYa=-4;$RPCYb=93;
$RPCKl=16;$RPCKa=0.01;$RPCKb=0.01;

$RPCC50l=75.14;$RPCC50a=-16.63;$RPCC50b=-27.88;
$RPCM50l=70.07;$RPCM50a=35.98;$RPCM50b=-7.49;
$RPCY50l=91.49;$RPCY50a=-2.75;$RPCY50b=41.34;
$RPCK50l=60.4;$RPCK50a=0.46;$RPCK50b=-2.59;

$RPCgl=57.46;$RPCga=0.38;$RPCgb=-2.03;


$Xp=$PX*100;
$Yp=$PY*100;
$Zp=$PZ*100;
//////////////////////////////////////////////////////////////CCCCCCCC
$RPCCX=lab2xyz("x",$RPCCl,$RPCCa,$RPCCb);
$RPCCY=lab2xyz("y",$RPCCl,$RPCCa,$RPCCb);
$RPCCZ=lab2xyz("z",$RPCCl,$RPCCa,$RPCCb);

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

$scCL=xyz2lab("l",$scCX,$scCY,$scCZ);
$scCa=xyz2lab("a",$scCX,$scCY,$scCZ);
$scCb=xyz2lab("b",$scCX,$scCY,$scCZ);

$RPCC50X=lab2xyz("x",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Y=lab2xyz("y",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Z=lab2xyz("z",$RPCC50l,$RPCC50a,$RPCC50b);

$scC50X=SCCA06("x",$RPCC50X,$Xp);
$scC50Y=SCCA06("y",$RPCC50Y,$Yp);
$scC50Z=SCCA06("z",$RPCC50Z,$Zp);

$scC50L=xyz2lab("l",$scC50X,$scC50Y,$scC50Z);
$scC50a=xyz2lab("a",$scC50X,$scC50Y,$scC50Z);
$scC50b=xyz2lab("b",$scC50X,$scC50Y,$scC50Z);

/////////////////////////////////////////////////////////////
$RPCMX=lab2xyz("x",$RPCMl,$RPCMa,$RPCMb);
$RPCMY=lab2xyz("y",$RPCMl,$RPCMa,$RPCMb);
$RPCMZ=lab2xyz("z",$RPCMl,$RPCMa,$RPCMb);

$scMX=SCCA06("x",$RPCMX,$Xp);
$scMY=SCCA06("y",$RPCMY,$Yp);
$scMZ=SCCA06("z",$RPCMZ,$Zp);

$scML=xyz2lab("l",$scMX,$scMY,$scMZ);
$scMa=xyz2lab("a",$scMX,$scMY,$scMZ);
$scMb=xyz2lab("b",$scMX,$scMY,$scMZ);

$RPCM50X=lab2xyz("x",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Y=lab2xyz("y",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Z=lab2xyz("z",$RPCM50l,$RPCM50a,$RPCM50b);

$scM50X=SCCA06("x",$RPCM50X,$Xp);
$scM50Y=SCCA06("y",$RPCM50Y,$Yp);
$scM50Z=SCCA06("z",$RPCM50Z,$Zp);

$scM50L=xyz2lab("l",$scM50X,$scM50Y,$scM50Z);
$scM50a=xyz2lab("a",$scM50X,$scM50Y,$scM50Z);
$scM50b=xyz2lab("b",$scM50X,$scM50Y,$scM50Z);
////////////////////////////////////////////////////////////////
$RPCYX=lab2xyz("x",$RPCYl,$RPCYa,$RPCYb);
$RPCYY=lab2xyz("y",$RPCYl,$RPCYa,$RPCYb);
$RPCYZ=lab2xyz("z",$RPCYl,$RPCYa,$RPCYb);

$scYX=SCCA06("x",$RPCYX,$Xp);
$scYY=SCCA06("y",$RPCYY,$Yp);
$scYZ=SCCA06("z",$RPCYZ,$Zp);

$scYL=xyz2lab("l",$scYX,$scYY,$scYZ);
$scYa=xyz2lab("a",$scYX,$scYY,$scYZ);
$scYb=xyz2lab("b",$scYX,$scYY,$scYZ);

$RPCY50X=lab2xyz("x",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Y=lab2xyz("y",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Z=lab2xyz("z",$RPCY50l,$RPCY50a,$RPCY50b);

$scY50X=SCCA06("x",$RPCY50X,$Xp);
$scY50Y=SCCA06("y",$RPCY50Y,$Yp);
$scY50Z=SCCA06("z",$RPCY50Z,$Zp);

$scY50L=xyz2lab("l",$scY50X,$scY50Y,$scY50Z);
$scY50a=xyz2lab("a",$scY50X,$scY50Y,$scY50Z);
$scY50b=xyz2lab("b",$scY50X,$scY50Y,$scY50Z);
////////////////////////////////////////////////////////////////////
$RPCKX=lab2xyz("x",$RPCKl,$RPCKa,$RPCKb);
$RPCKY=lab2xyz("y",$RPCKl,$RPCKa,$RPCKb);
$RPCKZ=lab2xyz("z",$RPCKl,$RPCKa,$RPCKb);

$scKX=SCCA06("x",$RPCKX,$Xp);
$scKY=SCCA06("y",$RPCKY,$Yp);
$scKZ=SCCA06("z",$RPCKZ,$Zp);

$scKL=xyz2lab("l",$scKX,$scKY,$scKZ);
$scKa=xyz2lab("a",$scKX,$scKY,$scKZ);
$scKb=xyz2lab("b",$scKX,$scKY,$scKZ);

$RPCK50X=lab2xyz("x",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Y=lab2xyz("y",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Z=lab2xyz("z",$RPCK50l,$RPCK50a,$RPCK50b);

$scK50X=SCCA06("x",$RPCK50X,$Xp);
$scK50Y=SCCA06("y",$RPCK50Y,$Yp);
$scK50Z=SCCA06("z",$RPCK50Z,$Zp);

$scK50L=xyz2lab("l",$scK50X,$scK50Y,$scK50Z);
$scK50a=xyz2lab("a",$scK50X,$scK50Y,$scK50Z);
$scK50b=xyz2lab("b",$scK50X,$scK50Y,$scK50Z);
/////////////////////////////////////////////////////gray
$RPCgX=lab2xyz("x",$RPCgl,$RPCga,$RPCgb);
$RPCgY=lab2xyz("y",$RPCgl,$RPCga,$RPCgb);
$RPCgZ=lab2xyz("z",$RPCgl,$RPCga,$RPCgb);

$scgX=SCCA06("x",$RPCgX,$Xp);
$scgY=SCCA06("y",$RPCgY,$Yp);
$scgZ=SCCA06("z",$RPCgZ,$Zp);

$scgL=xyz2lab("l",$scgX,$scgY,$scgZ);
$scga=xyz2lab("a",$scgX,$scgY,$scgZ);
$scgb=xyz2lab("b",$scgX,$scgY,$scgZ);

//echo "CRPC 6 SCCA <br> Cyan L:".round($scCL,2)."  a:".round($scCa,2)."  b:".round($scCb,2)."<br>Magenta L:".round($scML,2)."  a:".round($scMa,2)."  b:".round($scMb,2)."<br>Yellow L:".round($scYL,2)."  a:".round($scYa,2)."  b:".round($scYb,2)."<br>Black L:".round($scKL,2)."  a:".round($scKa,2)."  b:".round($scKb,2).  "<br />";


 
//////////////////////////////mc///////////////////////////////////////////////////////////
	 for ($s=1; $s<=20; $s+=1) {///////
	$Pdot=4+10*($s-1);
	//$Pdot=4;////////////////////////////////K100
 	${'mk'.$s.'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]);
	
	${'mk'.$s.'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]);
	
	${'mk'.$s.'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]);
 
	${'mk'.$s.'l'}=xyz2lab01("l",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	${'mk'.$s.'a'}=xyz2lab01("a",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	${'mk'.$s.'b'}=xyz2lab01("b",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	
	${'mk'.$s.'D'}=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]);
	
		$Pdot=8+10*($s-1);;////////////////////////////K50
 
	//$Pdot=8;////////////////////////////////K50
 	${'mk50'.$s.'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]);
	
	${'mk50'.$s.'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]);
	
	${'mk50'.$s.'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]);
 
	${'mk50'.$s.'l'}=xyz2lab01("l",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	${'mk50'.$s.'a'}=xyz2lab01("a",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	${'mk50'.$s.'b'}=xyz2lab01("b",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	
	${'mk50'.$s.'D'}=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]);
	
	${'TVIk'.$s}=((($PX-0.55*$PZ)-(${'mk50'.$s.'x'}-0.55*${'mk50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mk'.$s.'x'}-0.55*${'mk'.$s.'z'})))*100;
	//echo "tvi;".${'TVIk'.$s}."xx";
	////////////////////////////////sec c
	$Pdot=1+10*($s-1);///////////////////////////////////////////////C100
 	${'mc'.$s.'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]);
	
	${'mc'.$s.'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]);
	
	${'mc'.$s.'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]);
 
	${'mc'.$s.'l'}=xyz2lab01("l",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	${'mc'.$s.'a'}=xyz2lab01("a",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	${'mc'.$s.'b'}=xyz2lab01("b",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	
	${'mc'.$s.'D'}=DensitySp38("C",$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]);
	
		$Pdot=5+10*($s-1);//////////////////////////////////////////////C50
 	${'mc50'.$s.'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]);
	
	${'mc50'.$s.'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]);
	
	${'mc50'.$s.'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]);
 
	${'mc50'.$s.'l'}=xyz2lab01("l",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	${'mc50'.$s.'a'}=xyz2lab01("a",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	${'mc50'.$s.'b'}=xyz2lab01("b",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	
	${'mc50'.$s.'D'}=DensitySp38("C",$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]);
 
	${'TVIc'.$s}=((($PX-0.55*$PZ)-(${'mc50'.$s.'x'}-0.55*${'mc50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mc'.$s.'x'}-0.55*${'mc'.$s.'z'})))*100;

 ///////////////////////////////////////////////////////////////sec M
 $Pdot=2+10*($s-1);////////////////////M100
 	${'mm'.$s.'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]);
	
	${'mm'.$s.'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]);
	
	${'mm'.$s.'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]);
 
	${'mm'.$s.'l'}=xyz2lab01("l",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	${'mm'.$s.'a'}=xyz2lab01("a",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	${'mm'.$s.'b'}=xyz2lab01("b",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	
	${'mm'.$s.'D'}=DensitySp38("M",$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]);
	
	 $Pdot=6+10*($s-1);////////////////////M50
 	${'mm50'.$s.'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]);
	
	${'mm50'.$s.'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]);
	
	${'mm50'.$s.'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]);
 
	${'mm50'.$s.'l'}=xyz2lab01("l",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	${'mm50'.$s.'a'}=xyz2lab01("a",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	${'mm50'.$s.'b'}=xyz2lab01("b",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	
	${'mm50'.$s.'D'}=DensitySp38("M",$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]);
 
	${'TVIm'.$s}=((($PX-0.55*$PZ)-(${'mm50'.$s.'x'}-0.55*${'mm50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mm'.$s.'x'}-0.55*${'mm'.$s.'z'})))*100;
 ////////////////////////////////////sec Y
 $Pdot=3+10*($s-1);///////////////////////////////////////Y100
 	${'my'.$s.'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]);
	
	${'my'.$s.'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]);
	
	${'my'.$s.'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]);
 
	${'my'.$s.'l'}=xyz2lab01("l",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	${'my'.$s.'a'}=xyz2lab01("a",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	${'my'.$s.'b'}=xyz2lab01("b",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	
	${'my'.$s.'D'}=DensitySp38("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]);
	
  $Pdot=7+10*($s-1);///////////////////////////////////////Y50
 		${'my50'.$s.'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]);
	
	${'my50'.$s.'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]);
	
	${'my50'.$s.'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]);
 
	${'my50'.$s.'l'}=xyz2lab01("l",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	${'my50'.$s.'a'}=xyz2lab01("a",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	${'my50'.$s.'b'}=xyz2lab01("b",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	
	${'my50'.$s.'D'}=DensitySp38("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]);
	
	${'TVIy'.$s}=((($PX-0.55*$PZ)-(${'my50'.$s.'x'}-0.55*${'my50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'my'.$s.'x'}-0.55*${'my'.$s.'z'})))*100;
	
	  $Pdot=9+10*($s-1);///////////////////////////////////////Gray
 	${'mg'.$s.'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]);
	
	${'mg'.$s.'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]);
	
	${'mg'.$s.'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]);
 
	${'mg'.$s.'l'}=xyz2lab01("l",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	${'mg'.$s.'a'}=xyz2lab01("a",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	${'mg'.$s.'b'}=xyz2lab01("b",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	
	${'mg'.$s.'D'}=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]);

}///
	
	 $dec=de00($RPCCl,$RPCCa,$RPCCb,$mcl,$mca,$mcb);
	 $dem=de00($RPCMl,$RPCMa,$RPCMb,$mml,$mma,$mmb);
	 $dey=de00($RPCYl,$RPCYa,$RPCYb,$myl,$mya,$myb);
	 $dek=de00($RPCKl,$RPCKa,$RPCKb,$mkl,$mka,$mkb);
	 $dec50=de00($RPCC50l,$RPCC50a,$RPCC50b,$mc50l,$mc50a,$mc50b);
	 $dem50=de00($RPCM50l,$RPCM50a,$RPCM50b,$mm50l,$mm50a,$mm50b);
	 $dey50=de00($RPCY50l,$RPCY50a,$RPCY50b,$my50l,$my50a,$my50b);
	 $dek50=de00($RPCK50l,$RPCK50a,$RPCK50b,$mk50l,$mk50a,$mk50b);
	 $deg=de00($RPCgl,$RPCga,$RPCgb,$mgl,$mga,$mgb);
	
?>


	

  


  <?php
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
	  
if ($fMarkC>0) { ////////////////////////////////////////////////////////////// ColorPort 400
	 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'WEIGHTING_FUNCTION ');
//echo "cols:".$cols."_zz<br>";
		//echo $contents[20]; 
		//echo $stringC; 
$string = implode($contents);		
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", ',', $p);
//echo $p;


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

$dot = explode("\t", $datastring);
//print_r ($dot);
echo "<br>";	  
$Pdot=0;///paper line
//echo "take:".$dot[9+$cols*$Pdot-$Pdot];
          /////380-730 paper
$PX=sp38XYZ("X",$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]);

$PY=sp38XYZ("Y",$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]);

$PZ=sp38XYZ("Z",$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]);



//echo "take PX:".$PX."_Y:".$PY."_Z:".$PZ;



$PL=xyz2lab01("l",$PX,$PY,$PZ);
$Pa=xyz2lab01("a",$PX,$PY,$PZ);
$Pb=xyz2lab01("b",$PX,$PY,$PZ);

//$depaper=sqrt(pow((95-$PL),2)+ pow((1-$Pa),2)+pow(((4)-$Pb),2));
echo "CRPC6 paper: L:95,  a:1,  b:-4<br />";
echo "paper measured: L:".$PL.",  a:".$Pa.",  b:".$Pb.  "<br />";
//echo "CRPC 6 Paper: 95	1	-4,<br> Cyan:56	-37	-50".", Magenta:48	75	-4".", Yellow:89	-4	93".", Black:16	0	0".  "<br />";




$RPCCl=56;$RPCCa=-37;$RPCCb=-50;
$RPCMl=48;$RPCMa=75;$RPCMb=-4;
$RPCYl=89;$RPCYa=-4;$RPCYb=93;
$RPCKl=16;$RPCKa=0.01;$RPCKb=0.01;

$RPCC50l=75.14;$RPCC50a=-16.63;$RPCC50b=-27.88;
$RPCM50l=70.07;$RPCM50a=35.98;$RPCM50b=-7.49;
$RPCY50l=91.49;$RPCY50a=-2.75;$RPCY50b=41.34;
$RPCK50l=60.4;$RPCK50a=0.46;$RPCK50b=-2.59;

$RPCgl=57.46;$RPCga=0.38;$RPCgb=-2.03;



$Xp=$PX*100;
$Yp=$PY*100;
$Zp=$PZ*100;
//////////////////////////////////////////////////////////////
$RPCCX=lab2xyz("x",$RPCCl,$RPCCa,$RPCCb);
$RPCCY=lab2xyz("y",$RPCCl,$RPCCa,$RPCCb);
$RPCCZ=lab2xyz("z",$RPCCl,$RPCCa,$RPCCb);

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

$scCL=xyz2lab("l",$scCX,$scCY,$scCZ);
$scCa=xyz2lab("a",$scCX,$scCY,$scCZ);
$scCb=xyz2lab("b",$scCX,$scCY,$scCZ);

$RPCC50X=lab2xyz("x",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Y=lab2xyz("y",$RPCC50l,$RPCC50a,$RPCC50b);
$RPCC50Z=lab2xyz("z",$RPCC50l,$RPCC50a,$RPCC50b);

$scC50X=SCCA06("x",$RPCC50X,$Xp);
$scC50Y=SCCA06("y",$RPCC50Y,$Yp);
$scC50Z=SCCA06("z",$RPCC50Z,$Zp);

$scC50L=xyz2lab("l",$scC50X,$scC50Y,$scC50Z);
$scC50a=xyz2lab("a",$scC50X,$scC50Y,$scC50Z);
$scC50b=xyz2lab("b",$scC50X,$scC50Y,$scC50Z);

/////////////////////////////////////////////////////////////
$RPCMX=lab2xyz("x",$RPCMl,$RPCMa,$RPCMb);
$RPCMY=lab2xyz("y",$RPCMl,$RPCMa,$RPCMb);
$RPCMZ=lab2xyz("z",$RPCMl,$RPCMa,$RPCMb);

$scMX=SCCA06("x",$RPCMX,$Xp);
$scMY=SCCA06("y",$RPCMY,$Yp);
$scMZ=SCCA06("z",$RPCMZ,$Zp);

$scML=xyz2lab("l",$scMX,$scMY,$scMZ);
$scMa=xyz2lab("a",$scMX,$scMY,$scMZ);
$scMb=xyz2lab("b",$scMX,$scMY,$scMZ);

$RPCM50X=lab2xyz("x",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Y=lab2xyz("y",$RPCM50l,$RPCM50a,$RPCM50b);
$RPCM50Z=lab2xyz("z",$RPCM50l,$RPCM50a,$RPCM50b);

$scM50X=SCCA06("x",$RPCM50X,$Xp);
$scM50Y=SCCA06("y",$RPCM50Y,$Yp);
$scM50Z=SCCA06("z",$RPCM50Z,$Zp);

$scM50L=xyz2lab("l",$scM50X,$scM50Y,$scM50Z);
$scM50a=xyz2lab("a",$scM50X,$scM50Y,$scM50Z);
$scM50b=xyz2lab("b",$scM50X,$scM50Y,$scM50Z);
////////////////////////////////////////////////////////////////
$RPCYX=lab2xyz("x",$RPCYl,$RPCYa,$RPCYb);
$RPCYY=lab2xyz("y",$RPCYl,$RPCYa,$RPCYb);
$RPCYZ=lab2xyz("z",$RPCYl,$RPCYa,$RPCYb);

$scYX=SCCA06("x",$RPCYX,$Xp);
$scYY=SCCA06("y",$RPCYY,$Yp);
$scYZ=SCCA06("z",$RPCYZ,$Zp);

$scYL=xyz2lab("l",$scYX,$scYY,$scYZ);
$scYa=xyz2lab("a",$scYX,$scYY,$scYZ);
$scYb=xyz2lab("b",$scYX,$scYY,$scYZ);

$RPCY50X=lab2xyz("x",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Y=lab2xyz("y",$RPCY50l,$RPCY50a,$RPCY50b);
$RPCY50Z=lab2xyz("z",$RPCY50l,$RPCY50a,$RPCY50b);

$scY50X=SCCA06("x",$RPCY50X,$Xp);
$scY50Y=SCCA06("y",$RPCY50Y,$Yp);
$scY50Z=SCCA06("z",$RPCY50Z,$Zp);

$scY50L=xyz2lab("l",$scY50X,$scY50Y,$scY50Z);
$scY50a=xyz2lab("a",$scY50X,$scY50Y,$scY50Z);
$scY50b=xyz2lab("b",$scY50X,$scY50Y,$scY50Z);
////////////////////////////////////////////////////////////////////
$RPCKX=lab2xyz("x",$RPCKl,$RPCKa,$RPCKb);
$RPCKY=lab2xyz("y",$RPCKl,$RPCKa,$RPCKb);
$RPCKZ=lab2xyz("z",$RPCKl,$RPCKa,$RPCKb);

$scKX=SCCA06("x",$RPCKX,$Xp);
$scKY=SCCA06("y",$RPCKY,$Yp);
$scKZ=SCCA06("z",$RPCKZ,$Zp);

$scKL=xyz2lab("l",$scKX,$scKY,$scKZ);
$scKa=xyz2lab("a",$scKX,$scKY,$scKZ);
$scKb=xyz2lab("b",$scKX,$scKY,$scKZ);

$RPCK50X=lab2xyz("x",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Y=lab2xyz("y",$RPCK50l,$RPCK50a,$RPCK50b);
$RPCK50Z=lab2xyz("z",$RPCK50l,$RPCK50a,$RPCK50b);

$scK50X=SCCA06("x",$RPCK50X,$Xp);
$scK50Y=SCCA06("y",$RPCK50Y,$Yp);
$scK50Z=SCCA06("z",$RPCK50Z,$Zp);

$scK50L=xyz2lab("l",$scK50X,$scK50Y,$scK50Z);
$scK50a=xyz2lab("a",$scK50X,$scK50Y,$scK50Z);
$scK50b=xyz2lab("b",$scK50X,$scK50Y,$scK50Z);
/////////////////////////////////////////////////////gray
$RPCgX=lab2xyz("x",$RPCgl,$RPCga,$RPCgb);
$RPCgY=lab2xyz("y",$RPCgl,$RPCga,$RPCgb);
$RPCgZ=lab2xyz("z",$RPCgl,$RPCga,$RPCgb);

$scgX=SCCA06("x",$RPCgX,$Xp);
$scgY=SCCA06("y",$RPCgY,$Yp);
$scgZ=SCCA06("z",$RPCgZ,$Zp);

$scgL=xyz2lab("l",$scgX,$scgY,$scgZ);
$scga=xyz2lab("a",$scgX,$scgY,$scgZ);
$scgb=xyz2lab("b",$scgX,$scgY,$scgZ);

echo "CRPC 6 SCCA <br> Cyan L:".round($scCL,2)."  a:".round($scCa,2)."  b:".round($scCb,2)."<br>Magenta L:".round($scML,2)."  a:".round($scMa,2)."  b:".round($scMb,2)."<br>Yellow L:".round($scYL,2)."  a:".round($scYa,2)."  b:".round($scYb,2)."<br>Black L:".round($scKL,2)."  a:".round($scKa,2)."  b:".round($scKb,2).  "<br />";
?>

	<p><p>

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

 for ($s=1; $s<=20; $s+=1) {///////
	$Pdot=4+10*($s-1);
	//$Pdot=4;////////////////////////////////K100
 	${'mk'.$s.'x'}=sp38XYZ("X",$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]);
	
	${'mk'.$s.'y'}=sp38XYZ("Y",$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]);
	
	${'mk'.$s.'z'}=sp38XYZ("Z",$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]);
 
	${'mk'.$s.'l'}=xyz2lab01("l",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	${'mk'.$s.'a'}=xyz2lab01("a",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	${'mk'.$s.'b'}=xyz2lab01("b",${'mk'.$s.'x'},${'mk'.$s.'y'},${'mk'.$s.'z'});
	
	${'mk'.$s.'D'}=DensitySp38("K",$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]);
	
		$Pdot=8+10*($s-1);;////////////////////////////K50
 
	//$Pdot=8;////////////////////////////////K50
 	${'mk50'.$s.'x'}=sp38XYZ("X",$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]);
	
	${'mk50'.$s.'y'}=sp38XYZ("Y",$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]);
	
	${'mk50'.$s.'z'}=sp38XYZ("Z",$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]);
 
	${'mk50'.$s.'l'}=xyz2lab01("l",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	${'mk50'.$s.'a'}=xyz2lab01("a",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	${'mk50'.$s.'b'}=xyz2lab01("b",${'mk50'.$s.'x'},${'mk50'.$s.'y'},${'mk50'.$s.'z'});
	
	${'mk50'.$s.'D'}=DensitySp38("K",$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]);
	
	${'TVIk'.$s}=((($PX-0.55*$PZ)-(${'mk50'.$s.'x'}-0.55*${'mk50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mk'.$s.'x'}-0.55*${'mk'.$s.'z'})))*100;
	//echo "tvi;".${'TVIk'.$s}."xx";
	////////////////////////////////sec c
	$Pdot=1+10*($s-1);///////////////////////////////////////////////C100
 	${'mc'.$s.'x'}=sp38XYZ("X",$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]);
	
	${'mc'.$s.'y'}=sp38XYZ("Y",$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]);
	
	${'mc'.$s.'z'}=sp38XYZ("Z",$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]);
 
	${'mc'.$s.'l'}=xyz2lab01("l",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	${'mc'.$s.'a'}=xyz2lab01("a",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	${'mc'.$s.'b'}=xyz2lab01("b",${'mc'.$s.'x'},${'mc'.$s.'y'},${'mc'.$s.'z'});
	
	${'mc'.$s.'D'}=DensitySp38("C",$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]);
	
		$Pdot=5+10*($s-1);//////////////////////////////////////////////C50
 	${'mc50'.$s.'x'}=sp38XYZ("X",$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]);
	
	${'mc50'.$s.'y'}=sp38XYZ("Y",$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]);
	
	${'mc50'.$s.'z'}=sp38XYZ("Z",$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]);
 
	${'mc50'.$s.'l'}=xyz2lab01("l",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	${'mc50'.$s.'a'}=xyz2lab01("a",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	${'mc50'.$s.'b'}=xyz2lab01("b",${'mc50'.$s.'x'},${'mc50'.$s.'y'},${'mc50'.$s.'z'});
	
	${'mc50'.$s.'D'}=DensitySp38("C",$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]);
 
	${'TVIc'.$s}=((($PX-0.55*$PZ)-(${'mc50'.$s.'x'}-0.55*${'mc50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mc'.$s.'x'}-0.55*${'mc'.$s.'z'})))*100;

 ///////////////////////////////////////////////////////////////sec M
 $Pdot=2+10*($s-1);////////////////////M100
 	${'mm'.$s.'x'}=sp38XYZ("X",$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]);
	
	${'mm'.$s.'y'}=sp38XYZ("Y",$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]);
	
	${'mm'.$s.'z'}=sp38XYZ("Z",$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]);
 
	${'mm'.$s.'l'}=xyz2lab01("l",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	${'mm'.$s.'a'}=xyz2lab01("a",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	${'mm'.$s.'b'}=xyz2lab01("b",${'mm'.$s.'x'},${'mm'.$s.'y'},${'mm'.$s.'z'});
	
	${'mm'.$s.'D'}=DensitySp38("M",$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]);
	
	 $Pdot=6+10*($s-1);////////////////////M50
 	${'mm50'.$s.'x'}=sp38XYZ("X",$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]);
	
	${'mm50'.$s.'y'}=sp38XYZ("Y",$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]);
	
	${'mm50'.$s.'z'}=sp38XYZ("Z",$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]);
 
	${'mm50'.$s.'l'}=xyz2lab01("l",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	${'mm50'.$s.'a'}=xyz2lab01("a",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	${'mm50'.$s.'b'}=xyz2lab01("b",${'mm50'.$s.'x'},${'mm50'.$s.'y'},${'mm50'.$s.'z'});
	
	${'mm50'.$s.'D'}=DensitySp38("M",$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]);
 
	${'TVIm'.$s}=((($PX-0.55*$PZ)-(${'mm50'.$s.'x'}-0.55*${'mm50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'mm'.$s.'x'}-0.55*${'mm'.$s.'z'})))*100;
 ////////////////////////////////////sec Y
 $Pdot=3+10*($s-1);///////////////////////////////////////Y100
 	${'my'.$s.'x'}=sp38XYZ("X",$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]);
	
	${'my'.$s.'y'}=sp38XYZ("Y",$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]);
	
	${'my'.$s.'z'}=sp38XYZ("Z",$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]);
 
	${'my'.$s.'l'}=xyz2lab01("l",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	${'my'.$s.'a'}=xyz2lab01("a",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	${'my'.$s.'b'}=xyz2lab01("b",${'my'.$s.'x'},${'my'.$s.'y'},${'my'.$s.'z'});
	
	${'my'.$s.'D'}=DensitySp38("Y",$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]);
	
  $Pdot=7+10*($s-1);///////////////////////////////////////Y50
 		${'my50'.$s.'x'}=sp38XYZ("X",$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]);
	
	${'my50'.$s.'y'}=sp38XYZ("Y",$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]);
	
	${'my50'.$s.'z'}=sp38XYZ("Z",$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]);
 
	${'my50'.$s.'l'}=xyz2lab01("l",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	${'my50'.$s.'a'}=xyz2lab01("a",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	${'my50'.$s.'b'}=xyz2lab01("b",${'my50'.$s.'x'},${'my50'.$s.'y'},${'my50'.$s.'z'});
	
	${'my50'.$s.'D'}=DensitySp38("Y",$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]);
	
	${'TVIy'.$s}=((($PX-0.55*$PZ)-(${'my50'.$s.'x'}-0.55*${'my50'.$s.'z'}))/(($PX-0.55*$PZ)-(${'my'.$s.'x'}-0.55*${'my'.$s.'z'})))*100;
	
	  $Pdot=9+10*($s-1);///////////////////////////////////////Gray
 	${'mg'.$s.'x'}=sp38XYZ("X",$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]);
	
	${'mg'.$s.'y'}=sp38XYZ("Y",$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]);
	
	${'mg'.$s.'z'}=sp38XYZ("Z",$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]);
 
	${'mg'.$s.'l'}=xyz2lab01("l",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	${'mg'.$s.'a'}=xyz2lab01("a",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	${'mg'.$s.'b'}=xyz2lab01("b",${'mg'.$s.'x'},${'mg'.$s.'y'},${'mg'.$s.'z'});
	
	${'mg'.$s.'D'}=DensitySp38("K",$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]);

}/////////////400 for loop
}////////////////////////////fMark ColorPort

	 $dec=de00($RPCCl,$RPCCa,$RPCCb,$mcl,$mca,$mcb);
	 $dem=de00($RPCMl,$RPCMa,$RPCMb,$mml,$mma,$mmb);
	 $dey=de00($RPCYl,$RPCYa,$RPCYb,$myl,$mya,$myb);
	 $dek=de00($RPCKl,$RPCKa,$RPCKb,$mkl,$mka,$mkb);
	 $dec50=de00($RPCC50l,$RPCC50a,$RPCC50b,$mc50l,$mc50a,$mc50b);
	 $dem50=de00($RPCM50l,$RPCM50a,$RPCM50b,$mm50l,$mm50a,$mm50b);
	 $dey50=de00($RPCY50l,$RPCY50a,$RPCY50b,$my50l,$my50a,$my50b);
	 $dek50=de00($RPCK50l,$RPCK50a,$RPCK50b,$mk50l,$mk50a,$mk50b);
	 $deg=de00($RPCgl,$RPCga,$RPCgb,$mgl,$mga,$mgb);

	 ?>

<p><p>
	<table width="400" border="1" align="center">
  <tr>
	<td>
	<td colspan = "3">Original data</td>

	<td colspan = "3">SCCA data</td>

	</tr>
	<tr>
	<td>Paper</td>
	<td>95</td>
	<td>1</td>
	<td>-4</td>
	<td><?php echo  $PL;?></td>
	<td><?php echo  $Pa;?></td>
	<td><?php echo  $Pb;?></td>
	</tr>
	<tr>
	<td bgcolor="#00FFFF">100C</td>
	<td bgcolor="#00FFFF"><?php echo  $RPCCl;?></td>
	<td bgcolor="#00FFFF"><?php echo  $RPCCa;?></td>
	<td bgcolor="#00FFFF"><?php echo  $RPCCb;?></td>
	<td bgcolor="#00FFFF"><?php echo  round($scCL,2);?></td>
	<td bgcolor="#00FFFF"><?php echo  round($scCa,2);?></td>
	<td bgcolor="#00FFFF"><?php echo  round($scCb,2);?></td>
	</tr>
		<tr>
	<td bgcolor="#FFCCFF">100M</td>
	<td bgcolor="#FFCCFF"><?php echo  $RPCMl;?></td>
	<td bgcolor="#FFCCFF"><?php echo  $RPCMa;?></td>
	<td bgcolor="#FFCCFF"><?php echo  $RPCMb;?></td>
	<td bgcolor="#FFCCFF"><?php echo  round($scML,2);?></td>
	<td bgcolor="#FFCCFF"><?php echo  round($scMa,2);?></td>
	<td bgcolor="#FFCCFF"><?php echo  round($scMb,2);?></td>
	</tr>
	<td bgcolor="#FFFF66">100Y</td>
	<td bgcolor="#FFFF66"><?php echo  $RPCYl;?></td>
	<td bgcolor="#FFFF66"><?php echo  $RPCYa;?></td>
	<td bgcolor="#FFFF66"><?php echo  $RPCYb;?></td>
	<td bgcolor="#FFFF66"><?php echo  round($scYL,2);?></td>
	<td bgcolor="#FFFF66"><?php echo  round($scYa,2);?></td>
	<td bgcolor="#FFFF66"><?php echo  round($scYb,2);?></td>
	</tr>
	<td bgcolor="#BBBBBB">100K</td>
	<td bgcolor="#BBBBBB"><?php echo  $RPCKl;?></td>
	<td bgcolor="#BBBBBB"><?php echo  $RPCKa;?></td>
	<td bgcolor="#BBBBBB"><?php echo  $RPCKb;?></td>
	<td bgcolor="#BBBBBB"><?php echo  round($scKL,2);?></td>
	<td bgcolor="#BBBBBB"><?php echo  round($scKa,2);?></td>
	<td bgcolor="#BBBBBB"><?php echo  round($scKb,2);?></td>
	</tr>
	<td bgcolor="#CCFFFF">50C</td>
	<td bgcolor="#CCFFFF"><?php echo  $RPCC50l;?></td>
	<td bgcolor="#CCFFFF"><?php echo  $RPCC50a;?></td>
	<td bgcolor="#CCFFFF"><?php echo  $RPCC50b;?></td>
	<td bgcolor="#CCFFFF"><?php echo  round($scC50L,2);?></td>
	<td bgcolor="#CCFFFF"><?php echo  round($scC50a,2);?></td>
	<td bgcolor="#CCFFFF"><?php echo  round($scC50b,2);?></td>
	</tr>
		<td bgcolor="#FFDDFF">50M</td>
	<td bgcolor="#FFDDFF"><?php echo  $RPCM50l;?></td>
	<td bgcolor="#FFDDFF"><?php echo  $RPCM50a;?></td>
	<td bgcolor="#FFDDFF"><?php echo  $RPCM50b;?></td>
	<td bgcolor="#FFDDFF"><?php echo  round($scM50L,2);?></td>
	<td bgcolor="#FFDDFF"><?php echo  round($scM50a,2);?></td>
	<td bgcolor="#FFDDFF"><?php echo  round($scM50b,2);?></td>
	</tr>
		<td bgcolor="#FFFFCC">50Y</td>
	<td bgcolor="#FFFFCC"><?php echo  $RPCY50l;?></td>
	<td bgcolor="#FFFFCC"><?php echo  $RPCY50a;?></td>
	<td bgcolor="#FFFFCC"><?php echo  $RPCY50b;?></td>
	<td bgcolor="#FFFFCC"><?php echo  round($scY50L,2);?></td>
	<td bgcolor="#FFFFCC"><?php echo  round($scY50a,2);?></td>
	<td bgcolor="#FFFFCC"><?php echo  round($scY50b,2);?></td>
	</tr>
		<td bgcolor="#DDDDDD">50K</td>
	<td bgcolor="#DDDDDD"><?php echo  $RPCK50l;?></td>
	<td bgcolor="#DDDDDD"><?php echo  $RPCK50a;?></td>
	<td bgcolor="#DDDDDD"><?php echo  $RPCK50b;?></td>
	<td bgcolor="#DDDDDD"><?php echo  round($scK50L,2);?></td>
	<td bgcolor="#DDDDDD"><?php echo  round($scK50a,2);?></td>
	<td bgcolor="#DDDDDD"><?php echo  round($scK50b,2);?></td>
	</tr>
			<td bgcolor="#DDDCCF">504040</td>
	<td bgcolor="#DDDCCF"><?php echo  $RPCgl;?></td>
	<td bgcolor="#DDDCCF"><?php echo  $RPCga;?></td>
	<td bgcolor="#DDDCCF"><?php echo  $RPCgb;?></td>
	<td bgcolor="#DDDCCF"><?php echo  round($scgL,2);?></td>
	<td bgcolor="#DDDCCF"><?php echo  round($scga,2);?></td>
	<td bgcolor="#DDDCCF"><?php echo  round($scgb,2);?></td>
	</tr>

	</table>
	
	
		<p><p>
	
  <p>&nbsp;</p>
  <table border="1" align="center" cellpadding="0" cellspacing="0">
    <col width="87" />
    <col width="83" />
    <col width="71" span="2" />
    <col width="83" />
    <col width="56" />
    <col width="53" />
    <col width="83" />
    <col width="53" />
    <col width="56" />
    <col width="83" />
    <col width="47" span="2" />
    <col width="83" />
    <col width="63" span="2" />
    <col width="83" />
    <col width="56" />
    <col width="63" />
    <col width="83" />
    <col width="47" />
    <col width="49" />
    <col width="83" />
    <col width="47" />
    <col width="53" />
    <col width="83" />
    <col width="41" />
    <col width="47" />
    <tr>
      <td width="87"></td>
      <td colspan = "3" bgcolor="#00CCFF">Reference_C100</td>
<td colspan = "3" bgcolor="#FFCCFF">Reference_M100</td>
<td colspan = "3" bgcolor="#FFFF99">Reference_Y100</td>
<td colspan = "3" bgcolor="#CCCCCC">Reference_K100</td>
 
<td colspan = "3" bgcolor="#00DDFF">Reference_C50</td>
<td colspan = "3" bgcolor="#FFDDFF">Reference_M50</td>
<td colspan = "3" bgcolor="#FFFFDD">Reference_Y50</td>
<td colspan = "3" bgcolor="#CCCCCC">Reference_K50</td>
<td colspan = "3" bgcolor="#CCCCCC">Reference_50/40/40</td>
    </tr>
    <tr>
      <td></td>
      <td bgcolor="#00CCFF"><?php echo  round($scCL,2);?></td>
      <td bgcolor="#00CCFF"><?php echo  round($scCa,2);?></td>
      <td bgcolor="#00CCFF"><?php echo  round($scCb,2);?></td>
      <td bgcolor="#FFCCFF"><?php echo  round($scML,2);?></td>
      <td bgcolor="#FFCCFF"><?php echo  round($scMa,2);?></td>
      <td bgcolor="#FFCCFF"><?php echo  round($scMb,2);?></td>
      <td bgcolor="#FFFF99"><?php echo  round($scYL,2);?></td>
      <td bgcolor="#FFFF99"><?php echo  round($scYa,2);?></td>
      <td bgcolor="#FFFF99"><?php echo  round($scYb,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scKL,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scKa,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scKb,2);?></td>
      <td bgcolor="#00DDFF"><?php echo  round($scC50L,2);?></td>
      <td bgcolor="#00DDFF"><?php echo  round($scC50a,2);?></td>
      <td bgcolor="#00DDFF"><?php echo  round($scC50b,2);?></td>
      <td bgcolor="#FFDDFF"><?php echo  round($scM50L,2);?></td>
      <td bgcolor="#FFDDFF"><?php echo  round($scM50a,2);?></td>
      <td bgcolor="#FFDDFF"><?php echo  round($scM50b,2);?></td>
      <td bgcolor="#FFFFDD"><?php echo  round($scY50L,2);?></td>
      <td bgcolor="#FFFFDD"><?php echo  round($scY50a,2);?></td>
      <td bgcolor="#FFFFDD"><?php echo  round($scY50b,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scK50L,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scK50a,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scK50b,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scgL,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scga,2);?></td>
      <td bgcolor="#CCCCCC"><?php echo  round($scgb,2);?></td>
    </tr>
    <tr>
      <td></td>
<td colspan = "3" bgcolor="#00CCFF">20 samples</td>
<td colspan = "3" bgcolor="#FFCCFF">20 samples</td>
<td colspan = "3" bgcolor="#FFFF99">20 samples</td>
<td colspan = "3" bgcolor="#CCCCCC">20 samples</td>
<td colspan = "3" bgcolor="#00DDFF">20 samples</td>
<td colspan = "3" bgcolor="#FFDDFF">20 samples</td>
<td colspan = "3" bgcolor="#FFFFDD">20 samples</td>
<td colspan = "3" bgcolor="#CCCCCC">20 samples</td>
<td colspan = "3" bgcolor="#CCCCCC">20 samples</td>
    </tr>
    <tr>
      <td>ID</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
      <td>L*</td>
      <td>a*</td>
      <td>b*</td>
    </tr>
    
	<?php 
	for ($s=1; $s<=20; $s+=1) {///////
	?>
	<tr>
      <td><?php echo $s;?></td>
      <td><?php echo  round(${'mc'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mc'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mc'.$s.'b'},2);?></td>
      <td><?php echo  round(${'mm'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mm'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mm'.$s.'b'},2);?></td>
      <td><?php echo  round(${'my'.$s.'l'},2);?></td>
      <td><?php echo  round(${'my'.$s.'a'},2);?></td>
      <td><?php echo  round(${'my'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mk'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mk'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mk'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mc50'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mc50'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mc50'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mm50'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mm50'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mm50'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'my50'.$s.'l'},2);?></td>
      <td><?php echo  round(${'my50'.$s.'a'},2);?></td>
      <td><?php echo  round(${'my50'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mk50'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mk50'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mk50'.$s.'b'},2);?></td>
	  <td><?php echo  round(${'mg'.$s.'l'},2);?></td>
      <td><?php echo  round(${'mg'.$s.'a'},2);?></td>
      <td><?php echo  round(${'mg'.$s.'b'},2);?></td>
	  </tr> 
	  <?php } ?>
      
 </table> 
 <br>
 <table border="1" align="center" cellpadding="1" cellspacing="1">
    <col width="87">
    <col width="83">
    <col width="71" span="2">
    <col width="83">
    <col width="56">
    <col width="53">
    <col width="83">
    <col width="53">
    <col width="56">
    <tr>
      <td width="87">Tol    CIEDE00</td>
      <td width="83" align="center" bgcolor="#00CCFF">C100</td>
      <td width="71" align="center" bgcolor="#FFCCFF">M100</td>
      <td width="71" align="center" bgcolor="#FFFF99">Y100</td>
      <td width="83" align="center" bgcolor="#CCCCCC">K100</td>
      <td width="56" align="center" bgcolor="#00CCFF">C50</td>
      <td width="53" align="center" bgcolor="#FFCCFF">M50</td>
      <td width="83" align="center" bgcolor="#FFFFCC">Y50</td>
      <td width="53" align="center" bgcolor="#CCCCCC">K50</td>
      <td width="56" align="center" bgcolor="#CCCCCC">50/40/40</td>
    </tr>
    <tr>
      <td>Level A</td>
      <td align="right" bgcolor="#00CCFF">1.50</td>
      <td align="right" bgcolor="#FFCCFF">1.50</td>
      <td align="right" bgcolor="#FFFF99">1.50</td>
      <td align="right" bgcolor="#CCCCCC">2.40</td>
      <td align="right" bgcolor="#00CCFF">1.50</td>
      <td align="right" bgcolor="#FFCCFF">1.50</td>
      <td align="right" bgcolor="#FFFFCC">1.50</td>
      <td align="right" bgcolor="#CCCCCC">1.50</td>
      <td align="right" bgcolor="#CCCCCC">3.00</td>
    </tr>
    <tr>
      <td>Level B</td>
      <td align="right" bgcolor="#00CCFF">2.4</td>
      <td align="right" bgcolor="#FFCCFF">2.4</td>
      <td align="right" bgcolor="#FFFF99">2.4</td>
      <td align="right" bgcolor="#CCCCCC">3.6</td>
      <td align="right" bgcolor="#00CCFF">2</td>
      <td align="right" bgcolor="#FFCCFF">2</td>
      <td align="right" bgcolor="#FFFFCC">2</td>
      <td align="right" bgcolor="#CCCCCC">2</td>
      <td align="right" bgcolor="#CCCCCC">3.5</td>
    </tr>
    <tr>
      <td>Level C</td>
      <td align="right" bgcolor="#00CCFF">4</td>
      <td align="right" bgcolor="#FFCCFF">4</td>
      <td align="right" bgcolor="#FFFF99">4</td>
      <td align="right" bgcolor="#CCCCCC">6</td>
      <td align="right" bgcolor="#00CCFF">2.5</td>
      <td align="right" bgcolor="#FFCCFF">2.5</td>
      <td align="right" bgcolor="#FFFFCC">2.5</td>
      <td align="right" bgcolor="#CCCCCC">2.5</td>
      <td align="right" bgcolor="#CCCCCC">5</td>
    </tr>
	    
	<?php 
	$rangeC = array();$rangeM = array();$rangeY = array();$rangeK = array();
	$rangeC50 = array();$rangeM50 = array();$rangeY50 = array();$rangeK50 = array();
	$rangeG = array();
	 for ( $i = 1; $i <= 20; $i+= 1) { 
	  ${'dec'.$i}=de00($RPCCl,$RPCCa,$RPCCb,${'mc'.$i.'l'},${'mc'.$i.'a'},${'mc'.$i.'b'});
	  ${'dem'.$i}=de00($RPCMl,$RPCMa,$RPCMb,${'mm'.$i.'l'},${'mm'.$i.'a'},${'mm'.$i.'b'});
	   ${'dey'.$i}=de00($RPCYl,$RPCYa,$RPCYb,${'my'.$i.'l'},${'my'.$i.'a'},${'my'.$i.'b'});
	    ${'dek'.$i}=de00($RPCKl,$RPCKa,$RPCKb,${'mk'.$i.'l'},${'mk'.$i.'a'},${'mk'.$i.'b'});
		${'dec50'.$i}=de00($RPCC50l,$RPCC50a,$RPCC50b,${'mc50'.$i.'l'},${'mc50'.$i.'a'},${'mc50'.$i.'b'});
		${'dem50'.$i}=de00($RPCM50l,$RPCM50a,$RPCM50b,${'mm50'.$i.'l'},${'mm50'.$i.'a'},${'mm50'.$i.'b'});
		${'dey50'.$i}=de00($RPCY50l,$RPCY50a,$RPCY50b,${'my50'.$i.'l'},${'my50'.$i.'a'},${'my50'.$i.'b'});
		${'dek50'.$i}=de00($RPCK50l,$RPCK50a,$RPCK50b,${'mk50'.$i.'l'},${'mk50'.$i.'a'},${'mk50'.$i.'b'});
		${'deg'.$i}=de00($RPCgl,$RPCga,$RPCgb,${'mg'.$i.'l'},${'mg'.$i.'a'},${'mg'.$i.'b'});
		
		$rangeC[$i] = ${'dec'.$i};
		$rangeM[$i] = ${'dem'.$i};
		$rangeY[$i] = ${'dey'.$i};
		$rangeK[$i] = ${'dek'.$i};
		$rangeC50[$i] = ${'dec50'.$i};
		$rangeM50[$i] = ${'dem50'.$i};
		$rangeY50[$i] = ${'dey50'.$i};
		$rangeK50[$i] = ${'dek50'.$i};
		$rangeG[$i] = ${'deg'.$i};
		
	 ?>
	 <tr>
      <td><?php echo $i;?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dec'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dem'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dey'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dek'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dec50'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dem50'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dey50'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'dek50'.$i},2);?></td>
      <td align="right" bgcolor="#FFFFFF"><?php echo round(${'deg'.$i},2);?></td>
	  </tr>
	  <?php 
	  } 
	  		
sort($rangeC);sort($rangeM);sort($rangeY);sort($rangeK);
sort($rangeC50);sort($rangeM50);sort($rangeY50);sort($rangeK50);
sort($rangeG);

$C95 = $rangeC[round((94/100) * count($rangeC) -0.5)];		
$M95 = $rangeM[round((94/100) * count($rangeM) -0.5)];		
$Y95 = $rangeY[round((94/100) * count($rangeY) -0.5)];		
$K95 = $rangeK[round((94/100) * count($rangeK) -0.5)];		
$C5095 = $rangeC50[round((94/100) * count($rangeC50) -0.5)];		
$M5095 = $rangeM50[round((94/100) * count($rangeM50) -0.5)];		
$Y5095 = $rangeY50[round((94/100) * count($rangeY50) -0.5)];		
$K5095 = $rangeK50[round((94/100) * count($rangeK50) -0.5)];		
$G95 = $rangeG[round((94/100) * count($rangeG) -0.5)];		
	  ?>    
	   <tr>
      <td>95th% </td>
	  
     <?php 	if ($C95<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($C95<2.40) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($C95<4.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($C95,2);?></td>
	
     <?php 	if ($M95<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($M95<2.40) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($M95<4.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($M95,2);?></td>
	
     <?php 	if ($Y95<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($Y95<2.40) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($Y95<4.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($Y95,2);?></td>
	
     <?php 	if ($K95<2.40) { 
	echo '<td bgcolor="#008000">';}
	elseif ($K95<3.60) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($K95<6.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($K95,2);?></td>
	
     <?php 	if ($C5095<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($C5095<2.00) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($C5095<2.50) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($C5095,2);?></td>
	
     <?php 	if ($M5095<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($M5095<2.00) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($M5095<2.50) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($M5095,2);?></td>
	
     <?php 	if ($Y5095<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($Y5095<2.00) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($Y5095<2.500) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($Y5095,2);?></td>
	
	
     <?php 	if ($K5095<1.50) { 
	echo '<td bgcolor="#008000">';}
	elseif ($K5095<2.00) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($K5095<2.500) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($K5095,2);?></td>
	
     <?php 	if ($G95<3.00) { 
	echo '<td bgcolor="#008000">';}
	elseif ($G95<3.50) { 
	echo '<td bgcolor="#75923c">';}
	elseif ($G95<5.000) { 
	echo '<td bgcolor="#d7e4bc">';}
	else {echo '<td bgcolor="#ff003a">';}
	echo round($G95,2);?></td>
    </tr> 
		   
	<tr>
	  <td>Level</td>
    <?php  if ($C95<1.50) { 
	echo '<td>A</td>';}
	elseif ($C95<2.40) { 
	echo '<td>B</td>';}
	elseif ($C95<4.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($M95<1.50) { 
	echo '<td>A</td>';}
	elseif ($M95<2.40) { 
	echo '<td>B</td>';}
	elseif ($M95<4.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($Y95<1.50) { 
	echo '<td>A</td>';}
	elseif ($Y95<2.40) { 
	echo '<td>B</td>';}
	elseif ($Y95<4.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($K95<2.4) { 
	echo '<td>A</td>';}
	elseif ($K95<3.60) { 
	echo '<td>B</td>';}
	elseif ($K95<6.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($C5095<1.50) { 
	echo '<td>A</td>';}
	elseif ($C5095<2.00) { 
	echo '<td>B</td>';}
	elseif ($C5095<2.50) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($M5095<1.50) { 
	echo '<td>A</td>';}
	elseif ($M5095<2.00) { 
	echo '<td>B</td>';}
	elseif ($M5095<2.50) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($Y5095<1.50) { 
	echo '<td>A</td>';}
	elseif ($Y5095<2.00) { 
	echo '<td>B</td>';}
	elseif ($Y5095<2.50) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($K5095<1.50) { 
	echo '<td>A</td>';}
	elseif ($K5095<2.00) { 
	echo '<td>B</td>';}
	elseif ($K5095<2.50) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>
	
    <?php  if ($G95<3.00) { 
	echo '<td>A</td>';}
	elseif ($G95<3.50) { 
	echo '<td>B</td>';}
	elseif ($G95<5.00) { 
	echo '<td>C</td>';}
	else {echo '<td>F</td>';} ?>

    </tr> 
	
	<tr>
      <td>Score</td>
    <?php  if ($C95<1.50) { 
	$C95S=3;echo '<td>3</td>';}
	elseif ($C95<2.40) { 
	$C95S=2;echo '<td>2</td>';}
	elseif ($C95<4.00) { 
	$C95S=1;echo '<td>1</td>';}
	else {$C95S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($M95<1.50) { 
	$M95S=3;echo '<td>3</td>';}
	elseif ($M95<2.40) { 
	$M95S=2;echo '<td>2</td>';}
	elseif ($M95<4.00) { 
	$M95S=1;echo '<td>1</td>';}
	else {$M95S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($Y95<1.50) { 
	$Y95S=3;echo '<td>3</td>';}
	elseif ($Y95<2.40) { 
	$Y95S=2;echo '<td>2</td>';}
	elseif ($Y95<4.00) { 
	$Y95S=1;echo '<td>1</td>';}
	else {$Y95S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($K95<2.4) { 
	$K95S=3;echo '<td>3</td>';}
	elseif ($K95<3.60) { 
	$K95S=2;echo '<td>2</td>';}
	elseif ($K95<6.00) { 
	$K95S=1;echo '<td>1</td>';}
	else {$K95S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($C5095<1.50) { 
	$C5095S=3;echo '<td>3</td>';}
	elseif ($C5095<2.00) { 
	$C5095S=2;echo '<td>2</td>';}
	elseif ($C5095<2.50) { 
	$C5095S=1;echo '<td>1</td>';}
	else {$C5095S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($M5095<1.50) { 
	$M5095S=3;echo '<td>3</td>';}
	elseif ($M5095<2.00) { 
	$M5095S=2;echo '<td>2</td>';}
	elseif ($M5095<2.50) { 
	$M5095S=1;echo '<td>1</td>';}
	else {$M5095S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($Y5095<1.50) { 
	$Y5095S=3;echo '<td>3</td>';}
	elseif ($Y5095<2.00) { 
	$Y5095S=2;echo '<td>2</td>';}
	elseif ($Y5095<2.50) { 
	$Y5095S=1;echo '<td>1</td>';}
	else {$Y5095S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($K5095<1.50) { 
	$K5095S=3;echo '<td>3</td>';}
	elseif ($K5095<2.00) { 
	$K5095S=2;echo '<td>2</td>';}
	elseif ($K5095<2.50) { 
	$K5095S=1;echo '<td>1</td>';}
	else {$K5095S=0;echo '<td>0</td>';} ?>
	
    <?php  if ($G95<3.00) { 
	$G95S=3;echo '<td>3</td>';}
	elseif ($G95<3.50) { 
	$G95S=2;echo '<td>2</td>';}
	elseif ($G95<5.00) { 
	$G95S=1;echo '<td>1</td>';}
	else {$G95S=0;echo '<td>0</td>';} ?>
	</tr>
	  
  </table>
  <hr size="5"> 
<p>Production Variation Chart<p>
 <p>
 <p>
<table width="200" border="1" align="center"> <font color="green">

<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
//require_once ('../jpgraph/jpgraph.php');
$CMYSIDN="./image/".$imgID."-CMYSID.png";
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 

//unlink('CMYSID.png');

$datay1 = array($dec1,$dec2,$dec3,$dec4,$dec5,$dec6,$dec7,$dec8,$dec9,$dec10,$dec11,$dec12,$dec13,$dec14,$dec15,$dec16,$dec17,$dec18,$dec19,$dec20);
$datay2 = array($dem1,$dem2,$dem3,$dem4,$dem5,$dem6,$dem7,$dem8,$dem9,$dem10,$dem11,$dem12,$dem13,$dem14,$dem15,$dem16,$dem17,$dem18,$dem19,$dem20);
$datay3 = array($dey1,$dey2,$dey3,$dey4,$dey5,$dey6,$dey7,$dey8,$dey9,$dey10,$dey11,$dey12,$dey13,$dey14,$dey15,$dey16,$dey17,$dey18,$dey19,$dey20);





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

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

$graph->title->Set('CMY 100');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xaxis->title->Set("Sample ID");
$graph->yaxis->title->Set("de00");
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

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

$p2 = new LinePlot($datay2);
$graph->Add($p2);
//$ADR=92.04-5.9;
//$BDR=91.12-6.32;
$p3 = new LinePlot($datay3);
$graph->Add($p3);




$p1->SetColor("#55bbdd");
$p1->SetLegend('C100');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#55bbdd');
$p1->mark->SetFillColor('#55bbdd');
$p1->SetCenter();

$p2->SetColor("#fcbffb");
$p2->SetLegend('M100');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#fcbffb');
$p2->mark->SetFillColor('#fcbffb');
$p2->value->SetMargin(14);
$p2->SetCenter();

$p3->SetColor("#dce72a");
$p3->SetLegend('Y100');
$p3->mark->SetType(MARK_DIAMOND,'',1.0);
$p3->mark->SetColor('#dce72a');
$p3->mark->SetFillColor('#dce72a');
$p3->value->SetMargin(14);
$p3->SetCenter();

$sline = new PlotLine(HORIZONTAL,1.5,'#146f02',1.1); 
$sline->SetLineStyle('dashed');
$sline->SetLegend("Level A");
$sline2 = new PlotLine(HORIZONTAL,2.4,'black',1.1); 
$sline2->SetLineStyle('dashed');
$sline2->SetLegend("Level B");
$sline3 = new PlotLine(HORIZONTAL,4,'red',1.1); 
$sline3->SetLineStyle('dashed');
$sline3->SetLegend("Level C");
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);



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


// Output line
$graph->Stroke($CMYSIDN);
?>
<img src=<?php echo $CMYSIDN;?>>
</div></td>

<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
//require_once ('../jpgraph/jpgraph.php');
$CMYSID_DN="./image/".$imgID."-CMYSID_D.png";
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 

//unlink('CMYSID_D.png');

$datay1 = array($mc1D,$mc2D,$mc3D,$mc4D,$mc5D,$mc6D,$mc7D,$mc8D,$mc9D,$mc10D,$mc11D,$mc12D,$mc13D,$mc14D,$mc15D,$mc16D,$mc17D,$mc18D,$mc19D,$mc20D);
$datay2 = array($mm1D,$mm2D,$mm3D,$mm4D,$mm5D,$mm6D,$mm7D,$mm8D,$mm9D,$mm10D,$mm11D,$mm12D,$mm13D,$mm14D,$mm15D,$mm16D,$mm17D,$mm18D,$mm19D,$mm20D);
$datay3 = array($my1D,$my2D,$my3D,$my4D,$my5D,$my6D,$my7D,$my8D,$my9D,$my10D,$my11D,$my12D,$my13D,$my14D,$my15D,$my16D,$my17D,$my18D,$my19D,$my20D);





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

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

$graph->title->Set('CMY 100');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xaxis->title->Set("Sample ID");
$graph->yaxis->title->Set("Density");
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

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

$p2 = new LinePlot($datay2);
$graph->Add($p2);
//$ADR=92.04-5.9;
//$BDR=91.12-6.32;
$p3 = new LinePlot($datay3);
$graph->Add($p3);




$p1->SetColor("#55bbdd");
$p1->SetLegend('C100');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#55bbdd');
$p1->mark->SetFillColor('#55bbdd');
$p1->SetCenter();

$p2->SetColor("#fcbffb");
$p2->SetLegend('MC100');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#fcbffb');
$p2->mark->SetFillColor('#fcbffb');
$p2->value->SetMargin(14);
$p2->SetCenter();

$p3->SetColor("#dce72a");
$p3->SetLegend('Y100');
$p3->mark->SetType(MARK_DIAMOND,'',1.0);
$p3->mark->SetColor('#dce72a');
$p3->mark->SetFillColor('#dce72a');
$p3->value->SetMargin(14);
$p3->SetCenter();




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


// Output line
$graph->Stroke($CMYSID_DN);
?>
<img src=<?php echo $CMYSID_DN;?>>
</div></td>
</tr>
</table>
 
 <p>
 
 <table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
//require_once ('../jpgraph/jpgraph.php');
$KSIDN="./image/".$imgID."-KSID.png";
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 

//unlink('KSID.png');

$datay1 = array($dek1,$dek2,$dek3,$dek4,$dek5,$dek6,$dek7,$dek8,$dek9,$dek10,$dek11,$dek12,$dek13,$dek14,$dek15,$dek16,$dek17,$dek18,$dek19,$dek20);

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

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

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

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xaxis->title->Set("Sample ID");
$graph->yaxis->title->Set("de00");

//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

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




$p1->SetColor("#aaaaaa");
$p1->SetLegend('K100');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();

$sline = new PlotLine(HORIZONTAL,2.4,'#146f02',1.1); 
$sline->SetLineStyle('dashed');
$sline->SetLegend("Level A");
$sline2 = new PlotLine(HORIZONTAL,3.6,'black',1.1); 
$sline2->SetLineStyle('dashed');
$sline2->SetLegend("Level B");
$sline3 = new PlotLine(HORIZONTAL,6,'red',1.1); 
$sline3->SetLineStyle('dashed');
$sline3->SetLegend("Level C");
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);


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


// Output line
$graph->Stroke($KSIDN);
?>
<img src=<?php echo $KSIDN;?>>
</div></td>

<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
//require_once ('../jpgraph/jpgraph.php');
$KSID_DN="./image/".$imgID."-KSID_D.png";
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 

//unlink('KSID_D.png');

$datay1 = array($mk1D,$mk2D,$mk3D,$mk4D,$mk5D,$mk6D,$mk7D,$mk8D,$mk9D,$mk10D,$mk11D,$mk12D,$mk13D,$mk14D,$mk15D,$mk16D,$mk17D,$mk18D,$mk19D,$mk20D);

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

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

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

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xaxis->title->Set("Sample ID");
$graph->yaxis->title->Set("Density");

//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

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




$p1->SetColor("#aaaaaa");
$p1->SetLegend('K100');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();




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


// Output line
$graph->Stroke($KSID_DN);
?>
<img src=<?php echo $KSID_DN;?>>
</div></td>
</tr>
</table>
 <p>
 <table width="200" border="1" align="center"> <font color="green">

<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
//require_once ('../jpgraph/jpgraph.php');
$CMYK50N="./image/".$imgID."-CMYK50.png";
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 

//unlink('CMYK50.png');

$datay1 = array($dec501,$dec502,$dec503,$dec504,$dec505,$dec506,$dec507,$dec508,$dec509,$dec5010,$dec5011,$dec5012,$dec5013,$dec5014,$dec5015,$dec5016,$dec5017,$dec5018,$dec5019,$dec5020);
$datay2 = array($dem501,$dem502,$dem503,$dem504,$dem505,$dem506,$dem507,$dem508,$dem509,$dem5010,$dem5011,$dem5012,$dem5013,$dem5014,$dem5015,$dem5016,$dem5017,$dem5018,$dem5019,$dem5020);
$datay3 = array($dey501,$dey502,$dey503,$dey504,$dey505,$dey506,$dey507,$dey508,$dey509,$dey5010,$dey5011,$dey5012,$dey5013,$dey5014,$dey5015,$dey5016,$dey5017,$dey5018,$dey5019,$dey5020);
$datay4 = array($dek501,$dek502,$dek503,$dek504,$dek505,$dek506,$dek507,$dek508,$dek509,$dek5010,$dek5011,$dek5012,$dek5013,$dek5014,$dek5015,$dek5016,$dek5017,$dek5018,$dek5019,$dek5020);





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

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

$graph->title->Set('CMYK 50');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xaxis->title->Set("Sample ID");
$graph->yaxis->title->Set("de00");
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

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

$p2 = new LinePlot($datay2);
$graph->Add($p2);
//$ADR=92.04-5.9;
//$BDR=91.12-6.32;
$p3 = new LinePlot($datay3);
$graph->Add($p3);

$p4 = new LinePlot($datay4);
$graph->Add($p4);


$p1->SetColor("#55bbdd");
$p1->SetLegend('C50');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#55bbdd');
$p1->mark->SetFillColor('#55bbdd');
$p1->SetCenter();

$p2->SetColor("#fcbffb");
$p2->SetLegend('MC50');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#fcbffb');
$p2->mark->SetFillColor('#fcbffb');
$p2->value->SetMargin(14);
$p2->SetCenter();

$p3->SetColor("#dce72a");
$p3->SetLegend('Y50');
$p3->mark->SetType(MARK_DIAMOND,'',1.0);
$p3->mark->SetColor('#dce72a');
$p3->mark->SetFillColor('#dce72a');
$p3->value->SetMargin(14);
$p3->SetCenter();

$p4->SetColor("#aaaaaa");
$p4->SetLegend('Y50');
$p4->mark->SetType(MARK_DIAMOND,'',1.0);
$p4->mark->SetColor('#aaaaaa');
$p4->mark->SetFillColor('#aaaaaa');
$p4->value->SetMargin(14);
$p4->SetCenter();

$sline = new PlotLine(HORIZONTAL,1.5,'#146f02',1.1); 
$sline->SetLineStyle('dashed');
$sline->SetLegend("Level A");
$sline2 = new PlotLine(HORIZONTAL,2,'black',1.1); 
$sline2->SetLineStyle('dashed');
$sline2->SetLegend("Level B");
$sline3 = new PlotLine(HORIZONTAL,2.5,'red',1.1); 
$sline3->SetLineStyle('dashed');
$sline3->SetLegend("Level C");
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);




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


// Output line
$graph->Stroke($CMYK50N);
?>
<img src=<?php echo $CMYK50N;?>>
</div></td>
<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
//require_once ('../jpgraph/jpgraph.php');
$CMYK50_TN="./image/".$imgID."-CMYK50_T.png";
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 

//unlink('CMYK50_T.png');

$datay1 = array($TVIc1,$TVIc2,$TVIc3,$TVIc4,$TVIc5,$TVIc6,$TVIc7,$TVIc8,$TVIc9,$TVIc10,$TVIc11,$TVIc12,$TVIc13,$TVIc14,$TVIc15,$TVIc16,$TVIc17,$TVIc18,$TVIc19,$TVIc20);
$datay2 = array($TVIm1,$TVIm2,$TVIm3,$TVIm4,$TVIm5,$TVIm6,$TVIm7,$TVIm8,$TVIm9,$TVIm10,$TVIm11,$TVIm12,$TVIm13,$TVIm14,$TVIm15,$TVIm16,$TVIm17,$TVIm18,$TVIm19,$TVIm20);
$datay3 = array($TVIy1,$TVIy2,$TVIy3,$TVIy4,$TVIy5,$TVIy6,$TVIy7,$TVIy8,$TVIy9,$TVIy10,$TVIy11,$TVIy12,$TVIy13,$TVIy14,$TVIy15,$TVIy16,$TVIy17,$TVIy18,$TVIy19,$TVIy20);
$datay4 = array($TVIk1,$TVIk2,$TVIk3,$TVIk4,$TVIk5,$TVIk6,$TVIk7,$TVIk8,$TVIk9,$TVIk10,$TVIk11,$TVIk12,$TVIk13,$TVIk14,$TVIk15,$TVIk16,$TVIk17,$TVIk18,$TVIk19,$TVIk20);





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

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

$graph->title->Set('CMYK 50 TVI');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xaxis->title->Set("Sample ID");
$graph->yaxis->title->Set("TVI");
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

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

$p2 = new LinePlot($datay2);
$graph->Add($p2);
//$ADR=92.04-5.9;
//$BDR=91.12-6.32;
$p3 = new LinePlot($datay3);
$graph->Add($p3);

$p4 = new LinePlot($datay4);
$graph->Add($p4);


$p1->SetColor("#55bbdd");
$p1->SetLegend('C50');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#55bbdd');
$p1->mark->SetFillColor('#55bbdd');
$p1->SetCenter();

$p2->SetColor("#fcbffb");
$p2->SetLegend('MC50');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#fcbffb');
$p2->mark->SetFillColor('#fcbffb');
$p2->value->SetMargin(14);
$p2->SetCenter();

$p3->SetColor("#dce72a");
$p3->SetLegend('Y50');
$p3->mark->SetType(MARK_DIAMOND,'',1.0);
$p3->mark->SetColor('#dce72a');
$p3->mark->SetFillColor('#dce72a');
$p3->value->SetMargin(14);
$p3->SetCenter();

$p4->SetColor("#aaaaaa");
$p4->SetLegend('Y50');
$p4->mark->SetType(MARK_DIAMOND,'',1.0);
$p4->mark->SetColor('#aaaaaa');
$p4->mark->SetFillColor('#aaaaaa');
$p4->value->SetMargin(14);
$p4->SetCenter();






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


// Output line
$graph->Stroke($CMYK50_TN);
?>
<img src=<?php echo $CMYK50_TN;?>>
</div></td>
</tr>
</table>
<p>

<table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
//require_once ('../jpgraph/jpgraph.php');
$grayN="./image/".$imgID."-gray.png";
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 

//unlink('gray.png');

$datay1 = array($deg1,$deg2,$deg3,$deg4,$deg5,$deg6,$deg7,$deg8,$deg9,$deg10,$deg11,$deg12,$deg13,$deg14,$deg15,$deg16,$deg17,$deg18,$deg19,$deg20);

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

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

$graph->title->Set('50/40/40');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xaxis->title->Set("Sample ID");
$graph->yaxis->title->Set("de00");
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

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




$p1->SetColor("#aaaaaa");
$p1->SetLegend('50/40/40');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();


$sline = new PlotLine(HORIZONTAL,3,'#146f02',1.1); 
$sline->SetLineStyle('dashed');
$sline->SetLegend("Level A");
$sline2 = new PlotLine(HORIZONTAL,3.5,'black',1.1); 
$sline2->SetLineStyle('dashed');
$sline2->SetLegend("Level b");
$sline3 = new PlotLine(HORIZONTAL,5,'red',1.1); 
$sline3->SetLineStyle('dashed');
$sline3->SetLegend("Level c");
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);

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


// Output line
$graph->Stroke($grayN);
?>
<img src=<?php echo $grayN;?>>
</div></td>
<td><div align="center">
<?php // content="text/plain; charset=utf-8" 
//require_once ('../jpgraph/jpgraph.php');
$gray_DN="./image/".$imgID."-gray_D.png";
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php'); 

//unlink('gray_D.png');

$datay1 = array($mg1D,$mg2D,$mg3D,$mg4D,$mg5D,$mg6D,$mg7D,$mg8D,$mg9D,$mg10D,$mg11D,$mg12D,$mg13D,$mg14D,$mg15D,$mg16D,$mg17D,$mg18D,$mg19D,$mg20);

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

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

$graph->title->Set('50/40/40');
$graph->SetBox(false);

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xaxis->title->Set("Sample ID");
$graph->yaxis->title->Set("Density");
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);

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




$p1->SetColor("#aaaaaa");
$p1->SetLegend('50/40/40');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();




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


// Output line
$graph->Stroke($gray_DN);
?>
<img src=<?php echo $gray_DN;?>>
</div></td>
</tr>
</table>
	


<br>
<?php
	 }
 } ?>
<hr size="5"> 
<p>TR016(2012) Combined Conformity Assessment -- PRINTING<p>
<br>
<br>
<table width="1" border="2" align="center" cellpadding="0" cellspacing="0">
  <col width="88" span="7" />
  <tr>
    <td colspan="4" width="352">Combined Conformity Assessment -- PRINTING</td>
    <td colspan="2" width="176">TR016_2012</td>
    <td width="88"></td>
  </tr>
  <tr>
    <td>Aspect</td>
    <td width="88">Score*</td>
    <td width="88">Level**</td>
    <td>Weighting***</td>
    <td width="88">Combined    Score</td>
    <td width="88">Passing  Score ****</td>
    <td>Pass/Fail</td>
  </tr>
  <tr>
	<?php  
	$deviation=min($sc0095S,$dc00S,$dm00S,$dy00S,$dk00S,$dc50S,$dm50S,$dy50S,$dk50S,$dcmyS);
	$wiightD=3;
	$wiightW=1;	
	$wiightV=6;		
	//$WSS
	$variation=min($C95S,$M95S,$Y95S,$K95S,$C5095S,$M5095S,$Y5095S,$K5095S,$dk50S,$dcmyS);
	$CBscore=($deviation*$wiightD+$WSS*$wiightW+$variation*$wiightV);
	$passing=$wiightD+$wiightW+$wiightV;
	
	
	?>
    <td>Deviation</td>
    <td><?php echo $deviation;?></td>
    <td><?php if ($deviation==3) {echo "A";} elseif ($deviation==2) {echo "B";} elseif ($deviation==1) {echo "C";} elseif ($deviation==0) {echo "Fail";}?></td>
    <td><?php echo $wiightD;?> </td>
    <td rowspan="3"><?php echo $CBscore?></td>
    <td rowspan="3"><?php echo $passing;?></td>
    <td rowspan="3"><?php if ($CBscore>$passing){echo "Pass";} else {echo "Fail";}?></td>
  </tr>
  <tr>
    <td>Within-sheet</td>
    <td><?php echo $WSS;?></td>
    <td><?php if ($WSS==3) {echo "A";} elseif ($WSS==2) {echo "B";}elseif ($WSS==1) {echo "C";} elseif ($WSS==0) {echo "Fail";}?></td>
    <td><?php echo $wiightW;?> </td>
  </tr>
  <tr>
    <td>Variation</td>
    <td><?php echo $variation;?></td>
    <td><?php if ($variation==3) {echo "A";} elseif ($variation==2) {echo "B";} elseif ($variation==1) {echo "C";} elseif ($variation==0) {echo "Fail";}?></td>
    <td><?php echo $wiightV;?> </td>
  </tr>
</table>
<br>

<table align="center">
<tr>
  <td align="center"> <a href="TVI-parsing13-Print.php?file=<?php echo $dStr.$_FILES["file"]["name"]."&fileP=".$dStr.$_FILES["fileP"]["name"]."&imgID=".$imgID;?>">Print</a><br></td>

  <td align="center"> <a href="rank.php">Report</a><br></td>
  <td align="center"> <a href="index.htm">MainPage</a><br></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>
</table>
</body>


</html>