-
Notifications
You must be signed in to change notification settings - Fork 0
/
funcoes.php
52 lines (45 loc) · 905 Bytes
/
funcoes.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
<?php
error_reporting(E_WARNING);
function getClientesOptions()
{
$resp="";
$sql="select * from cliente order by nome";
$resultado = pg_query($sql);
while($linha = pg_fetch_assoc($resultado))
{
$cpf = $linha['cpf'];
$nome = $linha['nome'];
$resp = $resp."<option value='$cpf'>$nome</option>";
}
return $resp;
}
function getServicosOptions()
{
$resp="";
$sql="select * from servico order by descr";
$resultado = pg_query($sql);
while($linha = pg_fetch_assoc($resultado))
{
$cod = $linha['cod'];
$descr = $linha['descr'];
$resp = $resp."<option value='$cod'>$descr</option>";
}
return $resp;
}
function dataToDate($data)
{
$vet = explode("/", $data);
$dia = $vet[0];
$ano = $vet[2];
$mes = $vet[1];
return "$mes/$dia/$ano";
}
function dateToData($date)
{
$vet = explode("-", $date);
$dia = $vet[2];
$ano = $vet[0];
$mes = $vet[1];
return "$dia/$mes/$ano";
}
?>