Sorry, you don't have permission for this site! If you want to search for existing DNA data please use the Search function! | "; }
else { ?>
Please select an aliquot!";
$Check = "true"; }
else
{
foreach ($_POST['x'] as $index => $check)
{
if(isset($check))
{
// $index = $index+$check;
$IDDNATest = $_POST['IDDNA'][$index];
$IDAliquotsTest = $_POST['IDAliquots'][$index];
$IDRequestTest = $_POST['IDRequest'][$index];
$NumberTest = $_POST['Number'][$index];
$RestTest = $_POST['Rest'][$index];
$ShippingTest = $_POST['Shipping'][$index];
$SourceTest = $_POST['Source'][$index];
$PriceTest = $_POST['Price'][$index];
if($NumberTest != "") {
$sql1 = "SELECT ID_Aliquots, Rest_Quantity FROM aliquots WHERE ID_Aliquots = '$IDAliquotsTest'";
$result1 = mysqli_query($GLOBALS["___mysqli_ston"], $sql1);
while($row = mysqli_fetch_object($result1))
{$RestQuantity = $row->Rest_Quantity;
$ID = $row->ID_Aliquots;}
if($RestQuantity < $ShippingTest)
{ echo "Value of 'Shipping volume' is bigger than available volume for Aliquot No. ".$NumberTest.". Please enter a valid value! ";}
if($RestQuantity > $ShippingTest)
{
$RestTest2 = $RestQuantity - $ShippingTest;
if($formShippingDate != "" and $formShippingDate != "YYYY-MM-DD")
{
$Ship_Part = "Yes";
$Order_Part = "";
$Order_All = "";
$Ship_All = "";
$Ship_Rest = "";
$Order_Rest = ""; }
if($formShippingDate == "" or $formShippingDate == "YYYY-MM-DD")
{
$Ship_Part = "";
$Order_Part = "Yes";
$Order_All = "";
$Ship_All = "";
$Ship_Rest = "";
$Order_Rest = "";}
if($formOrderDate != "" and $formOrderDate != "YYYY-MM-DD")
{ $OrderDate = $formOrderDate." 00:00:00"; }
if($formShippingDate != "" and $formShippingDate != "YYYY-MM-DD")
{ $ShippingDate = $formShippingDate." 00:00:00"; }
$sql2a = "UPDATE aliquots SET Rest_Quantity = '$RestTest2', Update_Who = '$log', Update_When = '$Current_Date', Order_All = '$Order_All', Order_Partial = '$Order_Part', Order_Rest = '$Order_Rest', Shipping_All = '$Ship_All', Shipping_Partial = '$Ship_Part', Shipping_Rest = '$Ship_Rest' WHERE ID_Aliquots = '$ID'";
$result2a = mysqli_query($GLOBALS["___mysqli_ston"], $sql2a);
$sql3a = "INSERT INTO request (FK_People, FK_DNA, FK_Aliquots, Request_Date, Request_Number_Aliquots, Request_Volume, Request_Notes, Shipping_Date, PriceAndCurrency, Agreement Created_Who) VALUES ('$formCustomer','$IDDNATest','$ID','$OrderDate','$NumberTest','$ShippingTest','$formNotes','$ShippingDate','$PriceTest','$formAgreement','$log')";
$result3a = mysqli_query($GLOBALS["___mysqli_ston"], $sql3a);
#######################################Error 2a###############################################################
if(!$result2a)
{ $msg = $sql2a."\n";
$msg .= "####Error 2a####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php"); }
#############################################################################################################
#######################################Error 3a###############################################################
if(!$result3a)
{ $msg = $sql3a."\n";
$msg .= "####Error 3a####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php"); }
#############################################################################################################
} // if($RestQuantity > $RestTest and $RestQuantity > $ShippingTest)
if($RestTest == $ShippingTest)
{
if($formShippingDate != "" and $formShippingDate != "YYYY-MM-DD" and $ShippingTest == $SourceTest)
{
$Ship_All = "Yes";
$Order_All = "";
$Order_Part = "";
$Ship_Part = "";
$Ship_Rest = "";
$Order_Rest = "";}
if($formShippingDate == "" or $formShippingDate == "YYYY-MM-DD" and $ShippingTest == $SourceTest)
{
$Ship_All = "";
$Order_All = "Yes";
$Ship_Part = "";
$Order_Part = "";
$Ship_Rest = "";
$Order_Rest = "";}
if($formShippingDate != "" and $formShippingDate != "YYYY-MM-DD" and $ShippingTest != $SourceTest)
{
$Ship_All = "";
$Order_All = "";
$Order_Part = "";
$Ship_Part = "";
$Ship_Rest = "Yes";
$Order_Rest = ""; }
if($formShippingDate == "" or $formShippingDate == "YYYY-MM-DD" and $ShippingTest != $SourceTest)
{
$Ship_All = "";
$Order_All = "";
$Ship_Part = "";
$Order_Part = "";
$Ship_Rest = "";
$Order_Rest = "Yes"; }
if($formOrderDate != "" and $formOrderDate != "YYYY-MM-DD")
{ $OrderDate = $formOrderDate." 00:00:00"; }
if($formShippingDate != "" and $formShippingDate != "YYYY-MM-DD")
{ $ShippingDate = $formShippingDate." 00:00:00"; }
$sql2b = "UPDATE aliquots SET Rest_Quantity = '0', Update_Who = '$log', Update_When = '$Current_Date', Order_All = '$Order_All', Order_Partial = '$Order_Part', Order_Rest = '$Order_Rest', Shipping_All = '$Ship_All', Shipping_Partial = '$Ship_Part', Shipping_Rest = '$Ship_Rest' WHERE ID_Aliquots = '$ID'";
$result2b = mysqli_query($GLOBALS["___mysqli_ston"], $sql2b);
$sql3b = "INSERT INTO request (FK_People, FK_DNA, FK_Aliquots, Request_Date, Request_Number_Aliquots, Request_Volume, Request_Notes, Shipping_Date, PriceAndCurrency, Agreement, Created_Who) VALUES ('$formCustomer','$IDDNATest','$ID','$OrderDate','$NumberTest','$ShippingTest','$formNotes','$ShippingDate','$PriceTest','$formAgreement','$log')";
$result3b = mysqli_query($GLOBALS["___mysqli_ston"], $sql3b);
#######################################Error 3b###############################################################
if(!$result3b)
{ $msg = $sql3b."\n";
$msg .= "####Error 3b####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php"); }
#############################################################################################################
}
if($result3a or $result3b)
{ echo "Data have been saved!"; }
} // if($NumberTest != "")
if($NumberTest == "")
{
if($formShippingDate != "" and $formShippingDate != "YYYY-MM-DD")
{ $ShippingDate = $formShippingDate." 00:00:00"; }
if($formOrderDate != "" and $formOrderDate != "YYYY-MM-DD")
{ $OrderDate = $formOrderDate." 00:00:00"; }
$sql4 = "INSERT INTO request (FK_People, FK_DNA, Request_Date, Request_Number_Aliquots, Request_Notes, PriceAndCurrency, Shipping_Date, Agreement, Created_Who) VALUES ('$formCustomer','$IDDNATest','$OrderDate','No Aliquot made','$formNotes','$PriceTest','$ShippingDate','$formAgreement','$log')";
$result4 = mysqli_query($GLOBALS["___mysqli_ston"], $sql4);
#######################################Error 4###############################################################
if(!$result4)
{ $msg = $sql4."\n";
$msg .= "####Error 4####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php"); }
#############################################################################################################
}
} // if(isset($check)
} //foreach ($_POST['x'] as $index => $check)
} //else
}
?>
|
Customer |
|
|
DNA Extraction Numbers |
|
Please separate numbers with semicolon (e.g. DB 236;DB 289;DB 324) |
Show available aliquots only |
"; ?>
| |
0) {
$sqlupdate = "UPDATE people SET FormOfAddress = '$formFormOfAddress', Title = '$formTitle', Forename = '$formForename', Surname = '$formSurname', Name_All = '$Name_All', Phone = '$formPhone', Email = '$formEmail', Remarks = '$formNotes', Institut = '$formInstitut', Division = '$formDivision', Street = '$formStreet', City = '$formCity', Postal_Code = '$formPostal_Code', Country = '$formCountry', Institut_Delivery = '$formInstitut2', Division_Delivery = '$formDivision2', Street_Delivery = '$formStreet2', City_Delivery = '$formCity2', Postal_Code_Delivery = '$formPostal_Code2', Country_Delivery = '$formCountry2', ExtractionStaff = '$formExtraction', Provider = '$formProvider', Customer = '$formCustomer2', Updated_When = '$Current_Date', Updated_Who = '$log' WHERE Email = '$formEmail'";
$resultupdate = mysqli_query($GLOBALS["___mysqli_ston"], $sqlupdate);
###############################################Error resultupdate####################################################
if(!$resultupdate)
{
$msg = $sqlupdate."\n";
$msg .= "####Error resultupdate####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
#########################################################################################################
if($resultupdate) { echo "Customer data have been saved. | "; }
}
else {
$sqlinsert = "INSERT INTO people (FormOfAddress, Title, Forename, Surname, Phone, Email, Remarks, Name_All, Institut, Division, Street, City, Postal_Code, Country, Institut_Delivery, Division_Delivery, Street_Delivery, City_Delivery, Postal_Code_Delivery, Country_Delivery, ExtractionStaff, Provider, Customer, Created_Who) VALUES ('$formFormOfAddress','$formTitle','$formForename','$formSurname','$formPhone','$formEmail','$formNotes','$Name_All','$formInstitut','$formDivision','$formStreet','$formCity','$formPostal_Code','$formCountry','$formInstitut2','$formDivision2','$formStreet2','$formCity2','$formPostal_Code2','$formCountry2','$formExtraction','$formProvider','$formCustomer2','$log')";
$resultinsert = mysqli_query($GLOBALS["___mysqli_ston"], $sqlinsert);
###############################################Error insert2####################################################
if(!$resultinsert)
{
$msg = $sqlinsert."\n";
$msg .= "####Error insert2####";
if($debug == '1') echo $msg;
trigger_error($msg, E_USER_ERROR);
include ("../config/Errorreport.php");
$error = "true"; }
#########################################################################################################
}
if($resultinsert) { echo "Customer data have been changed successfully. | "; }
}
if($formSubmitCheck or $formSubmitEditView or $formSubmitSave2)
{
if(empty($formCustomer) and empty($formDnaBankNumber))
{ echo "No search key entered!";}
else {
$sql1 = "SELECT * FROM people WHERE people.ID_People = '$formCustomer'";
$result1 = mysqli_query($GLOBALS["___mysqli_ston"], $sql1);
while($row = mysqli_fetch_object($result1))
{
echo '';
echo ' | ';
}
$DnaArray = explode(";", $formDnaBankNumber);
while($i = each($DnaArray))
{
$Dna = trim($i[1]);
$string .= 'dnabanknumbers.Dna_Bank_Number = "'.$Dna.'" OR ';
//Check if DNA samples are in database
$sqlcheck = "SELECT Dna_Bank_Number FROM dnabanknumbers WHERE Dna_Bank_Number = '".$Dna."'";
$resultcheck = mysqli_query($GLOBALS["___mysqli_ston"], $sqlcheck);
if(mysqli_num_rows($resultcheck) == 0)
{ echo "DNA sample '".$Dna."' has not been found in database! "; }
else { // if required DNA sample is in database ; if DNA samples is not in database show message (see line xy)
//Check for each DNA Bank Number if rest quantity of aliquot is enough for shipping
$sqltest = "SELECT dnabanknumbers.ID_DNA, dnabanknumbers.Dna_Bank_Number,
aliquots.ID_Aliquots,
aliquots.Rest_Quantity,
aliquots.Origin_Quantity
FROM dnabanknumbers
LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.FK_DNA
WHERE dnabanknumbers.Dna_Bank_Number = '".$Dna."'
AND aliquots.Rest_Quantity >= ".$StandardVolume;
$resulttest = mysqli_query($GLOBALS["___mysqli_ston"], $sqltest);
if(mysqli_num_rows($resulttest) == 0)
{
//if rest quantity of aliquot is not enough for shipping, check rest quantity of stock
$sqlteststock = "SELECT dnabanknumbers.ID_DNA,
dnabanknumbers.Dna_Bank_Number,
dnabanknumbers.FK_Location_Stock,
location_stock.Origin_Quantity,
location_stock.Rest_Quantity
FROM dnabanknumbers, location_stock
WHERE dnabanknumbers.DNA_Bank_Number = '".$Dna."'
AND dnabanknumbers.FK_Location_Stock = location_stock.ID_Location_Stock
AND location_stock.Rest_Quantity >= ".$StandardVolume;
$resultteststock = mysqli_query($GLOBALS["___mysqli_ston"], $sqlteststock);
$countQuantityStock = mysqli_num_rows($resultteststock);
//if rest Quantity of stock is enough subtract another aliquot
if($countQuantityStock > 0) {
while($row = mysqli_fetch_object($resultteststock))
{ $NewStockQuantity = $row->Rest_Quantity - $StandardVolume;
$ID_Location_Stock = $row->FK_Location_Stock; }
// search for letter suffix of last existing aliquot
$sqltest2 = "SELECT dnabanknumbers.ID_DNA, dnabanknumbers.Dna_Bank_Number,
aliquots.ID_Aliquots,
aliquots.Aliquot_Number
FROM dnabanknumbers
LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.FK_DNA
WHERE dnabanknumbers.Dna_Bank_Number = '".$Dna."'
ORDER BY aliquots.Aliquot_Number DESC LIMIT 1";
$resulttest2 = mysqli_query($GLOBALS["___mysqli_ston"], $sqltest2);
while($row = mysqli_fetch_object($resulttest2))
{ $Number = $row->Aliquot_Number;
$IDDNA = $row->ID_DNA;
$DNA_Bank_Number = $row->Dna_Bank_Number; }
$suffix = substr($Number, -1);
$suffix++;
if($suffix == "")
{$suffix = "A"; }
//insert new aliquot
$Aliquot_Number = $DNA_Bank_Number."-".$suffix;
$sqlNewAliquot = "INSERT INTO aliquots (FK_DNA, Aliquot_Number, Origin_Quantity, Rest_Quantity, Price, Currency, Created_Who) " .
"VALUES ('$IDDNA','$Aliquot_Number','$StandardVolume','$StandardVolume','$PricePerAliquot','$Currency','$log')";
$resultNewAliquot = mysqli_query($GLOBALS["___mysqli_ston"], $sqlNewAliquot);
$sqlupdatestock = "UPDATE location_stock SET Rest_Quantity = '".$NewStockQuantity."' WHERE ID_Location_Stock = '".$ID_Location_Stock."'";
$resultupdatestock = mysqli_query($GLOBALS["___mysqli_ston"], $sqlupdatestock);
//$NewStockQuantity pruefen: >= $StandardVolume = ok; < $StandardVolume -> Warnung!
if($NewStockQuantity < $StandardVolume) { echo "Stock for ".$Dna." almost gone now."; }
} // if($countQuantityStock > 0)
//if rest Quantity of stock is NOT enough display message
if($countQuantityStock == 0 or $countQuantityStock < $Standardvolume) {
echo "Stock almost or already gone (".$countQuantityStock." µl). Shipping of aliquot impossible. Please do a new extraction for ".$Dna.". ";
} // if($countQuantityStock = 0)
} // if(mysql_num_rows($resulttest) = 0)
} //if(mysql_num_rows($resultcheck) != 0), if required DNA sample is in database
} // while($i = each($DnaArray))
$l=strlen ($string);
$max = $l-4;
$str = "(".substr($string, 0, $max).") ";
if(isset($_POST['shipping']))
{ $str .= 'AND aliquots.Rest_Quantity >= '.$StandardVolume; }
$sql2 = "SELECT dnabanknumbers.ID_DNA, dnabanknumbers.Dna_Bank_Number, " .
"aliquots.ID_Aliquots, " .
"aliquots.Aliquot_Number, " .
"aliquots.Origin_Quantity, " .
"aliquots.Rest_Quantity, " .
"aliquots.Aliquot_Barcode, " .
"aliquots.Aliquot_Position, " .
"aliquots.Price, " .
"aliquots.Currency, " .
"aliquots_box.Aliquots_Box, " .
"aliquots_rack.Aliquots_Rack, " .
"aliquots_fridge.Aliquots_Fridge " .
"FROM dnabanknumbers
LEFT JOIN aliquots ON dnabanknumbers.ID_DNA = aliquots.FK_DNA
LEFT JOIN aliquots_box ON aliquots.FK_Aliquots_Box = aliquots_box.ID_Aliquots_Box
LEFT JOIN aliquots_rack ON aliquots.FK_Aliquots_Rack = aliquots_rack.ID_Aliquots_Rack
LEFT JOIN aliquots_fridge ON aliquots.FK_Aliquots_Fridge = aliquots_fridge.ID_Aliquots_Fridge
WHERE ".$str." ORDER BY dnabanknumbers.Dna_Bank_Number";
$result2 = mysqli_query($GLOBALS["___mysqli_ston"], $sql2);
$countresult2 = mysqli_num_rows($result2);
echo "";
if(empty($formDnaBankNumber))
{ echo "Please enter a DNA Extraction Number!";}
else {
if($countresult2 == 0) {
echo "No aliquots found! ";
}
if($countresult2 > 0) {
echo "";
}
echo " | ";
echo "
| ";
echo "Order date | | ";
echo "MTA received and accepted | | ";
echo "Shipping date | | (you can add this later) | ";
echo "Internal Notes | | ";
echo " |