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-Print.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>
	    body {
        margin: 0;
        padding: 0;
        background-color: #FAFAFA;
        font: 12pt "Tahoma";
    }
    * {
        box-sizing: border-box;
        -moz-box-sizing: border-box;
    }
    .page {
        width: 21cm;
        min-height: 29.7cm;
        padding: 1cm;
        margin: 1cm auto;
        border: 1px #D3D3D3 solid;
        border-radius: 5px;
        background: white;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    }
    .subpage {
        padding: 1cm;
        border: 1px black solid;
        height: 279mm;
        outline: 1cm #DDDDDD solid;
    }
    
    @page {
        size: A4;
        margin: 0;
    }
    @media print {
        .page {
            margin: 0;
            border: initial;
            border-radius: initial;
            width: initial;
            min-height: initial;
            box-shadow: initial;
            background: initial;
            page-break-after: avoid;
        }
    }
	.oneColElsCtr .book .page .subpage table tr th {
	font-size: 9pt;
}
    .oneColElsCtr .book .page .subpage table tr td {
	font-size: 9pt;
}
    .oneColElsCtr .book .page .subpage table tr td table {
	font-size: x-small;
}
    </style>
    </head>
<?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);
}
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;
}
$dStr="";
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Return Code: " . $file . "<br />";
    }
  else
    {
    if (file_exists("upload/" .$dStr. $_FILES["file"]["name"]))   
      { 
	  $contents = file("upload/".$file);
	   $stringC = implode($contents);	
	 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'WEIGHTING_FUNCTION ');
	  $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]);
		natsort($contents);
 $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);

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

$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];

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

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

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

  $cl=$scCL; $ca=$scCa;$cb=$scCb;
  $ml=$scML; $ma=$scMa;$mb=$scMb;
  $yl=$scYL; $ya=$scYa;$yb=$scYb;
  $kl=$scKL; $ka=$scKa;$kb=$scKb;
 
 $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);

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

sort($CRde);

  $CRF0=0;

  for ( $i = 1; $i <= 29; $i += 1) {
  ${'CRF'.$i}=${'CRF'.($i-1)}+(1/29);
  }

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

require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_scatter.php');
  
}}    ////////////////////////////////////////////////////////////////////production 
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';


$dStrP="";
	  $contents = file("upload/".$fileP);
		$stringC = implode($contents);
		
		$fMark = strrpos($stringC,'i1Profiler');
		//echo "fMark:".$fMark."<br>";
		$fMarkC = strrpos($stringC,'ColorPort');
		//echo "fMarkC:".$fMarkC."<br>";
		
if ($fMark>0) { /////////////////////////////////////////////////////////////////////////////////////////// 
		 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'BEGIN_DATA_FORMAT');

$string = implode($contents);		
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", ',', $p);
//echo $p;
}
	  
