<?php session_start(); ?>
<?php session_cache_limiter('private-no-expire'); ?>

<!DOCTYPE html>
<meta charset="utf-8">
<html lang="en">
<HEAD>
<TITLE>Definire date unitate</TITLE>

<link rel="stylesheet" type="text/css" href="stiluri3.css">

</HEAD>
<script language="javascript" type="text/javascript">
function load()
{
alert("Datele au fost salvate cu succes!");
window.close();
}

var w5;
function target_popup5(form) {
		w5=window.open('', 'win05','width=800,height=170,top=300,left=250,toolbar=no, location=no,status=no,menubar=no,scrollbars=no,resizable=no');
		form.target = 'win05';
}
var w10;
function target_popup10(form) {
		w10=window.open('', 'win10','width=600,height=350,top=200,left=400,resizeable,scrollbars');
		form.target = 'win10';
}
</script>

</head>
<body onkeydown="enterToTab(event);">
<CENTER>
<?php
ob_start();
include 'javascripts.php';
include 'conectare.php';



			
	

if ($_POST["actiune"]=="DEFINIRE DATE UNITATE")
{	
	include 'A21_param2.php';
			echo "<TR>";
			echo "<TD colspan=\"35\" align=\"center\">";
			echo "<B>DEFINIRE DATE UNITATE</B>";
			echo "</TD>";
			echo "</TR>";
			echo "<FORM NAME=\"form1\" ACTION=\"A21_utilitare.php\" METHOD=\"POST\">";
			include 'A03_param2.php';
			echo "</TABLE>";
			
			$connection=mysql_connect("$host","$username","$password") or die("Nu aveti acces la server");
			$baza="apponlin_"."apponlin_".$_POST["aplic"]."_".$_POST["unit"];
			$db=mysql_select_db($baza,$connection) or die("Nu puteti selecta Baza de date ".$baza);

			$query="SELECT * FROM unitate where unit=\"".$_POST["unit"]."\"";
			$result=mysql_query($query) or die("Interogare esuata: ".mysql_error());

	$i=0;
	while($row=mysql_fetch_array($result))
	{
		echo "<TABLE class=\"table2\" id=\"navigate\" cellSpacing=0 cellPadding=0 width=\"100%\" border=0>";
		if ($i-floor($i/2)*2==0)
		{
			echo "<TR BGCOLOR=\"#FFFFFF\">";
		}
		else
		{
			echo "<TR BGCOLOR=\"#EAEBEB\">";
		}
			  	
		echo "<tr><td><BR></td></tr>";
/*		
		echo "<tr>";
		echo "<td colspan=\"2\">Cod unitate:</td>";
		echo "<td colspan=\"2\">";
		echo "".$row["unit"]."";
		echo "</td>";
		echo "</tr>";
*/		
		echo "<tr>";
		echo "<td colspan=\"2\">Denumire unitate:</td>";
		echo "<td colspan=\"2\">";
		echo "<input name=\"denunit\" type=\"text\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\" id=\"denunit\" size=\"50\" VALUE=\"".$row["denunit"]."\">";
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Cod fiscal:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\"  onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_numar(this)\" onkeypress=\"return isNumberKey(event)\" size=\"12\"  NAME=\"cf\" VALUE=\"".$row["cf"]."\">";
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Denumire functie 1:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"func1\" size=\"30\" VALUE=\"".$row["func1"]."\">";		
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Nume si prenume 1:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\"  onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"nume1\" size=\"30\" VALUE=\"".$row["nume1"]."\">";		
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Denumire functie 2:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"func2\" size=\"30\" VALUE=\"".$row["func2"]."\">";				
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Nume si prenume 2:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"nume2\" size=\"30\" VALUE=\"".$row["nume2"]."\">";		
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Adresa:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"adresa\" size=\"50\" VALUE=\"".$row["adresa"]."\">";		
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Judetul:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"judet\" size=\"25\" VALUE=\"".$row["judet"]."\">";		
		echo "</td>";
		echo "</tr>";
	
		echo "<tr><td><BR></td></tr>";

		echo "<tr>";
		echo "<td colspan=\"5\" align=\"right\" height=\"35px\">";
		echo "<input type=\"submit\" name=\"actiune\" id=\"button10\" value=\"MODIFIC\">";
		echo "<input type=\"hidden\" name=\"tip_act4\" value=\"DATE_GEN\">";
		//echo "<input type=\"submit\" name=\"actiune\" value=\"MODIFIC\" onMouseUp=\"javascript:setTimeout('window.close()',3000);\">";
		echo "<input type=\"button\" onclick=\"javascript:window.close()\" id=\"button10\" value=\"RENUNT\">";
		echo "</td>";
		echo "</tr>";
		$i++;
					
	}	
	 echo  "</table>";		
	mysql_close($connection);
		
				
}	 

