jablonka.czprosek.czf

is

Subversion Repositories:
[/] [trunk/] [html/] [add_ukon.php] - Rev 3 Go to most recent revision

Compare with Previous - Blame - Download


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<style type="text/css" media="screen"> @import "style.css"; </style>
<title>add úkon</title>
</head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body topmargin=0 leftmargin=10>
<?
include("header.htm");
require('grab_globals.lib.php');
include ("fce.php");
$spojeni = MySQL_Connect($db_host, $db_user, $db_pass);
MySQL_Select_DB($db_name);
$aktualnidatum=date("d.m.Y");
if(!@$action)
{
echo '
<b>Přidání úkonu pro uživatele '.id_to_name($clen).':</b><br>

<form action="add_ukon.php?action=zapis" method=POST>
<table>
  <tr>
    <td class=text>Datum:</td><td><input class=field name="datum" type="text" value="'.$aktualnidatum.'" size=25></td>
  </tr>
        <tr>
           <td class=text>Typ udalosti:</td>
           <td>
                <select class=field name="udalost">';
                $dotaz=MySQL_Query("SELECT * from udalosti ORDER BY id");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option value='.$radek["id"].'>'.$radek["nazev"].'</option>';
                         Next($string);
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text>Předmětné IP:</td>
           <td>
                <select class=field name="predmet">';
                $dotaz=MySQL_Query("SELECT c.id as cid, c.*, i.id as iid, i.* FROM cleni c LEFT JOIN ipecka i ON c.id = i.clen WHERE c.id=$clen AND i.id IS NOT NULL ORDER BY ip");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                echo '<option value=0>není</option>';
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option value='.$radek["iid"].'>'.$radek["ip"].'</option>';
                         Next($string);
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text>Adresa:</td>
           <td>
                <select class=field name="adresa">';
                $dotaz=MySQL_Query("SELECT * from adresy WHERE clen=$clen ORDER BY ulice,cp,byt");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                echo '<option value=0>není</option>';
                $nabidnutaadresa=clen_to_adresa($clen);
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($nabidnutaadresa==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["id"]." ".$radek["ulice"]." ".$radek["cp"]." byt ".$radek["byt"].'</option>';
                         Next($string);
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text>Finance:</td>
           <td>
                <select class=field name="finance">';
                $dotaz=MySQL_Query("SELECT * from finance ORDER BY datum");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                echo '<option value=0>není</option>';
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option value='.$radek["id"].'>'.$radek["datum"]." ".$radek["hodnota"]."Kč ".$radek["pokladna"].'</option>';
                         Next($string);
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text>Majetek:</td>
           <td>
                <select class=field name="majetek">';
                $dotaz=MySQL_Query("SELECT * from majetek ORDER BY id");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                echo '<option value=0>není</option>';
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($majetek==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["id"]." ".id_to_zarizeni($radek["zarizeni"])." ".$radek["komentar"]." ".$radek["scislo"]." ".$radek["mac"].'</option>';
                         Next($string);
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text valign=top>Komentář:</td><td><textarea class=fieldthin name="komentar" rows=8 cols=25></textarea></td>
        </tr>
</table>
<br><br>
<input class=field type="submit" name="OK" value="&nbsp;přidat úkon&nbsp;">
<input name="clen" type="hidden" value="'.$clen.'">

</form>
';
}
else
{

$test=MySQL_Query("SELECT MAX(id) FROM ukony");
$test=MySQL_Fetch_Array($test);
$id=$test["MAX(id)"];
$id++;
$datum=datum2sql($datum);
$result = MySQL_Query("INSERT INTO ukony VALUES ('$id','$clen','$udalost','$predmet','$datum','$komentar','$adresa','$finance','$majetek')");

if (!$result) {
echo "<br><b>Výsledek : ".mysql_error()."</b>";
} else {
echo '
<br><b>Úkon uživatele <a class="odkaz" target="_self" href="clen.php?clen='.$clen.'">'.id_to_name($clen).'</a> byl úspěšně přidán!</b>
';
}

echo '
<br><br>
<img src=images/arrow.jpg>&nbsp;<a href="javascript:history.go(-2)" class=odkaz>zpět</a>
';
}
MySQL_Close($spojeni);
?>
</body>
</html>

Powered by WebSVN 2.2.1