100)
$page = 100;
elseif($page<1)
$page = 1;
elseif(!is_numeric($page))
unset($page);
// Variablen vordefinieren
$sql = "";
$sqlcreate = "CREATE TEMPORARY TABLE tmpDnaIDs TYPE=HEAP ";
if(isset($page))
$sqllimit = "LIMIT " . (($page-1) * $pagesize) . "," . ($pagesize + 1);
else
$sqllimit = "LIMIT " . ($pagesize + 1);
/* FEHLERMELDUNG AUSGEBEN
$result = mysql_query($sql) or die($sql.' '.mysql_error()); */
if($formSubmitSearch or $_REQUEST['hitlist'] == "true")
{
if($_REQUEST['hitlist'] == "true")
{$parr = $_COOKIE; }
if($_REQUEST['hitlist'] == "")
{$parr = $_POST; }
array($parr);
foreach ($parr as $var)
{
$i ++;
if(!empty($var) and $var!="dd.mm.yyyy" and $var!="Show selection" and key($parr)!="PHPSESSID")
{
switch (key($parr))
{
case 'formDnaBankNumber':
$str = 'tablednabanknumbers.Dna_Bank_Number = "" OR ';
$description = " DNA Extraction No = ";
$value = "empty";
break;
case 'formDnaBankNumberDouble':
$sqltest = 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()) { }
else { while($roww = mysql_fetch_object($sqltest))
{ $formDna = $roww->Dna_Bank_Number.";";
$DnaArray = explode(";", $formDna);
while($i = each($DnaArray))
{
$Dna = trim($i[1]);
$str .= 'tablednabanknumbers.Dna_Bank_Number = "'.$Dna.'" OR '; }
} }
$description = " DNA Extraction No = ";
$value = "double";
break;
case 'formRelation':
$str = 'tablednabanknumbers.ID_RelationDNA_Voucher = "" OR ';
$description = " Relation to Voucher = ";
$value = "empty";
break;
case 'formNoVoucherToDNA':
$str = 'tablednabanknumbers.ID_Cache NOT IN (SELECT ID_Cache FROM tablecache) OR ';
$description = " ";
$value = "DNA Sample without link to voucher";
break;
case 'formType':
$str = 'tablednabanknumbers.ID_Type = "" OR ';
$description = " Type = ";
$value = "empty";
break;
case 'formPreservation':
$str = 'tablednabanknumbers.ID_Preservation = "" OR ';
$description = " Preservation = ";
$value = "empty";
break;
case 'formTissue':
$str = 'tablednabanknumbers.ID_Tissue = "" OR ';
$description = " Tissue = ";
$value = "empty";
break;
case 'formExtractionMethod':
$str = 'tablednabanknumbers.ID_Extraction_Method = "" OR ';
$description = " Extraction Method = ";
$value = "empty";
break;
case 'formExtractionDate':
$str = '(tablednabanknumbers.Extraction_Date = "" OR tablednabanknumbers.Extraction_Date = "0000-00-00") OR ';
$description = " Extraction Date = ";
$value = "empty";
break;
case 'formExtractionStaff':
$str = 'tablednabanknumbers.ID_Extraction_Staff = "" OR ';
$description = " Extraction Staff = ";
$value = "empty";
break;
case 'formPurificationMethod':
$str = 'tablednabanknumbers.ID_Purification = "" OR ';
$description = " Purification Method = ";
$value = "empty";
break;
case 'formAbsorbance280':
$str = 'tablednabanknumbers.Absorbance280 = "" OR ';
$description = " Absorbance 280/260 = ";
$value = "empty";
break;
case 'formAbsorbance230':
$str = 'tablednabanknumbers.Absorbance230 = "" OR ';
$description = " Absorbance 230/260 = ";
$value = "empty";
break;
case 'formConcentration':
$str = 'tablednabanknumbers.Concentration = "" OR ';
$description = " Concentration = ";
$value = "empty";
break;
case 'formDegradation':
$str = 'tablednabanknumbers.ID_Degradation = "" OR ';
$description = " Quality = ";
$value = "empty";
break;
case 'formDegradationDate':
$str = 'tablednabanknumbers.Degradation_Date = "" OR ';
$description = " Quality Check Date = ";
$value = "empty";
break;
case 'formAmplificationDate':
$str = 'tablednabanknumbers.Amplification_Date = "" OR ';
$description = " Amplification Date = ";
$value = "empty";
break;
case 'formAmplificationStaff':
$str = 'tablednabanknumbers.ID_Amplification_Staff = "" OR ';
$description = " Amplification Staff = ";
$value = "empty";
break;
case 'formStock':
$str = 'tablednabanknumbers.ID_Location_Stock = "" OR ';
$description = " Location Stock = ";
$value = "empty";
break;
}
$where[$i] = $str;
$descriptionall[$i] = $description;
$valueall[$i] = $value;
}
next($parr);
}
if(empty($str))
{ echo ""; }
else {
foreach($where AS $a) $string .= $a;
$l=strlen ($string);
$max = $l-4;
$where_str = substr($string, 0, $max);
$wherestr = ' WHERE ' . $where_str;
//abfrage
mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
$sqlType = "Dna";
$sql = $sqlcreate .
$sql = "SELECT DISTINCT tablednabanknumbers.ID_DNA FROM tablednabanknumbers
LEFT JOIN tablecache ON tablednabanknumbers.ID_Cache = tablecache.ID_Cache
LEFT JOIN tablecachetaxonidentified ON tablecache.ID_Cache = tablecachetaxonidentified.ID_Cache
LEFT JOIN tablecachehighertaxa ON tablecachetaxonidentified.ID_TaxonIdentified = tablecachehighertaxa.ID_CacheTaxonidentified
LEFT JOIN tableamplifications ON tablednabanknumbers.ID_DNA = tableamplifications.ID_DNA
LEFT JOIN tablelocation_stock ON tablelocation_stock.ID_Location_Stock = tablednabanknumbers.ID_Location_Stock
LEFT JOIN tablealiquots ON tablednabanknumbers.ID_DNA = tablealiquots.ID_DNA
LEFT JOIN tablerequest ON tablednabanknumbers.ID_DNA = tablerequest.ID_DNA " .
$wherestr.$sqllimit;
$result = mysql_query($sql) or die($sql.' '.mysql_error());
} } //if($formSubmitSearch)
else
{
if($formSubmitSaveEdit)
{
//$log = $_SESSION["log"];
$Current_Date = date('Y-m-d H:i:s');
$result2a = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tablepeople.Name_All " .
" FROM tablednabanknumbers, tablepeople " .
" WHERE tablednabanknumbers.ID_Extraction_Staff = tablepeople.ID_People " .
" AND tablednabanknumbers.ID_DNA = '$ID_DNA'");
while($row = mysql_fetch_object($result2a))
{ $Extraction_Staff_old = $row->Name_All; }
$result3a = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tablepeople.Name_All " .
" FROM tablednabanknumbers, tablepeople " .
" WHERE tablednabanknumbers.ID_Provided_By_People = tablepeople.ID_People " .
" AND tablednabanknumbers.ID_DNA = '$ID_DNA'");
while($row = mysql_fetch_object($result3a))
{ $Provided_By_People_old = $row->Name_All; }
$result4a = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tablestock_fridge.Stock_Fridge, " .
" tablestock_rack.Stock_Rack, " .
" tablestock_box.Stock_Box, " .
" tablelocation_stock.ID_Stock_Fridge, " .
" tablelocation_stock.ID_Stock_Rack, " .
" tablelocation_stock.ID_Stock_Box, " .
" tablelocation_stock.Rest_Quantity, " .
" tablelocation_stock.Stock_Barcode, " .
" tablelocation_stock.Stock_Position " .
" FROM tablednabanknumbers " .
" LEFT JOIN tablelocation_stock ON tablednabanknumbers.ID_Location_Stock = tablelocation_stock.ID_Location_Stock " .
" LEFT JOIN tablestock_fridge ON tablelocation_stock.ID_Stock_Fridge = tablestock_fridge.ID_Stock_Fridge " .
" LEFT JOIN tablestock_rack ON tablelocation_stock.ID_Stock_Rack = tablestock_rack.ID_Stock_Rack " .
" LEFT JOIN tablestock_box ON tablelocation_stock.ID_Stock_Box = tablestock_box.ID_Stock_Box " .
" WHERE tablednabanknumbers.ID_DNA = '$ID_DNA'");
while($row = mysql_fetch_object($result4a))
{ $Stock_Fridge = $row->Stock_Fridge;
$Stock_Rack = $row->Stock_Rack;
$Stock_Box = $row->Stock_Box;
$ID_Stock_Fridge_old = $row->ID_Stock_Fridge;
$ID_Stock_Rack_old = $row->ID_Stock_Rack;
$ID_Stock_Box_old = $row->ID_Stock_Box;
$Stock_Rest_old = $row->Rest_Quantity;}
//NORMAL:
//$Location_Stock_old = "Fridge: " . $Stock_Fridge . " Rack: " . $Stock_Rack . " Box: " . $Stock_Box;
//ZSM München
$Location_Stock_old = "Fridge: " . $Stock_Fridge . " Drawer: " . $Stock_Box . " Rack: " . $Stock_Rack . " Position: " . $Stock_Position . " Barcode: " . $Stock_Barcode;
$result6a = mysql_query
("SELECT tablednabanknumbers.Dna_Bank_Number, " .
"tablednabanknumbers.ID_Cache, " .
"tablednabanknumbers.Extraction_Date, " .
"tablednabanknumbers.Degradation_Date, " .
"tablednabanknumbers.Concentration, " .
"tablednabanknumbers.Absorbance280, " .
"tablednabanknumbers.Absorbance230, " .
"tablednabanknumbers.Quantity_Aliquots, " .
"tablednabanknumbers.Stock_Gone, " .
"tablednabanknumbers.Source_Gone, " .
"tablednabanknumbers.Notes, " .
"tablednabanknumbers.Block_Until, " .
"tablednabanknumbers.Block_General, " .
"tablednabanknumbers.Number_Aliquots, " .
"tablednabanknumbers.Backup_Aliquot, " .
"tablednabanknumbers.ID_Type, " .
"tablednabanknumbers.ID_Tissue, " .
"tablednabanknumbers.ID_RelationDNA_Voucher, " .
"tablednabanknumbers.ID_Preservation, " .
"tablednabanknumbers.ID_Extraction_Method, " .
"tablednabanknumbers.ID_Purification, " .
"tablednabanknumbers.ID_Degradation, " .
"tablednabanknumbers.ID_Extraction_Staff, " .
"tablednabanknumbers.ID_Provided_By_People, " .
"tablednabanknumbers.ID_Location_Stock, " .
"tabletype.Type, " .
"tabletissue.Tissue, " .
"tablerelationdna_voucher.RelationDNA_Voucher, " .
"tablepreservation.Preservation, " .
"tableextractionmethod.Method AS Extraction_Method, " .
"tablepurification.Method AS Purification_Method, " .
"tabledegradation.Degradation " .
"FROM tablednabanknumbers " .
"LEFT JOIN tabletype ON tablednabanknumbers.ID_Type = tabletype.ID_Type " .
"LEFT JOIN tabletissue ON tablednabanknumbers.ID_Tissue = tabletissue.ID_Tissue " .
"LEFT JOIN tablerelationdna_voucher ON tablednabanknumbers.ID_RelationDNA_Voucher = tablerelationdna_voucher.ID_RelationDNA_Voucher " .
"LEFT JOIN tablepreservation ON tablednabanknumbers.ID_Preservation = tablepreservation.ID_Preservation " .
"LEFT JOIN tableextractionmethod ON tablednabanknumbers.ID_Extraction_Method = tableextractionmethod.ID_Method " .
"LEFT JOIN tablepurification ON tablednabanknumbers.ID_Purification = tablepurification.ID_Purification " .
"LEFT JOIN tabledegradation ON tablednabanknumbers.ID_Degradation = tabledegradation.ID_Degradation " .
"WHERE tablednabanknumbers.ID_DNA = '$ID_DNA'");
while($row = mysql_fetch_object($result6a))
{ $Dna_Bank_Number_old = $row->Dna_Bank_Number;
$ID_Cache_old = $row->ID_Cache;
$Extraction_Date_old = $row->Extraction_Date;
$Degradation_Date_old = $row->Degradation_Date;
$Concentration_old = $row->Concentration;
$Absorbance280_old = $row->Absorbance280;
$Absorbance230_old = $row->Absorbance230;
$Quantity_Aliquots_old = $row->Quantity_Aliquots;
$Stock_Gone_old = $row->Stock_Gone;
$Source_Gone_old = $row->Source_Gone;
$Backup_Aliquot_old = $row->Backup_Aliquot;
$Notes_old = $row->Notes;
$Block_Until_old = $row->Block_Until;
$BlockGeneral_old = $row->Block_General;
$Number_Aliquots_old = $row->Number_Aliquots;
$Type_old = $row->Type;
$ID_Type_old = $row->ID_Type;
$Tissue_old = $row->Tissue;
$ID_Tissue_old = $row->ID_Tissue;
$RelationDNA_Voucher_old = $row->RelationDNA_Voucher;
$ID_RelationDNA_Voucher_old = $row->ID_RelationDNA_Voucher;
$Preservation_old = $row->Preservation;
$ID_Preservation_old = $row->ID_Preservation;
$Extraction_Method_old = $row->Extraction_Method;
$ID_Extraction_Method_old = $row->ID_Extraction_Method;
$Purification_Method_old = $row->Purification_Method;
$ID_Extraction_Staff_old = $row->ID_Extraction_Staff;
$ID_Purification_Method_old = $row->ID_Purification;
$Degradation_old = $row->Degradation;
$ID_Degradation_old = $row->ID_Degradation;
$ID_Provided_By_People_old = $row->ID_Provided_By_People;
$ID_Location_Stock_old = $row->ID_Location_Stock; }
if(empty($formAmplificationID))
{}
else {
foreach ($formAmplificationID as $index => $AmplificationIDTest)
{
$LinkTest = $formLink[$index];
$GenBankNumberTest = $formGenBankNo[$index];
$FragmentIDTest = $formFragment[$index];
$Amplification_StaffIDTest = $formAmplificationStaff[$index];
$formAmplificationDate = $formAmplificationDate2[$index];
if($formAmplificationDate=="dd.mm.yyyy")
unset($formAmplificationDate);
else {
$AmplificationDate_split = explode (".", $formAmplificationDate);
$AmplificationDate = $AmplificationDate_split[2] . "-" . $AmplificationDate_split[1] . "-" . $AmplificationDate_split[0];
}
$Amplification_SuccessTest = $radioAmplification[$index];
$resultAmplification = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tableamplifications.GenBankNumber AS GenBankNumber, " .
" tableamplifications.Link AS Link, " .
" tableamplifications.ID_Fragment, " .
" tablefragment.Fragment AS Fragment, " .
" tablepeople.ID_People AS ID_People, " .
" tablepeople.Name_All AS Name_All, " .
" tableamplifications.Amplification_Success, " .
" tableamplifications.Amplification_Date " .
" FROM tablednabanknumbers " .
" LEFT JOIN tableamplifications ON tablednabanknumbers.ID_DNA = tableamplifications.ID_DNA " .
" LEFT JOIN tablefragment ON tableamplifications.ID_Fragment = tablefragment.ID_Fragment " .
" LEFT JOIN tablepeople ON tableamplifications.ID_Amplification_Staff = tablepeople.ID_People " .
" WHERE tableamplifications.ID_Amplification = '$AmplificationIDTest' " .
" ORDER BY tableamplifications.ID_Amplification");
if(empty($AmplificationIDTest))
{}
else {
while($row = mysql_fetch_object($resultAmplification))
{
$GenBankNumber_old = $row->GenBankNumber;
$Link_old = $row->Link;
$Fragment_old = $row->Fragment;
$Amplification_Staff_old = $row->Name_All;
$AmplificationDate_old = $row->Amplification_Date;
$Amplification_Success_old = $row->Amplification_Success;
if ($row->Link != $LinkTest or $row->GenBankNumber != $GenBankNumberTest or $row->ID_Fragment != $FragmentIDTest or $row->ID_People != $Amplification_StaffIDTest or DatumsWandler($row->Amplification_Date) != $formAmplificationDate or $row->Amplification_Success != $Amplification_SuccessTest)
{
$result1 = "INSERT INTO table_log_amplifications (ID_Amplification, ID_DNA, Fragment, GenBankNumber, Link, Amplification_Staff, Amplification_Date, Amplification_Success, Update_Created_Who, Source_Created_Who, Source_Created_When) " .
" (SELECT tableamplifications.ID_Amplification, " .
"tableamplifications.ID_DNA, " .
"'$Fragment_old', " .
"'$GenBankNumber_old', " .
"'$Link_old', " .
"'$Amplification_Staff_old', " .
"'$AmplificationDate_old', " .
"'$Amplification_Success_old', " .
"'$log', " .
"tableamplifications.Created_Who, " .
"tableamplifications.Created_When " .
"FROM tableamplifications " .
"WHERE tableamplifications.ID_Amplification = '$AmplificationIDTest')";
$sql1 = mysql_query($result1);
#######################################Error 1###############################################################
if(!$sql1)
{ $msg = $result1."\n";
$msg .= "####Error 1####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false1"; }
#############################################################################################################
if ($sql1)
{
$result2 = "UPDATE tableamplifications SET GenBankNumber = '$GenBankNumberTest', " .
"Link = '$LinkTest', " .
"ID_Fragment = '$FragmentIDTest', " .
"ID_Amplification_Staff = '$Amplification_StaffIDTest', " .
"Amplification_Date = '$AmplificationDate', " .
"Amplification_Success = '$Amplification_SuccessTest', " .
"Update_Who = '$log', " .
"Update_When = '$Current_Date' " .
"WHERE tableamplifications.ID_Amplification = '$AmplificationIDTest'";
$sql2 = mysql_query($result2);
#######################################Error 2###############################################################
if(!$sql2)
{ $msg = $result2."\n";
$msg .= "####Error 2####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false2"; }
#############################################################################################################
}
}
} //while
}
} //foreach Ende $formGenBankID
}
$QuantityAliquots = array_sum($_POST['formRestQuantity']);
foreach ($formLocationAliquotsID as $index => $AliquotsID)
{
$AliquotsFridge = $formAliquotsFridge[$index];
$AliquotsRack = $formAliquotsRack[$index];
$AliquotsBox = $formAliquotsBox[$index];
$RestQuantity = $formRestQuantity[$index];
$SourceQuantity = $formSourceQuantity[$index];
$Positions = $_POST['PositionAliquot'][$index];
$resultAliquots = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tablealiquots.Aliquot_Number, " .
" tablealiquots_fridge.Aliquots_Fridge, " .
" tablealiquots.ID_Aliquots_Fridge, " .
" tablealiquots_rack.Aliquots_Rack, " .
" tablealiquots.ID_Aliquots_Rack, " .
" tablealiquots_box.Aliquots_Box, " .
" tablealiquots.Rest_Quantity, " .
" tablealiquots.Origin_Quantity, " .
" tablealiquots.ID_Aliquots_Box, " .
" tablealiquots.Aliquot_Barcode, " .
" tablealiquots.Aliquot_Position " .
" FROM tablednabanknumbers " .
" LEFT JOIN tablealiquots ON tablednabanknumbers.ID_DNA = tablealiquots.ID_DNA " .
" LEFT JOIN tablealiquots_fridge ON tablealiquots.ID_Aliquots_Fridge = tablealiquots_fridge.ID_Aliquots_Fridge " .
" LEFT JOIN tablealiquots_rack ON tablealiquots.ID_Aliquots_Rack = tablealiquots_rack.ID_Aliquots_Rack " .
" LEFT JOIN tablealiquots_box ON tablealiquots.ID_Aliquots_Box = tablealiquots_box.ID_Aliquots_Box " .
" WHERE tablealiquots.ID_Aliquots = '$AliquotsID' " .
" ORDER BY tablealiquots.ID_Aliquots");
if(empty($AliquotsID))
{
$AliquotNumber = $formDnaBankNumber.'-A';
$result3a = "INSERT INTO tablealiquots (ID_DNA, ID_Aliquots_Box, ID_Aliquots_Rack, ID_Aliquots_Fridge, Origin_Quantity, Rest_Quantity, Aliquot_Number, Barcode_Aliquot, Position_Aliquot, Created_Who) " .
" VALUES('$ID_DNA','$AliquotsBox','$AliquotsRack','$AliquotsFridge','$SourceQuantity','$RestQuantity','$AliquotNumber','$Barcode','$Positions','$log')";
$sql3a = mysql_query($result3a);
$result3b = "UPDATE tablednabanknumbers SET Number_Aliquots = '1' " .
"WHERE tablednabanknumbers.ID_DNA = '$ID_DNA'";
$sql3b = mysql_query($result3b);
#######################################Error 3a/3b##############################################################
if(!$sql3a or !$sql3b)
{ $msg = $result3a."\n";
$msg .= $result3b."\n";
$msg .= "####Error 3a/3b####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false1"; }
#############################################################################################################
}
else {
while($row = mysql_fetch_object($resultAliquots))
{
$Aliquot_Number_old = $row->Aliquot_Number;
$Aliquots_Fridge_old = $row->Aliquots_Fridge;
$Aliquots_Rack_old = $row->Aliquots_Rack;
$Aliquots_Box_old = $row->Aliquots_Box;
$Origin_Quantity_old = $row->Origin_Quantity;
$Rest_Quantity_old = $row->Rest_Quantity;
$Barcode_old = $row->Aliquot_Barcode;
$Position_old = $row->Aliquot_Position;
if ($row->ID_Aliquots_Fridge != $AliquotsFridge or $row->ID_Aliquots_Rack != $AliquotsRack or $row->ID_Aliquots_Box != $AliquotsBox or $Rest_Quantity_old != $RestQuantity or $Position_old != $Positions)
{
$result3 = "INSERT INTO table_log_aliquots (ID_Aliquots, ID_DNA, Aliquots_Box, Aliquots_Rack, Aliquots_Fridge, Aliquot_Number, Origin_Quantity, Rest_Quantity, Aliquot_Barcode, Aliquot_Position, Update_Created_Who, Source_Created_Who, Source_Created_When) " .
" (SELECT tablealiquots.ID_Aliquots, " .
"tablealiquots.ID_DNA, " .
"'$Aliquots_Box_old', " .
"'$Aliquots_Rack_old', " .
"'$Aliquots_Fridge_old', " .
"tablealiquots.Aliquot_Number, " .
"tablealiquots.Origin_Quantity, " .
"tablealiquots.Rest_Quantity, " .
"'$Barcode_old', " .
"'$Position_old', " .
"'$log', " .
"tablealiquots.Created_Who, " .
"tablealiquots.Created_When " .
"FROM tablealiquots " .
"WHERE tablealiquots.ID_Aliquots = '$AliquotsID')";
$sql3 = mysql_query($result3);
#######################################Error 3###############################################################
if(!$sql3)
{ $msg = $result3."\n";
$msg .= "####Error 3####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false1"; }
#############################################################################################################
if ($sql3)
{
$result4 = "UPDATE tablealiquots SET ID_Aliquots_Fridge = '$AliquotsFridge', " .
"ID_Aliquots_Rack = '$AliquotsRack', " .
"ID_Aliquots_Box = '$AliquotsBox', " .
"Rest_Quantity = '$RestQuantity', " .
"Aliquot_Position = '$Positions', " .
"Update_Who = '$log', " .
"Update_When = '$Current_Date' " .
"WHERE tablealiquots.ID_Aliquots = '$AliquotsID'";
$sql4 = mysql_query($result4);
#######################################Error 4###############################################################
if(!$sql4)
{ $msg = $result4."\n";
$msg .= "####Error 4####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false2"; }
#############################################################################################################
}
}
} //while
}
} //foreach Ende $formLocationAliquotsID
if ($Source_Gone == "SourceGone")
{$SourceGone = "1";}
if ($Stock_Gone == "StockGone")
{$StockGone = "1";}
if ($BlockGeneral == "BlockGeneral")
{$BlockGeneral = "1";}
if ($Backup_Aliquot == "Backup")
{$Backup = "1";}
if($formAmplificationStaffA)
{
$result = "INSERT INTO tableamplifications (ID_DNA, ID_Fragment, GenBankNumber, Link, Amplification_Date, ID_Amplification_Staff, Amplification_Success, Created_Who)" .
"VALUES ('$ID_DNA','$formFragmentA','$formGenbankNumberA','$formGenbankLinkA','$AmplificationDateA','$formAmplificationStaffA','$radioAmplificationA','$log')";
$sql = mysql_query($result);
#######################################Error formGenbankNumberA###############################################################
if(!$sql)
{ $msg = $result."\n";
$msg .= "####Error formGenbankNumberA####";
trigger_error($msg, E_USER_ERROR);
include ("Errorreport.php"); }
#############################################################################################################
}
if($formAmplificationStaffB)
{
$result = "INSERT INTO tableamplifications (ID_DNA, ID_Fragment, GenBankNumber, Link, Amplification_Date, ID_Amplification_Staff, Amplification_Success, Created_Who)" .
"VALUES ('$ID_DNA','$formFragmentB','$formGenbankNumberB','$formGenbankLinkB','$AmplificationDateB','$formAmplificationStaffB','$radioAmplificationB','$log')";
$sql = mysql_query($result);
#######################################Error formGenbankNumberB###############################################################
if(!$sql)
{ $msg = $result."\n";
$msg .= "####Error formGenbankNumberB####";
trigger_error($msg, E_USER_ERROR);
include ("Errorreport.php"); }
#############################################################################################################
}
if($formAmplificationStaffC)
{
$result = "INSERT INTO tableamplifications (ID_DNA, ID_Fragment, GenBankNumber, Link, Amplification_Date, ID_Amplification_Staff, Amplification_Success, Created_Who)" .
"VALUES ('$ID_DNA','$formFragmentC','$formGenbankNumberC','$formGenbankLinkC','$AmplificationDateC','$formAmplificationStaffC','$radioAmplificationC','$log')";
$sql = mysql_query($result);
#######################################Error formGenbankNumberC###############################################################
if(!$sql)
{ $msg = $result."\n";
$msg .= "####Error formGenbankNumberC####";
trigger_error($msg, E_USER_ERROR);
include ("Errorreport.php"); }
#############################################################################################################
}
if($formAmplificationStaffD)
{
$result = "INSERT INTO tableamplifications (ID_DNA, ID_Fragment, GenBankNumber, Link, Amplification_Date, ID_Amplification_Staff, Amplification_Success, Created_Who)" .
"VALUES ('$ID_DNA','$formFragmentD','$formGenbankNumberD','$formGenbankLinkD','$AmplificationDateD','$formAmplificationStaffD','$radioAmplificationD','$log')";
$sql = mysql_query($result);
#######################################Error formGenbankNumberD###############################################################
if(!$sql)
{ $msg = $result."\n";
$msg .= "####Error formGenbankNumberD####";
trigger_error($msg, E_USER_ERROR);
include ("Errorreport.php"); }
#############################################################################################################
}
if ($moreAliquots == "Aliquot")
$Aliquot = "1";
if(!$resultLastAliquotsNumber)
{ $letter = A; }
foreach ($_POST['x'] as $v => $value)
{
$rack = $_POST['y'][$v];
$box = $_POST['z'][$v];
$SourceQuantity = $_POST['formSourceQuantity2'][$v];
$Barcode = $_POST['BarcodeAliquot'][$v];
$Position = $_POST['PositionAliquot'][$v];
if ($Aliquot!="1")
{ unset($value);
unset($rack);
unset($box); }
else {
if($value=="")
{ unset($value);
unset($rack);
unset($box); }
else {
$resultLastAliquotsNumber = mysql_query("SELECT Aliquot_Number FROM tablealiquots WHERE ID_DNA = '$ID_DNA' ORDER BY Aliquot_Number DESC LIMIT 0,1");
while($row = mysql_fetch_object($resultLastAliquotsNumber))
{
$Number = $row->Aliquot_Number;
$array = explode("-",$Number);
$letter = $array[1]; }
$lettercount = $letter++;
$AliquotNumber = $formDnaBankNumber.'-'.$letter++;
$result10 = "INSERT INTO tablealiquots (ID_DNA, ID_Aliquots_Fridge, ID_Aliquots_Rack, ID_Aliquots_Box,
Aliquot_Number, Origin_Quantity, Rest_Quantity, Aliquot_Barcode, Aliquot_Position, Created_Who) " .
"VALUES ('$ID_DNA','$value','$rack','$box','$AliquotNumber','$SourceQuantity','$SourceQuantity','$Barcode','$Position','$log')";
$sql10 = mysql_query($result10);
#######################################Error 10###############################################################
if(!$sql10)
{ $msg = $result10."\n";
$msg .= "####Error 10####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false2"; }
#############################################################################################################
} } }
$result10a = "SELECT ID_Aliquots FROM tablealiquots WHERE ID_DNA = '$ID_DNA'";
$sql10a = mysql_query($result10a);
$anzahl = mysql_num_rows($sql10a);
$result10b = "SELECT SUM(Rest_Quantity) as Summe FROM tablealiquots WHERE ID_DNA = '$ID_DNA'";
$sql10b = mysql_query($result10b);
while ($row = mysql_fetch_object($sql10b)) {
$Sum = $row->Summe;
}
$result10c = "UPDATE tablednabanknumbers SET Number_Aliquots = '$anzahl', Quantity_Aliquots = '$Sum'" .
"WHERE tablednabanknumbers.ID_DNA = '$ID_DNA'";
$sql10c = mysql_query($result10c);
#######################################Error 10c###############################################################
if(!$sql10c)
{ $msg = $result10c."\n";
$msg .= "####Error 10c####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false2"; }
#############################################################################################################
if($Dna_Bank_Number_old != $formDnaBankNumber or $Concentration_old != $formConcentration or $Absorbance280_old != $formAbsorbance280 or $Absorbance230_old != $formAbsorbance230 or $Quantity_Aliquots_old != $formQuantityAliquots or $Notes_old != $formNotes or $Number_Aliquots_old != $formNumberAliquots or $ID_Type_old != $formType or $ID_Tissue_old != $formTissue or $ID_RelationDNA_Voucher_old != $formRelation or $ID_Preservation_old != $formPreservation or $ID_Extraction_Method_old != $formExtractionMethod or $ID_Purification_Method_old != $formPurificationMethod or $ID_Extraction_Staff_old != $formExtractionStaff or $ID_Provided_By_People_old != $formProvidedBy or $ID_Stock_Fridge_old != $formStockFridge or $ID_Stock_Rack_old != $formStockRack or $ID_Stock_Box_old != $formStockBox or $Stock_Rest != $formStockRest or DatumsWandler($Extraction_Date_old) != $formExtractionDate or DatumsWandler($Degradation_Date_old) != $formDegradationDate or DatumsWandler($Block_Until_old) != $formBlockDate or $Stock_Gone_old != $StockGone or $Source_Gone_old != $SourceGone or $BlockGeneral_old != $BlockGeneral or $Backup_Aliquot_old != $Backup_Aliquot)
{
$result11 = "INSERT INTO table_log_dnabanknumbers (ID_DNA, ID_Cache, Dna_Bank_Number, Extraction_Date, Degradation_Date, Concentration, Absorbance280, Absorbance230, Quantity_Aliquots, Stock_Gone, Source_Gone, Notes, Block_Until, Block_General, Number_Aliquots, Source_Created_When, Source_Created_Who, Type, Tissue, Preservation, Purification, Extraction_Method, Degradation, RelationDNA_Voucher, Extraction_Staff, Provided_By_People, Update_Created_Who, Location_Stock, Backup_Aliquot) " .
"(SELECT tablednabanknumbers.ID_DNA, " .
"'$ID_Cache_old', " .
"'$Dna_Bank_Number_old', " .
"'$Extraction_Date_old', " .
"'$Degradation_Date_old', " .
"'$Concentration_old', " .
"'$Absorbance280_old', " .
"'$Absorbance230_old', " .
"'$Quantity_Aliquots_old', " .
"'$Stock_Gone_old', " .
"'$Source_Gone_old', " .
"'$Notes_old', " .
"'$Block_Until_old', " .
"'$BlockGeneral_old', " .
"'$Number_Aliquots_old', " .
"tablednabanknumbers.Created_When, " .
"tablednabanknumbers.Created_Who, " .
"'$Type_old', " .
"'$Tissue_old', " .
"'$Preservation_old', " .
"'$Purification_Method_old', " .
"'$Extraction_Method_old', " .
"'$Degradation_old', " .
"'$RelationDNA_Voucher_old', " .
"'$Extraction_Staff_old', " .
"'$Provided_By_People_old', " .
"'$log', " .
"'$Location_Stock_old', " .
"'$Backup_Aliquot_old' " .
"FROM tablednabanknumbers " .
"WHERE tablednabanknumbers.ID_DNA = '$ID_DNA')";
$sql11 = mysql_query($result11);
$IDDnaLog=mysql_insert_id();
#######################################Error 11###############################################################
if(!$sql11)
{ $msg = $result11."\n";
$msg .= "####Error 11####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false1"; }
#############################################################################################################
// "'$Amplification_Success_old', " .
// "'$Block_General_old', " .
if ($sql11)
{
$result12 = "UPDATE tablednabanknumbers SET DNA_Bank_Number = '$formDnaBankNumber', " .
"Extraction_Date = '$ExtractionDate', " .
"Degradation_Date = '$DegradationDate', " .
"Concentration = '$formConcentration', " .
"Absorbance280 = '$formAbsorbance280', " .
"Absorbance230 = '$formAbsorbance230', " .
"ID_Amplification_Staff = '$formAmplificationStaff', " .
"Amplification_Date = '$AmplificationDate', " .
"Notes = '$formNotes', " .
"Block_Until = '$BlockDate', " .
"ID_Type = '$formType', " .
"ID_Tissue = '$formTissue', " .
"ID_RelationDNA_Voucher = '$formRelation', " .
"ID_Preservation = '$formPreservation', " .
"ID_Extraction_Method = '$formExtractionMethod', " .
"ID_Extraction_Staff = '$formExtractionStaff', " .
"ID_Purification = '$formPurificationMethod', " .
"ID_Degradation = '$formDegradation', " .
"ID_Provided_By_People = '$formProvidedBy', " .
"Stock_Gone = '$StockGone', " .
"Source_Gone = '$SourceGone', " .
"Block_General = '$BlockGeneral', " .
"Backup_Aliquot = '$Backup', " .
"Update_Who = '$log', " .
"Update_When = '$Current_Date' " .
"WHERE tablednabanknumbers.ID_DNA = '$ID_DNA'";
$sql12 = mysql_query($result12);
if(empty($ID_Stock_Fridge_old) or empty($ID_Stock_Rack_old) or empty($ID_Stock_Box_old))
{ $result13a = "INSERT INTO tablelocation_stock (ID_Stock_Fridge, ID_Stock_Rack, ID_Stock_Box, Origin_Quantity, Rest_Quantity, Created_Who) " .
"VALUES ('$formStockFridge','$formStockRack','$formStockBox','$formStockQuantity','$formStockRest','$log')";
$sql13a = mysql_query($result13a);
$ID_Location_Stock_New = mysql_insert_id();
$result13b = "UPDATE tablednabanknumbers SET ID_Location_Stock = '$ID_Location_Stock_New' " .
"WHERE tablednabanknumbers.ID_DNA = '$ID_DNA'";
$sql13b = mysql_query($result13b);
#######################################Error 13a/13b###############################################################
if(!$sql13a or !$sql13b)
{ $msg = $result13a."\n";
$msg .= $result13b. "\n";
$msg .= "####Error 13a/13b####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false2"; }
#############################################################################################################
}
$result13 = "UPDATE tablelocation_stock SET ID_Stock_Fridge = '$formStockFridge', " .
"ID_Stock_Rack = '$formStockRack', " .
"ID_Stock_Box = '$formStockBox', " .
"Update_Who = '$log', " .
"Update_When = '$Current_Date' " .
"WHERE tablelocation_stock.ID_Location_Stock = '$ID_Location_Stock_old'";
$sql13 = mysql_query($result13);
#######################################Error 12/13###############################################################
if(!$sql12 or !$sql13)
{ $msg = $result12."\n";
$msg .= $result13. "\n";
$msg .= "####Error 12/13####";
trigger_error($msg, E_USER_ERROR);
$test1 = "false2"; }
#############################################################################################################
}
mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
$sqlType = "Detail";
// $where_str = "test";
$sql = $sqlcreate .
$sql = "SELECT DISTINCT tablednabanknumbers.ID_DNA FROM tablednabanknumbers
LEFT JOIN tablecache ON tablednabanknumbers.ID_Cache = tablecache.ID_Cache
LEFT JOIN tablecachetaxonidentified ON tablecache.ID_Cache = tablecachetaxonidentified.ID_Cache
LEFT JOIN tablecachehighertaxa ON tablecachetaxonidentified.ID_TaxonIdentified = tablecachehighertaxa.ID_CacheTaxonidentified
LEFT JOIN tableamplifications ON tablednabanknumbers.ID_DNA = tableamplifications.ID_DNA
LEFT JOIN tablelocation_stock ON tablelocation_stock.ID_Location_Stock = tablednabanknumbers.ID_Location_Stock
LEFT JOIN tablealiquots ON tablednabanknumbers.ID_DNA = tablealiquots.ID_DNA
LEFT JOIN tablerequest ON tablednabanknumbers.ID_DNA = tablerequest.ID_DNA " .
"WHERE tablednabanknumbers.ID_DNA = '$ID_DNA' " . $sqllimit;
}
}
else {
mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
$sqlType = "Detail";
// $where_str = "test";
$sql = $sqlcreate .
$sql = "SELECT DISTINCT tablednabanknumbers.ID_DNA FROM tablednabanknumbers
LEFT JOIN tablecache ON tablednabanknumbers.ID_Cache = tablecache.ID_Cache
LEFT JOIN tablecachetaxonidentified ON tablecache.ID_Cache = tablecachetaxonidentified.ID_Cache
LEFT JOIN tablecachehighertaxa ON tablecachetaxonidentified.ID_TaxonIdentified = tablecachehighertaxa.ID_CacheTaxonidentified
LEFT JOIN tableamplifications ON tablednabanknumbers.ID_DNA = tableamplifications.ID_DNA
LEFT JOIN tablelocation_stock ON tablelocation_stock.ID_Location_Stock = tablednabanknumbers.ID_Location_Stock
LEFT JOIN tablealiquots ON tablednabanknumbers.ID_DNA = tablealiquots.ID_DNA
LEFT JOIN tablerequest ON tablednabanknumbers.ID_DNA = tablerequest.ID_DNA " .
"WHERE tablednabanknumbers.ID_DNA = '$ID_DNA' " . $sqllimit;
}
}
$Dnacount=0;
if(!empty($sql))
{
// just in case it is still here: drop tmpDnaIDs
mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
mysql_query($sql);
if(!mysql_affected_rows())
{
echo "Back to overview. | ";
echo "No hits found for:";
foreach($descriptionall as $index => $descriptiontest)
{ $valuetest = $valueall[$index];
echo $descriptiontest."[".$valuetest."]"; }
echo ". | ";
}
else
{
// Abfrage für TableDnaBankNumbers
$result1 = mysql_query
("SELECT tablednabanknumbers.ID_DNA AS ID_DNA, " .
" tablednabanknumbers.ID_Cache, " .
" tablednabanknumbers.Dna_Bank_Number AS DNA_Bank_Number, " .
" tablednabanknumbers.Extraction_Date AS Extraction_Date, " .
" tablednabanknumbers.NoExtractDate AS NoExtractDate, " .
" tablednabanknumbers.Absorbance280 AS Absorbance280, " .
" tablednabanknumbers.Absorbance230 AS Absorbance230, " .
" tablednabanknumbers.Concentration AS Concentration, " .
" tablednabanknumbers.Number_Aliquots AS Number_Aliquots, " .
" tablednabanknumbers.Quantity_Aliquots AS Quantity_All_Aliquots, " .
" tablednabanknumbers.Degradation_Date AS Degradation_Date, " .
" tablednabanknumbers.Created_Who AS Created_Who, " .
" tablednabanknumbers.Created_When AS Created_When, " .
" tablednabanknumbers.Stock_Gone AS Stock_Gone, " .
" tablednabanknumbers.Source_Gone AS Source_Gone, " .
" tablednabanknumbers.Block_Until AS Block_Until, " .
" tablednabanknumbers.Block_General AS Block_General, " .
" tablednabanknumbers.Notes AS Notes, " .
" tablednabanknumbers.Backup_Aliquot AS Backup_Aliquot, " .
" tablednabanknumbers.Update_Who AS Update_Who, " .
" tablednabanknumbers.Update_When AS Update_When, " .
" tablerelationdna_voucher.RelationDNA_Voucher AS RelationDNA_Voucher, " .
" tabletype.Type AS Type, " .
" tablepreservation.Preservation AS Preservation, " .
" tabletissue.Tissue AS Tissue, " .
" tableextractionmethod.Method AS Extraction_Method, " .
" tableextractionmethod.Company AS Extraction_Company, " .
" tablepurification.Method AS Purification_Method, " .
" tablepurification.Company AS Purificaton_Company, " .
" tabledegradation.Degradation AS Degradation, " .
" tablecache.ID_Dataset_Specimen AS ID_Dataset_Specimen, " .
" tablecache.UnitID_Specimen AS UnitID_Specimen, " .
" tablecache.CollectionCode_Specimen AS CollectionCode_Specimen, " .
" tablecache.InstitutionCode_Specimen AS InstitutionCode_Specimen, " .
" tablecache.ContinentOrOcean AS ContinentOrOcean, " .
" tablecache.CountryName AS CountryName, " .
" tablecache.CountryISO2 AS CountryISO2, " .
" tablecache.GatheringAgent AS GatheringAgent, " .
" tablecache.GatheringDate AS GatheringDate, " .
" tablecache.LocalityText AS LocalityText, " .
" tablecache.Altitude AS Altitude, " .
" tablecache.LongitudeDecimal AS LongitudeDecimal, " .
" tablecache.LatitudeDecimal AS LatitudeDecimal, " .
" tablecache.Gathering_Other AS Gathering_Other " .
" FROM tablednabanknumbers JOIN tmpDnaIDs " .
" LEFT JOIN tablecache ON tablednabanknumbers.ID_Cache = tablecache.ID_Cache " .
" LEFT JOIN tablerelationdna_voucher ON tablednabanknumbers.ID_RelationDNA_Voucher = tablerelationdna_voucher.ID_RelationDNA_Voucher " .
" LEFT JOIN tabletype ON tablednabanknumbers.ID_Type = tabletype.ID_Type " .
" LEFT JOIN tablepreservation ON tablednabanknumbers.ID_Preservation = tablepreservation.ID_Preservation " .
" LEFT JOIN tabletissue ON tablednabanknumbers.ID_Tissue = tabletissue.ID_Tissue " .
" LEFT JOIN tableextractionmethod ON tablednabanknumbers.ID_Extraction_Method = tableextractionmethod.ID_Method " .
" LEFT JOIN tablepurification ON tablednabanknumbers.ID_Purification = tablepurification.ID_Purification " .
" LEFT JOIN tablepeople ON tablednabanknumbers.ID_Extraction_Staff = tablepeople.ID_People " .
" LEFT JOIN tabledegradation ON tablednabanknumbers.ID_Degradation = tabledegradation.ID_Degradation " .
" WHERE tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA " .
" ORDER BY LENGTH(tablednabanknumbers.Dna_Bank_Number),tablednabanknumbers.DNA_Bank_Number");
// $result = mysql_query($result1) or die($result1.' '.mysql_error());
$result2 = mysql_query
("SELECT tablednabanknumbers.ID_DNA AS ID_DNA, " .
" tablednabanknumbers.ID_Cache, " .
" tablecache.ID_Cache, " .
" tablecachetaxonidentified.NameAuthorYear AS NameAuthorYear, " .
" tablecachetaxonidentified.PreferredFlag AS PreferredFlag " .
" FROM tablecache, tablecachetaxonidentified, tablednabanknumbers, tmpDnaIDs " .
" WHERE tablecachetaxonidentified.ID_Cache = tablecache.ID_Cache " .
" AND tablecache.ID_Cache = tablednabanknumbers.ID_Cache " .
" AND tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
// $result = mysql_query($result3) or die($result3.' '.mysql_error());
while($row = mysql_fetch_object($result2))
{
if(isset($PreferredFlag[$row->ID_DNA]))
{ $Flag = $PreferredFlag[$row->ID_DNA];
if($Flag == 'true' or $Flag == '1') {$Preferred = "(Preferred Taxon Name)";}
if($Flag != 'true' and $Flag != '1') {$Preferred = ""; }
}
else
{ $PreferredFlag[$row->ID_DNA] = ""; }
if(isset($NameAuthorYear[$row->ID_DNA]))
{ $NameAuthorYear[$row->ID_DNA] .= " " . $Preferred . ", Other Identifications: "; }
else
{ $NameAuthorYear[$row->ID_DNA] = ""; }
$tmp = $row->NameAuthorYear;
$NameAuthorYear[$row->ID_DNA] .= $tmp;
$tmp2 = $row->PreferredFlag;
$PreferredFlag[$row->ID_DNA] .= $tmp2;
}
$result3 = mysql_query
("SELECT tablednabanknumbers.ID_DNA AS ID_DNA, " .
" tablednabanknumbers.ID_Cache, " .
" tablecache.ID_Cache, " .
" tablecachetaxonidentified.ID_TaxonIdentified, " .
" tablecachehighertaxa.HigherTaxon AS HigherTaxon, " .
" tablecachehighertaxa.TaxonRank AS TaxonRank " .
" FROM tablecache, tablecachetaxonidentified, tablecachehighertaxa, tablednabanknumbers, tmpDnaIDs " .
" WHERE tablecachehighertaxa.ID_CacheTaxonIdentified = tablecachetaxonidentified.ID_TaxonIdentified " .
" AND tablecachetaxonidentified.ID_Cache = tablecache.ID_Cache " .
" AND tablecache.ID_Cache = tablednabanknumbers.ID_Cache " .
" AND tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
while($row = mysql_fetch_object($result3))
{
if(isset($TaxonRank[$row->ID_DNA]))
{ $TaxonRank[$row->ID_DNA] .= " "; }
else { $TaxonRank[$row->ID_DNA] = ""; }
if(isset($HigherTaxon[$row->ID_DNA]))
{
$HigherTaxon[$row->ID_DNA] .= " ";
}
else
{ $HigherTaxon[$row->ID_DNA] = ""; }
$tmp = $row->HigherTaxon;
$HigherTaxon[$row->ID_DNA] .= $tmp;
$tmp2 = $row->TaxonRank;
$TaxonRank[$row->ID_DNA] .= $tmp2;
}
$result3a = mysql_query
("SELECT tablednabanknumbers.ID_DNA AS ID_DNA, " .
" tablednabanknumbers.ID_Cache, " .
" tablecacheimages.ID_Cache, " .
" tablecacheimages.Images " .
" FROM tablecacheimages, tablednabanknumbers, tmpDnaIDs " .
" WHERE tablecacheimages.ID_Cache = tablednabanknumbers.ID_Cache " .
" AND tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
while($row = mysql_fetch_object($result3a))
{
if(isset($ImageLink[$row->ID_DNA]))
{ $ImageLink .= build_href1($row->Images,$row->Images) . " "; }
else
{$ImageLink .= build_href1($row->Images,$row->Images) . " "; }
}
$result5 = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tablepeople.Name_All AS Name_All_Extraction " .
" FROM tablednabanknumbers,tablepeople, tmpDnaIDs " .
" WHERE tablednabanknumbers.ID_Extraction_Staff = tablepeople.ID_People " .
" AND tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
while($row = mysql_fetch_object($result5))
{ $Extraction_Staff = $row->Name_All_Extraction; }
$result6 = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tablepeople.Name_All AS Name_All_Provided_By " .
" FROM tablednabanknumbers,tablepeople, tmpDnaIDs " .
" WHERE tablednabanknumbers.ID_Provided_By_People = tablepeople.ID_People " .
" AND tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
while($row = mysql_fetch_object($result6))
{ $Provided_By_People = $row->Name_All_Provided_By; }
$result8 = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tablestock_box.Stock_Box AS Location_Box, " .
" tablestock_rack.Stock_Rack AS Location_Rack, " .
" tablestock_fridge.Stock_Fridge AS Location_Fridge, " .
" tablelocation_stock.Origin_Quantity AS Location_Volume, " .
" tablelocation_stock.Rest_Quantity AS Location_Rest, " .
" tablelocation_stock.Stock_Barcode AS Stock_Barcode, " .
" tablelocation_stock.Stock_Position AS Stock_Position " .
" FROM tablednabanknumbers JOIN tmpDnaIDs " .
" LEFT JOIN tablelocation_stock ON tablednabanknumbers.ID_Location_Stock = tablelocation_stock.ID_Location_Stock " .
" LEFT JOIN tablestock_box ON tablestock_box.ID_Stock_Box = tablelocation_stock.ID_Stock_Box " .
" LEFT JOIN tablestock_rack ON tablestock_rack.ID_Stock_Rack = tablelocation_stock.ID_Stock_Rack " .
" LEFT JOIN tablestock_fridge ON tablestock_fridge.ID_Stock_Fridge = tablelocation_stock.ID_Stock_Fridge " .
" WHERE tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
$result7 = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tableamplifications.GenBankNumber AS GenBankNumber, " .
" tableamplifications.Link AS Link, " .
" tableamplifications.Amplification_Success AS Amplification_Success, " .
" tableamplifications.Amplification_Date AS Amplification_Date, " .
" tablefragment.Fragment AS Fragment, " .
" tablepeople.Name_All AS Amplification_Staff " .
" FROM tablednabanknumbers JOIN tmpDnaIDs " .
" LEFT JOIN tableamplifications ON tablednabanknumbers.ID_DNA = tableamplifications.ID_DNA " .
" LEFT JOIN tablefragment ON tableamplifications.ID_Fragment = tablefragment.ID_Fragment " .
" LEFT JOIN tablepeople ON tableamplifications.ID_Amplification_Staff = tablepeople.ID_People " .
" WHERE tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
while($row = mysql_fetch_object($result7))
{
if(isset($Amplification_Staff[$row->ID_DNA]))
{
$Amplification_Staff[$row->ID_DNA] .= " ";
}
else
{ $Amplification_Staff[$row->ID_DNA] = ""; }
if(isset($Amplification_Success[$row->ID_DNA]))
{
$Amplification_Success[$row->ID_DNA] .= " ";
}
else
{ $Amplification_Success[$row->ID_DNA] = ""; }
if(isset($Amplification_Date[$row->ID_DNA]))
{
$Amplification_Date[$row->ID_DNA] .= " ";
}
else
{ $Amplification_Date[$row->ID_DNA] = ""; }
if(isset($Link[$row->ID_DNA]))
{ if($formSubmitSaveEdit) {}
else { $Link[$row->ID_DNA] .= ""; }
$Link2 .= build_href1($row->Link,$row->GenBankNumber) . " ";
}
else
{
$Link[$row->ID_DNA] = "";
$Link2 .= build_href1($row->Link,$row->GenBankNumber) . " ";
}
if(isset($Fragment[$row->ID_DNA]))
{
$Fragment[$row->ID_DNA] .= " ";
}
else
{ $Fragment[$row->ID_DNA] = ""; }
if($formSubmitSaveEdit) {}
else {
$tmp = $row->Link;
$Link[$row->ID_DNA] .= $tmp; }
$tmp = $row->Fragment;
$Fragment[$row->ID_DNA] .= $tmp;
$tmp = $row->Amplification_Staff;
$Amplification_Staff[$row->ID_DNA] .= $tmp;
$tmp = $row->Amplification_Success;
$Amplification_Success[$row->ID_DNA] .= $tmp;
$tmp = DatumsWandler($row->Amplification_Date);
$Amplification_Date[$row->ID_DNA] .= $tmp;
}
while($row = mysql_fetch_object($result8))
{ $Location_Box = $row->Location_Box;
$Location_Rack = $row->Location_Rack;
$Location_Fridge = $row->Location_Fridge;
$Location_Volume = $row->Location_Volume;
$Location_Rest = $row->Location_Rest;
$Stock_Barcode = $row->Stock_Barcode;
$Stock_Position = $row->Stock_Position;
}
$result9 = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tablealiquots_box.Aliquots_Box AS Aliquots_Box, " .
" tablealiquots_rack.Aliquots_Rack AS Aliquots_Rack, " .
" tablealiquots_fridge.Aliquots_Fridge AS Aliquots_Fridge, " .
" tablealiquots.Aliquot_Number AS Aliquot_Number, " .
" tablealiquots.Origin_Quantity AS Origin_Quantity, " .
" tablealiquots.Rest_Quantity AS Rest_Quantity, " .
" tablealiquots.Aliquot_Barcode AS Aliquot_Barcode, " .
" tablealiquots.Aliquot_Position AS Aliquot_Position " .
" FROM tablednabanknumbers JOIN tmpDnaIDs " .
" LEFT JOIN tablealiquots ON tablednabanknumbers.ID_DNA = tablealiquots.ID_DNA " .
" LEFT JOIN tablealiquots_box ON tablealiquots_box.ID_Aliquots_Box = tablealiquots.ID_Aliquots_Box " .
" LEFT JOIN tablealiquots_rack ON tablealiquots_rack.ID_Aliquots_Rack = tablealiquots.ID_Aliquots_Rack " .
" LEFT JOIN tablealiquots_fridge ON tablealiquots_fridge.ID_Aliquots_Fridge = tablealiquots.ID_Aliquots_Fridge " .
" WHERE tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA " .
" ORDER BY tablealiquots.Aliquot_Number");
while($row = mysql_fetch_object($result9))
{
if(isset($Aliquots_Box[$row->ID_DNA]))
{ $Aliquots_Box[$row->ID_DNA] .= " "; }
else
{ $Aliquots_Box[$row->ID_DNA] = ""; }
if(isset($Aliquots_Rack[$row->ID_DNA]))
{ $Aliquots_Rack[$row->ID_DNA] .= " "; }
else
{ $Aliquots_Rack[$row->ID_DNA] = ""; }
if(isset($Aliquots_Fridge[$row->ID_DNA]))
{ $Aliquots_Fridge[$row->ID_DNA] .= " "; }
else
{ $Aliquots_Fridge[$row->ID_DNA] = ""; }
if(isset($Aliquot_Number[$row->ID_DNA]))
{ $Aliquot_Number[$row->ID_DNA] .= " "; }
else
{ $Aliquot_Number[$row->ID_DNA] = ""; }
if(isset($Aliquot_Barcode[$row->ID_DNA]))
{ $Aliquot_Barcode[$row->ID_DNA] .= " "; }
else
{ $Aliquot_Barcode[$row->ID_DNA] = ""; }
if(isset($Aliquot_Position[$row->ID_DNA]))
{ $Aliquot_Position[$row->ID_DNA] .= " "; }
else
{ $Aliquot_Position[$row->ID_DNA] = ""; }
if(isset($Origin_Quantity[$row->ID_DNA]))
{ $Origin_Quantity[$row->ID_DNA] .= " "; }
else
{ $Origin_Quantity[$row->ID_DNA] = ""; }
if(isset($Rest_Quantity[$row->ID_DNA]))
{ $Rest_Quantity[$row->ID_DNA] .= " "; }
else
{ $Rest_Quantity[$row->ID_DNA] = ""; }
$tmp = $row->Aliquots_Box;
$Aliquots_Box[$row->ID_DNA] .= $tmp;
$tmp = $row->Aliquots_Rack;
$Aliquots_Rack[$row->ID_DNA] .= $tmp;
$tmp = $row->Aliquots_Fridge;
$Aliquots_Fridge[$row->ID_DNA] .= $tmp;
$tmp = $row->Aliquot_Number;
$Aliquot_Number[$row->ID_DNA] .= $tmp;
$tmp = $row->Aliquot_Barcode;
$Aliquot_Barcode[$row->ID_DNA] .= $tmp;
$tmp = $row->Aliquot_Position;
$Aliquot_Position[$row->ID_DNA] .= $tmp;
$tmp = $row->Origin_Quantity;
$Origin_Quantity[$row->ID_DNA] .= $tmp;
$tmp = $row->Rest_Quantity;
$Rest_Quantity[$row->ID_DNA] .= $tmp;
}
$result10 = mysql_query
("SELECT tablednabanknumbers.ID_DNA, " .
" tablerequest.Request_Date AS Request_Date, " .
" tablerequest.Request_Number_Aliquots AS Request_Number_Aliquots, " .
" tablerequest.Request_Notes AS Request_Notes, " .
" tablepeople.Name_All AS Customer " .
" FROM tablednabanknumbers JOIN tmpDnaIDs " .
" LEFT JOIN tablerequest ON tablednabanknumbers.ID_DNA = tablerequest.ID_DNA " .
" LEFT JOIN tablepeople ON tablerequest.ID_People = tablepeople.ID_People " .
" WHERE tablednabanknumbers.ID_DNA = tmpDnaIDs.ID_DNA");
while($row = mysql_fetch_object($result10))
{
if(isset($Request_Date[$row->ID_DNA]))
{ $Request_Date[$row->ID_DNA] .= "";
$DateRequest .= DatumsWandler($row->Request_Date) . " ";
}
else
{ $Request_Date[$row->ID_DNA] = "";
$DateRequest .= DatumsWandler($row->Request_Date) . " "; }
if(isset($Request_Number_Aliquots[$row->ID_DNA]))
{ $Request_Number_Aliquots[$row->ID_DNA] .= " "; }
else
{ $Request_Number_Aliquots[$row->ID_DNA] = ""; }
if(isset($Request_Notes[$row->ID_DNA]))
{ $Request_Notes[$row->ID_DNA] .= " "; }
else
{ $Request_Notes[$row->ID_DNA] = ""; }
if(isset($Customer[$row->ID_DNA]))
{ $Customer[$row->ID_DNA] .= " "; }
else
{ $Customer[$row->ID_DNA] = ""; }
$tmp = $row->Request_Date;
$Request_Date[$row->ID_DNA] .= $tmp;
$tmp = $row->Request_Number_Aliquots;
$Request_Number_Aliquots[$row->ID_DNA] .= $tmp;
$tmp = $row->Request_Notes;
$Request_Notes[$row->ID_DNA] .= $tmp;
$tmp = $row->Customer;
$Customer[$row->ID_DNA] .= $tmp; }
$result11 = mysql_query
("SELECT tablepublications_amplifications.ID_DNA, " .
" tablepublications_amplifications.Paper_Cache AS Paper_Cache, " .
" tablepublications_amplifications.Fragment AS FragmentPub, " .
" tablepublications.Link AS LinkPub " .
" FROM tablepublications_amplifications JOIN tmpDnaIDs " .
" LEFT JOIN tablepublications ON tablepublications_amplifications.ID_Publications = tablepublications.ID_Publications " .
" WHERE tablepublications_amplifications.ID_DNA = tmpDnaIDs.ID_DNA");
while($row = mysql_fetch_object($result11))
{
if(isset($Paper_Cache[$row->ID_DNA]))
{ $Paper_Cache[$row->ID_DNA] .= " "; }
else
{ $Paper_Cache[$row->ID_DNA] = ""; }
if(isset($FragmentPub[$row->ID_DNA]))
{ $FragmentPub[$row->ID_DNA] .= " "; }
else
{ $FragmentPub[$row->ID_DNA] = ""; }
if(isset($LinkPub[$row->ID_DNA]))
{ if($formSubmitSaveEdit) {}
else { $LinkPub[$row->ID_DNA] .= ""; }
$LinkPub2 .= build_href1($row->LinkPub,"document") . " ";
}
else
{
$LinkPub[$row->ID_DNA] = "";
$LinkPub2 .= build_href1($row->LinkPub,"document") . " ";
}
$tmp = $row->Paper_Cache;
$Paper_Cache[$row->ID_DNA] .= $tmp;
$tmp = $row->FragmentPub;
$FragmentPub[$row->ID_DNA] .= $tmp;
if($formSubmitSaveEdit) {}
else {
$tmp = $row->LinkPub;
$LinkPub[$row->ID_DNA] .= $tmp; }
}
if($sqlType=="Dna")
{
echo "Back to Overview. | ";
$gesamt = mysql_num_rows($result1);
echo "".$gesamt;
if($gesamt == 1) {echo " entry "; } else { echo " entries ";}
echo "found for:";
foreach($descriptionall as $index => $descriptiontest)
{ $valuetest = $valueall[$index];
echo $descriptiontest."[".$valuetest."]"; }
echo ". | ";
echo "
| ";
$Dnacount=0;
echo "";
for ($i=1; $i<=$gesamt; $i++) {
$row=mysql_fetch_array($result1);
{
$Dnacount++;
if($Dnacount<=$pagesize)
{
$ID = $row['ID_DNA'];
echo "".$i.". | ".build_href("query_clean.php",
"sqlType=Detail&ID_DNA=$ID",
$row['DNA_Bank_Number'] . ", " .
$row['UnitID_Specimen'] . ", " .
$row['CollectionCode_Specimen'] . ", " .
$row['InstitutionCode_Specimen'] . ", " .
$NameAuthorYear[$row['ID_DNA']]) . " | ";
}
} }
echo " ";
}
if($sqlType=="Detail")
{
echo "Back to Overview. | ";
if($formSubmitSaveEdit)
{ echo "Back to Hitlist | ",
"";
if ($test1 == 'false1'){ include("ErrorreportLog.php"); }
if ($test1 == 'false2'){ include("Errorreport.php"); }
if ($test1 != 'false1' and $test1 != 'false2') { echo "Changes accepted."; }
echo " | "; }
else {
echo "Back to Hitlist | "; }
echo "
| ";
$Dnacount=0;
while($row = mysql_fetch_object($result1))
{
$Dnacount++;
$ID_Cache = $row->ID_Cache;
$test = mysql_query("SELECT tablednabanknumbers.ID_DNA, tablednabanknumbers.DNA_Bank_Number, " .
"tablednabanknumbers.Extraction_Date FROM tablednabanknumbers, tmpDnaIDs " .
"WHERE tablednabanknumbers.ID_Cache = '$ID_Cache' " .
" AND tablednabanknumbers.ID_DNA != tmpDnaIDs.ID_DNA " .
"ORDER BY tablednabanknumbers.DNA_Bank_Number");
if($Dnacount<=$pagesize)
{
if($Amplification_Date[$row->ID_DNA] == '0000-00-00')
{ unset($Amplification_Date[$row->ID_DNA]); }
if($row->Extraction_Date == '0000-00-00')
{ unset($row->Extraction_Date); }
if($row->Degradation_Date == '0000-00-00')
{ unset($row->Degradation_Date); }
if($row->Block_Until == '0000-00-00')
{ unset($row->Block_Until); }
// Position Start Einfügen für "Ausgabe ZSM" - Datei: "Extra-ZSM Query-Ausgabe.php"
echo "",
"Voucher: | ",
"Taxon Name: | " . $NameAuthorYear[$row->ID_DNA] . " | ",
$HigherTaxon[$row->ID_DNA] ? "Higher Taxon: | " . $HigherTaxon[$row->ID_DNA] . " | " . $TaxonRank[$row->ID_DNA] . " | " : "",
$row->ContinentOrOcean ? "Continent/Ocean: | " . $row->ContinentOrOcean . " | " : "",
$row->CountryName ? "Country: | " . $row->CountryName . " | " : "",
$row->CountryISO2 ? "Country ISO Code: | " . $row->CountryISO2 . " | " : "",
$row->GatheringAgent ? "Collector(s): | " . $row->GatheringAgent . " | " : "",
$row->GatheringDate ? "Collection Date: | " . $row->GatheringDate . " | " : "",
$row->Gathering_Other ? "Collection: | " . $row->Gathering_Other . " | " : "",
$row->LocalityText ? "Locality: | " . $row->LocalityText . " | " : "",
$row->Altitude ? "Altitude: | " . $row->Altitude . " | " : "",
$row->LongitudeDecimal ? "Longitude: | " . $row->LongitudeDecimal . " | " : "",
$row->LatitudeDecimal ? "Latitude: | " . $row->LatitudeDecimal . " | " : "",
$ImageLink ? "Multimedia: | " . $ImageLink . " | " : "",
"Specimen Number/UnitID: | " . $row->UnitID_Specimen . " | ",
"Collection Code: | " . $row->CollectionCode_Specimen . " | ",
"Institution Code: | " . $row->InstitutionCode_Specimen . " | ",
"
| ",
"";
if(mysql_num_rows($test))
{ echo "Other DNA Samples from this voucher: | ";
while($roww = mysql_fetch_object($test))
{ $Test_ID = $roww->ID_DNA;
echo "DNA Extraction Number: | ".build_hrefDNA("query.php","sqlType=Detail&ID_DNA=$Test_ID",$roww->DNA_Bank_Number)." | Extraction Date: | ".DatumsWandler($roww->Extraction_Date)." | "; }
echo "
| "; }
// build_href("query.php","sqlType=Detail&ID_DNA=$Test_ID",$roww->DNA_Bank_Number);
echo "DNA Sample: | ",
$row->RelationDNA_Voucher ? "Relation to Voucher: | " . $row->RelationDNA_Voucher . " | " : " | ",
"DNA Extraction Number: | " . $row->DNA_Bank_Number . " | ",
$row->Type ? "DNA Type: | " . $row->Type . " | " : " | ",
$row->Preservation ? "Preservation: | " . $row->Preservation . " | " : " | ",
$row->Tissue ? "Tissue: | " . $row->Tissue . " | " : " | ",
$row->Source_Gone ? "Tissue source material gone: | Yes | " : " | ",
$Extraction_Staff || $row->Extraction_Method || $row->Extraction_Date ? "Extraction Method/Date/Staff: | " . $row->Extraction_Method . " (" . $row->Extraction_Company . ") | " . DatumsWandler($row->Extraction_Date) . " | " . $Extraction_Staff . " | " : "",
$row->Purification_Method ? "Purification Method: | " . $row->Purification_Method . " (" . $row->Purificaton_Company . ") | " : "",
$row->Absorbance280 || $row->Absorbance230 ? "Ratio of Absorbance: | " . $row->Absorbance280 . " OD260nm/OD280nm | " . $row->Absorbance230 . " OD260nm/OD230nm | " : "",
$row->Concentration ? "Concentration: | " . $row->Concentration . " ng/μl | " : "",
$row->Degradation ? "Quality/Check Date: | " . $row->Degradation . " | " . DatumsWandler($row->Degradation_Date) . " | " : "",
"Number of Aliquots: | " . $row->Number_Aliquots . " | Total volume (Aliquots): | " .$row->Quantity_All_Aliquots . " μl";
if($row->Quantity_All_Aliquots == '0') { echo " (No Aliquots available)"; }
echo " | ",
$Amplification_Date[$row->ID_DNA] || $Amplification_Success[$row->ID_DNA] || $Amplification_Staff[$row->ID_DNA] ? "Amplification(s): | Amplification successful: " .$Amplification_Success[$row->ID_DNA] . " | Amplification Date: " . $Amplification_Date[$row->ID_DNA] . " | Amplification Staff: " . $Amplification_Staff[$row->ID_DNA] . " | Gen Bank No: " .$Link2 . " | Fragment: " .$Fragment[$row->ID_DNA] ." | " : "",
$Paper_Cache[$row->ID_DNA] ? "Publications: | Fragment: " . $FragmentPub[$row->ID_DNA] . " | Publication: " . $Paper_Cache[$row->ID_DNA] . " | " . $LinkPub2 ." | " : "",
$Provided_By_People ? "DNA is Provided By: | " . $Provided_By_People . " | " : "",
$row->Block_Until ? "and Blocked until: | " . DatumsWandler($row->Block_Until) . " | " : "",
$row->Block_General ? "DNA is Blocked in General: | Yes | " : "",
$row->Stock_Gone ? "Stock material gone: | Yes | " : "",
$Location_Fridge || $LocationRack || $Location_Box ? "Location Stock: | Fridge: " . $Location_Fridge . " | Drawer: " . $Location_Box . " | Rack: " . $Location_Rack . " | Position: " . $Stock_Position . " | Barcode: " . $Stock_Barcode . " | Source volume (µl): " .$Location_Volume . " | Remaining volume (µl): " . $Location_Rest . " | " : "Location Stock: | No Stock made | ",
$Aliquots_Fridge[$row->ID_DNA] || $Aliquots_Rack[$row->ID_DNA] || $Aliquots_Box[$row->ID_DNA] || $Aliquot_Barcode[$row->ID_DNA] ? "Location Aliquots: | Fridge: " . $Aliquots_Fridge[$row->ID_DNA] . " | Drawer: " . $Aliquots_Box[$row->ID_DNA] . " | Rack: " . $Aliquots_Rack[$row->ID_DNA] . " | Position: " . $Aliquot_Position[$row->ID_DNA] . " | Aliquot No: " . $Aliquot_Number[$row->ID_DNA] . " | Barcode: " . $Aliquot_Barcode[$row->ID_DNA] . " | Source volume (µl): " . $Origin_Quantity[$row->ID_DNA] . " | Remaining volume (µl): " . $Rest_Quantity[$row->ID_DNA] . " | " : "Location Aliquot: | No Aliquots made | ",
$row->Backup_Aliquot ? "Backup Aliquot made: | Yes | " : "Backup Aliquot made: | No | ",
$row->Notes ? "Notes: | " . $row->Notes . " | " : "",
$Customer[$row->ID_DNA] ? "Requests: | Customer: " . $Customer[$row->ID_DNA] . " | Date: " . $DateRequest . " | Quantity of Aliquots: " . $Request_Number_Aliquots[$row->ID_DNA] . " | Notes: " . $Request_Notes[$row->ID_DNA] . " | " : "",
"Dataset created by: | " . $row->Created_Who . " (" . DatumsWandler($row->Created_When) . ") | ",
$row->Update_Who ? "Dataset last modified by: | " . $row->Update_Who . " (" . DatumsWandler($row->Update_When) . ") | " : "",
"";
if($formSubmitSaveEdit)
{$result0 = "UPDATE tablednabanknumbers SET Lock_Who = '', Lock_When = '' WHERE tablednabanknumbers.ID_DNA = '$ID_DNA'";
$sql0 = mysql_query($result0);}
else {
$result10 = "SELECT ID_DNA, Lock_Who, Lock_When FROM tablednabanknumbers WHERE ID_DNA = '$ID_DNA'";
$sql10 = mysql_query($result10);
while($row = mysql_fetch_object($sql10))
{ $TestWho = $row->Lock_Who;
$TestWhen = $row->Lock_When;}
if($TestWho == "")
{ echo " | "; }
if($TestWho != "")
{
$TestWhen2 = $TestWhen + "0000-00-00 00:30:00";
if($TestWhen2 <= $Current_Date)
{
if($TestWho != $log)
{echo "Dataset temporarily not editable."; }
}
if($TestWhen2 > $Current_Date or $TestWho == $log)
{ $result11 = "UPDATE tablednabanknumbers SET Lock_Who = '', Lock_When = '' WHERE tablednabanknumbers.ID_DNA = '$ID_DNA'";
$sql11 = mysql_query($result11);
echo "";
}
// Position Ende Einfügen für "Ausgabe ZSM" - Datei: "Extra-ZSM Query-Ausgabe.php"
} }
echo " ";
}
}
echo "\n";
}
mysql_query("DROP TABLE IF EXISTS tmpDnaIDs");
}
}
?>
|