if ($_POST["actiune"]=="MODIFIC" AND isset($_POST["tip_act4"]) AND $_POST["tip_act4"]=="DATE_GEN")
{
		
		echo "<body onload=\"load()\">";

			include 'A21_param2.php';
			echo "<TR>";
			echo "<TD colspan=\"35\" align=\"center\">";
			echo "<B>DEFINIRE DATE UNITATE</B>";
			echo "</TD>";
			echo "</TR>";
			echo "<FORM NAME=\"form1\" ACTION=\"A21_utilitare.php\" METHOD=\"POST\">";
			echo "</TABLE>";
		
			$connection=mysql_connect("$host","$username","$password") or die("Nu aveti acces la server");
			$baza="apponlin_"."apponlin_".$_POST["aplic"]."_".$_POST["unit"];
			$db=mysql_select_db($baza,$connection) or die("Nu puteti selecta Baza de date ".$baza);
			
			include 'A21_param2.php';
			
			$query="UPDATE unitate SET denunit=\"".$_POST["denunit"]."\",cf=\"".$_POST["cf"]."\",func1=\"".$_POST["func1"]."\",";
			$query=$query."nume1=\"".$_POST["nume1"]."\",func2=\"".$_POST["func2"]."\",nume2=\"".$_POST["nume2"]."\",";
			$query=$query."adresa=\"".$_POST["adresa"]."\",judet=\"".$_POST["judet"]."\" where unit=\"".$_POST["unit"]."\"";
			$result=mysql_query($query) or die("Interogare esuata: ".mysql_error());
									
			$query2="SELECT * FROM unitate where unit=\"".$_POST["unit"]."\"";
			$result2=mysql_query($query2) or die("Interogare esuata: ".mysql_error());
			$total2 = mysql_num_rows($result2);
		
	$i=0;
	while($row=mysql_fetch_array($result2))
	{
		echo "<TABLE class=\"table2\" id=\"navigate\" cellSpacing=0 cellPadding=0 width=\"100%\" border=0>";
		if ($i-floor($i/2)*2==0)
		{
			echo "<TR BGCOLOR=\"#FFFFFF\">";
		}
		else
		{
			echo "<TR BGCOLOR=\"#EAEBEB\">";
		}		  	
		echo "<tr><td><BR></td></tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Cod unitate:</td>";
		echo "<td colspan=\"2\">";
		echo "".$row["unit"]."";
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Denumire unitate:</td>";
		echo "<td colspan=\"2\">";
		echo "<input name=\"denunit\" type=\"text\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\" id=\"denunit\" size=\"50\" VALUE=\"".$row["denunit"]."\">";
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Cod fiscal:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\"  onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_numar(this)\" onkeypress=\"return isNumberKey(event)\" size=\"12\"  NAME=\"cf\" VALUE=\"".$row["cf"]."\">";
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Denumire functie 1:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"func1\" size=\"30\" VALUE=\"".$row["func1"]."\">";		
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Nume si prenume 1:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\"  onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"nume1\" size=\"30\" VALUE=\"".$row["nume1"]."\">";		
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Denumire functie 2:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"func2\" size=\"30\" VALUE=\"".$row["func2"]."\">";				
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Nume si prenume 2:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"nume2\" size=\"30\" VALUE=\"".$row["nume2"]."\">";		
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Adresa:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"adresa\" size=\"50\" VALUE=\"".$row["adresa"]."\">";		
		echo "</td>";
		echo "</tr>";
		echo "<tr>";
		echo "<td colspan=\"2\">Judetul:</td>";
		echo "<td colspan=\"2\">";
		echo "<INPUT TYPE=\"TEXT\" onkeydown=\"ModifyEnterKeyPressAsTab(event)\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\"  NAME=\"judet\" size=\"25\" VALUE=\"".$row["judet"]."\">";		
		echo "</td>";
		echo "</tr>";
			
		echo "<tr><td><BR></td></tr>";

		echo "<tr>";
		echo "<td colspan=\"5\" align=\"right\">";
		echo "<input type=\"submit\" name=\"actiune\" id=\"button10\" value=\"MODIFIC\" onLoad=\"javascript:window.close();\">";
		//echo "<input type=\"submit\" name=\"actiune\" value=\"MODIFIC\" onMouseUp=\"javascript:setTimeout('window.close()',3000);\">";
		echo "<input type=\"button\" onclick=\"javascript:window.close()\" id=\"button10\" value=\"RENUNT\">";
		echo "</td>";
		echo "</tr>";
		$i++;
					
	}	
	echo "</form>";
	echo  "</table>";		
	mysql_close($connection);																																
}			
	
