is |
Subversion Repositories: |
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 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);
$aktualnidatum=date("d.m.Y");
$aktualnirok=date("Y");
if(!@$platba) $platba=0;
if(!@$pokladna) $pokladna=0;
if(!@$dodavatel) $dodavatel=0;
if(!@$datum) $datum=date("d.m.Y");
if(!@$action)
{
echo '
<b>Přidání platby uživatele '.id_to_name($clen).':</b><br>
<form action="add_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($clen==$vysledek["cid"]){ echo 'selected';} echo' value='.$vysledek["cid"].'>'.$vysledek["prijmeni"]." ".$vysledek["jmeno"]." ".$vysledek["ip"]." ".$vysledek["vs"].'</option>'."\n";
}
echo '
</select>
</td>
</tr>
<tr>
<td class=text>Datum:</td><td><input class=field name="datum" type="text" value="'.$datum.'" size=15></td>
<td class=text>Hodnota:</td><td><input class=field name="hodnota" type="text" value="'.$hodnota.'" size=15></td>
</tr>
<tr>
<td class=text>Účtenka:</td>
<td>';
$dotaz=MySQL_Query("SELECT * from finance WHERE pokladna=".$pokladna." AND YEAR(datum)=".$aktualnirok." ORDER BY id");
$count=MySQL_Num_Rows($dotaz);
echo '
<input class=field name="uctenka" type="text" value="'.$count.'" 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($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($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($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></textarea></td>
</tr>
</table>
<br><br>
<input class=field type="submit" name="OK" value=" přidat transakci ">
</form>
';
}
else
{
$test=MySQL_Query("SELECT MAX(id) FROM finance");
$test=MySQL_Fetch_Array($test);
$id=$test["MAX(id)"];
$id++;
$datum=datum2sql($datum);
$result = MySQL_Query("INSERT INTO finance VALUES ('$id','$clen','$platba','$hodnota','$datum','$komentar','$dodavatel','$uctenka','$pokladna')");
if (!$result) {
echo "<br><b>Výsledek : ".mysql_error()."</b>";
} else {
echo "<br><b>Platba uživatele ".id_to_name($clen)." byla úspěšně vložena!</b>";
}
echo '
<br><br>
<img src=images/arrow.jpg> <a href="javascript:history.go(-2)" class=odkaz>zpět</a>
<img src=images/arrow.jpg> <a href="prispevky.php" class=odkaz>zpět na příspěvky</a>
';
}
MySQL_Close($spojeni);
?>
</body>
</html>