if ($fMarkC>0) { ////////////////////////////////////////////////////////////// ColorPort 400
	 $cols=get_betweenC($stringC,"NUMBER_OF_FIELDS",'WEIGHTING_FUNCTION ');

$string = implode($contents);		
$p = ereg_replace("\r\n?", "\n", $string);
$p = str_replace("\n", ',', $p);



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

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

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


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

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


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

	$rangeC = array();$rangeM = array();$rangeY = array();$rangeK = array();
	$rangeC50 = array();$rangeM50 = array();$rangeY50 = array();$rangeK50 = array();
	$rangeG = array();
	 

$WS=($CRde[26]+$CRde[27])/2;
	if ($WS<1.05) { 
	$WSS=3;}
	elseif ($WS<1.55) { 
	$WSS=2;}
	elseif ($WS<3.05) { 
	$WSS=1;}
	else {$WSS=0;}
	
	if ($sc0095<3.05) { 
	$sc0095S=3;}
	elseif ($sc0095<4.05) { 
	$sc0095S=2;}
	elseif ($sc0095<5.05) { 
	$sc0095S=1;}
	else {$sc0095S=0;}

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

       
	if ($dm00<1.55) { 
	$dm00S=3;}
	elseif ($dm00<2.45) { 
	$dm00S=2;}
	elseif ($dm00<4.05) { 
	$dm00S=1;}
	else {$dm00S=0;}
	
	if ($dy00<1.55) { 
	$dy00S=3;}
	elseif ($dy00<2.45) { 
	$dy00S=2;}
	elseif ($dy00<4.05) { 
	$dy00S=1;}
	else {$dy00S=0;}
	
	if ($dk00<2.45) { 
	$dk00S=3;}
	elseif ($dk00<3.65) { 
	$dk00S=2;}
	elseif ($dk00<6.05) { 
	$dk00S=1;}
	else {$dk00S=0;}
	
	if ($dc50<1.55) { 
	$dc50S=3;}
	elseif ($dc50<2.05) { 
	$dc50S=2;}
	elseif ($dc50<2.55) { 
	$dc50S=1;}
	else {$dc50S=0;}
	
	if ($dm50<1.55) { 
	$dm50S=3;}
	elseif ($dm50<2.05) { 
	$dm50S=2;}
	elseif ($dm50<2.55) { 
	$dm50S=1;}
	else {$dm50S=0;}
	
	if ($dy50<1.55) { 
	$dy50S=3;}
	elseif ($dy50<2.05) { 
	$dy50S=2;}
	elseif ($dy50<2.55) { 
	$dy50S=1;}
	else {$dy50S=0;}
	
	if ($dk50<1.55) { 
	$dk50S=3;}
	elseif ($dk50<2.05) { 
	$dk50S=2;}
	elseif ($dk50<2.55) { 
	$dk50S=1;}
	else {$dk50S=0;}
	
	if ($dcmy<3.05) { 
	$dcmyS=3;}
	elseif ($dcmy<3.55) { 
	$dcmyS=2;}
	elseif ($dcmy<5.05) { 
	$dcmyS=1;}
	else {$dcmyS=0;}
	
	
	
	
	
	$deviation=min($sc0095S,$dc00S,$dm00S,$dy00S,$dk00S,$dc50S,$dm50S,$dy50S,$dk50S,$dcmyS);
	if ($sc0095<5.0) {$passSC="Pass";} else {$passSC= "Fail";}
	if ($sc0095<3.0) {$levelSC= "Level A";} elseif ($sc0095<4.0) {$levelSC="Level B";}  elseif ($sc0095<5.0){$levelSC="Level C";} else {$levelSC="";}
	
	if ($dcmy<4.05) {$passcmy="Pass";} else {$passcmy= "Fail";}
	if ($dcmy<1.55) {$levelcmy= "Level A";} elseif ($dcmy<2.45) {$levelcmy="Level B";}  elseif ($dcmy<4.05){$levelcmy="Level C";} else {$levelcmy="";}
	
	if ($dc00<4.05) {$passdc="Pass";} else {$passdc= "Fail";}
	if ($dc00<1.55) {$leveldc= "Level A";} elseif ($dc00<2.45) {$leveldc="Level B";}  elseif ($dc00<4.05){$leveldc="Level C";} else {$leveldc="";}
	
	if ($dm00<4.05) {$passdm="Pass";} else {$passdm= "Fail";}
	if ($dm00<1.55) {$leveldm= "Level A";} elseif ($dm00<2.45) {$leveldm="Level B";}  elseif ($dm00<4.05){$leveldm="Level C";} else {$leveldm="";}
	
	if ($dy00<4.05) {$passdy="Pass";} else {$passdy= "Fail";}
	if ($dy00<1.55) {$leveldy= "Level A";} elseif ($dy00<2.45) {$leveldy="Level B";}  elseif ($dy00<4.05){$leveldy="Level C";} else {$leveldy="";}
	
	if ($dk00<6.05) {$passdk="Pass";} else {$passdk= "Fail";}
	if ($dk00<2.45) {$leveldk= "Level A";} elseif ($dk00<3.65) {$leveldk="Level B";}  elseif ($dk00<6.05){$leveldk="Level C";} else {$leveldk="";}
	
	if ($dc50<2.55) {$pass50c="Pass";} else {$pass50c= "Fail";}
	if ($dc50<1.55) {$leveldc50= "Level A";} elseif ($dc50<2.05) {$leveldc50="Level B";} elseif ($dc50<2.55){$leveldc50="Level C";} else {$leveldc50="";}
	
	if ($dm50<2.55) {$pass50m="Pass";} else {$pass50m= "Fail";}
	if ($dm50<1.55) {$leveldm50= "Level A";} elseif ($dm50<2.05) {$leveldm50="Level B";} elseif ($dm50<2.55){$leveldm50="Level C";} else {$leveldm50="";}

	if ($dy50<2.55) {$pass50y="Pass";} else {$pass50y= "Fail";}
	if ($dy50<1.55) {$leveldy50= "Level A";} elseif ($dy50<2.05) {$leveldy50="Level B";} elseif ($dy50<2.55){$leveldy50="Level C";} else {$leveldy50="";}
	
	if ($dk50<2.55) {$pass50k="Pass";} else {$pass50k= "Fail";}
	if ($dk50<1.55) {$leveldk50= "Level A";} elseif ($dk50<2.05) {$leveldk50="Level B";} elseif ($dk50<2.55){$leveldk50="Level C";} else {$leveldk50="";}
	
	



	$wiightD=3;
	$wiightW=1;	
	$wiightV=6;		
	//$WSS
	if ($deviation==3) {$passD="Pass";$levelD="Level A";} elseif ($deviation==2) {$passD="Pass";$levelD="Level B";} elseif ($deviation==1) {$passD="Pass";$levelD="Level C";} elseif ($deviation==0) {$passD="Fail";$levelD="";}

	
	?>

<body class="oneColElsCtr">

<div class="book">
    <div class="page">
        <div class="subpage">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
			<tr>
			<td width="50%">
			
			<!-- Table on right side -->
			<table width="100%" border="0" cellspacing="0" cellpadding="1">
			<p>Target:IT8.7/4(1,617 patches)<br />
            Sampling:2 OK sheets <br />
			          10 normative requirements          </p>
			</table>
<!--------------------------------------------Left and right   Page 1------------------------->			
			</td>
			<td width="50%">
			<!-- Table on Left side -->
			<table width="100%" border="0" cellspacing="0" cellpadding="1">
			<tr><td>Target Dataset: CRPC6</td></tr>
			</table>
            <table width="271" border="2" cellspacing="2" cellpadding="2">
			  <tr>
			    <td width="55" scope="row">Outcome:</td>
			    <td width="47" scope="row"><?php if ($passD=='Pass') {echo "<font color='green'>";} elseif ($passD=='Fail') {echo "<font color='red'>"; }?><?php echo $passD;?></td>
			    <td width="49"><?php if ($passD=='Pass') {echo "<font color='green'>";} elseif ($passD=='Fail') {echo "<font color='red'>"; }?><?php echo $levelD;?></td>
		      </tr>
			  </table>
			</td>
			</tr>
</table>
			
			<!-- Main Table(You can define padding accordingly) -->
			<table width="100%" border="0" cellspacing="0" cellpadding="5">
			<tr>
			<td width="50%" height="363">	
			
			<!-- Table on left side --><!-- END -->
		    <img src="ToleranceTR16.png" width="243" height="195" alt="TolTR16" longdesc="ToleranceTR16.png" /></td>
		<td width="50%">

		<!-- Table on right side -->
		<table width="100%" border="0" cellspacing="0" cellpadding="1">
		<tr>
		<td> <img src=<?php echo "./image/".$imgID."-scatter.png";?> alt="CRFIT8" width="326" height="307" /></td>
		</tr>
		</table>
	<!-- END -->
	</td>
	</tr>
	</table>
	
	
<table width="100%" border="0" cellspacing="0" cellpadding="5">
	<tr>
	<td width="50%">	
			
	<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>
	</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>
	</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>
	</tr>
	<tr>
	<td><div align="center">dE00.</div></td>
	<td><div align="right"><?php echo round($dcmy,2);?></div></td>
	<td><div align="center"><?php echo $passcmy;?></div></td>
	<td><div align="center"><?php echo $levelcmy;?></div></td>
	</tr>
	</table>		
		<!-- END --------------------------------------------Left-------------------------->
		</td>
		<td width="50%">
	<table width="200" border="1" align="center">
	<tr>
	  <td width="106"><font color="#aaaaaa"><div align="center"></div>
	    95th Percentile</td>
	  <td><?php echo $sc0095;?></td>
	  </tr>
	<tr>
    <td><font color="#aaaaaa">Pass/Fail</td>
    <td><?php if ($sc0095<5.0) {echo "Pass";} else {echo "Fail";}?></td>
	</tr>
	<tr>
    <td><font color="#aaaaaa">Level</td>
    <td><?php if ($sc0095<3.0) {echo "Level A";} elseif ($sc0095<4.0) {echo "Level B";}  elseif ($sc0095<5.0){echo "Level C";} else {echo "";}?></td>
	</tr>
	</table>
	</td>
	</tr>
</table>	

	
<table width="100%" border="0" cellspacing="0" cellpadding="5">
	<tr>
	<td width="50%">	
			
	<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>
	</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>
	</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>
	</tr>
	<tr>
	<td><div align="center">dE00.</div></td>
	<td><div align="right"><?php echo round($dc00,2);?></div></td>
	<td><div align="center"><?php echo $passdc;?></div></td>
	<td><div align="center"><?php echo $leveldc;?></div></td>
	</tr>
	</table>		
		<!-- END --------------------------------------------Left-------------------------->
		</td>
		<td width="50%">
	<table width="200" border="1" align="center">
	<tr> 
	 <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>
	</tr>
	<tr>
	<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>
	</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>
	</tr>
	<tr>
	<td><div align="center">dE00.</div></td>
	<td><div align="right"><?php echo round($dc00,2);?></div></td>
	<td><div align="center"><?php echo $passdm;?></div></td>
	<td><div align="center"><?php echo $leveldm;?></div></td>
	</tr>
	</table>
	</td>
	</tr>
</table>	
<!-- END --------------------------------------------Right YK-------------------------->	
<table width="100%" border="0" cellspacing="0" cellpadding="5">
	<tr>
	<td width="50%">	
			
	<table width="200" border="1" align="center">
	<tr>
	<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>
	</tr>
		<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>
	</tr>
		<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>
	</tr>
	<tr>
		<td><div align="center">dE00.</div></td>
	    <td><div align="right"><?php echo round($dy00,2);?></div></td>
	<td><div align="center"><?php echo $passdy;?></div></td>
	<td><div align="center"><?php echo $leveldy;?></div></td>
	</tr>
	</table>		
		<!-- END --------------------------------------------Left YK-------------------------->
		</td>
		<td width="50%">
	<table width="200" border="1" align="center">
	<tr> 
	<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>
	<tr>
	    <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($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>
	</tr>
	<tr>
	    <td><div align="center">dE00.</div></td>
	    <td><div align="right"><?php echo round($dk00,2);?></div></td>
	<td><div align="center"><?php echo $passdk;?></div></td>
	<td><div align="center"><?php echo $leveldk;?></div></td>
	</tr>
	</table>
	</td>
	</tr>
</table>	

<!-- END --------------------------------------------Right CM50-------------------------->	
<table width="100%" border="0" cellspacing="0" cellpadding="5">
	<tr>
	<td width="50%">	
			
	<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>
	</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>
	</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>
	</tr>
	<tr>
<td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dc50,2);?></div></td>
	<td><div align="center"><?php echo $pass50c;?></div></td>
	<td><div align="center"><?php echo $leveldc50;?></div></td>
	</tr>
	</table>		
		<!-- END --------------------------------------------Left CM50-------------------------->
		</td>
		<td width="50%">
	<table width="200" border="1" align="center">
	<tr> 
	<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> 
	</tr>
	<tr>
<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>
	</tr>
	<tr>
<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>
	</tr>
	<tr>
<td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dm50,2);?></div></td>
	<td><div align="center"><?php echo $pass50m;?></div></td>
	<td><div align="center"><?php echo $leveldm50;?></div></td>
	</tr>
	</table>
	</td>
	</tr>