if ($_POST["actiune"]=="GRUPE COPII" 
		OR $_POST["actiune"]=="CONFIRM" AND isset($_POST["tip_act2"]) AND $_POST["tip_act2"]=="GRUPE"
		OR $_POST["actiune"]=="MODIFIC" AND isset($_POST["tip_act2"]) AND $_POST["tip_act2"]=="GRUPE"
		OR $_POST["actiune"]=="STERGE" AND isset($_POST["tip_act2"]) AND $_POST["tip_act2"]=="GRUPE")
{	
			echo "<TR>";
			echo "<TD colspan=\"35\" align=\"center\">";
			echo "<B>GRUPE COPII</B>";
			echo "</TD>";
			echo "</TR>";
			echo "</TABLE>";
			echo "<BR>";
			$connection=mysql_connect("$host","$username","$password") or die("Nu aveti acces la server");
			$baza="apponlin_".$_POST["aplic"]."_".$_POST["unit"];
			$db=mysql_select_db($baza,$connection) or die("Nu puteti selecta Baza de date ".$baza);

			IF ($_POST["actiune"]=="CONFIRM" AND isset($_POST["tip_act2"]) AND $_POST["tip_act2"]=="GRUPE")
			{
				include 'A21_param2.php';
				
				$wcodgrp = $_POST["codgrp"];
				$wdengrp=$_POST["dengrp_".$wcodgrp];
				
				
				$query1="INSERT INTO grupe (codgrp,dengrp)";
				$query1=$query1."VALUES (\"".$wcodgrp."\",\"".$wdengrp."\")";
				$result1=mysql_query($query1) or die("Interogare esuata: ".mysql_error());	
			}
			
			if ($_POST["actiune"]=="MODIFIC" and isset($_POST["tip_act2"]) AND $_POST["tip_act2"] == "GRUPE")
			{	
				include 'A21_param1.php';
		
				$wcodgrp=$_POST["codgrp"];
				$wdengrp=$_POST["dengrp"];
			
				$query2="UPDATE grupe set codgrp=\"".$wcodgrp."\", dengrp=\"".$wdengrp."\" WHERE codgrp = \"".$_POST["codgrp"]."\"";
				$result2=mysql_query($query2) or die("Interogare esuata: ".mysql_error());
			}
			
			if ($_POST["actiune"]=="STERGE" and isset($_POST["tip_act2"]) AND $_POST["tip_act2"] == "GRUPE")
			{
				include 'A21_param1.php';
		
				$query3="DELETE FROM grupe WHERE codgrp = \"".$_POST["codgrp"]."\"";
				$result3=mysql_query($query3) or die("Interogare esuata: ".mysql_error());
			}

	
			echo "<FORM NAME=\"form\" ACTION=\"A21_utilitare.php\" METHOD=\"POST\" onsubmit=\"target_popup5(this)\">";
			include 'A21_param2.php';
			echo "<TABLE cellSpacing=0 cellPadding=0 width=\"70%; height:100%;\" border=0 align=\"right\">";	
			echo "<TR>";
			echo "<TD align=\"right\" height=\"35\">";
			echo "<input type=\"submit\" class=\"noPrint\" NAME=\"actiune\" value=\"ADAUGARE\">";
			echo "<input type=\"hidden\" name=\"tip_act\" value=\"GRUPE\">";
			echo "</TD>";	
			echo "</FORM>";
			
			echo "<FORM NAME=\"form\" ACTION=\"A21_copii.php\" METHOD=\"POST\" target=\"win01\">";
			include 'A21_param2.php';	
			echo "<TD align=\"left\" height=\"35\">";			
			echo "<input type=\"submit\" class=\"noPrint\" NAME=\"actiune\" value=\"INAPOI\" onMouseUp=\"javascript:setTimeout('window.close()',300);\">";
			echo "</TD>";
			echo "</TR>";
			echo "<TR><TD>&nbsp</TD></TR>";
			echo "</TABLE>";
			echo "<TABLE cellSpacing=0 cellPadding=0 width=\"70%\" border=0>";
			echo "<TR BGCOLOR=\"white\">";			
			echo 	"<TH align=\"center\" width=\"10%\" class=\"td35\">Cod grupa</TH>";					
			echo	"<TH align=\"center\" width=\"40%\"  class=\"td35\">Denumire grupa</TH>";	
			echo	"<TH align=\"center\" width=\"10%\" class=\"td39\">Nr. copii</TH>";		
			echo "</TR>";
			echo "</form>";
			
			$query="SELECT * FROM grupe order by codgrp";
			$result=mysql_query($query) or die("Interogare esuata: ".mysql_error());
			
			echo "<FORM NAME=\"form\" ACTION=\"A21_utilitare.php\" METHOD=\"POST\" onsubmit=\"target_popup5(this)\">";
			include 'A21_param2.php';
			echo "<input type=\"hidden\" name=\"tip_act3\" value=\"EDITG\">";
			
			$i=0;
			while($row = mysql_fetch_array( $result))	
			{ 	
				$query2="SELECT * FROM copii where codgrp=\"".$row["codgrp"]."\"";
				$result2=mysql_query($query2) or die("Interogare esuata: ".mysql_error());
				$total2=mysql_num_rows($result2);	
					
				if ($i-floor($i/2)*2==0)
				{
					echo "<TR class=\"tr4\" BGCOLOR=\"#FFFFFF\">";
				}
				else
				{
					echo "<TR class=\"tr4\" BGCOLOR=\"#EAEBEB\">";
				}
				
				echo "<TD width=\"10%\" height=\"30px\" align=\"center\">";			
				echo "<input type=\"submit\" name=\"actiune\" class=\"noPrint11\" value='<".$row["codgrp"].">'>";
				echo "</TD>";
				echo"<TD width=\"40%\" align=\"left\">";
				echo "&nbsp".$row["dengrp"]."&nbsp";
				echo "</TD>";
				echo"<TD width=\"10%\" align=\"center\">";
				echo "&nbsp".$total2."&nbsp";
				echo "</TD>";
				echo "</TR>";
				$i++;					
			}
			
		echo "</FORM>";
		echo "</TABLE>";
}	

