· 7 years ago · Nov 16, 2018, 07:52 PM
1/*
2 Navicat SQLite Data Transfer
3
4 Source Server : MicProba
5 Source Server Version : 3007013
6 Source Database : main
7
8 Target Server Version : 3007013
9 File Encoding : utf-8
10
11 Date: 09/09/2012 18:29:56 PM
12*/
13
14PRAGMA foreign_keys = false;
15
16-- ----------------------------
17-- Table structure for "Almacen"
18-- ----------------------------
19DROP TABLE IF EXISTS "Almacen";
20CREATE TABLE "Almacen" (
21 "Codigo" text(2,0) NOT NULL,
22 "Cod_Empresa" text(3,0),
23 "Cod_Articulo" text(18,0),
24 "Existencias" integer,
25 "PteRecibir" integer,
26 "PteServir" integer,
27 PRIMARY KEY("Codigo")
28);
29
30-- ----------------------------
31-- Table structure for "Articulo"
32-- ----------------------------
33DROP TABLE IF EXISTS "Articulo";
34CREATE TABLE "Articulo" (
35 "Codigo" text(18,0) NOT NULL,
36 "Cod_Empresa" text(3,0),
37 "Nombre_Castella" text,
38 "Nombre_Catala" text,
39 "Precio_Coste" real,
40 "Trazabilidad" integer(1,0),
41 "Meses_Consumo_Lotes" integer(3,0),
42 "Meses_Garantia_Series" integer,
43 "Cod_Unidad_Medida" text(2,0),
44 PRIMARY KEY("Codigo")
45);
46
47-- ----------------------------
48-- Table structure for "Banco"
49-- ----------------------------
50DROP TABLE IF EXISTS "Banco";
51CREATE TABLE "Banco" (
52 "Codigo" text(4,0) NOT NULL,
53 "Cod_Entidad" integer(4,0),
54 "Nombre" text,
55 PRIMARY KEY("Codigo")
56);
57
58-- ----------------------------
59-- Table structure for "Cabecera"
60-- ----------------------------
61DROP TABLE IF EXISTS "Cabecera";
62CREATE TABLE "Cabecera" (
63 "Cod_Serie" text(2,0) NOT NULL,
64 "ID" integer NOT NULL,
65 "Num_Albara" integer,
66 "Num_Pedido" integer,
67 "Cod_Cliente" integer(4,0),
68 "Percen_PP" integer,
69 "Percen_Dto" integer,
70 "Percen_IVA" integer,
71 "Cod_Forma_Pago" text(4,0),
72 "Cod_Representante" integer(4,0),
73 "Cod_Almacen" text(2,0),
74 "Cod_Ruta" text(10,0),
75 "Cod_Tarifa" integer(4,0),
76 "Cod_Canal" text(10,0),
77 "Cod_Divisa" text(4,0),
78 "AplicarRE" text,
79 "Percen_IRPF" integer,
80 "Nombre" text,
81 "Direccion" text,
82 "Cod_Poblacion" text(6,0),
83 "CPostal" integer(5,0),
84 "Cod_Provincia" text(6,0),
85 "CIF/DNI" text,
86 "Num_Factura" integer,
87 "Fecha_Factura" text,
88 "Exportado" text,
89 "Importe_Cobrado" real,
90 PRIMARY KEY("ID")
91);
92
93-- ----------------------------
94-- Table structure for "Canal"
95-- ----------------------------
96DROP TABLE IF EXISTS "Canal";
97CREATE TABLE "Canal" (
98 "Codigo" text(10,0) NOT NULL,
99 "Cod_Empresa" text(3,0),
100 "Nombre" text,
101 PRIMARY KEY("Codigo")
102);
103
104-- ----------------------------
105-- Table structure for "Client"
106-- ----------------------------
107DROP TABLE IF EXISTS "Client";
108CREATE TABLE "Client" (
109 "Codigo" integer(4,0) NOT NULL,
110 "Cod_Empresa" text(3,0),
111 "Cod_Poblacion" text(6,0),
112 "Cod_Provincia" text(6,0),
113 "Cod_Banco" text(4,0),
114 "Cod_Form_Pago" text(4,0),
115 "Cod_Dto" integer(1,0),
116 "Nombre_Comercial" text,
117 "Nombre_Fiscal" text,
118 "Cod_Entidad" integer(4,0),
119 "CIF/DNI" text,
120 "Direccion" text,
121 "CP" integer(5,0),
122 "Tel1" text,
123 "Tel2" text,
124 "Fax" text,
125 "Email" text,
126 "Numero_Tarifa" integer(2,0),
127 "Percen_Gtos_Finan" integer,
128 "Percen_Increm_PVP" integer,
129 "Num_Copias_Fact" integer(1,0),
130 "Apli_Gast_Gestion" text(1,0),
131 "Apli_RE" text(1,0),
132 "Valorar_Alb_Imprimir" text(1,0),
133 "Percen_PP" integer,
134 "Percen_Dto" integer,
135 "IRPF" integer(1,0),
136 "Percen_IRPF" integer,
137 "Idioma" integer,
138 "Dia_Pago1" integer(2,0),
139 "Dia_Pago2" integer(2,0),
140 "Dia_Pago3" integer(2,0),
141 "Agencia" integer(4,0),
142 "Dig_Control" integer(2,0),
143 "Cuenta" integer(10,0),
144 "Comentario" text,
145 PRIMARY KEY("Codigo")
146);
147
148-- ----------------------------
149-- Table structure for "Constantes"
150-- ----------------------------
151DROP TABLE IF EXISTS "Constantes";
152CREATE TABLE "Constantes" (
153 "Cod_Empresa" text(3,0) NOT NULL,
154 "Cod_Serie" integer(2,0) NOT NULL,
155 "Cod_Ruta" integer(10,0) NOT NULL,
156 "Cod_Canal" integer(10,0) NOT NULL,
157 "Cod_Representante" integer(4,0) NOT NULL,
158 "Cod_Cliente_Contado" integer,
159 "Num_Tarifa" integer,
160 "Ver_Stock_Ventas" integer,
161 "PWD_Programa" text,
162 "PWD_Constantes" text,
163 "Email_Envio" text,
164 "Mod_Precio" integer,
165 "Mod_Descuento" integer,
166 "Ver_Margen_Ventas" integer,
167 "Comprobar_Trazabilidad" integer,
168 "Finalizar_Venta_Sin_Trazabilidad" integer,
169 "Vender_Trazabilidad_Sin_Stock" integer,
170 "Ventana_Cambio" integer,
171 PRIMARY KEY("Cod_Empresa")
172);
173
174-- ----------------------------
175-- Table structure for "Descuento"
176-- ----------------------------
177DROP TABLE IF EXISTS "Descuento";
178CREATE TABLE "Descuento" (
179 "Codigo" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
180 "Cod_Empresa" text(3,0),
181 "Cod_Articulo" text(18,0),
182 "Cod_Cliente" integer(4,0),
183 "Percen_Dto" integer
184);
185
186-- ----------------------------
187-- Table structure for "Divisa"
188-- ----------------------------
189DROP TABLE IF EXISTS "Divisa";
190CREATE TABLE "Divisa" (
191 "Codigo" text(4,0) NOT NULL,
192 "Nombre" text,
193 "Decimales_Importe" integer(2,0),
194 "Decimales_Precio" integer(2,0),
195 PRIMARY KEY("Codigo")
196);
197
198-- ----------------------------
199-- Table structure for "Empresa"
200-- ----------------------------
201DROP TABLE IF EXISTS "Empresa";
202CREATE TABLE "Empresa" (
203 "Codigo" text(3,0) NOT NULL,
204 "Cod_Divisa" text(4,0),
205 "Cod_Poblacio" text(6,0),
206 "Nombre_Fiscal" text,
207 "Nombre_Comercial" text,
208 "Direccion" text,
209 "Provincia" text,
210 "Tel1" text,
211 "Tel2" text,
212 "Fax" text,
213 "Email" text,
214 "Actividad" text(36,0),
215 "Logo" blob,
216 "Iva_Incluido" integer,
217 "CPostal" integer,
218 "CIF/DNI" text,
219 "DecimalesUnidad" integer,
220 "NotaPieAlbaran" text,
221 "NotaPieFactura" text,
222 "NotaLOPD" text,
223 PRIMARY KEY("Codigo")
224);
225
226-- ----------------------------
227-- Table structure for "Extracto"
228-- ----------------------------
229DROP TABLE IF EXISTS "Extracto";
230CREATE TABLE "Extracto" (
231 "ID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
232 "Cod_Cliente" integer(4,0),
233 "Fecha" text,
234 "Concepto" text,
235 "Importe" real,
236 "Debe/Habe" integer
237);
238
239-- ----------------------------
240-- Table structure for "Familia"
241-- ----------------------------
242DROP TABLE IF EXISTS "Familia";
243CREATE TABLE "Familia" (
244 "Codigo" text(10,0) NOT NULL,
245 "Nombre" text,
246 PRIMARY KEY("Codigo")
247);
248
249-- ----------------------------
250-- Table structure for "Forma_Pago"
251-- ----------------------------
252DROP TABLE IF EXISTS "Forma_Pago";
253CREATE TABLE "Forma_Pago" (
254 "Codigo" text(4,0) NOT NULL,
255 "Nombre" text,
256 "D1" integer,
257 "D2" integer,
258 "D3" integer,
259 "D4" integer,
260 "D5" integer,
261 "D6" integer,
262 "D7" integer,
263 "D8" integer,
264 "D9" integer,
265 "D10" integer,
266 "D11" integer,
267 "D12" integer,
268 "Tipo" text(1,0),
269 PRIMARY KEY("Codigo")
270);
271
272-- ----------------------------
273-- Table structure for "IVA"
274-- ----------------------------
275DROP TABLE IF EXISTS "IVA";
276CREATE TABLE "IVA" (
277 "Codigo" text(4,0) NOT NULL,
278 "Nombre" text,
279 "Percen_IVA" integer,
280 "Percen_RE" integer,
281 PRIMARY KEY("Codigo")
282);
283
284-- ----------------------------
285-- Table structure for "Linea"
286-- ----------------------------
287DROP TABLE IF EXISTS "Linea";
288CREATE TABLE "Linea" (
289 "Codigo" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
290 "Cod_Serie" text(2,0),
291 "Num_Albaran" integer,
292 "Fecha_Albaran" text,
293 "Cod_Articulo" text(18,0),
294 "Descripcion" text,
295 "Notas" text,
296 "Percen_Comisio" integer,
297 "Percen_IVA" integer,
298 "Percen_RE" integer,
299 "Percen_Dto" integer,
300 "Precio_Venta" real,
301 "Cantidad" integer
302);
303
304-- ----------------------------
305-- Table structure for "Lote"
306-- ----------------------------
307DROP TABLE IF EXISTS "Lote";
308CREATE TABLE "Lote" (
309 "Codigo" text(30,0) NOT NULL,
310 "Cod_Empresa" text(3,0),
311 "Cod_Articulo" text(18,0),
312 "Cantidad" integer,
313 "Fech_Fabricacion" text,
314 "Fech_Consumo" text,
315 PRIMARY KEY("Codigo")
316);
317
318-- ----------------------------
319-- Table structure for "Lote_Linea"
320-- ----------------------------
321DROP TABLE IF EXISTS "Lote_Linea";
322CREATE TABLE "Lote_Linea" (
323 "ID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
324 "Cod_Lote" text(30,0),
325 "Cantidad" integer,
326 "Cod_Linea" integer,
327 "Cod_Empresa" text(3,0)
328);
329
330-- ----------------------------
331-- Table structure for "Num_Serie_Linea"
332-- ----------------------------
333DROP TABLE IF EXISTS "Num_Serie_Linea";
334CREATE TABLE "Num_Serie_Linea" (
335 "ID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
336 "Cod_Linea" integer,
337 "Numero_Serie" integer,
338 "Cod_Empresa" text(3,0)
339);
340
341-- ----------------------------
342-- Table structure for "Num_Series"
343-- ----------------------------
344DROP TABLE IF EXISTS "Num_Series";
345CREATE TABLE "Num_Series" (
346 "Codigo" text(30,0) NOT NULL,
347 "Cod_Empresa" text(3,0),
348 "Cod_Articulo" text(18,0),
349 "Meses_Garantia" integer,
350 PRIMARY KEY("Codigo")
351);
352
353-- ----------------------------
354-- Table structure for "Pais"
355-- ----------------------------
356DROP TABLE IF EXISTS "Pais";
357CREATE TABLE "Pais" (
358 "Codigo" text(2,0) NOT NULL,
359 "Nombre" text,
360 PRIMARY KEY("Codigo")
361);
362
363-- ----------------------------
364-- Table structure for "Poblacion"
365-- ----------------------------
366DROP TABLE IF EXISTS "Poblacion";
367CREATE TABLE "Poblacion" (
368 "Codigo" text(6,0) NOT NULL,
369 "Nombre" text,
370 "Cod_Postal" integer(5,0),
371 PRIMARY KEY("Codigo")
372);
373
374-- ----------------------------
375-- Table structure for "Precios"
376-- ----------------------------
377DROP TABLE IF EXISTS "Precios";
378CREATE TABLE "Precios" (
379 "Cod_Articulo" text(18,0) NOT NULL,
380 "Cod_Cliente" integer(4,0),
381 "Prec_Venta" real,
382 "Dto" integer,
383 "Reventa" integer
384);
385
386-- ----------------------------
387-- Table structure for "Promocion"
388-- ----------------------------
389DROP TABLE IF EXISTS "Promocion";
390CREATE TABLE "Promocion" (
391 "Codigo" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
392 "Cod_Empresa" text(3,0),
393 "Cod_Articulo" text(18,0),
394 "Fecha_Inicio" text,
395 "Fecha_Fin" text,
396 "Precio_Venta" real
397);
398
399-- ----------------------------
400-- Table structure for "Provincia"
401-- ----------------------------
402DROP TABLE IF EXISTS "Provincia";
403CREATE TABLE "Provincia" (
404 "Codigo" text(6,0) NOT NULL,
405 "Nombre" text,
406 "Cod_Pais" text(2,0),
407 PRIMARY KEY("Codigo")
408);
409
410-- ----------------------------
411-- Table structure for "Representante"
412-- ----------------------------
413DROP TABLE IF EXISTS "Representante";
414CREATE TABLE "Representante" (
415 "Codigo" integer(4,0) NOT NULL,
416 "Cod_Empresa" text(3,0),
417 "Nombre" text,
418 "Percen_Comision" integer,
419 PRIMARY KEY("Codigo")
420);
421
422-- ----------------------------
423-- Table structure for "Ruta"
424-- ----------------------------
425DROP TABLE IF EXISTS "Ruta";
426CREATE TABLE "Ruta" (
427 "Codigo" text(10,0) NOT NULL,
428 "Cod_Empresa" text(3,0),
429 "Cod_Cliente" integer(4,0),
430 "Orden" integer(4,0),
431 PRIMARY KEY("Codigo")
432);
433
434-- ----------------------------
435-- Table structure for "Serie"
436-- ----------------------------
437DROP TABLE IF EXISTS "Serie";
438CREATE TABLE "Serie" (
439 "Codigo" text(2,0) NOT NULL,
440 "Cod_Empresa" text(3,0),
441 "Nombre" text,
442 "Fact_Albaran" text(1,0),
443 "Albaran_Contador" integer,
444 "Albaran_Documento" text,
445 "Factura_Contador" integer,
446 "Factura_Documento" text,
447 PRIMARY KEY("Codigo")
448);
449
450-- ----------------------------
451-- Table structure for "Tarifa"
452-- ----------------------------
453DROP TABLE IF EXISTS "Tarifa";
454CREATE TABLE "Tarifa" (
455 "Codigo" integer(4,0) NOT NULL,
456 "Cod_Empresa" text(3,0),
457 "Cod_Articulo" text(18,0),
458 "Precio_Venta" real,
459 "Porcen_Margen" integer,
460 "Cod_IVA" text(4,0),
461 "Cod_Famili" text(10,0),
462 "Cod_Dto" integer(2,0),
463 "ABC" integer(1,0),
464 "NotaCastella" text,
465 "NotaCatala" text,
466 PRIMARY KEY("Codigo")
467);
468
469-- ----------------------------
470-- Table structure for "Unidad_Medida"
471-- ----------------------------
472DROP TABLE IF EXISTS "Unidad_Medida";
473CREATE TABLE "Unidad_Medida" (
474 "Codigo" text(2,0) NOT NULL,
475 "Nombre" text,
476 "Medida" integer(1,0),
477 PRIMARY KEY("Codigo")
478);
479
480-- ----------------------------
481-- Table structure for "Venta"
482-- ----------------------------
483DROP TABLE IF EXISTS "Venta";
484CREATE TABLE "Venta" (
485 "ID" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
486 "Cod_Articulo" text(18,0),
487 "Fecha" text,
488 "Descripcion" text,
489 "Percen_IVA" integer,
490 "Percen_Dto" integer,
491 "Precio" real,
492 "Cantidad" integer
493);
494
495PRAGMA foreign_keys = true;