<!-- Copyright (C) 2009 DNA Bank Network
http://www.dnabank-network.org

The contents of this file are subject to the Mozilla Public License Version 1.1
See LICENSE.TXT at the top of this package for the full license terms. -->

<?php
    include ("head.php");
    include ("auth.php");
?>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>DNA Bank Network - Data Cleaning</title>
<link rel="stylesheet" type="text/css" href="format.css">
<link rel="stylesheet" type="text/css" href="XSLT/Styles.css">
<SCRIPT LANGUAGE="JavaScript1.1" src="Functions.js"></SCRIPT>
<NOSCRIPT>Bitte aktivieren Sie Javascript!</NOSCRIPT>

</head>

<body>
<div align="center">
<form name="formular" method="POST" action="query_Clean.php">
<table id="tablemain">
	<tr>
  <td id="tdLogo"><img border="0" src="images/Logo-DNA-Bank-Network-ocker.jpg" width="123" height="78"></td>
		<td>
		<h1>DNA Bank Network - Data Cleaning</h1></td>
    <td id="tdLogo"><img border="0" src="images/Logo.jpg"></td>
	</tr>
  <tr>
  <td><?php

    echo "Logged in as: ";
    $log = $_SESSION["log"];
    echo $log;
    ?></td><td colspan="2"><a href="logout.php">Logout</a>.</td>
  </tr>

	<tr>
		<td colspan="4">
		<table border="0" id="table2">
				<tr>
				<td id="DescriptionBlack">
				DNA Extraction Number: *<br>
        doppelte Einträge: </td>
				<td id="entry">
        <?php
        $sql1 = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE Dna_Bank_Number = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql1);
        if($count == 1) { echo "<span class='error'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error'>".$count. " entries found empty.</span>"; } }
        $sql2 = mysql_query("SELECT DISTINCT tablednabanknumbers.ID_DNA, tablednabanknumbers.Dna_Bank_Number " .
                ", COUNT(*) AS anzahl FROM tablednabanknumbers " .
                "GROUP BY tablednabanknumbers.Dna_Bank_Number HAVING anzahl > 1");
        if(!mysql_affected_rows()) { echo "<br><span class='fine'>No double entries found.</span>"; }
        else { echo "<span class='error'><br />Folgende DNA Nr. sind doppelt erfasst worden: </span><br />";
        while($roww = mysql_fetch_object($sql2))
        {  $formDna = $roww->Dna_Bank_Number."; ";
            echo $formDna; } }
        ?>
         </td>
         <td>
         <?php if ($sql1) {
         echo "<input type='checkbox' name='formDnaBankNumber' />"; } ?><br>
         <input type="checkbox" name="formDnaBankNumberDouble"/>
         </td>
         </tr>
         <tr>
    <td id="DescriptionBlackA">
    Relation to Voucher: *</td>
    <td id="entry">
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_RelationDNA_Voucher = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error'>".$count. " entries found empty.</span>"; } }
        ?>
    </td>   
<td>
         <input type="checkbox" name="formRelation" />
         </td>          
			</tr>
      <tr>
      <td id="DescriptionBlackA">
      DNA samples without link to voucher: *</td>
      <td id="entry">
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_Cache NOT IN (SELECT ID_Cache FROM tablecache)');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error'>".$count." entry found without link to voucher.</span>"; }
        else {  echo "<span class='error'>".$count. " entries found without link to voucher.</span>"; } }
        ?>      
      </td>
      <td><input type="checkbox" name="formNoVoucherToDNA" />
      </td>
      </tr>
    <tr>
    <td id="DescriptionBlack">
    Tissue:</td>
    <td id="entry">
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_Tissue = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error2'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error2'>".$count. " entries found empty.</span>"; } }
        ?>
    </td>
<td>
         <input type="checkbox" name="formTissue" />
         </td>    
    </tr>
    <tr>
		<td id="DescriptionBlack">
				Preservation:</td>
				<td id="entry">
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_Preservation = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error2'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error2'>".$count. " entries found empty.</span>"; } }
        ?>
</td>
<td>
         <input type="checkbox" name="formPreservation" />
         </td>
    </tr>  
		<tr>
        <td id="DescriptionBlack">
        DNA Type:</td>
        <td id="entry">
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_Type = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error2'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error2'>".$count. " entries found empty.</span>"; } }
        ?>
    </td>