IF ($_POST["actiune"]=="ADAUGARE" AND isset($_POST["tip_act"]) AND $_POST["tip_act"]=="GRUPE")
{
	echo "<TR>";
			echo "<TD colspan=\"35\" align=\"center\">";
			echo "<B>GRUPE COPII</B>";
			echo "</TD>";
			echo "</TR>";
			echo "<FORM NAME=\"form1\" ACTION=\"A21_utilitare.php\" METHOD=\"POST\" TARGET=\"win10\">";
			include 'A21_param2.php';
			echo "</TABLE>";
			echo "<BR>";
			$connection=mysql_connect("$host","$username","$password") or die("Nu aveti acces la server");
			$baza="apponlin_".$_POST["aplic"]."_".$_POST["unit"];
			$db=mysql_select_db($baza,$connection) or die("Nu puteti selecta Baza de date ".$baza);

			$query="SELECT * FROM grupe where codgrp=(select max(codgrp) from grupe) order by codgrp";
			$result=mysql_query($query) or die("Interogare esuata: ".mysql_error());
	
			echo "<TABLE cellSpacing=0 cellPadding=0 width=\"60%\" border=0>";
			echo "<TR BGCOLOR=\"white\">";			
			echo 	"<TH align=\"center\" width=\"10%\" class=\"td35\">Cod grupa</TH>";					
			echo	"<TH align=\"center\" width=\"40%\"  class=\"td39\">Denumire grupa</TH>";	
			echo "</TR>";
			
		$i=0;		
		$wcodgrp=0;	
		if(mysql_num_rows($result) == 0) 
		{
			$wcodgrp = "10";
			
				if ($i-floor($i/2)*2==0)
				{
					echo "<TR class=\"tr4\" BGCOLOR=\"#FFFFFF\">";
				}
				else
				{
					echo "<TR class=\"tr4\" BGCOLOR=\"#EAEBEB\">";
				}
				
				echo"<TD width=\"10%\" align=\"center\">";
				echo "".$wcodgrp."";
				echo "<INPUT TYPE=\"HIDDEN\" NAME=\"codgrp\" VALUE=\"".$wcodgrp."\">";
				echo "</TD>";			
				echo "<TD width=\"40%\" align=\"left\">";
				echo "<INPUT TYPE=\"TEXT\" size=\"70\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\" class=\"text13\" NAME=\"dengrp_".$wcodgrp."\" VALUE=\"\">";
				echo "</TD>";				
				$i++;					
		}
		else
		{
			while($row = mysql_fetch_array( $result )) 
			{ 	
				$wcodgrp = $row["codgrp"] + "10";
				
				if ($i-floor($i/2)*2==0)
				{
					echo "<TR class=\"tr4\" BGCOLOR=\"#FFFFFF\">";
				}
				else
				{
					echo "<TR class=\"tr4\" BGCOLOR=\"#EAEBEB\">";
				}
				
				echo"<TD width=\"10%\" align=\"center\">";
				echo "".$wcodgrp."";
				echo "<INPUT TYPE=\"HIDDEN\" NAME=\"codgrp\" VALUE=\"".$wcodgrp."\">";
				echo "</TD>";			
				echo "<TD width=\"40%\" align=\"left\">";
				echo "<INPUT TYPE=\"TEXT\" size=\"70\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\" class=\"text13\" NAME=\"dengrp_".$wcodgrp."\" VALUE=\"\">";
				echo "</TD>";				
				$i++;
			}	
		}
			
			echo "<TABLE cellSpacing=0 align=\"right\" cellPadding=0 width=\"50%; height:15%;\" border=0>";
			echo "<TR>";
			echo "<TD>&nbsp</TD>";
			echo "</TR>";
			echo "<tr>";
		   echo "<td width=\"15%\" height=\"35\" align=\"right\">";
			echo "<input type=\"submit\" name=\"actiune\" id=\"button10\" onMouseUp=\"javascript:setTimeout('window.close()',300);\" value=\"CONFIRM\">";
			echo "</td>";
			echo "<input type=\"hidden\"name=\"tip_act2\" value=\"GRUPE\">";
			echo "<td width=\"15%\" height=\"35\" align=\"left\">";
			echo "<input name=\"button\" type=\"button\" id=\"button10\" value=\"RENUNT\" onClick=\"javascript:window.close()\">";
			echo "</td>";
			echo  "</tr>";
			echo "</TABLE>";
			
		echo "</FORM>";
		echo "</TABLE>";
}	

