author | viric@llimona |
Thu, 11 May 2006 00:00:15 +0200 | |
changeset 2 | eb656142f039 |
permissions | -rw-r--r-- |
2
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
1 |
<?php |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
2 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
3 |
class accio |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
4 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
5 |
var $dia; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
6 |
var $mes; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
7 |
var $any; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
8 |
var $hora; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
9 |
var $minut; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
10 |
var $data_modificat; // timestamp |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
11 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
12 |
function data() |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
13 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
14 |
return mktime($this->hora, $this->minut, 0, $this->mes, $this->dia, |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
15 |
$this->any); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
16 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
17 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
18 |
function setData($data) |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
19 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
20 |
$this->dia = date('d',$data); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
21 |
$this->mes = date('m',$data); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
22 |
$this->any = date('Y',$data); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
23 |
$this->hora = date('H',$data); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
24 |
$this->minut = date('i',$data); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
25 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
26 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
27 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
28 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
29 |
class comprador |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
30 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
31 |
var $persona; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
32 |
var $pagat; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
33 |
var $toca_pagar; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
34 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
35 |
// Valors de lligam |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
36 |
var $data; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
37 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
38 |
function comprador($data, $persona, $pagat, $toca_pagar) |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
39 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
40 |
$this->persona = $persona; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
41 |
$this->data = $data; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
42 |
$this->pagat = $pagat; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
43 |
$this->toca_pagar = $toca_pagar; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
44 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
45 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
46 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
47 |
class comprador_excepcio |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
48 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
49 |
var $persona; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
50 |
var $toca_pagar; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
51 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
52 |
// Valors de lligam |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
53 |
var $id_excepcio; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
54 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
55 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
56 |
class excepcio |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
57 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
58 |
var $article; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
59 |
var $preu; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
60 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
61 |
// Valors de lligam |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
62 |
var $data; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
63 |
// Calculats o llegits de la DB |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
64 |
var $id; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
65 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
66 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
67 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
68 |
class compra extends accio |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
69 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
70 |
var $botiga; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
71 |
var $motiu; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
72 |
var $comentari; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
73 |
var $preu; // Segur? |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
74 |
var $compradors; // Array d'objectes |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
75 |
var $excepcions; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
76 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
77 |
// Calculades |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
78 |
var $preu_per_compradors |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
79 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
80 |
function compra($connexio=-1, $data=0) |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
81 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
82 |
if ($connexio == -1) |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
83 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
84 |
$this->setData(time()); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
85 |
$this->botiga = ""; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
86 |
$this->motiu = ""; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
87 |
$this->comentari = ""; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
88 |
$this->preu = 0; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
89 |
$this->compradors = array(); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
90 |
$this->excepcions = array(); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
91 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
92 |
else |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
93 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
94 |
$query="SELECT UNIX_TIMESTAMP(data),botiga,motiu,preu,comentari FROM compres WHERE data=FROM_UNIXTIME(" . $data . ")"; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
95 |
$resultat = db->($query); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
96 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
97 |
// ****** Cal comprovar que existeix |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
98 |
$fila = mysql_fetch_row($resultat) |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
99 |
$this->setData($fila[0]); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
100 |
$this->botiga = $fila[1]; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
101 |
$this->motiu = $fila[2]; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
102 |
$this->preu = $fila[3]; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
103 |
$this->comentari = $fila[4]; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
104 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
105 |
$query = "SELECT persona,pagat,toca_pagar FROM compradors |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
106 |
WHERE compradors.data=FROM_UNIXTIME($date);"; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
107 |
$resultat = db->($query); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
108 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
109 |
$this->compradors = array(); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
110 |
while($fila = mysql_fetch_row($resultat)) |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
111 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
112 |
$this->comprador[] = new comprador($this->data, |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
113 |
$fila[0], $fila[1], $fila[2] ); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
114 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
115 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
116 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
117 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
118 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
119 |
function numCompradors() |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
120 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
121 |
return count($this->compradors); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
122 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
123 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
124 |
function numExcepcions() |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
125 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
126 |
return count($this->excepcions); |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
127 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
128 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
129 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
130 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
131 |
class pagament extends accio |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
132 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
133 |
var $comentari; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
134 |
var $motiu; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
135 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
136 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
137 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
138 |
class pagador |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
139 |
{ |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
140 |
var $persona; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
141 |
var $pagat; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
142 |
var $cobrat; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
143 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
144 |
// Valor de lligam |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
145 |
var $data; |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
146 |
|
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
147 |
} |
eb656142f039
Updating to the development version done in vicerveza.
viric@llimona
parents:
diff
changeset
|
148 |
?> |