</table>	

<!-- END --------------------------------------------Right YK50-------------------------->	
<table width="100%" border="0" cellspacing="0" cellpadding="5">
	<tr>
	<td width="50%">	
			
	<table width="200" border="1" align="center">
	<tr>
    <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>
	</tr>
<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>
	</tr>
<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>
	</tr>
	<tr>
<td><div align="center">dE00.</div></td>
<td><div align="right"><?php echo round($dy50,2);?></div></td>
	<td><div align="center"><?php echo $pass50y;?></div></td>
	<td><div align="center"><?php echo $leveldy50;?></div></td>
	</tr>
	</table>		
		<!-- END --------------------------------------------Left YK50-------------------------->
		</td>
		<td width="50%">
	<table width="200" border="1" align="center">
	<tr> 
	<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($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>
	</tr>
	<tr>
<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($dk50,2);?></div></td>
	<td><div align="center"><?php echo $pass50k;?></div></td>
	<td><div align="center"><?php echo $leveldk50;?></div></td>
	</tr>
	</table>
	</td>
	</tr>
</table>	
      </div> <!--subpage-->   
    </div><!--page-->
	
<!--------------------------------------------Page 2------------------------->	
    <div class="page">
        <div class="subpage">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
			<tr>
			<td width="50%">
			
			<!-- Table on right side -->
			<table width="100%" border="0" cellspacing="0" cellpadding="1">
			<p>Target:IT8.7/4(29 duplicates)<br />
            Sampling:2 OK sheets <br />
			          1 normative requirements  
			</p>
			</table>
<!--------------------------------------------Left and right------------------------->			
			</td>
			<td width="50%">
			<!-- Table on Left side -->

			<table width="336" border="2" cellspacing="2" cellpadding="2">
			  <tr>
			    <td width="142" scope="row">Target description</td>
			    <td colspan="3">Within-sheet variation tolence(de00)</td>
		      </tr>
			  <tr>
			    <td rowspan="2" scope="row">95th percentile of redunt patches</td>
			    <td width="53">Level A</td>
			    <td width="51">Level B</td>
			    <td width="52">Level C</td>
		      </tr>
			  <tr>
			    <td bgcolor="#66CCFF">1.0</td>
			    <td bgcolor="#66CCFF">1.5</td>
			    <td bgcolor="#66CCFF">3.0</td>
		      </tr>
			  </table></td>
			</tr>
</table>		
<table width="100%" border="0" cellspacing="0" cellpadding="5">
			<tr>
			<td width="50%">
			
			<!-- Table on right side -->
			<table width="271" border="2" cellspacing="2" cellpadding="2">
			  <tr>
			    <td width="55" scope="row">Outcome:</td>
			    <td width="47" scope="row"><?php if ($pass=='Pass') {echo "<font color='green'>";} elseif ($pass=='Fail') {echo "<font color='red'>"; }?><?php echo $pass;?></td>
			    <td width="49"><?php if ($pass=='Pass') {echo "<font color='green'>";} elseif ($pass=='Fail') {echo "<font color='red'>"; }?><?php echo $level;?></td>
		      </tr>
			  </table>
<!--------------------------------------------Left and right------------------------->			
			</td>
			<td width="50%">
			<!-- Table on Left side -->

			<table width="336" border="2" cellspacing="2" cellpadding="2">
			  <tr>
			    <td width="142" scope="row">95th Percentile</td>
			    <td width="156"><?php echo round(($CRde[26]+$CRde[27])/2,2);?></td>
		      </tr>
			  </table>
			  </td>
			</tr>
</table>		
<br><br><br>		
<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 } ?>
</table>
		
		
		</div><!--subpage-->       
    </div><!--page-->    

