1 |
/* |
/* |
2 |
|
|
3 |
Decripción en zot de la estructura de la base de datos (DER/ERD) |
Decripción en zot de la estructura de la base de datos (DER/ERD) |
4 |
zot description of the ERD/DER |
zot description of the ERD/DER |
5 |
|
|
6 |
$Id$ |
$Id$ |
7 |
|
|
8 |
$Log$ |
*/ |
|
Revision 1.4 2002/09/04 23:10:41 mhepp |
|
|
se cambio la relacion AlienItem con producto por AlienItem con AlienProdItem y esta con Producto; |
|
|
además se agrego la tabla AlienServItem. |
|
|
|
|
|
Revision 1.3 2002/08/05 20:55:54 apronotti |
|
|
Agregado del campo name a entity. |
|
|
|
|
|
Revision 1.2 2002/08/05 20:05:29 apronotti |
|
|
Se borraron, EntityName y EntityNameType por un cambio de diseño. |
|
|
|
|
|
Revision 1.1 2002/06/28 20:08:34 charlie |
|
|
Sumamos todos los archivos del proyecto zot y la estructura de la base |
|
|
de datos, ademas del famoso LEEME-CABEZA |
|
|
|
|
|
Revision 1.20 2002/06/10 18:08:18 pronotti |
|
|
se elimino el campo product porque puede ser referenciado a traves de la tabla Price |
|
|
y se reemplazo el campo unit_price por price para corregir una cuestion de nombres. |
|
|
|
|
|
Revision 1.19 2002/06/05 19:59:59 pronotti |
|
|
se cambio las referencias por copia "-)" por referencias "->" al historico |
|
|
|
|
|
Revision 1.18 2002/05/30 19:05:40 charlie |
|
|
Algunos Cambios menores al .zot |
|
|
|
|
|
Revision 1.17 2002/05/20 19:24:02 charlie |
|
|
Mas Comentarios |
|
|
|
|
|
Revision 1.16 2002/05/15 19:46:22 charlie |
|
|
Agregar texto de documentacion |
|
|
|
|
|
Revision 1.15 2002/05/13 20:04:29 pronotti |
|
|
se dividio a OwnItem en OwnProdItem y OwnServItem |
|
|
|
|
|
Revision 1.14 2002/05/13 18:40:44 pronotti |
|
|
agregado del atributo description en la tabla Own Item |
|
|
|
|
|
Revision 1.13 2002/05/08 18:40:47 john |
|
|
* shortened names so they'd fit in psql's 32-char limit: |
|
|
- _id -> id |
|
|
- EmployeeCommissionXProductNClient -> EmployeeCommXProdNClient |
|
|
(and all other long commission relational things) |
|
|
|
|
|
* changed names a bit so we didn't use reserved keywords |
|
|
(Transaction -> Proceeding, BanckAccountMovement::to -> |
|
|
BankAccountMovement::destination (and from -> origin, for |
|
|
symmetry), CreditLimit::limit -> CreditLimit::credit_limit). |
|
|
|
|
|
* You can't create a table 'Money' in PostgreSQL (dunno why). |
|
|
Changed it to 'Currency', although I'm sure some DBMS won't |
|
|
like that one either (however it *is* legal to have table names |
|
|
called after data types, so you could construe that as a bug :) |
|
|
|
|
|
Revision 1.12 2002/04/29 22:30:02 pronotti |
|
|
se completo lo referente a definicion de tipos de atributos y lo referente |
|
|
a historicos |
|
|
|
|
|
Revision 1.11 2002/04/29 19:57:10 charlie |
|
|
Algunas descripciones de tablas |
|
9 |
|
|
10 |
Revision 1.10 2002/04/29 19:42:29 mdione |
/* |
11 |
+ added (hopefully) the logs on the file. |
Explicación de los nombres: |
12 |
|
|
13 |
|
Las tablas y columnas se nombran en inglés, de manera descriptiva, |
14 |
|
en minúscula, separando palabras con barras bajas, y en |
15 |
|
singular. Es decir, por ejemplo, si la tabla describe la |
16 |
|
estructura de los productos se llamará product_structure. |
17 |
|
|
18 |
|
Cuando una tabla se refiere a cosas de la empresa origen, es decir, |
19 |
|
la que está corriendo _esta_ instancia de PAPO, entonces esa tabla |
20 |
|
es own_algo. Por ejemplo la tabla que se refiere a los documentos |
21 |
|
emitidos por la propia empresa se llama own_document. El |
22 |
|
equivalente de esa tabla pero de documentos que son emitidos por |
23 |
|
otra entidad se llama alien_document. |
24 |
|
|
25 |
|
Para una explicación detallada de la relación entre las tablas |
26 |
|
entity, alien_entity, own_entity, alien_storehouse, contact, |
27 |
|
persona, client, provider, employee, own_storehouse, y own_branch |
28 |
|
(y sus tablas auxiliares), ver el archivo HERENCIA.txt. |
29 |
|
|
30 |
*/ |
*/ |
31 |
|
|
38 |
:history: peripheries=2 |
:history: peripheries=2 |
39 |
|
|
40 |
/* |
/* |
41 |
OwnDocument |
own_document |
42 |
Here we store all the documents ever produced by us (as program user), incliding those |
Here we store all the documents ever produced by us (as program user), |
43 |
which were anulled. |
incliding those which were voided. |
44 |
*/ |
*/ |
45 |
OwnDocument: |
own_document: |
46 |
|
|
47 |
|
# everything called "id" is automagically a primary key. |
48 |
id (bigserial) |
id (bigserial) |
49 |
type -> DocumentType |
|
50 |
recipient -> Entity # for who is this document made |
# the document type |
51 |
|
own_document_type -> document_type |
52 |
|
|
53 |
|
# the recipient is the target of the document; it's the answer |
54 |
|
# to "for who is this document?" |
55 |
|
recipient -> entity |
56 |
|
|
57 |
|
# some documents have an associated address. E.g. the "remito" |
58 |
|
# must include the address of the destination |
59 |
address (varchar(255)) |
address (varchar(255)) |
60 |
transport -> Entity # eventually, who transports what is described by this document |
|
61 |
guide_number (char(30)) # used for reference, e.g., cuando el flete nos da un numero |
# the shipping company of the associated merchandise, if |
62 |
# de guia con el cual podemos averiguar que paso con los bultos |
# applicable |
63 |
bundles (int) # # de bultos. no mandatorio. |
transport -> entity |
64 |
price_type -> PriceType |
|
65 |
authorized_by -> Employee # en caso se haga algo no permitido, quien lo permitio. |
# shipping companies usually give you a tracking or guide number |
66 |
authorized_amount (numeric(12,4)) # ??? |
guide_number (char(30)) |
67 |
own_entity -> OwnEntity # quien de nosotros lo emitio. |
|
68 |
bonus (numeric(12,4)) # Descuento |
# the number of packages that were shipped |
69 |
|
bundles (int) |
70 |
|
|
71 |
|
# if e.g. a sale on credit was made over and above the credit |
72 |
|
# limit of the client, "who was the blockhead that authorized |
73 |
|
# that?" |
74 |
|
authorized_by -> entity |
75 |
|
|
76 |
|
# "and for _how_ much did you say he authorized the guy?" |
77 |
|
authorized_amount (numeric(12,4)) |
78 |
|
|
79 |
|
# who (what) made this document. Not the salesperson (q.v.), but |
80 |
|
# the physical building or whatever (cash point, etc.) |
81 |
|
own_entity -> entity |
82 |
|
|
83 |
|
# what bonus did we grant the customer on this document as a |
84 |
|
# whole (q.v. Item.bonus) |
85 |
|
bonus (numeric(12,4)) |
86 |
|
|
87 |
|
# have we had to void this document? |
88 |
is_void (char(1)) |
is_void (char(1)) |
89 |
|
|
90 |
|
# what day was this document made? |
91 |
date (timestamp) |
date (timestamp) |
92 |
number (char(30)) # algunos documentos llevan una numeracion propia, |
|
93 |
# independiente del id |
# what is the number printed on this document? |
94 |
salesperson -> Employee |
number (char(30)) |
95 |
start_timestamp (timestamp) # para RRHH |
|
96 |
|
# who or what was the salesperson that handled the transaction |
97 |
|
# that ended with this document? |
98 |
|
salesperson -> entity |
99 |
|
|
100 |
|
# what time did the salesperson start to make out this document? |
101 |
|
start_timestamp (timestamp) |
102 |
|
|
103 |
|
# what time did he finish? |
104 |
end_timestamp (timestamp) |
end_timestamp (timestamp) |
105 |
|
|
106 |
|
# blow your mind |
107 |
observations (text) |
observations (text) |
|
:entry: |
|
108 |
|
|
109 |
/* |
# generates an accounting entry |
|
OwnDocumentRetention |
|
|
If the document is about a payment in which we made a retention. |
|
|
??? cuando hacemos una retencion, no debemos anotar en que moneda? |
|
|
*/ |
|
|
OwnDocumentRetention: |
|
|
id (bigserial) |
|
|
own_document -> OwnDocument |
|
|
retention -> Retention |
|
|
amount (numeric(12,4)) |
|
110 |
:entry: |
:entry: |
111 |
|
|
112 |
/* |
/* |
113 |
OwnDocumentTax |
own_document_tax |
114 |
|
the taxes associated with this document |
115 |
*/ |
*/ |
116 |
OwnDocumentTax: |
own_document_tax: |
117 |
|
# the primary key |
118 |
id (bigserial) |
id (bigserial) |
119 |
own_document -> OwnDocument |
|
120 |
tax -> Tax |
# what document is this tax about? |
121 |
|
own_document -> own_document |
122 |
|
|
123 |
|
# what tax is this? |
124 |
|
tax -> tax |
125 |
|
|
126 |
|
# how much? |
127 |
amount (numeric(12,4)) |
amount (numeric(12,4)) |
128 |
|
|
129 |
|
# generates an accounting entry |
130 |
:entry: |
:entry: |
131 |
|
|
132 |
/* |
/* |
133 |
AlienDocument |
alien_document |
134 |
mirror of OwnDocument |
Documents made by other people. Similar to own_document, but less |
135 |
|
information. |
136 |
*/ |
*/ |
137 |
AlienDocument: |
AlienDocument: |
138 |
|
# primary key |
139 |
id (bigserial) |
id (bigserial) |
140 |
type -> DocumentType |
alien_document_type -> document_type |
141 |
sender -> Entity |
|
142 |
salesperson -> Entity |
# The entity who made the document. |
143 |
transport -> Entity |
sender -> entity |
144 |
|
|
145 |
|
# The salesperson in the other organization who is responsible |
146 |
|
# before us for the transaction described in this document |
147 |
|
salesperson -> entity |
148 |
|
|
149 |
|
# the shipping company of the associated merchandise, if |
150 |
|
# applicable |
151 |
|
transport -> entity |
152 |
|
|
153 |
|
# shipping companies usually give you a tracking or guide number |
154 |
guide_number (char(30)) |
guide_number (char(30)) |
155 |
|
|
156 |
|
# the number of packages that were shipped |
157 |
bundles (int) |
bundles (int) |
158 |
received_by -> Employee |
|
159 |
entity -> OwnEntity |
# The person who signed the receipt |
160 |
|
received_by -> entity |
161 |
|
|
162 |
|
# Which of the 'us'es this is for (physical building etc) |
163 |
|
own_entity -> entity |
164 |
|
|
165 |
|
# Have we had to void this document for some reason? |
166 |
is_void (char(1)) |
is_void (char(1)) |
167 |
|
|
168 |
|
# The number of this document |
169 |
number (char(30)) |
number (char(30)) |
170 |
|
|
171 |
|
# date of emission |
172 |
date (timestamp) |
date (timestamp) |
173 |
|
|
174 |
|
# time the document loading was started |
175 |
start_timestamp (timestamp) |
start_timestamp (timestamp) |
176 |
|
|
177 |
|
# time the document loading was finished |
178 |
end_timestamp (timestamp) |
end_timestamp (timestamp) |
179 |
|
|
180 |
|
# blow your mind |
181 |
observations (text) |
observations (text) |
|
:entry: |
|
182 |
|
|
183 |
/* |
# generates an accounting entry |
|
AlienDocumentPerception |
|
|
Para cuando nos retienen parte de pago en concepto de retencion. |
|
|
Debiera haber un documento que lo certifique? |
|
|
*/ |
|
|
AlienDocumentPerception: |
|
|
id (bigserial) |
|
|
alien_document -> AlienDocument |
|
|
perception -> Retention |
|
|
amount (numeric(12,4)) |
|
184 |
:entry: |
:entry: |
185 |
|
|
186 |
/* |
/* |
187 |
AlienDocumentTax |
alien_document_tax |
188 |
*/ |
*/ |
189 |
AlienDocumentTax: |
AlienDocumentTax: |
190 |
|
# primary key |
191 |
id (bigserial) |
id (bigserial) |
192 |
alien_document -> AlienDocument |
|
193 |
tax -> Tax |
# what document is this tax about? |
194 |
|
alien_document -> alien_document |
195 |
|
|
196 |
|
# what tax is this? |
197 |
|
tax -> tax |
198 |
|
|
199 |
|
# how much? |
200 |
amount (numeric(12,4)) |
amount (numeric(12,4)) |
201 |
|
|
202 |
|
# generates an accounting entry |
203 |
:entry: |
:entry: |
204 |
|
|
205 |
/* |
/* |
206 |
DocumentType |
document_type |
207 |
*/ |
*/ |
208 |
DocumentType: |
document_type: |
209 |
|
# the primary key |
210 |
id (serial) |
id (serial) |
211 |
|
|
212 |
|
# what is this document type? |
213 |
name (varchar(80)) |
name (varchar(80)) |
214 |
|
|
215 |
|
# that doesn't say a thing to me. Tell me more. |
216 |
description (varchar(255)) |
description (varchar(255)) |
217 |
|
|
218 |
|
# this table mirrors an entry in account_plan |
219 |
:account: |
:account: |
220 |
|
|
221 |
|
# this table has a history (or "transactional") |
222 |
:history: |
:history: |
223 |
|
|
224 |
/* |
/* |