<?php
include "asset/fungsi/fungsi_indotgl.php";
include "asset/fungsi/fungsi_rupiah.php";
error_reporting(0);
if(isset($_GET['id_perusahaan']))
{
	$rs=mysql_query("Select * from perusahaan where id_perusahaan='".$_GET['id_perusahaan']."'");
	$aa=mysql_fetch_array($rs);
	$peru=$aa['id_perusahaan'];

}
if(isset($_GET['id_paket']))
{
	$rs=mysql_query("Select * from paket where id_paket='".$_GET['id_paket']."'");
	$row=mysql_fetch_array($rs);
	$pak=$row['id_paket'];

}
?>
<div class="col-md-9">
<div class="panel panel-default">
<div class="panel-body">
	<div class="page-header">
			<h2>Penilaian Peserta</h2>
			<ol class="breadcrumb">

				<li><a href="?cat=web&page=evaluasi"><i class="fa fa-file-text-o"> Evaluasi </i></a></li>
				<li class="active"><i class="fa fa-"> Penilaian Peserta <b style="color:red"> <?php echo $aa['nama']; ?></b></i></li>
            </ol>
    </div>
<?php


if(isset($_POST['kualifikasi'])){
	$a=$_POST['skk0'];
	$b=$_POST['skk1'];
	$c=$_POST['skk2'];
	$d=$_POST['skk3'];
	$e=$_POST['skk4'];
	$nilai=$a + $b + $c + $d + $e;
	if($nilai<350){
	$keterangan_kual="GUGUR";
	}else{
	$keterangan_kual="lulus";
	}
	$alasan_kual=$_POST['alasan_kual'];
	
	$ra=mysql_query("Select * from kualifikasi where id_paket='$pak' and id_perusahaan='$peru'");
  	$ac=mysql_fetch_array($ra);
  	$id_kualifikasi=$ac['id_kualifikasi'];
    $id_paket=$ac['id_paket'];
    $id_perusahaan=$ac['id_perusahaan'];
  	
		$rs=mysql_query("Update kualifikasi SET skk1='$a', skk2='$b', skk3='$c', skk4='$d', skk5='$e', keterangan_kual='$keterangan_kual', alasan_kual='$alasan_kual', jumlah_kual='$nilai' Where id_kualifikasi='$id_kualifikasi'");
		$rsz=mysql_query("Update pemenang SET jumlah_kual='$nilai' Where id_paket='$pak' and id_perusahaan='$peru'");
    
    if($rs and $rsz)
	{
		?>
      <div class="row">
          <div class="col-md-offset-2 col-md-8">
          <div class="alert alert-success  alert-dismissable">
          <button type="button" class="close" data-dismiss="alert">x</button>
            <center>Nilai Berhasil diinput</center>
          
          </div></div></div>
    <?php
	}else
	{
		?>
      <div class="row">
          <div class="col-md-offset-2 col-md-8">
          <div class="alert alert-danger  alert-dismissable">
          <button type="button" class="close" data-dismiss="alert">x</button>
            <center>Terjadi kesalahan</center>
          
          </div></div></div>
    <?php
	}
	
}

if(isset($_POST['administrasi'])){
	$f=$_POST['ska0'];
	$g=$_POST['ska1'];
	$h=$_POST['ska2'];
	$i=$_POST['ska3'];
	$j=$_POST['ska4'];
	$nilai=$f + $g + $h + $i + $j;
	if($nilai<350){
	$keterangan_adm="GUGUR";
	}else{
	$keterangan_adm="lulus";
	}
	$alasan_adm=$_POST['alasan_adm'];
	
	$ra=mysql_query("Select * from administrasi where id_paket='$pak' and id_perusahaan='$peru'");
  	$a=mysql_fetch_array($ra);
  	$id_administrasi=$a['id_administrasi'];
    $id_paket=$a['id_paket'];
    $id_perusahaan=$a['id_perusahaan'];
  	
	$rs=mysql_query("Update administrasi SET ska1='$f', ska2='$g', ska3='$h', ska4='$i', ska5='$j', keterangan_adm='$keterangan_adm', alasan_adm='$alasan_adm', jumlah_adm='$nilai' Where id_administrasi='$id_administrasi'");
    $rsz=mysql_query("Update pemenang SET jumlah_adm='$nilai' Where id_paket='$pak' and id_perusahaan='$peru'");
    
  if($rs and $rsz)
	{
		?>
      <div class="row">
          <div class="col-md-offset-2 col-md-8">
          <div class="alert alert-success  alert-dismissable">
          <button type="button" class="close" data-dismiss="alert">x</button>
            <center>Nilai Berhasil diinput</center>
          
          </div></div></div>
    <?php
	}else
	{
		?>
      <div class="row">
          <div class="col-md-offset-2 col-md-8">
          <div class="alert alert-danger  alert-dismissable">
          <button type="button" class="close" data-dismiss="alert">x</button>
            <center>Terjadi kesalahan</center>
          
          </div></div></div>
    <?php
	}
}

