ajax dhtmlx

<?php

$cs = Yii::app()->clientScript;
$cs->coreScriptPosition = CClientScript::POS_HEAD;
$cs->scriptMap = array();
$version = Yii::app()->params["deployVersion"];
$baseUrl = Yii::app()->theme->baseUrl;
$cs->registerCssFile($baseUrl . '/css/main/vstac.css?v=' . $version . '');

$baseUrl=Yii::app()->request->baseUrl;
$cs->registerCoreScript('jquery');
$cs->registerScriptFile($baseUrl . '/js/kandytabs/kandytabs.pack.js?v=' . $version . '');
$cs->registerCssFile($baseUrl . '/js/kandytabs/kandytabs.css?v=' . $version . '');
$cs->registerScriptFile($baseUrl.'/js/lhgdialog/lhgdialog.min.js?skin=mac&v='.$version.'');

$cs->registerScriptFile($baseUrl . '/js/datepicker_exact/js/jquery-ui-slide.min.js');
$cs->registerScriptFile($baseUrl . '/js/datepicker_exact/js/jquery-ui-timepicker-addon.js');
$cs->registerCssFile($baseUrl.'/js/datepicker_exact/css/jquery-ui.css?&v='.$version.'');
$cs->registerScriptFile($baseUrl . '/js/datepicker_exact/js/jquery-ui.js');
$cs->registerScriptFile($baseUrl . '/js/dist/bootstrap.min.js');
$cs->registerScriptFile($baseUrl . '/js/dhtmlx/dhtmlx.js?v=' . $version . '');
$cs->registerScriptFile($baseUrl . '/js/dhtmlx/dhtmlx.ex.js?v=' . $version . '');
$cs->registerScriptFile($baseUrl . '/js/dhtmlx/dhtmlxform_dyn.js');
$cs->registerCssFile($baseUrl . '/js/dhtmlx/dhtmlx.css?v=' . $version . '');


include_once dirname(__FILE__)."/../site/PublicView.php";

?>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->theme->baseUrl; ?>/css/style-advantest.css" />
    <script type="text/javascript">
        dhxSkin = "dhx_skyblue"
        dhtmlx.image_path = '<?php echo Yii::app()->baseUrl."/js/dhtmlx/imgs/"; ?>';

        function closeLeft(){
            if ($("#ccenter").attr('class')=="at_center")var op=0; else var op=1;
            $("#cleft").css('display',(op==0)?"none":"block");
            $("#ccenter").attr('class',(op==0)?"at_left":"at_center");
            $("#ct").css('margin-left',(op==0)?"-290px":"0px");
        }

        /*status: none: hidden the obj show: show the obj*/
        function toggle_collapse(objname,status){
            var obj = document.getElementById(objname);
            var img = document.getElementById(objname + '_img');

            if (!isUndefined(status)){
                obj.style.display = status=='none'?'none':'';
                img.src = status=='none' ? img.src.replace(/_no\.gif/, '_yes\.gif'):img.src.replace(/_yes\.gif/, '_no\.gif') ;
            } else {
                obj.style.display = obj.style.display == '' ? 'none' : '';

                img.src = img.src.indexOf('_yes.gif') == -1 ? img.src.replace(/_no\.gif/, '_yes\.gif') : img.src.replace(/_yes\.gif/, '_no\.gif')
            }
        };

    </script>


