jablonka.czprosek.czf

is

Subversion Repositories:
[/] [trunk/] [html/] [edit_platba.php] - Rev 7 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>db.jablonka.cz edit platba</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);
if(!@$action)
{
$dbplatba=MySQL_Query("SELECT * from finance WHERE id=$id");
$dbplatba=MySQL_Fetch_Array($dbplatba);

echo '
<b>Editace platby '.$dbplatba["hodnota"].'Kč uživatele '.id_to_name($dbplatba["clen"]).' z '.sql2datum($dbplatba["datum"]).':</b><br>

<form action="edit_platba.php?action=zapis" method=POST>
<br>
<table>
  <tr>
  <td class=text>Člen:</td><td colspan=3>
    <select class=field name="clen">'."\n";
      #vypis vsech moznosti a predvybrani podle vs
      $string=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 active=1 ORDER BY prijmeni");
      while($vysledek=MySQL_Fetch_Array($string))
        {
          echo '<option '; if($dbplatba["clen"]==$vysledek["cid"]){ echo 'selected';} echo' value='.$vysledek["cid"].'>'.$vysledek["prijmeni"]." ".$vysledek["jmeno"]." ".$vysledek["ip"]." ".$vysledek["vs"].'</option>'."\n";
        }
          echo '
    </select>
  </td>
    <td class=text> <a href=del_platba.php?id='.$id.'>Smazat tuto platbu!</a></td>
  </tr>
  <tr>
    <td class=text>Datum:</td><td><input class=field name="datum" type="text" value="'.sql2datum($dbplatba["datum"]).'" size=15></td>
    <td class=text>Hodnota:</td><td><input class=field name="hodnota" type="text" value="'.$dbplatba["hodnota"].'" size=15></td>
  </tr>
  <tr>
    <td class=text>Účtenka:</td><td><input class=field name="uctenka" type="text" value="'.$dbplatba["uctenka"].'" size=15></td>

           <td class=text>Pokladna:</td><td>
                <select class=field name="pokladna">';
                $dotaz=MySQL_Query("SELECT * from pokladny ORDER BY id");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($dbplatba["pokladna"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
                         echo '
                          ';
                         Next($string);
                }
                echo '</select>
           </td>


  </tr>
        <tr>
           <td class=text>Typ platby:</td>
           <td>
                <select class=field name="platba">';
                $dotaz=MySQL_Query("SELECT * from platby ORDER BY id");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($dbplatba["platba"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
                         echo '
                          ';
                         Next($string);
                }
                echo '</select>
           </td>
           <td class=text>Dodavatel:</td>
           <td>
                <select class=field name="dodavatel">';
                $dotaz=MySQL_Query("SELECT * from dodavatele ORDER BY id");
                $count=MySQL_Num_Rows($dotaz);
                $count++;
                for ($i=1;$i<$count;$i++)
                {
                         $radek=MySQL_Fetch_Array($dotaz);
                         echo '<option '; if($dbplatba["dodavatel"]==$radek["id"]){ echo 'selected';} echo' value='.$radek["id"].'>'.$radek["nazev"].'</option>';
                         echo '
                          ';
                         Next($string);
                }
                echo '</select>
           </td>
        </tr>
        <tr>
           <td class=text valign=top>Komentář:</td><td colspan=3><textarea class=fieldthin name="komentar" rows=4 cols=45>'.$dbplatba["komentar"].'</textarea></td>
        </tr>
</table>
<input class=field type="submit" name="OK" value="&nbsp;uložit úpravy&nbsp;">
<input name="id" type="hidden" value="'.$id.'">
</form>
';
}
else
{

$datum=datum2sql($datum);

$result = MySQL_Query("UPDATE finance SET clen='$clen',platba='$platba',hodnota='$hodnota',datum='$datum',komentar='$komentar',dodavatel='$dodavatel',uctenka='$uctenka',pokladna='$pokladna' WHERE id='$id'");

if (!$result) {
echo "<br><b>Výsledek : ".mysql_error()."</b>";
} else {
echo "<br><b>Platba uživatele ".id_to_name($clen)." byla úspěšně změněna!</b>";
}
echo '
<br><br>
<img src=images/arrow.jpg>&nbsp;<a href="javascript:history.go(-2)" class=odkaz>zpět</a>
<img src=images/arrow.jpg>&nbsp;<a href="prispevky.php" class=odkaz>zpět na příspěvky</a>
';
}
MySQL_Close($spojeni);
?>
</body>
</html>

Powered by WebSVN 2.2.1