<!--------------------------------------------Page 3------------------------->	
    <div class="page">
        <div class="subpage">
<table width="101%" border="0" cellspacing="0" cellpadding="5">
			<tr>
			<td width="52%" height="201">
			
			<!-- Table on right side -->
			<table width="100%" border="0" cellspacing="0" cellpadding="1">
			<tr><td><p>Target:Color control bar<br />
            Sampling: 20 production samples <br />
			          9 normative requirements <br />
					  per sample
			</p></td></tr>
			</table>
			
	<?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};
		}
		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)];	
		
			if ($C95<1.50) { 
	$C95S=3;}
	elseif ($C95<2.40) { 
	$C95S=2;}
	elseif ($C95<4.00) { 
	$C95S=1;}
	else {$C95S=0;} ?>
	
    <?php  if ($M95<1.50) { 
	$M95S=3;}
	elseif ($M95<2.40) { 
	$M95S=2;}
	elseif ($M95<4.00) { 
	$M95S=1;}
	else {$M95S=0;} ?>
	
    <?php  if ($Y95<1.50) { 
	$Y95S=3;}
	elseif ($Y95<2.40) { 
	$Y95S=2;}
	elseif ($Y95<4.00) { 
	$Y95S=1;}
	else {$Y95S=0;} ?>
	
    <?php  if ($K95<2.4) { 
	$K95S=3;}
	elseif ($K95<3.60) { 
	$K95S=2;}
	elseif ($K95<6.00) { 
	$K95S=1;}
	else {$K95S=0;} ?>
	
    <?php  if ($C5095<1.50) { 
	$C5095S=3;}
	elseif ($C5095<2.00) { 
	$C5095S=2;}
	elseif ($C5095<2.50) { 
	$C5095S=1;}
	else {$C5095S=0;} ?>
	
    <?php  if ($M5095<1.50) { 
	$M5095S=3;}
	elseif ($M5095<2.00) { 
	$M5095S=2;}
	elseif ($M5095<2.50) { 
	$M5095S=1;}
	else {$M5095S=0;} ?>
	
    <?php  if ($Y5095<1.50) { 
	$Y5095S=3;}
	elseif ($Y5095<2.00) { 
	$Y5095S=2;}
	elseif ($Y5095<2.50) { 
	$Y5095S=1;}
	else {$Y5095S=0;} 
	
	if ($K5095<1.50) { 
	$K5095S=3;}
	elseif ($K5095<2.00) { 
	$K5095S=2;}
	elseif ($K5095<2.50) { 
	$K5095S=1;}
	else {$K5095S=0;} 
	
	if ($G95<3.00) { 
	$G95S=3;}
	elseif ($G95<3.50) { 
	$G95S=2;}
	elseif ($G95<5.00) { 
	$G95S=1;}
	else {$G95S=0;} 
		
		
		
	
	$wiightD=3;
	$wiightW=1;	
	$wiightV=6;		
	//$WSS
	$variation=min($C95S,$M95S,$Y95S,$K95S,$C5095S,$M5095S,$Y5095S,$K5095S,$G95S);
	$CBscore=($deviation*$wiightD+$WSS*$wiightW+$variation*$wiightV);
	$passing=$wiightD+$wiightW+$wiightV;
	
		if ($variation==3) {$passP="Pass";$levelP="Level A";} elseif ($variation==2) {$passP="Pass";$levelP="Level B";} elseif ($variation==1) {$passP="Pass";$levelP="Level C";} elseif ($variation==0) {$passP="Fail";$levelP="";}
	

	

	?>
			<table width="271" border="2" cellspacing="2" cellpadding="2">
			  <tr>
			    <td width="55" scope="row">Outcome:</td>
			    <td width="47" scope="row"><?php if ($passP=='Pass') {echo "<font color='green'>";} elseif ($passP=='Fail') {echo "<font color='red'>"; }?><?php echo $passP."";?></td>
				
			    <td width="49"><?php if ($passP=='Pass') {echo "<font color='green'>";} elseif ($passP=='Fail') {echo "<font color='red'>"; }?><?php echo $levelP;?></td>
		      </tr>
			  </table>
			<!--------------------------------------------Left and right------------------------->			
			</td>
			<td width="48%">
			<!-- Table on Left side --><img src="ProductionTR16.png" width="301" height="220" alt="P_TR16" longdesc="ProductionTR16.png" /></td>
			</tr>