<script language="javascript">
    var DG = frameElement.lhgDG;
    DG.SetTitle('<?php echo $result["test_type"] == 0 ? "Final Test - " . $result["summary_data"]["tester_id"] : "Wafer Sort - " . $result["summary_data"]["tester_id"] . " "; ?><?php echo "   ".date('Y-m-d H:i:s'); ?>');
    //function( id, txt, fn, pos )
    DG.addBtn( 'ok', 'Refresh', reload );
    function reload()
    {
         window_reload();
    }
    DG.SetPosition('center', 'center');


   function export_ft_Csv() {
            var tmpUrl = 'Export_FT_WS_CSV?lotid='+'<?php echo $_GET['lotid']; ?>'+'&testerid='+'<?php echo $_GET['testerid']; ?>'+'&lotautoid='+'<?php echo $_GET['lotautoid'];?>'+'&start_time='+'<?php echo $_GET['start_time']; ?>'+'&end_time='+'<?php echo $_GET['end_time']; ?>'+'&stage='+'<?php echo $_GET['stage']; ?>';
            window.open(tmpUrl, 'Download', 'menubar=0');
     }
    function export_ws_Csv() {  
            var tmpUrl = 'Export_FT_WS_CSV?lotid='+'<?php echo $_GET['lotid']; ?>'+'&testerid='+'<?php echo $_GET['testerid']; ?>'+'&wafer_id='+"<?php echo $_GET['wafer_id'];?>"+'&waferautoid='+'<?php echo $_GET['waferautoid'];?>'+'&start_time='+'<?php echo $_GET['start_time'];?>'+'&end_time='+'<?php echo $_GET['end_time']; ?>'+'&stage='+'<?php echo $_GET['stage']; ?>'; 
            window.open(tmpUrl, 'Download', 'menubar=0');
    
 }


</script>