if(isset($_POST['teknis'])){
	$k=$_POST['skt0'];
	$l=$_POST['skt1'];
	$m=$_POST['skt2'];
	$n=$_POST['skt3'];
	$o=$_POST['skt4'];
	$nilai=$k + $l + $m + $n + $o;
	if($nilai<350){
	$keterangan_teknis="GUGUR";
	}else{
	$keterangan_teknis="LULUS";
	}
	$alasan_teknis=$_POST['alasan_teknis'];
	
	$ra=mysql_query("Select * from teknis where id_paket='$pak' and id_perusahaan='$peru'");
  	$a=mysql_fetch_array($ra);
  	$id_teknis=$a['id_teknis'];
    $id_paket=$a['id_paket'];
    $id_perusahaan=$a['id_perusahaan'];
  	
		$rs=mysql_query("Update teknis SET skt1='$k', skt2='$l', skt3='$m', skt4='$n', skt5='$o', keterangan_teknis='$keterangan_teknis', jumlah_teknis='$nilai', alasan_teknis='$alasan_teknis' Where id_teknis='$id_teknis'");
	$rsz=mysql_query("Update pemenang SET jumlah_teknis='$nilai' Where id_paket='$pak' and id_perusahaan='$peru'");
    
  if($rs and $rsz)
	{
		?>
      <div class="row">
          <div class="col-md-offset-2 col-md-8">
          <div class="alert alert-success  alert-dismissable">
          <button type="button" class="close" data-dismiss="alert">x</button>
            <center>Nilai Berhasil diinput</center>
          
          </div></div></div>
    <?php
	}else
	{
		?>
      <div class="row">
          <div class="col-md-offset-2 col-md-8">
          <div class="alert alert-danger  alert-dismissable">
          <button type="button" class="close" data-dismiss="alert">x</button>
            <center>Terjadi kesalahan</center>
          
          </div></div></div>
    <?php
	}
}


if(isset($_POST['harga'])){
	$p=$_POST['skh1'];
  
 
  $nilai=$p;
	if($nilai<70){
	$keterangan_hrg="GUGUR";
	}else{
	$keterangan_hrg="LULUS";
	}
	$alasan_hrg=$_POST['alasan_hrg'];
	
	$ra=mysql_query("Select * from harga where id_paket='$pak' and id_perusahaan='$peru'");
  	$a=mysql_fetch_array($ra);
  	$id_harga=$a['id_harga'];
    $id_paket=$a['id_paket'];
    $id_perusahaan=$a['id_perusahaan'];
  	
		$rs=mysql_query("Update harga SET skh1='$p', keterangan_hrg='$keterangan_hrg', jumlah_hrg='$nilai', alasan_hrg='$alasan_hrg' Where id_harga='$id_harga'");
	$rsz=mysql_query("Update pemenang SET jumlah_harga='$nilai' Where id_paket='$pak' and id_perusahaan='$peru'");
    
  if($rs and $rsz)
	{
		?>
      <div class="row">
          <div class="col-md-offset-2 col-md-8">
          <div class="alert alert-success  alert-dismissable">
          <button type="button" class="close" data-dismiss="alert">x</button>
            <center>Nilai Berhasil diinput</center>
          
          </div></div></div>
    <?php
	}else
	{
		?>
      <div class="row">
          <div class="col-md-offset-2 col-md-8">
          <div class="alert alert-danger  alert-dismissable">
          <button type="button" class="close" data-dismiss="alert">x</button>
            <center>Terjadi kesalahan</center>
          
          </div></div></div>
    <?php
	}
}


?>

<div class="col-md-5">
  <div class="panel panel-default">
  
  <div class="panel-heading"><span class="fa fa-list"></span> <b>Rincian Paket</b></div>
  <div class="panel-body">
  
  <table class="table table-striped">
				<thead>
					<tr>
    					<td align="left">Nama Paket</td>
						<td align="center"> <?php echo $row['nama_paket']; ?> </td>
					</tr>
					<tr>
   						<td align="left">Nama Proyek</td>
						<td align="center"> <?php echo $row['nama_proyek']; ?> </td>
					</tr>
					<tr>
   						<td align="left">HPS</td>
						<td align="center"> <?php $hps=format_rupiah($row['hps']); echo"Rp. ";echo $hps; ?> </td>
					</tr>
					<tr>
   						<td align="left">Keterangan</td>
						<td align="center"> <?php echo $row['kecamatan']; ?> </td>
					</tr>
				</thead>
			</table>
  
  </div>
  </div>
  </div>




