Please select an aliquot!"; }
else
{
foreach ($_POST['x'] as $index => $check)
{
if(isset($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];
if($NumberTest != "") {
$result1 = "SELECT ID_Aliquots, Rest_Quantity FROM tablealiquots WHERE ID_Aliquots = '$IDAliquotsTest'";
$sql1 = mysql_query($result1);
while($row = mysql_fetch_object($sql1))
{$RestQuantity = $row->Rest_Quantity;
$ID = $row->ID_Aliquots;}
if($RestQuantity < $ShippingTest)
{ echo "Der Wert für 'Shipping volume' ist größer als das verfügbare Volumen für Aliquot Nr. ".$NumberTest.". Bitte wiederholen Sie die Eingabe mit einem korrekten Wert! ";}
if($RestQuantity > $ShippingTest)
{
$RestTest2 = $RestQuantity - $ShippingTest;
if($formShippingDate != "" and $formShippingDate != "dd.mm.yyyy")
{
$Ship_Part = "Yes";
$Order_Part = "";
$Order_All = "";
$Ship_All = "";
$Ship_Rest = "";
$Order_Rest = "";}
if($formShippingDate == "" or $formShippingDate == "dd.mm.yyyy")
{
$Ship_Part = "";
$Order_Part = "Yes";
$Order_All = "";
$Ship_All = "";
$Ship_Rest = "";
$Order_Rest = "";}
$result2a = "UPDATE tablealiquots SET Rest_Quantity = '$RestTest2', Update_Who = '$log', Update_When = '$Current_Date' WHERE ID_Aliquots = '$ID'";
$sql2a = mysql_query($result2a);
$result3a = "INSERT INTO tablerequest (ID_People, ID_DNA, ID_Aliquots, Request_Date, Request_Number_Aliquots, Request_Volume, Request_Notes, Shipping_Date, Price, Order_All, Order_Partial, Order_Rest, Shipping_All, Shipping_Partial, Shipping_Rest, Created_Who) VALUES ('$formCustomer','$IDDNATest','$ID','$OrderDate','$NumberTest','$ShippingTest','$formNotes','$ShippingDate','$formPrice','$Order_All','$Order_Part','$Order_Rest','$Ship_All','$Ship_Part','$Ship_Rest','$log')";
$sql3a = mysql_query($result3a);
#######################################Error 2a###############################################################
if(!$sql2a)
{ $msg = $result2a."\n";
$msg .= "####Error 2a####";
trigger_error($msg, E_USER_ERROR);
include ("Errorreport.php"); }
#############################################################################################################
#######################################Error 3a###############################################################
if(!$sql3a)
{ $msg = $result3a."\n";
$msg .= "####Error 3a####";
trigger_error($msg, E_USER_ERROR);
include ("Errorreport.php"); }
#############################################################################################################
} // if($RestQuantity > $RestTest and $RestQuantity > $ShippingTest)
if($RestTest == $ShippingTest)
{
if($formShippingDate != "" and $formShippingDate != "dd.mm.yyyy" and $ShippingTest == $SourceTest)
{
$Ship_All = "Yes";
$Order_All = "";
$Order_Part = "";
$Ship_Part = "";
$Ship_Rest = "";
$Order_Rest = "";}
if($formShippingDate == "" or $formShippingDate == "dd.mm.yyyy" and $ShippingTest == $SourceTest)
{
$Ship_All = "";
$Order_All = "Yes";
$Ship_Part = "";
$Order_Part = "";
$Ship_Rest = "";
$Order_Rest = "";}
if($formShippingDate != "" and $formShippingDate != "dd.mm.yyyy" and $ShippingTest != $SourceTest)
{
$Ship_All = "";
$Order_All = "";
$Order_Part = "";
$Ship_Part = "";
$Ship_Rest = "Yes";
$Order_Rest = ""; }
if($formShippingDate == "" or $formShippingDate == "dd.mm.yyyy" and $ShippingTest != $SourceTest)
{
$Ship_All = "";
$Order_All = "";
$Ship_Part = "";
$Order_Part = "";
$Ship_Rest = "";
$Order_Rest = "Yes"; }
$result2b = "UPDATE tablealiquots SET Rest_Quantity = '0', Update_Who = '$log', Update_When = '$Current_Date' WHERE ID_Aliquots = '$ID'";
$sql2b = mysql_query($result2b);
$result3b = "INSERT INTO tablerequest (ID_People, ID_DNA, ID_Aliquots, Request_Date, Request_Number_Aliquots, Request_Volume, Request_Notes, Shipping_Date, Price, Order_All, Order_Partial, Order_Rest, Shipping_All, Shipping_Partial, Shipping_Rest, Agreement, Created_Who) VALUES ('$formCustomer','$IDDNATest','$ID','$OrderDate','$NumberTest','$ShippingTest','$formNotes','$ShippingDate','$formPrice','$Order_All','$Order_Part','$Order_Rest','$Ship_All','$Ship_Part','$Ship_Rest','$formAgreement','$log')";
$sql3b = mysql_query($result3b);
#######################################Error 3b###############################################################
if(!$sql3b)
{ $msg = $result3b."\n";
$msg .= "####Error 3b####";
trigger_error($msg, E_USER_ERROR);
include ("Errorreport.php"); }
#############################################################################################################
}
if($sql3a or $sql3b)
{ echo "Data have been saved!"; }
} // if($NumberTest != "")
if($NumberTest == "")
{
$result4 = "INSERT INTO tablerequest (ID_People, ID_DNA, Request_Date, Request_Number_Aliquots, Request_Notes, Order_All, Shipping_Date, Agreement, Created_Who) VALUES ('$formCustomer','$IDDNATest','$OrderDate','No Aliquot made','$formNotes','No Aliquot made!','$ShippingDate','$formAgreement','$log')";
$sql4 = mysql_query($result4);
#######################################Error 4###############################################################
if(!$sql4)
{ $msg = $result4."\n";
$msg .= "####Error 4####";
trigger_error($msg, E_USER_ERROR);
include ("Errorreport.php"); }
#############################################################################################################
}
} // if(isset($check)
} //foreach ($_POST['x'] as $index => $check)
} //else
}
?>
>>> Help <<<
|
Please insert a new order!
If you want to add shipping date, cancel existing order or check orders please use this form. |
Customer: |
|
edit/new
|
DNA Extraction Numbers: |
|
Please separate numbers with semicolon (e.g. 236;289;324) |
Zeige nur verfügbare Aliquots: |
"; ?>
|
|
No search key entered!";}
else {
$result1 = "SELECT tablepeople.ID_People, " .
"tablepeople.Title, " .
"tablepeople.Forename, " .
"tablepeople.Surname, " .
"tablepeople.Phone, " .
"tablepeople.Email, " .
"tablepeople.Name_All, " .
"tablepeople.Customer_Number, " .
"tableinstitut.University, " .
"tableinstitut.Division, " .
"tableinstitut.Address, " .
"tableinstitut.Postal_Code, " .
"tableinstitut.City, " .
"tableinstitut.Country, " .
"tableinstitut.Homepage FROM tablepeople ".
"JOIN tableinstitut ON tablepeople.ID_Institut = tableinstitut.ID_Institut " .
"WHERE tablepeople.ID_People = '$formCustomer'";
$sql1 = mysql_query($result1);
while($row = mysql_fetch_object($sql1))
{ $Title = $row->Title;
$Forename = $row->Forename;
$Surname = $row->Surname;
$Phone = $row->Phone;
$Email = $row->Email;
$Name_All = $row->Name_All;
$Customer_Number = $row->Customer_Number;
$University = $row->University;
$Division = $row->Division;
$Address = $row->Address;
$Postal_Code = $row->Postal_Code;
$City = $row->City;
$Country = $row->Country;
$Homepage = $row->Homepage; }
$DnaArray = explode(";", $formDnaBankNumber);
while($i = each($DnaArray))
{
$Dna = trim($i[1]);
$string .= 'tablednabanknumbers.Dna_Bank_Number = "'.$Dna.'" OR '; }
$l=strlen ($string);
$max = $l-4;
$str = "(".substr($string, 0, $max).")";
if(isset($shipping))
{ $str .= 'AND tablealiquots.Rest_Quantity > 0'; }
$result2 = "SELECT tablednabanknumbers.ID_DNA, tablednabanknumbers.Dna_Bank_Number, " .
"tablealiquots.ID_Aliquots, " .
"tablealiquots.Aliquot_Number, " .
"tablealiquots.Origin_Quantity, " .
"tablealiquots.Rest_Quantity, " .
"tablealiquots.Aliquot_Barcode, " .
"tablealiquots.Aliquot_Position, " .
"tablealiquots_box.Aliquots_Box, " .
"tablealiquots_rack.Aliquots_Rack, " .
"tablealiquots_fridge.Aliquots_Fridge " .
"FROM tablednabanknumbers
LEFT JOIN tablealiquots ON tablednabanknumbers.ID_DNA = tablealiquots.ID_DNA
LEFT JOIN tablealiquots_box ON tablealiquots.ID_Aliquots_Box = tablealiquots_box.ID_Aliquots_Box
LEFT JOIN tablealiquots_rack ON tablealiquots.ID_Aliquots_Rack = tablealiquots_rack.ID_Aliquots_Rack
LEFT JOIN tablealiquots_fridge ON tablealiquots.ID_Aliquots_Fridge = tablealiquots_fridge.ID_Aliquots_Fridge
WHERE ".$str." ORDER BY tablednabanknumbers.Dna_Bank_Number";
$sql2 = mysql_query($result2);
echo "Details for: ".$Name_All." | ";
echo "".$Title." | ";
echo "".$Forename." ".$Surname." | ";
echo "".$University." | ";
echo "".$Division." | ";
echo "".$Address." | ";
echo "".$Postal_Code." | ";
echo "".$City." | ";
echo "".$Country." | ";
echo "
| ";
echo "";
if(empty($formDnaBankNumber))
{ echo "Please enter a DNA Extraction Number!";}
else {
//NORMAL:
echo " | | | ";
}
} } ?>
|
|
|