<style type='text/css'>
    table{border-collapse:collapse;border:1px solid #AAAAAA;background:#F4FFF4;background-color:#0080C0;border-spacing:0;font-family:verdana,arial,sans-serif;width:100%;font-size: 10pt;}
    table th {border:1px solid #AAAAAA;height:25px;background-color: #FFF; text-align: left;font-weight: bold;}
    table thead th {border:1px solid #AAAAAA;height:25px;background-color: #C8C8C8; text-align: left;font-weight: bold;}
    table td {border:1px solid #AAAAAA;height:25px;background-color: #FFF;}
    div {
        text-align: center;
    }
</style>
<?php
/*
 * author cherry
 * generate tester summary.
 * date 2013/6/21.
 *
 */


$basic_info = array();
$per_site = array();
$bin_info = array();
$per_site_bin_info = array();
$lot_variable = array();
if ($result["summary_data"] != "" && $result["summary_data"] != null) {
    $sumary_data = $result["summary_data"];
    foreach ($sumary_data as $label => $v) {
        if ($label == "per_site_yield") {
            $per_site["$label"] = $v;
        } else if ($label == "top_number_swbin" || $label == "top_number_hwbin") {
            $bin_info["$label"] = $v;
        } else if ($label == "per_site_swbin" || $label == "per_site_hwbin") {
            $per_site_bin_info["$label"] = $v;
        } else if($label == "lot_variable"){
            $lot_variable["$label"] = $v;
        }else {
            $basic_info["$label"] = $v;
        }
    }
}

function create_basic($sumary_data) {
        if ($sumary_data != "") {
            $col_cnts = count($sumary_data);
            echo '<table>';
            echo '<thead><tr><th colspan="' . $col_cnts . '">Basic Information</th></tr></thead>';
            echo '<tbody><tr>';
            foreach ($sumary_data as $key => $v) {
                $key = preg_replace("/\_/i", " ", $key);
                $key = ucwords($key);
                echo '<th>' . $key . '</th>';
            }
            echo '</tr></tbody>';
            echo '<tr>';
            foreach ($sumary_data as $key => $v) {
                echo '<td>' . $v . '</td>';
            }
            echo '</tr>';
            echo '</table><br/>';
        }
    }

    function create_per_site($sumary_data) {
        if ($sumary_data != "") {
            foreach ($sumary_data as $key => $v) {
                if ($v != null && $v != "") {
                    $cols_cnt = count($v);
                    $key = preg_replace("/\_/i", " ", $key);
                    $key = ucwords($key);
                    echo '<table>';
                    echo '<thead><tr><th colspan="' . $cols_cnt . '">' . $key . '(%)</th></tr></thead>';
                    echo '<tbody><tr>';
                    foreach ($v as $id => $yield) {
                        echo '<th> Site ' . $id . '</th>';
                    }
                    echo '</tr></tbody>';
                    echo '<tr>';
                    foreach ($v as $id => $yield) {
                        echo '<td>' . $yield . '</td>';
                    }
                    echo '</tr>';
                    echo '</table></br>';
                }
            }
        }
    }

    function create_bin($sumary_data,$key) {
        if ($sumary_data != "") {
                    $cols_cnt = count($sumary_data);
                    $key = preg_replace("/number/i", $cols_cnt, $key);
                    $key = preg_replace("/\_/i", " ", $key);
                    $key = ucwords($key);
                    echo '<table>';
                    echo '<thead><tr><th colspan="' . $cols_cnt . '">' . $key . '(cnt)</th></tr></thead>';
                    echo '<tbody><tr>';
                    foreach ($sumary_data as $bin => $cnt) {
                        echo '<th> Bin ' . $bin . '</th>';
                    }
                    echo '</tr></tbody>';
                    echo '<tr>';
                    foreach ($sumary_data as $bin => $cnt) {
                        echo '<td>' . $cnt . '</td>';
                    }
                    echo '</tr>';
                    echo '</table></br>';
                }
    }

    function create_per_site_bin($bin_info, $per_site_bin_info, $key) {
        if ($bin_info != null && $bin_info != "") {
            $cnt = count($bin_info);
            $key = preg_replace("/number/i", $cnt, $key);
            $key = preg_replace("/\_/i", " ", $key);
            $key = ucwords($key);
            $cnt = count($per_site_bin_info) + 1;
            echo '<table>';
            echo '<thead><tr><th colspan="' . $cnt . '">' . $key . ' For Per Site(cnt)</th></tr></thead>';
            echo '<tr>';
            echo '<td>Bin/Site</td>';
            foreach ($per_site_bin_info as $site => $bins) {
                    echo '<td> Site ' . $site . '</td>';
            }
            echo '</tr>';
            foreach ($bin_info as $bin => $cnt) {
                echo '<tr>';
                echo '<td>Bin ' . $bin . '(' . $cnt . ')</td>';
                    foreach ($per_site_bin_info as $site => $bins) {
                           if(isset ($per_site_bin_info[$site][$bin])){
                               $f_cnt = $per_site_bin_info[$site][$bin];
                                echo '<td>' . $f_cnt . '</td>';
                           }else{
                                echo '<td>0</td>';
                           }
                    }
                echo '</tr>';
            }
            echo '</table></br>';
        }
}

function create_lot_variables($summary_data){  //print_r($summary_data);
     if ($summary_data != "") {
            $col_cnts = count($summary_data);
            echo '<table>';
            echo '<thead><tr><th colspan="' . $col_cnts . '">Lot Variables</th></tr></thead>';
            echo '<tbody><tr>';
            foreach ($summary_data as $key => $v) {
                $key = preg_replace("/\_/i", " ", $key);
                $key = ucwords($key);
                echo '<th>' . $key . '</th>';

            }
            echo '</tr></tbody>';
            echo '<tr>';
            foreach ($summary_data as $key => $v) {
                echo '<td>' . $v . '</td>';
            }
            echo '</tr>';
            echo '</table><br/>';
        }
}
/*
*	02-3/2015
*	add by mort 
*	show lot_variables by vertiacl style
*/
function creat_lot_variables_vertical($summary_data){  

	    if($summary_data!=""){
            $col_cnts = count($summary_data);
            echo '<table>';
            echo '<thead><tr><th colspan="2">Lot Variables</th></tr></thead>';
            echo '<tr><th>Variable Name</th>'.'<th>Variable Value</th></tr>';

            foreach ($summary_data as $key => $v) {
                echo '<tbody><tr>';
                $key = preg_replace("/\_/i", " ", $key);
                $key = ucwords($key);
                echo '<td>' . $key . '</td>'.'<td>'.$v.'</td>';

	        echo '</tr></tbody>';

            }
            echo '</table><br/>';
			
			}

}

function create_FT_rawdata($raw_data){

	if(!empty($raw_data)){
	echo     '<div style="overflow:auto;height:90%"><table >
            <tr><th>Part Id</th><th>Test Start</th><th>Test End</th><th>Test Time(S)</th><th>Index Time(S)</th><th>Site</th><th>Pass/Fail</th><th>HBin</th><th>SBin</th></tr>';
                foreach($raw_data as $k=>$v){
		echo "<tr>";
                echo "<td >".$v['part_id']."</td>";
                echo "<td >".date('Y-m-d H:i:s', floor($v['start_time']/1000)).'.'.($v['start_time']%1000)."</td>";
                echo "<td >".date('Y-m-d H:i:s', floor($v['end_time']/1000)).'.'.($v['end_time']%1000)."</td>";
                echo "<td >".round($v['test_time']/1000,2)."</td>";
                echo "<td >".round($v['index_time']/1000,2)."</td>";
                echo "<td >".$v['site']."</td>";
                echo "<td >".($v['pf']==1?'Pass':'Fail')."</td>";
                echo "<td >".$v['hwb']."</td>";
                echo "<td >".$v['swb']."</td>";
                echo "</tr>";
				}

		echo '</table></div>
			<input type=button value="Export to CSV..." οnclick="javascript:export_ft_Csv()">';
			}
		}

function create_WS_rawdata($raw_data){

	if(!empty($raw_data)){
	echo     '<div style="overflow:auto;height:90%"><table >
            <tr><th>X Pos</th><th>Y Pos</th><th>Test Start</th><th>Test End</th><th>Test Time(S)</th><th>Index Time(S)</th><th>Site</th><th>P/F</th><th>HBin</th><th>SBin</th></tr>';
                foreach($raw_data as $k=>$v){
		echo "<tr>";
                echo "<td align='center' width='10%'>".$v[X]."</td>";
                echo "<td align='center' width='10%'>".$v[Y]."</td>";
                echo "<td align='center' width='20%'>".date('Y-m-d H:i:s', floor($v[start_time]/1000)).'.'.($v[start_time]%1000)."</td>";
                echo "<td align='center' width='20%'>".date('Y-m-d H:i:s', floor($v[end_time]/1000)).'.'.($v[end_time]%1000)."</td>";
                echo "<td >".round($v['test_time']/1000,2)."</td>";
                echo "<td >".round($v['index_time']/1000,2)."</td>";
                echo "<td align='center' width='5%'>".$v[site]."</td>";
                echo "<td align='center' width='5%'>".($v[pf]==1?'Pass':'Fail')."</td>";
                echo "<td align='center' width='5%'>".$v[hwb]."</td>";
                echo "<td align='center' width='5%'>".$v[swb]."</td>";
                echo "</tr>";
				}

		echo '</table></div>
			<input type=button value="Export to CSV..." οnclick="javascript:export_ws_Csv()">';
			}
		}



function creat_smarttest_session_table($summary_data){
	if($summary_data!=""){
            echo '<table>';
            echo '<thead><tr><th colspan="' . $col_cnts . '">Basic Information</th></tr></thead>';
            echo '<tbody><tr>';




		}




	}

?>
<div style="margin:20px;">
    <?php
        create_basic($basic_info);
        create_per_site($per_site);
        if($per_site_bin_info["per_site_swbin"] == "" || $per_site_bin_info["per_site_swbin"] == null) return;
    ?>
<dl id="tester_summary">
    <dt>SWB Summary</dt>
    <dd class='bmw ofy' style='height:728px;width:100%;'>
        <div><?php echo $swb_chart;?></div><br/>
       <?php
            create_bin($bin_info["top_number_swbin"],"top_number_swbin");
            create_per_site_bin($bin_info["top_number_swbin"], $per_site_bin_info["per_site_swbin"], "top_number_swbin");
       ?>
    </dd>
    <dt>HWB Summary</dt>
    <dd class='bmw ofy' style='height:728px;width:100%;'>
        <div><?php echo $hwb_chart;?></div><br/>
        <?php
            create_bin($bin_info["top_number_hwbin"],"top_number_hwbin");
            create_per_site_bin($bin_info["top_number_hwbin"], $per_site_bin_info["per_site_hwbin"], "top_number_hwbin");
        ?>
    </dd>
     <dt>Lot Variables</dt>
    <dd class='bmw ofy' style='height:auto;width:100%;'>
        <?php creat_lot_variables_vertical($lot_variable["lot_variable"]);?>
    </dd>
     <dt>Yield Trend</dt>
    <dd class='bmw ofy' style='height:auto;width:100%;'>
        <div>
		<div id="Yiled_chart" style="float:left;width:100%">
		<?php echo $rolling_yield_chart;?>
		</div>
		<div style="float:left;width:40%;clear:right"  >
		<table border="0" cellspacing="0" cellpadding="0"  style="border:0;!important">
		<tr><td style="border-style:none">Escaped count:</td><td style="border-style:none"><input type="text" id="Escaped_num"></td></tr>
		<tr><td style="border-style:none">Rolling count:</td><td style="border-style:none"><input type="text" id="Rolling_num"></td></tr>
		<tr><td style="border-style:none">Steps:</td><td style="border-style:none"><input type="text" id="Step_num"></td></tr>

		</table>
		</div>
		<div style="float:left;margin-left:10%"><hr style="width:1px;height:60px;"></hr></div>
 		</br>
		<div style="float:left;width:40%">
		<B>Rolling Yield ,Site selection</B>
		<br/>
		<?php if(!empty($msite)){  foreach($msite as $k=>$v){ ?>
		<input type="checkbox" name="msite" value="<?php echo $v;?>"/>
		<?php echo $v;?>
		
		<?php }} ?>
			</div>
	</div>
		<br/>
		<div style="float:left;width:100%">
		<input  type="button" value="Refresh" id="R_trend"/>
		</div>
    </dd>
	<?php if($_GET['type']=="FT"){?>
     <dt>Raw Data</dt>
    <dd class='bmw ofy' style='height:500px;width:100%;'>
		<input style="margin:10px" type=button value="Show Raw Data" οnclick="showrawdata()">
		<div id="raw_d" style="display:none">

	                <div id="div_hdtable" style="width:100%;"></div>
                <div id="hdtable" style="width:100%;height:200px"></div>
                <?php showPageInfo('hdpag'); ?>
		<input type=button value="Export to CSV..." οnclick="javascript:export_ft_Csv()">
		</div>
    </dd>
	<?php }else{?>
     <dt>Raw Data</dt>
    <dd class='bmw ofy' style='height:500px;width:100%;'>
		<input style="margin:10px" type=button value="Show Raw Data" οnclick="showrawdata()">

		<div id="raw_d" style="display:none">
                <div id="div_hdtable" style="width:100%;"></div>
                <div id="hdtable" style="width:100%;height:200px"></div>
                <?php showPageInfo('hdpag'); ?>
		<input type=button value="Export to CSV..." οnclick="javascript:export_ws_Csv()"/>
		</div>
    </dd>
	<?php }?> 

</dl>
</div>






<script type="text/javascript">


    $("#tester_summary").KandyTabs({trigger:"click"});

    function window_reload(){
        window.location.reload();
    }

</script>

<script>

    function showrawdata(){
    $("#raw_d").show();
    var re=/cp(.*)/ig;
    if(re.test('<?php echo $_GET['stage']?>'))
    reftable_WS();
	else
    reftable_FT();
		}
    function reftable_WS(){  //alert(111);
    mygrid = new dhtmlXGridObject('hdtable');
   // mygrid.setImagePath("../../codebase/imgs/");
    mygrid.setHeader("X Pos,Y Pos,Test Start,Test End,Test Time(S),Index Time(S),Site,P/F,HBin,SBin");
    mygrid.setInitWidthsP("10,10,10,10,10,10,10,10,10,10");
    mygrid.setColAlign("center,center,center,center,center,center,center,center,center,center");
    //mygrid.setColTypes("ed,dhxCalendar,dhxCalendarA");
    mygrid.enableEditEvents(false,false,false);
    mygrid.setColSorting("str,str,str,str,int,int,str,str,int,int");
    mygrid.enableAutoHeight(true);
    mygrid.enablePaging(true,30,1,"hdpag",true,'hdpag_info');
    mygrid.setPagingSkin("adv");
    mygrid.init();

    mygrid.loadXML('<?php echo $this->createUrl('Detail/rawdata?'.'testerid='.$_GET['testerid'].'&lotid='.$_GET['lotid'].'&waferautoid='.$_GET['waferautoid'].'&start_time='.$_GET['start_time'].'&end_time='.$_GET['end_time'].'&wafer_id='.$_GET['wafer_id'].'&stage='.$_GET['stage'].''); ?>');
	//alert(1111);
       // mygrid.entBox.onselectstart=function(e){(e||event), cancelBubble=true; return true;};
    }

    function reftable_FT(){
    mygrid = new dhtmlXGridObject('hdtable');
   // mygrid.setImagePath("../../codebase/imgs/");
//            <tr><th>Part Id</th><th>Test Start</th><th>Test End</th><th>Test Time(S)</th><th>Index Time(S)</th><th>Site</th><th>Pass/Fail</th><th>HBin</th><th>SBin</th></tr>';


    mygrid.setHeader("Part Id,Test Start,Test End ,Test Time(S),Index Time(S),Site,Pass/Fail,HBin,SBin");
    mygrid.setInitWidthsP("10,10,10,10,10,15,15,10,10");
    mygrid.setColAlign("center,center,center,center,center,center,center,center,center");
    //mygrid.setColTypes("ed,dhxCalendar,dhxCalendarA");
    mygrid.enableEditEvents(false,false,false);
    mygrid.setColSorting("str,str,str,int,int,str,str,int,int");
    mygrid.enableAutoHeight(true);
    mygrid.enablePaging(true,30,1,"hdpag",true,'hdpag_info');
    mygrid.setPagingSkin("adv");
    mygrid.init();

    mygrid.loadXML('<?php echo $this->createUrl('Detail/rawdata?'.'testerid='.$_GET['testerid'].'&lotid='.$_GET['lotid'].'&lotautoid='.$_GET['lotautoid'].'&start_time='.$_GET['start_time'].'&end_time='.$_GET['end_time'].'&wafer_id='.$_GET['wafer_id'].'&stage='.$_GET['stage'].''); ?>');

       // mygrid.entBox.onselectstart=function(e){(e||event), cancelBubble=true; return true;};
    }



    $(document).ready(function(){
	

        $("#ref_b").click(function(){
            reftable();

        });
	$("#R_trend").click(function(){ //alert()
	var re=/cp(.*)/ig;
	if(re.test("<?php echo $_GET['stage']?>")){
		var type=1;
		}else{
		var type=0;
		};
		var s="";
	$('input[name="msite"]:checked').each(function(){
		s+=$(this).val()+",";
		});	
		(s.length>0)&&(s=s.substring(0,s.length-1));
	$.ajax({
		type:"GET",
		url:"RefreshYieldTrend?<?php if($_GET['testerid'])echo 'testerid='.$_GET['testerid'];if($_GET['lotautoid'])echo '&id='.$_GET['lotautoid'];if($_GET['waferautoid'])echo '&id='.$_GET['waferautoid'];if($_GET['start_time'])echo '&start_time='.$_GET['start_time'];?>&type="+type,
		data:{rolling_size:$("#Rolling_num").val(),step_size:$("#Step_num").val(),escape_i:$("#Escaped_num").val(),msite:s},
		dataType:"text",
		success:function(data){
		$("#Yiled_chart").html(data);
			}

		});


		});

    });

</script>
<script>

	function RefreshYieldTrend(){

			


				}



</script>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值