<div class="col-md-7">
  <div class="panel panel-default">
  
  <div class="panel-heading"><span class="fa fa-edit"></span> <b>Daftar Nilai</b></div>
  <div class="panel-body">
  <?php
  		$ras=mysql_query("Select * from kualifikasi 
  		JOIN evaluasi on kualifikasi.id_kualifikasi=evaluasi.id_kualifikasi
  		JOIN administrasi on evaluasi.id_administrasi=administrasi.id_administrasi 
  		JOIN harga on evaluasi.id_harga=harga.id_harga
  		JOIN teknis on evaluasi.id_teknis=teknis.id_teknis
  		JOIN perusahaan on evaluasi.id_perusahaan=perusahaan.id_perusahaan
  		JOIN paket on evaluasi.id_paket=paket.id_paket
  		where paket.id_paket='$pak' and perusahaan.id_perusahaan='$peru'");
      $aas=mysql_fetch_array($ras);
      $jumlah_kual=$aas['jumlah_kual'];
       $jumlah_adm=$aas['jumlah_adm'];
        $jumlah_teknis=$aas['jumlah_teknis'];
         $jumlah_harga=$aas['jumlah_hrg'];

         $keterangan_kual=$aas['keterangan_kual'];
           $keterangan_adm=$aas['keterangan_adm'];
             $keterangan_teknis=$aas['keterangan_teknis'];
               $keterangan_harga=$aas['keterangan_hrg'];

        $jumlah_total=$jumlah_kual + $jumlah_adm + $jumlah_harga + $jumlah_teknis;

      $rszr=mysql_query("Update pemenang SET jumlah_total='$jumlah_total' Where id_paket='$pak' and id_perusahaan='$peru'");
      $rao=mysql_query("Select * from pemenang where id_paket='$pak' and id_perusahaan='$peru'");
      $axi=mysql_fetch_array($rao);
      $jumlah_total=$axi['jumlah_total'];
      $hps=$aas['hps'];

      if($jumlah_total==1120){
        $benefit=$hps;
      }else{
        $benefit=$hps * $jumlah_total / 1120;
      }

      $nilai_bcr=$benefit / $hps;
      $rszr=mysql_query("Update pemenang SET nilai_bcr='$nilai_bcr' Where id_paket='$pak' and id_perusahaan='$peru'");
      
      if($keterangan_kual=='GUGUR' or $keterangan_adm=='GUGUR' or $keterangan_teknis=='GUGUR' or $keterangan_harga=='GUGUR' or $nilai_bcr<'1'){
         $tidak_lulus="GUGUR";
          $rszr=mysql_query("Update pemenang SET status='$tidak_lulus' Where id_paket='$pak' and id_perusahaan='$peru'");
      
      }else{
        $lulus="lulus";
         $rszr=mysql_query("Update pemenang SET status='$lulus' Where id_paket='$pak' and id_perusahaan='$peru'");
      
      }


  		?>
<table class="table table-bordered" cellspacing="0" width="50%">
		<thead>
		<tr class="success">
			<th width="2%"><center>No</center></th>
			<th><center>Aspek</center></th>
        	<th width="20%"><center>Jumlah Nilai</center></th>
            <th><center>Keterangan</center></th>
            <th width="30%"><center>Alasan</center></th>
         
		</tr>
		</thead>
		<tbody>
       <?php
      $ra=mysql_query("Select * from kualifikasi 
      JOIN evaluasi on kualifikasi.id_kualifikasi=evaluasi.id_kualifikasi
      JOIN administrasi on evaluasi.id_administrasi=administrasi.id_administrasi 
      JOIN harga on evaluasi.id_harga=harga.id_harga
      JOIN teknis on evaluasi.id_teknis=teknis.id_teknis
      JOIN perusahaan on evaluasi.id_perusahaan=perusahaan.id_perusahaan
      JOIN paket on evaluasi.id_paket=paket.id_paket
      where paket.id_paket='$pak' and perusahaan.id_perusahaan='$peru'");

      while($a=mysql_fetch_array($ra))
      {


      ?>
   		<tr>
    		<td align="center">1</td>
    		<td>Kualifikasi</td>
    		<td><center><?php echo$a['jumlah_kual'];?></center></td>
    		<?php 
    		if( $a['keterangan_kual']=='lulus'){
    		?><td ><center><div class="label label-success"><?php echo $a['keterangan_kual']; ?></div></center></td>
    		<?php
    		}else{
    		?><td ><center><div class="label label-danger"><?php echo $a['keterangan_kual']; ?></div></center></td>
    		<?php
    		}
    		?>
    		<td><center><?php echo $a['alasan_kual']; ?> </center></td>
    	</tr>
    	<tr>
    	<td align="center">2</td>
    		<td>Administrasi</td>
    		<td><center><?php echo $a['jumlah_adm']; ?></center></td>
    		<?php 
    		if( $a['keterangan_adm']=='lulus'){
    		?><td ><center><div class="label label-success"><?php echo $a['keterangan_adm']; ?></div></center></td>
    		<?php
    		}else{
    		?><td ><center><div class="label label-danger"><?php echo $a['keterangan_adm']; ?></div></center></td>
    		<?php
    		}
    		?>
    		<td><center><?php echo $a['alasan_adm']; ?></center></td>
    	</tr>
    	<tr>
    	<td align="center">3</td>
    		<td>Teknis</td>
    		<td><center><?php echo $a['jumlah_teknis']; ?></center></td>
    		<?php 
    		if( $a['keterangan_teknis']=='lulus' || $a['keterangan_teknis']=='LULUS'){
    		?><td ><center><div class="label label-success"><?php echo $a['keterangan_teknis']; ?></div></center></td>
    		<?php
    		}else{
    		?><td ><center><div class="label label-danger"><?php echo $a['keterangan_teknis']; ?></div></center></td>
    		<?php
    		}
    		?>
    		<td><center><?php echo $a['alasan_teknis']; ?></center></td>
    	</tr>
    	<tr>
    	<td align="center">4</td>
    		<td>Harga</td>
    		<td><center><?php echo $a['jumlah_hrg']; ?></center></td>
    		<?php 
    		if( $a['keterangan_hrg']=='lulus' || $a['keterangan_hrg']=='LULUS'){
    		?><td ><center><div class="label label-success"><?php echo $a['keterangan_hrg']; ?></div></center></td>
    		<?php
    		}else{
    		?><td ><center><div class="label label-danger"><?php echo $a['keterangan_hrg']; ?></div></center></td>
    		<?php
    		}
    		?>
    		<td><center><?php echo $a['alasan_hrg']; ?></center></td>
		</tr>
		<?php
 		 }
 		?>
		</tbody>
</table>


<table class="table table-bordered" cellspacing="0" width="50%">
<thead>
<th width="5%" >No</th>
<th width="45%">HPS</th>
<th width="45%">Harga Penawaran</th>
</thead>
<tbody>
<?php
$ra=mysql_query("Select * from harga where id_paket='$pak' and id_perusahaan='$peru'");
  $a=mysql_fetch_array($ra);
  $hps=format_rupiah($row['hps']);
  $harga_penawaran=format_rupiah($a['harga_penawaran']);
?>
<tr>
<td align="center">1</td>
<td><?php echo"Rp. "; echo $hps ?></td>
<td><?php echo"Rp. "; echo $harga_penawaran; ?></td>
</tr>

</tbody>
</table>

 </div>
  </div>
  </div>


<div class="col-md-12">
  <div class="panel panel-default">
  
  <div class="panel-heading"><span class="fa fa-edit"></span> <b>Silahkan Melakukan Penilaian </b></div>
  <div class="panel-body">
<div>
<div class="row">
          <div class="col-md-offset-2 col-md-8">
          <div class="alert alert-info  alert-dismissable">
          <button type="button" class="close" data-dismiss="alert"></button>
            <center>Keterangan: Nilai tertinggi = 100 & Nilai terendah = 0</center>
          
          </div></div></div>

  <ul class="nav nav-tabs" role="tablist">
    <li role="presentation" class="active"><a href="#kualifikasi" aria-controls="home" role="tab" data-toggle="tab">Kualifikasi</a></li>
    <li role="presentation"><a href="#administrasi" aria-controls="profile" role="tab" data-toggle="tab">Administrasi</a></li>
    <li role="presentation"><a href="#teknis" aria-controls="messages" role="tab" data-toggle="tab">Teknis</a></li>
    <li role="presentation"><a href="#harga" aria-controls="settings" role="tab" data-toggle="tab">Harga</a></li>
  </ul>

  <!-- Tab panes -->
  <div class="tab-content">
  <div role="tabpanel" class="tab-pane fade in active" id="kualifikasi">
  <p></p>
  <form action="" method="post">
  <div class="col-md-12">
  <table class="table table-bordered" >
		<thead>
		<tr class="success">
			<td width="5%"><center>No.</center></td>
			<td width="45%">Dokumen</td>
			<td width="20%"><center>Status</center></td>
			<td width="20%"><center>Lihat File</center></td>
			<td width="10%"><center>Nilai</center></td>
		</tr>
		
		
		</thead>
		
		
    <tbody>
    <?php
      $ra=mysql_query("Select * from file_upload where id_paket='$pak' and id_perusahaan='$peru'");
      $a=mysql_fetch_array($ra);
      $rz=mysql_query("Select * from kualifikasi where id_paket='$pak' and id_perusahaan='$peru'");
      $az=mysql_fetch_array($rz);
      $skk1=$a['skk1'];
      $skk2=$a['skk2'];
      $skk3=$a['skk3'];
      $skk4=$a['skk4'];
      $skk5=$a['skk5'];

     $nilai1=$az['skk1'];
      $nilai2=$az['skk2'];
      $nilai3=$az['skk3'];
      $nilai4=$az['skk4'];
      $nilai5=$az['skk5'];
        $skk=array($skk1,$skk2,$skk3,$skk4,$skk5);
        $skk1=array($nilai1,$nilai2,$nilai3,$nilai4,$nilai5);
     for ($i= 0; $i <= 4; $i++){
      ?>
      <tr>
        <td align="center"><?php echo $i+1;?></td>
        <td>surat keterangan kualifikasi <?php echo $i+1;?></td>
        <td><?php 

        if(empty($skk[$i])){

        ?> <center><span class="label label-danger">belum upload</span></center>
        <td><center><a class="btn btn-default" disabled><i class="fa fa-eye"></i></a></center></td>
             <td>
            <div class="col-md-12">
            <input  type="text" name="skk<?php echo $i;?>" id="skk<?php echo $i;?>" value="<?php echo $skk1[$i]; ?>" class="form-control" disabled>
           
            </div>
            </td>
          
        <?php
        }else{ ?><center><span class="label label-success">sudah upload</span></center>
        
        <td><center><a class="btn btn-default tooltipsku" href="#" data-toggle="modal" data-target="#modal_kualifikasi<?php echo $i;?>" data-placement="top" title="Lihat File"><i class="fa fa-eye"></i></a></center></td>
        <td>
            <div class="col-md-12">
            <input  type="text" name="skk<?php echo $i;?>" id="skk<?php echo $i;?>" value="<?php echo $skk1[$i]; ?>" class="form-control" >
            </div>
            </td>
            <?php
        }
        ?></td>
      </tr>

      <?php
      }
      ?>
   
           
    	<tr>
            <td colspan="4" align="center">Jumlah Nilai</td>
            <td><div class=" pesan col-md-8 col-md-offset-2 label label-info" align="center" style="font-size:14pt">
              <?php echo $az['jumlah_kual']; ?>
            </div></td>
            </tr>
    	
    	<tr>
    		<td colspan="4" align="center">Keterangan</td>
    		<td><center><div class="keterangan"> <?php echo $az['keterangan_kual']; ?> </div></center></td>
    	
    	</tr>
    	<tr>
    	<td colspan="4" align="center">Alasan GUGUR
    		
    		<input class="form-control" name="alasan_kual" value="<?php echo $az['alasan_kual']; ?>"></td>
    
        <td><center><br><button type="submit" class="btn btn-primary" name="kualifikasi">Simpan</button></center></td>
        </form>
    	</tr>
    	
		
		
		</tbody>
</table>
   <script src="asset/js/jquery.js"></script>
 <script src="asset/js/jquery.min.js"></script>
 
  <script language="JavaScript">
function hitung(){
    a= parseInt( $("#skk0").val() );     
    b= parseInt( $("#skk1").val() );
    c= parseInt( $("#skk2").val() );
    d= parseInt( $("#skk3").val() );     
    e= parseInt( $("#skk4").val() );
  
    if(isNaN(a))a=0;     
    if(isNaN(b))b=0;
    if(isNaN(c))c=0;
    if(isNaN(d))d=0;     
    if(isNaN(e))e=0;
    total = a + b + c + d + e;
    if(total<350){
    $(".keterangan").empty().append("");  
    $(".keterangan").append("GUGUR");
    }else{
    $(".keterangan").empty().append("");  
    $(".keterangan").append("LULUS");
    }
    $(".pesan").empty().append("");     
    $(".pesan").append(total);
    }
    
	$("#skk0, #skk1, #skk2, #skk3, #skk4").keyup(function(){     hitung(); });
</script>


  
  </div>
  </div>
  
  <div role="tabpanel" class="tab-pane fade" id="administrasi">
  <p></p>
  <form method="post">
  <div class="col-md-12">
  <table class="table table-bordered" >
		<thead>
			<tr class="success">
			<td width="5%"><center>No.</center></td>
			<td width="45%">Dokumen</td>
			<td width="20%"><center>Status</center></td>
			<td width="20%"><center>Download File</center></td>
			<td width="10%"><center>Nilai</center></td>
		</tr>
		
		
		</thead>
    <tbody>
    <?php
      $raa=mysql_query("Select * from file_upload where id_paket='$pak' and id_perusahaan='$peru'");
      $aa=mysql_fetch_array($raa);
      $rza=mysql_query("Select * from administrasi where id_paket='$pak' and id_perusahaan='$peru'");
      $aza=mysql_fetch_array($rza);
      $ska1=$aa['ska1'];
      $ska2=$aa['ska2'];
      $ska3=$aa['ska3'];
      $ska4=$aa['ska4'];
      $ska5=$aa['ska5'];

      $nilai1=$aza['ska1'];
      $nilai2=$aza['ska2'];
      $nilai3=$aza['ska3'];
      $nilai4=$aza['ska4'];
      $nilai5=$aza['ska5'];
     
        $ska=array($ska1,$ska2,$ska3,$ska4,$ska5);
        $ska1=array($nilai1,$nilai2,$nilai3,$nilai4,$nilai5);
     for ($i= 0; $i <= 4; $i++){
      ?>
      <tr>
        <td align="center"><?php echo $i+1;?></td>
        <td>surat keterangan administrasi <?php echo $i+1;?></td>
        <td><?php 

        if(empty($ska[$i])){
        ?> <center><span class="label label-danger">belum upload</span></center>
        <td><center><a class="btn btn-default" disabled><i class="fa fa-eye"></i></a></center></td>
             <td>
            <div class="col-md-12">
            <input  type="text" name="ska<?php echo $i;?>" id="ska<?php echo $i;?>" value="<?php echo $ska1[$i]; ?>" class="form-control" disabled>
           
            </div>
            </td>
          
       
        <?php
        }else{ ?> <center><span class="label label-success">sudah upload</span></center>
        
        <td><center><a class="btn btn-default tooltipsku" href="#" data-toggle="modal" data-target="#modal_administrasi<?php echo $i;?>" data-placement="top" title="Lihat File"><i class="fa fa-eye"></i></a></center></td>
        <td>
            <div class="col-md-12">
            <input  type="text" name="ska<?php echo $i;?>" id="ska<?php echo $i;?>" value="<?php echo $ska1[$i]; ?>" class="form-control" >
            </div>
            </td>
          
            <?php
        }
        ?>
      </td>
      </tr>
  
      <?php
      }
      ?>
  
           
      <tr>
            <td colspan="4" align="center">Jumlah Nilai</td>
            <td><div class=" pesan1 col-md-8 col-md-offset-2 label label-info" align="center" style="font-size:14pt">
              <?php echo $aza['jumlah_adm']; ?>
            </div></td>
            </tr>
      
      <tr>
        <td colspan="4" align="center">Keterangan</td>
        <td><center><div class="keterangan1"> <?php echo $aza['keterangan_adm']; ?> </div></center></td>
      
      </tr>
      <tr>
      <td colspan="4" align="center">Alasan GUGUR
        
        <input class="form-control" name="alasan_adm" value="<?php echo $aza['alasan_adm']; ?>"></td>
    
        <td><center><br><button type="submit" class="btn btn-primary" name="administrasi">Simpan</button></center></td>
        </form>
      </tr>
      
    
    
    </tbody>
<script language="JavaScript">
function hitung1(){
    f= parseInt( $("#ska0").val() );     
    g= parseInt( $("#ska1").val() );
    h= parseInt( $("#ska2").val() );
    i= parseInt( $("#ska3").val() );     
    j= parseInt( $("#ska4").val() );
  
    if(isNaN(f))f=0;     
    if(isNaN(g))g=0;
    if(isNaN(h))h=0;
    if(isNaN(i))i=0;     
    if(isNaN(j))j=0;
    total = f + g + h + i + j;
    if(total<350){
    $(".keterangan1").empty().append("");  
    $(".keterangan1").append("GUGUR");
    }else{
    $(".keterangan1").empty().append("");  
    $(".keterangan1").append("LULUS");
    }
    $(".pesan1").empty().append("");     
    $(".pesan1").append(total);
    }
    
    $("#ska0, #ska1, #ska2, #ska3, #ska4").keyup(function(){     hitung1(); });
</script>


 		
</table>
  
  
  </div>
  </div>
  <div role="tabpanel" class="tab-pane fade" id="teknis">
  <p></p>
  <form method="post">
  <div class="col-md-12">
  <table class="table table-bordered" >
		<thead>
			<tr class="success">
			<td width="5%"><center>No.</center></td>
			<td width="45%">Dokumen</td>
			<td width="20%"><center>Status</center></td>
			<td width="20%"><center>Download File</center></td>
			<td width="10%"><center>Nilai</center></td>
		</tr>
		</thead>
    <tbody>
    <?php
      $rat=mysql_query("Select * from file_upload where id_paket='$pak' and id_perusahaan='$peru'");
      $at=mysql_fetch_array($rat);
      $rzt=mysql_query("Select * from teknis where id_paket='$pak' and id_perusahaan='$peru'");
      $azt=mysql_fetch_array($rzt);
      $skt1=$at['skt1'];
      $skt2=$at['skt2'];
      $skt3=$at['skt3'];
      $skt4=$at['skt4'];
      $skt5=$at['skt5'];

      $nilai1=$azt['skt1'];
      $nilai2=$azt['skt2'];
      $nilai3=$azt['skt3'];
      $nilai4=$azt['skt4'];
      $nilai5=$azt['skt5'];
     
        $skt=array($skt1,$skt2,$skt3,$skt4,$skt5);
        $skt1=array($nilai1,$nilai2,$nilai3,$nilai4,$nilai5);
     for ($i= 0; $i <= 4; $i++){
      ?>
      <tr>
        <td align="center"><?php echo $i+1;?></td>
        <td>surat keterangan administrasi <?php echo $i+1;?></td>
        <td><?php 

        if(empty($skt[$i])){
        ?> <center><span class="label label-danger">belum upload</span></center>
        <td><center><a class="btn btn-default" disabled><i class="fa fa-eye"></i></a></center></td>
             <td>
            <div class="col-md-12">
            <input  type="text" name="skt<?php echo $i;?>" id="skt<?php echo $i;?>" value="<?php echo $skt1[$i]; ?>" class="form-control" disabled>
           
            </div>
            </td>
          
       
        <?php
        }else{ ?> <center><span class="label label-success">sudah upload</span></center>
        
        <td><center><a class="btn btn-default tooltipsku" href="#" data-toggle="modal" data-target="#modal_teknis<?php echo $i;?>" data-placement="top" title="Lihat File"><i class="fa fa-eye"></i></a></center></td>
        <td>
            <div class="col-md-12">
            <input  type="text" name="skt<?php echo $i;?>" id="skt<?php echo $i;?>" value="<?php echo $skt1[$i]; ?>" class="form-control" >
            </div>
            </td>
          
            <?php
        }
        ?>
      </td>
      </tr>
  
      <?php
      }
      ?>
  
           
      <tr>
            <td colspan="4" align="center">Jumlah Nilai</td>
            <td><div class=" pesan2 col-md-8 col-md-offset-2 label label-info" align="center" style="font-size:14pt">
              <?php echo $azt['jumlah_teknis']; ?>
            </div></td>
            </tr>
      
      <tr>
        <td colspan="4" align="center">Keterangan</td>
        <td><center><div class="keterangan2"> <?php echo $azt['keterangan_teknis']; ?> </div></center></td>
      
      </tr>
      <tr>
      <td colspan="4" align="center">Alasan GUGUR
        
        <input class="form-control" name="alasan_teknis" value="<?php echo $azt['alasan_teknis']; ?>"></td>
    
        <td><center><br><button type="submit" class="btn btn-primary" name="teknis">Simpan</button></center></td>
        </form>
      </tr>
      
    </tbody>
		

<script language="JavaScript">
function hitung2(){
    k= parseInt( $("#skt0").val() );     
    l= parseInt( $("#skt1").val() );
    m= parseInt( $("#skt2").val() );
    n= parseInt( $("#skt3").val() );     
    o= parseInt( $("#skt4").val() );
  
    if(isNaN(k))k=0;     
    if(isNaN(l))l=0;
    if(isNaN(m))m=0;
    if(isNaN(n))n=0;     
    if(isNaN(o))o=0;
    total = k + l + m + n + o;
     if(total<350){
    $(".keterangan2").empty().append("");  
    $(".keterangan2").append("GUGUR");
    }else{
    $(".keterangan2").empty().append("");  
    $(".keterangan2").append("LULUS");
    }
    $(".pesan2").empty().append("");     
    $(".pesan2").append(total);
    }
    
    $("#skt0, #skt1, #skt2, #skt3, #skt4").keyup(function(){     hitung2(); });
</script>

</table>
  
  
  </div>
  </div>
  <div role="tabpanel" class="tab-pane fade" id="harga">
  <p></p>
  <form method="post">
  <div class="col-md-12">
  <table class="table table-bordered" >
		<thead>
			<tr class="success">
			<td width="5%"><center>No.</center></td>
			<td width="45%">Dokumen</td>
			<td width="20%"><center>Status / harga</center></td>
			<td width="20%"><center>Download File</center></td>
			<td width="10%"><center>Nilai</center></td>
		</tr>
		
		
		</thead>
		<tbody>
		<?php
      $rah=mysql_query("Select * from file_upload where id_paket='$pak' and id_perusahaan='$peru'");
      $ah=mysql_fetch_array($rah);

  		$ra=mysql_query("Select * from harga where id_paket='$pak' and id_perusahaan='$peru'");
  		while($a=mysql_fetch_array($ra))
  		{
         $skh1=$ah['skh1'];
        $nilai1=$a['skh1'];
  		?>
   		<tr>
    		<td align="center">1</td>
    		<td>surat keterangan harga 1</td>
    		<td><?php
           if(empty($skh1[$i])){
        ?> <center><span class="label label-danger">belum upload</span></center>
        <td><center><a class="btn btn-default" disabled><i class="fa fa-eye"></i></a></center></td>
             <td>
            <div class="col-md-12">
            <input  type="text" name="skh1" id="skh1" value="<?php echo $nilai1; ?>" class="form-control" disabled>
           
            </div>
            </td>
          
       
        <?php
        }else{ ?> <center><span class="label label-success">sudah upload</span></center>
        
        <td><center><a class="btn btn-default tooltipsku" href="#" data-toggle="modal" data-target="#modal_harga" data-placement="top" title="Lihat File"><i class="fa fa-eye"></i></a></center></td>
        <td>
            <div class="col-md-12">
            <input  type="text" name="skh1" id="skh1" value="<?php echo $nilai1; ?>" class="form-control" >
            </div>
            </td>
          
            <?php
        }
        ?>
      </td>

    	</tr>
    	
    	<tr>
            <td colspan="4" align="center">Jumlah Nilai</td>
            <td><div class=" pesan3 col-md-8 col-md-offset-2 label label-info" align="center" style="font-size:14pt">0
            </div></td>
        </tr>
         <tr>
    		<td colspan="4" align="center">Keterangan</td>
    		<td><center><div class="keterangan3" name="keterangan_harga"> </div></center></td>
    		
    	</tr>
        <tr>
    	<td colspan="4" align="center">Alasan GUGUR
        <input class="form-control" name="alasan_hrg" value="<?php echo $a['alasan_hrg']; ?>"></td>
      <input type="hidden" name="harga_penawaran" value="<?php echo $a['harga_penawaran']; ?>">
    		<td><br><button type="submit" class="btn btn-primary" name="harga">Simpan</button></td>
    		
    	</tr>
		</form>

<script language="JavaScript">
function hitung3(){
    p= parseInt( $("#skh1").val() );    
  
    if(isNaN(p))p=0;   
    total = p;
    if(total<70){
    $(".keterangan3").empty().append("");  
    $(".keterangan3").append("GUGUR");
    }else{
    $(".keterangan3").empty().append("");  
    $(".keterangan3").append("LULUS");
    }
    $(".pesan3").empty().append("");     
    $(".pesan3").append(total);
    }
    
    $("#skh1").keyup(function(){     hitung3(); });
</script>
    	
    	
		<?php
 		 }
 		?>
 		
		</tbody>
</table>
  
  
  </div>
  </div>
</div>


</div>
  </div>
  </div>
</div>

</div>
</div>

</div>
</div>


<?php

 for ($i= 0; $i <= 4; $i++){
?>
<div id="modal_kualifikasi<?php echo $i;?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">File Terupload</h4>
            </div>
            <div class="modal-body">

          <form class="form-horizontal">
<div class="form-group">
  <div class="col-md-12">
   <table class="table table-bordered">
      <tr class="success">
        <td><center>No</center></td>
        <td>Surat Keterangan Kualifikasi <?php echo$i+1;?></td>
        <td><center>Download</center></td>
        
      </tr>
      <tr>
        <?php
        $no=0;
        $ra=mysql_query("Select * from file_upload where id_paket='$pak' and id_perusahaan='$peru'");
      while($a=mysql_fetch_array($ra)){ 
      $skk[]=$a['skk1'];
      $skk[]=$a['skk2'];
      $skk[]=$a['skk3'];
      $skk[]=$a['skk4'];
      $skk[]=$a['skk5'];
      $file=explode(',', $skk[$i]);
      for ($c=0;$c<count($file);$c++){$no++;
        $bb=$file[$c];
     
      ?>
        <td align="center"><?php echo $no;?></td>

        <td><?php echo $bb."</br>"; ?></td>

        <td><center><a class="btn btn-default tooltipsku" target="_blank"  href="./asset/file/kualifikasi/<?php echo $bb; ?>" data-placement="top" title="Download"><i class="fa fa-download"></i></a></center></td>
         </tr>
   
  <?php
    }
     }
      ?>
        
        
        
      
     
    </table>
</form>

  </div></div>

  

            </div>
 
        </div>
    </div>
</div>
<?php
}
?>

<?php

 for ($i= 0; $i <= 4; $i++){
?>
<div id="modal_administrasi<?php echo $i;?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">File Terupload</h4>
            </div>
            <div class="modal-body">

          <form class="form-horizontal">
<div class="form-group">
  <div class="col-md-12">
   <table class="table table-bordered">
      <tr class="success">
        <td><center>No</center></td>
        <td>Surat Keterangan Administrasi <?php echo$i+1;?></td>
        <td><center>Download</center></td>
        
      </tr>
      <tr>
        <?php
        $no=0;
        $ra=mysql_query("Select * from file_upload where id_paket='$pak' and id_perusahaan='$peru'");
      while($a=mysql_fetch_array($ra)){ 
      $ska[]=$a['ska1'];
      $ska[]=$a['ska2'];
      $ska[]=$a['ska3'];
      $ska[]=$a['ska4'];
      $ska[]=$a['ska5'];
      $file=explode(',', $ska[$i]);
      for ($c=0;$c<count($file);$c++){$no++;
        $bb=$file[$c];
     
      ?>
        <td align="center"><?php echo $no;?></td>

        <td><?php echo $bb."</br>"; ?></td>

        <td><center><a class="btn btn-default tooltipsku" target="_blank"  href="./asset/file/administrasi/<?php echo $bb; ?>" data-placement="top" title="Download"><i class="fa fa-download"></i></a></center></td>
         </tr>
   
  <?php
    }
     }
      ?>
        
        
        
      
     
    </table>
</form>

  </div></div>

  

            </div>
 
        </div>
    </div>
</div>
<?php
}
?>


<?php

 for ($i= 0; $i <= 4; $i++){
?>
<div id="modal_teknis<?php echo $i;?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">File Terupload</h4>
            </div>
            <div class="modal-body">

          <form class="form-horizontal">
<div class="form-group">
  <div class="col-md-12">
   <table class="table table-bordered">
      <tr class="success">
        <td><center>No</center></td>
        <td>Surat Keterangan Teknis <?php echo$i+1;?></td>
        <td><center>Download</center></td>
        
      </tr>
      <tr>
        <?php
        $no=0;
        $ra=mysql_query("Select * from file_upload where id_paket='$pak' and id_perusahaan='$peru'");
      while($a=mysql_fetch_array($ra)){ 
      $skt[]=$a['skt1'];
      $skt[]=$a['skt2'];
      $skt[]=$a['skt3'];
      $skt[]=$a['skt4'];
      $skt[]=$a['skt5'];
      $file=explode(',', $skt[$i]);
      for ($c=0;$c<count($file);$c++){$no++;
        $bb=$file[$c];
     
      ?>
        <td align="center"><?php echo $no;?></td>

        <td><?php echo $bb."</br>"; ?></td>

        <td><center><a class="btn btn-default tooltipsku" target="_blank"  href="./asset/file/teknis/<?php echo $bb; ?>" data-placement="top" title="Download"><i class="fa fa-download"></i></a></center></td>
         </tr>
   
  <?php
    }
     }
      ?>
        
        
        
      
     
    </table>
</form>

  </div></div>

  

            </div>
 
        </div>
    </div>
</div>
<?php
}
?>


<div id="modal_harga" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">File Terupload</h4>
            </div>
            <div class="modal-body">

          <form class="form-horizontal">
<div class="form-group">
  <div class="col-md-12">
   <table class="table table-bordered">
      <tr class="success">
        <td><center>No</center></td>
        <td>Surat Keterangan Teknis <?php echo$i+1;?></td>
        <td><center>Download</center></td>
        
      </tr>
      <tr>
        <?php
        $no=0;
        $ra=mysql_query("Select * from file_upload where id_paket='$pak' and id_perusahaan='$peru'");
      while($a=mysql_fetch_array($ra)){ 
      $skh[]=$a['skh1'];
      $file=explode(',', $skt[$i]);
      for ($c=0;$c<count($file);$c++){$no++;
        $bb=$file[$c];
     
      ?>
        <td align="center"><?php echo $no;?></td>

        <td><?php echo $bb."</br>"; ?></td>

        <td><center><a class="btn btn-default tooltipsku" target="_blank"  href="./asset/file/harga/<?php echo $bb; ?>" data-placement="top" title="Download"><i class="fa fa-download"></i></a></center></td>
         </tr>
   
  <?php
    }
     }
      ?>
        
        
        
      
     
    </table>
</form>

  </div></div>

  

            </div>
 
        </div>
    </div>
</div>