if (substr($_POST["actiune"],0,1)=="<" AND isset($_POST["tip_act3"]) and $_POST["tip_act3"]=="EDITG")
{

	echo "<TR>";
			echo "<TD colspan=\"35\" align=\"center\">";
			echo "<B>GRUPE COPII</B>";
			echo "</TD>";
			echo "</TR>";
			echo "<FORM NAME=\"form1\" ACTION=\"A21_utilitare.php\" METHOD=\"POST\" TARGET=\"win10\">";
			include 'A21_param2.php';
			echo "</TABLE>";
			echo "<BR>";
			$connection=mysql_connect("$host","$username","$password") or die("Nu aveti acces la server");
			$baza="apponlin_".$_POST["aplic"]."_".$_POST["unit"];
			$db=mysql_select_db($baza,$connection) or die("Nu puteti selecta Baza de date ".$baza);

			$query="SELECT * FROM grupe where codgrp=".substr($_POST["actiune"],1,strpos($_POST["actiune"],'>')-1)."";
			$result=mysql_query($query) or die("Interogare esuata: ".mysql_error());
	
			echo "<TABLE cellSpacing=0 cellPadding=0 width=\"60%\" border=0>";
			echo "<TR BGCOLOR=\"white\">";			
			echo 	"<TH align=\"center\" width=\"10%\" class=\"td35\">Cod grupa</TH>";					
			echo	"<TH align=\"center\" width=\"40%\"  class=\"td39\">Denumire grupa</TH>";	
			echo "</TR>";
			
			$i=0;
			while($row = mysql_fetch_array( $result )) 
			{ 	
				$wcodgrp = $row["codgrp"];
				
				if ($i-floor($i/2)*2==0)
				{
					echo "<TR class=\"tr4\" BGCOLOR=\"#FFFFFF\">";
				}
				else
				{
					echo "<TR class=\"tr4\" BGCOLOR=\"#EAEBEB\">";
				}
				
				echo "<TD width=\"10%\" align=\"center\">";
				echo "<input type=\"text\" readonly=\"readonly\" size=\"5\" name=\"codgrp\" value=\"".$row["codgrp"]."\"";
				echo "</TD>";			
				echo "<TD width=\"40%\" align=\"left\">";
				echo "<INPUT TYPE=\"TEXT\" size=\"70\" onfocus=\"onfocus_camp(this)\" onblur=\"onblur_text(this)\" class=\"text13\" NAME=\"dengrp\" VALUE=\"".$row["dengrp"]."\">";
				echo "</TD>";				
				$i++;							
			}
			
			echo "<TABLE cellSpacing=0 align=\"right\" cellPadding=0 width=\"50%; height:15%;\" border=0>";
			echo "<TR>";
			echo "<TD>&nbsp</TD>";
			echo "</TR>";
			echo "<tr>";
		   echo "<td width=\"15%\" height=\"35\" align=\"right\">";
			echo "<input type=\"submit\" name=\"actiune\" id=\"button10\" onMouseUp=\"javascript:setTimeout('window.close()',300);\" value=\"MODIFIC\">";
			echo "<input type=\"hidden\"name=\"tip_act2\" value=\"GRUPE\">";
			echo "</td>";			
			echo "<td width=\"1%\" height=\"35\" align=\"left\">";
			echo "<input type=\"submit\" name=\"actiune\" id=\"button10\" onMouseUp=\"javascript:setTimeout('window.close()',300);\" onClick=\"javascript:return confirm('Doriti sa stergeti?')\" value=\"STERGE\">";	
			echo "<INPUT TYPE=\"HIDDEN\" NAME=\"tip_act2\" VALUE=\"GRUPE\">";
			echo "<td width=\"15%\" height=\"35\" align=\"left\">";
			echo "<input name=\"button\" type=\"button\" id=\"button10\" value=\"RENUNT\" onClick=\"javascript:window.close()\">";
			echo "</td>";
			echo  "</tr>";
			echo "</TABLE>";
			
		echo "</FORM>";
		echo "</TABLE>";
}	
?>
</CENTER>
</BODY>
</HTML>