<td>
         <input type="checkbox" name="formType" />
         </td>    
		</tr>

				<tr>
				<td id="DescriptionBlack">
				DNA Extraction Method: *</td>
				<td id="entry"> 
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_Extraction_Method = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error2'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error2'>".$count. " entries found empty.</span>"; } }
        ?>
    </td>
<td>
         <input type="checkbox" name="formExtractionMethod" />
         </td>    
    </tr>
		<tr>
				<td id="DescriptionBlack">
					
				DNA Extraction Date: *</td>
				<td id="entry"> 
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE Extraction_Date = "0000-00-00"');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error'>".$count. " entries found empty.</span>"; } }
        ?>
</td>
<td>
         <input type="checkbox" name="formExtractionDate" />
         </td>
				</tr>
				<tr>
				<td id="DescriptionBlack">
				DNA Extraction Staff: *</td>
				<td id="entry"> 
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_Extraction_Staff = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error'>".$count. " entries found empty.</span>"; } }
        ?>
    </td>
<td>
         <input type="checkbox" name="formExtractionStaff" />
         </td>    
    </tr>
			<tr>
				<td id="DescriptionBlack">
				DNA Purification Method:
				</td>
			<td id="entry">
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_Purification = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error'>".$count. " entries found empty.</span>"; } }
        ?>			
				</td>
<td>
         <input type="checkbox" name="formPurificationMethod" />
         </td>        
				</tr>
				<tr>
				<td id="DescriptionBlack">
				Ratio of absorbence <a id="Black">OD<sub>260nm</sub>/OD<sub>280nm</sub>:<br>
        OD<sub>260nm</sub>/OD<sub>230nm</sub>:</a></td>
				<td id="entry"> 
				<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE Absorbance280 = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error2'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error2'>".$count. " entries found empty.</span>"; } }
        echo "<br />";
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE Absorbance280 = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error2'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error2'>".$count. " entries found empty.</span>"; } }
        ?>	
        </td>
<td>
         <input type="checkbox" name="formAbsorbance280" />
         <br /><input type="checkbox" name="formAbsorbance230" />
         </td>        
        </tr>
				<tr>

				<td id="DescriptionBlack">
				DNA Concentration:</td>
				<td id="entry"> 
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE Concentration = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error2'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error2'>".$count. " entries found empty.</span>"; } }
        ?>	
				</td>
<td>
         <input type="checkbox" name="formConcentration" />
         </td>        
				</tr>
				<tr>
				<td id="DescriptionBlack">

				DNA Quality:</td>
				<td id="entry"> 
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_Degradation = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error2'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error2'>".$count. " entries found empty.</span>"; } }
        ?>							 
		</td>
<td>
         <input type="checkbox" name="formDegradation" />
         </td>    
    </tr>
    <tr>
				<td id="DescriptionBlack">
				DNA Quality Check Date:</td>
				<td id="entry"> 
<?php
        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE Degradation_Date = "0000-00-00"');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error2'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error2'>".$count. " entries found empty.</span>"; } }
        ?>	
        </td>
<td>
         <input type="checkbox" name="formDegradationDate" />
         </td>        
				</tr>
				<tr>
				<td id="DescriptionBlack">
				Location Stock Solution:</td>
				<td id="entry">
<?php

        $sql = mysql_query('SELECT ID_DNA FROM tablednabanknumbers WHERE ID_Location_Stock = ""');
        if(!mysql_affected_rows()) { echo "<span class='fine'>No entries found empty.</span>"; }
        else {        $count = mysql_num_rows($sql);
        if($count == 1) { echo "<span class='error'>".$count." entry found empty.</span>"; }
        else {  echo "<span class='error'>".$count. " entries found empty.</span>"; } }
        ?>	
     </td>
<td>
         <input type="checkbox" name="formStock" />
         </td>     
     </tr>
      <tr>
       <td colspan="2"></td>
   		<td id="tdbutton">
					<input type="button" value="Return to Main Menu" name="formSubmitMenu" id="button" onClick="self.location.href = 'Index.php';">
 			</td>
        </tr>
		<tr>
    <td colspan="2"></td>
        <td id="tdbutton">
					<input type="submit" value="Show selection" name="formSubmitSearch" id="button">
				</td>		
		</tr>
    <tr>
  <td colspan="3">* Required field</td>
	</tr>
			</table>
		</td>
	</tr>
</table>
 
</div>
</form>
</body>

</html>