</table>		
		

<table border="1" align="center" cellpadding="1" cellspacing="1">
    <col width="87">
    <col width="83">
    <col width="71" span="2">
    <col width="83">
    <col width="56">
    <col width="53">
    <col width="83">
    <col width="53">
    <col width="56">
    <tr>
      <td width="87">Tol    CIEDE00</td>
      <td width="83" align="center" bgcolor="#00CCFF">C100</td>
      <td width="71" align="center" bgcolor="#FFCCFF">M100</td>
      <td width="71" align="center" bgcolor="#FFFF99">Y100</td>
      <td width="83" align="center" bgcolor="#CCCCCC">K100</td>
      <td width="56" align="center" bgcolor="#00CCFF">C50</td>
      <td width="53" align="center" bgcolor="#FFCCFF">M50</td>
      <td width="83" align="center" bgcolor="#FFFFCC">Y50</td>
      <td width="53" align="center" bgcolor="#CCCCCC">K50</td>
      <td width="56" align="center" bgcolor="#CCCCCC">50/40/40</td>
    </tr>
    <tr>
      <td>Level A</td>
      <td align="right" bgcolor="#00CCFF">1.50</td>
      <td align="right" bgcolor="#FFCCFF">1.50</td>
      <td align="right" bgcolor="#FFFF99">1.50</td>
      <td align="right" bgcolor="#CCCCCC">2.40</td>
      <td align="right" bgcolor="#00CCFF">1.50</td>
      <td align="right" bgcolor="#FFCCFF">1.50</td>
      <td align="right" bgcolor="#FFFFCC">1.50</td>
      <td align="right" bgcolor="#CCCCCC">1.50</td>
      <td align="right" bgcolor="#CCCCCC">3.00</td>
    </tr>
    <tr>
      <td>Level B</td>
      <td align="right" bgcolor="#00CCFF">2.4</td>
      <td align="right" bgcolor="#FFCCFF">2.4</td>
      <td align="right" bgcolor="#FFFF99">2.4</td>
      <td align="right" bgcolor="#CCCCCC">3.6</td>
      <td align="right" bgcolor="#00CCFF">2</td>
      <td align="right" bgcolor="#FFCCFF">2</td>
      <td align="right" bgcolor="#FFFFCC">2</td>
      <td align="right" bgcolor="#CCCCCC">2</td>
      <td align="right" bgcolor="#CCCCCC">3.5</td>
    </tr>
    <tr>
      <td>Level C</td>
      <td align="right" bgcolor="#00CCFF">4</td>
      <td align="right" bgcolor="#FFCCFF">4</td>
      <td align="right" bgcolor="#FFFF99">4</td>
      <td align="right" bgcolor="#CCCCCC">6</td>
      <td align="right" bgcolor="#00CCFF">2.5</td>
      <td align="right" bgcolor="#FFCCFF">2.5</td>
      <td align="right" bgcolor="#FFFFCC">2.5</td>
      <td align="right" bgcolor="#CCCCCC">2.5</td>
      <td align="right" bgcolor="#CCCCCC">5</td>
    </tr>
	    
	<?php 

	 for ( $i = 1; $i <= 20; $i+= 1) { 	
	 ?>
	 <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 
	  } 
	  		
	
	  ?>    
	   <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>
  
