-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmVenda.php
62 lines (62 loc) · 1.86 KB
/
frmVenda.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<? include("inc/session.php"); ?>
<? require_once("classes/classFachada.php"); ?>
<? include("inc/header.inc"); ?>
<? include("inc/menu.inc"); ?>
<?
if ($_GET['id'])
{
//constrói e preenche o objeto $passaro
$passaro = new Passaro();
$passaro->set_id($_GET['id']);
$passaro->seleciona();
?>
<h2>Efetuar venda do pássaro <i><?=$passaro->get_nome()?></i></h2>
<?
}
else
{
?>
<h2>Efetuar venda</h2>
<?
}
?>
<form name="frmVenda" method="post" action="ctrlCadastro.php?tipo=venda" onsubmit="return validaVenda(this)">
<label for="idcliente">Cliente:</label>
<span><select id="idcliente" name="idcliente">
<option>-- Escolha um cliente --</option>
<?
$c = new Cliente();
foreach ($c->lista() as $cliente)
{
?>
<option value="<?=$cliente->get_id()?>"><?=$cliente->get_nome()?></option>
<?
}
?>
</select></span><br />
<label for="idpassaro">Pássaro:</label>
<span><select id="idpassaro" name="idpassaro">
<option>-- Escolha um pássaro --</option>
<?
$passaro = new Passaro();
foreach ($passaro->lista() as $p)
{
?>
<option value="<?=$p->get_id()?>" <?= ($p->get_id() == $_GET['id']) ? "selected=\"selected\"" : "" ?>><?= ($p->get_nome()) ? $p->get_nome() : $p->get_anilha() ?></option>
<?
}
?>
</select></span><br />
<label for="dia">Data da venda:</label> <span><input id="dia" name="dia" type="text" size="2" maxlength="2" />/<input id="mes" name="mes" type="text" size="2" maxlength="2" />/<input id="ano" name="ano" type="text" size="4" maxlength="4" /></span><br />
<label for="valor">Valor:</label> <span>R$ <input id="valor" name="valor" type="text" size="9" maxlength="9" /></span><br />
<label><input type="submit" value="Cadastrar" /></label> <span><input type="reset" value="Limpar" /></span>
</form>
<?
if ($_GET['id'])
{
?>
<p><a href="infPassaro.php?id=<?=$passaro->get_id()?>"><< Voltar</a></p>
<?
}
?>
<? include("inc/footer.inc"); ?>