<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>

    <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 "<font color='green'>";} elseif ($CBscore<$passing) {echo "<font color='red'>"; }?><?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>		
		
		</div><!--subpage-->       
    </div><!--page--> 
	
<!--------------------------------------------Page 4------------------------->	
    <div class="page">
        <div class="subpage">
<table width="100%" height="250" border="0" cellpadding="5" cellspacing="0">
			<tr>
			<td width="50%" height="250">
			
			<!-- Table on right side -->

<!--------------------------------------------Left and right------------------------->			
			<div align="center"> <img src=<?php echo "./image/".$imgID."-CMYSID.png";?> alt="CMYSID" width="333" height="225" /> </div></td>
			<td width="50%">
			<!-- Table on Left side -->
			<div align="center"> <img src=<?php echo "./image/".$imgID."-CMYSID_D.png";?> alt="CMYSID_D" width="311" height="225" /> </div></td>
			</tr>
</table>		
<table width="100%" border="0" cellspacing="0" cellpadding="5">
			<tr>
			<td width="50%">
			
			<!-- Table on right side --><!--------------------------------------------Left and right------------------------->			
			<img src=<?php echo "./image/".$imgID."-KSID.png";?> alt="KSID" width="333" height="225" /></td>
			<td width="50%">
			<!-- Table on Left side --><img src=<?php echo "./image/".$imgID."-KSID_D.png";?> alt="KSID_D" width="311" height="225" /></td>
			</tr>
</table>		
<table width="100%" border="0" cellpadding="5" cellspacing="0">
  <tr>
    <td width="50%"><!-- Table on right side -->
      <!--------------------------------------------Left and right------------------------->
      <img src=<?php echo "./image/".$imgID."-CMYK50.png";?> alt="CMYK50" width="333" height="225" /></td>
    <td width="50%"><!-- Table on Left side -->
      <img src=<?php echo "./image/".$imgID."-CMYK50_T.png";?> alt="CMYK50_T" width="311" height="225" /></td>
  </tr>
</table>

<table width="100%" border="0" cellpadding="5" cellspacing="0">
  <tr>
    <td width="50%"><!-- Table on right side -->
      <!--------------------------------------------Left and right------------------------->
      <img src=<?php echo "./image/".$imgID."-gray.png";?> alt="gray" width="333" height="225" /></td>
    <td width="50%"><!-- Table on Left side -->
      <img src=<?php echo "./image/".$imgID."-gray_D.png";?> alt="gray_D" width="311" height="225" /></td>
  </tr>
</table>

        </div><!--subpage-->       
    </div><!--page-->   
</div><!--book-->
</body>


</html>