chore: sql files

This commit is contained in:
JesusPerez 2021-10-01 20:27:42 +01:00
parent a1231503df
commit 4fe97661da
17 changed files with 1288 additions and 0 deletions

17
sql/audit-prov.sql Normal file
View File

@ -0,0 +1,17 @@
SELECT
facturas.f_emision, facturas.importe_total, facturas.tipo_doc_pago, facturas.nro_doc_pago, facturas.vto_pago,
proveedores.razon_social, proveedores.cta_contable,
bancos.nombre
FROM
sando_adminis@ol_sando_adm:informix.facturas facturas,
sando_adminis@ol_sando_adm:informix.proveedores proveedores,
sando_adminis@ol_sando_adm:informix.bancos bancos
WHERE
facturas.nif = proveedores.nif AND
facturas.cod_banco = bancos.cod_banco AND
facturas.f_emision < ' 961231' AND
facturas.tipo_doc_pago = '1' AND
facturas.vto_pago > '961231'
ORDER BY
proveedores.cta_contable ASC,
facturas.vto_pago ASC

18
sql/audit.sql Normal file
View File

@ -0,0 +1,18 @@
SELECT
facturas.f_emision, facturas.importe_total, facturas.tipo_doc_pago, facturas.nro_doc_pago, facturas.vto_pago,
proveedores.razon_social, proveedores.cta_contable,
bancos.nombre
FROM
sando_adminis@ol_sando_adm:informix.facturas facturas,
sando_adminis@ol_sando_adm:informix.proveedores proveedores,
sando_adminis@ol_sando_adm:informix.bancos bancos
WHERE
facturas.nif = proveedores.nif AND
facturas.cod_banco = bancos.cod_banco AND
facturas.f_emision < ' 961231 ' AND
facturas.tipo_doc_pago = '1' AND
facturas.vto_pago > '961231'
ORDER BY
proveedores.cta_contable ASC,
facturas.vto_pago ASC

18
sql/audit_banco.sql Normal file
View File

@ -0,0 +1,18 @@
SELECT
proveedores.cta_contable,
proveedores.razon_social,
facturas.nro_doc_pago,
facturas.vto_pago,
facturas.cod_banco,
facturas.importe_total
FROM
sando_adminis@ol_delfos:informix.facturas facturas,
sando_adminis@ol_delfos:informix.proveedores proveedores
WHERE
facturas.nro_reg matches "1996*" and
facturas.nif = proveedores.nif and
facturas.tipo_doc_pago = 1
ORDER BY
facturas.cod_banco,
facturas.vto_pago,
facturas.importe_total

17
sql/audit_prov.sql Normal file
View File

@ -0,0 +1,17 @@
SELECT
proveedores.cta_contable,
proveedores.razon_social,
facturas.nro_doc_pago,
facturas.vto_pago,
facturas.cod_banco,
facturas.importe_total
FROM
sando_adminis@ol_delfos:informix.facturas facturas,
sando_adminis@ol_delfos:informix.proveedores proveedores
WHERE
facturas.nro_reg matches "1996*" and
facturas.nif = proveedores.nif and
facturas.tipo_doc_pago = 1
ORDER BY
proveedores.cta_contable,
facturas.vto_pago

12
sql/auditores.sql Normal file
View File

@ -0,0 +1,12 @@
SELECT
facturas.importe_total, facturas.tipo_doc_pago, facturas.nro_doc_pago, facturas.vto_pago,
proveedores.razon_social, proveedores.cta_contable,
bancos.nombre
FROM
sando_adminis@ol_delfos:informix.facturas facturas,
sando_adminis@ol_delfos:informix.proveedores proveedores,
sando_adminis@ol_delfos:informix.bancos bancos
WHERE
facturas.nro_reg matches "1996*" and
facturas.nif = proveedores.nif and
facturas.tipo_doc_pago = 1

26
sql/bancos.sql Normal file
View File

@ -0,0 +1,26 @@
alter table bancos
l_importe integer,
c_importe integer,
l_paguese integer,
c_paguese integer,
l1_nroletra integer,
c1_nroletra integer,
l2_nroletra integer,
c2_nroletra integer,
l_fecha integer,
c_fecha integer,
l_mes integer,
c_mes integer,
l_anno integer,
c_anno integer,
l1_firmado integer,
c1_firmado integer,
l2_firmado integer,
c2_firmado integer,
t1_firmado char(40),
t2_firmado char(40)

7
sql/diffpagovto.sql Normal file
View File

@ -0,0 +1,7 @@
select vto_pago,nro_reg,f_pago
from facturas
where
nro_reg matches "1997*" and
vto_pago > "1/4/97" and vto_pago is not null
and vto_pago != f_pago
and tipo_doc_pago = "1"

548
sql/esquema.sql Normal file
View File

@ -0,0 +1,548 @@
DBSCHEMA Schema Utility INFORMIX-SQL Version 7.12.TC3
Copyright (C) Informix Software, Inc., 1984-1996
Software Serial Number AAB#J556877
grant dba to "informix";
{ TABLE "informix".plan_contable row size = 53 number of columns = 3 index size =
24 }
create table "informix".plan_contable
(
cta_contable char(12) not null constraint "informix".n111_32,
descirpcion char(40) not null constraint "informix".n111_33,
es_nueva char(1),
primary key (cta_contable) constraint "informix"._111_prom1
);
revoke all on "informix".plan_contable from "public";
{ TABLE "informix".traspaso_ctas row size = 24 number of columns = 3 index size =
0 }
create table "informix".traspaso_ctas
(
cta_contable char(12) not null constraint "informix".n109_28,
importe decimal(20,0) not null constraint "informix".n109_29,
es_nueva char(1) not null constraint "informix".n109_30
);
revoke all on "informix".traspaso_ctas from "public";
{ TABLE "informix".proveedores row size = 511 number of columns = 17 index size =
114 }
create table "informix".proveedores
(
nif char(12) not null constraint "informix".n102_3,
razon_social char(40) not null constraint "informix".n102_4,
cta_contable char(12) not null constraint "informix".n102_5,
cond_pago char(4),
domicilio char(40),
localidad char(30),
cod_postal char(7),
attn_envio char(40),
direccion_envio char(40),
localidad_envio char(30),
cod_postal_envio char(7),
telefono_1 char(14),
telefono_2 char(14),
fax char(14),
e_mail char(30),
observaciones varchar(120),
expediente text,
primary key (nif) constraint "informix"._102_prom1
);
revoke all on "informix".proveedores from "public";
create index "informix".ix_razonsocial on "informix".proveedores (razon_social);
create index "informix".ix_proveedores1 on "informix".proveedores (cta_contable);
{ TABLE "informix".centros row size = 64 number of columns = 3 index size = 90 }
create table "informix".centros
(
cod_centro char(12) not null constraint "informix".n103_8,
cod_departamento char(12),
descripcion char(40),
primary key (cod_centro) constraint "informix"._103_prom1
);
revoke all on "informix".centros from "public";
create index "informix".ix_centros1 on "informix".centros (descripcion);
{ TABLE "informix".cond_pago row size = 28 number of columns = 3 index size = 12
}
create table "informix".cond_pago
(
cond_pago char(4) not null constraint "informix".n104_10,
descripcion char(20),
vencimiento integer,
primary key (cond_pago) constraint "informix"._104_prom1
);
revoke all on "informix".cond_pago from "public";
{ TABLE "informix".ctas_contables row size = 53 number of columns = 3 index size
= 90 }
create table "informix".ctas_contables
(
cta_contable char(12) not null constraint "informix".n101_1,
descripcion char(40),
es_nueva char(1),
primary key (cta_contable) constraint "informix"._101_prom1
);
revoke all on "informix".ctas_contables from "public";
create index "informix".ix_ctas_contables1 on "informix".ctas_contables (descripcion);
{ TABLE "informix".localidades row size = 32 number of columns = 2 index size = 9
}
create table "informix".localidades
(
cod_localidad char(2) not null constraint "informix".n120_86,
descripcion char(30),
primary key (cod_localidad) constraint "informix"._120_prom1
);
revoke all on "informix".localidades from "public";
{ TABLE "informix".registros row size = 16 number of columns = 2 index size = 12
}
create table "informix".registros
(
tipo_reg char(4) not null constraint "informix".n122_95,
nro_reg char(12) not null constraint "informix".n122_96,
primary key (tipo_reg) constraint "informix"._122_prom1
);
revoke all on "informix".registros from "public";
{ TABLE "informix".user row size = 298 number of columns = 15 index size = 12 }
create table "informix".user
(
id serial not null constraint "informix".n100_1,
login varchar(10,1) not null constraint "informix".n100_2,
password varchar(10,1) not null constraint "informix".n100_3,
firstname varchar(20,1),
lastname varchar(20,1),
fullname varchar(40,1),
title varchar(80,1),
phone varchar(14,1),
email varchar(80,1),
active char(1) not null constraint "informix".n100_4,
status char(1),
admin char(1),
def_project integer,
def_category integer,
acl char(1)
);
revoke all on "informix".user from "public";
create unique index "informix".ix100_1 on "informix".user (id);
alter table "informix".user add constraint primary key (id) constraint
"informix".u100_5 ;
{ TABLE "informix".albalineas row size = 74 number of columns = 6 index size = 117
}
create table "informix".albalineas
(
nro_lin integer not null constraint "informix".n113_58,
nro_reg char(10) not null constraint "informix".n113_59,
cantidad integer,
referencia char(12),
descripcion char(40),
precio_und integer
);
revoke all on "informix".albalineas from "public";
create unique cluster index "informix".ix_alblin on "informix".albalineas (nro_reg,
nro_lin);
create index "informix".ix_albalineas1 on "informix".albalineas (referencia);
create index "informix".ix_albalineas2 on "informix".albalineas (descripcion);
{ TABLE "informix".claves row size = 33 number of columns = 2 index size = 0 }
create table "informix".claves
(
cod_clave char(3),
descripcion char(30)
);
revoke all on "informix".claves from "public";
{ TABLE "informix".albafras row size = 160 number of columns = 5 index size = 42
}
create table "informix".albafras
(
nroreg_albafact char(10) not null constraint "informix".n125_98,
nroreg_factura char(10) not null constraint "informix".n164_87,
nroreg_albaran char(10) not null constraint "informix".n164_88,
sumactas decimal(16,2),
observaciones varchar(120)
);
revoke all on "informix".albafras from "public";
create unique index "informix".ix_albafras1 on "informix".albafras (nroreg_albaran);
create index "informix".ix_albafras2 on "informix".albafras (nroreg_factura);
{ TABLE "informix".parametros row size = 194 number of columns = 29 index size =
12 }
create table "informix".parametros
(
id serial not null constraint "informix".n120_52,
nro_reg char(10),
ultimo_actual date,
iva_1 integer,
iva_2 integer,
iva_3 integer,
reten_1 integer,
cta_reten_1 char(12),
clave_reten_1 char(3),
reten_2 integer,
cta_reten_2 char(12),
clave_reten_2 char(3),
dia_pago_1 integer,
dia_pago_2 integer,
ex_dia_pago char(20),
longcta integer,
cta_iva char(12),
clave_iva char(3),
cta_cont char(12),
clave_cont char(3),
cta_comp char(12),
clave_comp char(3),
cta_coniva char(12),
clave_coniva char(3),
cta_siniva char(12),
clave_siniva char(3),
cta_dev char(12),
clave_dev char(3),
cp_lock char(4)
);
revoke all on "informix".parametros from "public";
create unique index "informix".ix119_1 on "informix".parametros (id);
{ TABLE "informix".aptectasfra row size = 91 number of columns = 10 index size =
120 }
create table "informix".aptectasfra
(
nro_reg char(10) not null constraint "informix".n104_12,
nro_lin integer not null constraint "informix".n104_13,
tipolin char(2),
albareg char(10),
cod_cta char(12) not null constraint "informix".n104_14,
clave char(3),
concepto char(30),
importe decimal(16,0) not null constraint "informix".n104_15,
tipo_apte char(1),
fecha char(10)
);
revoke all on "informix".aptectasfra from "public";
create unique cluster index "informix".ix_fractas on "informix".aptectasfra (nro_reg,
nro_lin);
create index "informix".ix_aptectasfra1 on "informix".aptectasfra (concepto);
create index "informix".ix_aptectasfra2 on "informix".aptectasfra (fecha);
{ TABLE "informix".pedidos row size = 282 number of columns = 10 index size = 60
}
create table "informix".pedidos
(
nro_pedido char(20) not null constraint "informix".n106_20,
descripcion char(40),
nif_proveedor char(12),
cod_centro char(12),
cond_pago char(4),
fecha_pedido date,
fecha_entrega date,
importe decimal(16,2),
observaciones varchar(120),
expediente text
);
revoke all on "informix".pedidos from "public";
create unique cluster index "informix".ix_pedidos1 on "informix".pedidos (nro_pedido);
{ TABLE "informix".albaranes row size = 260 number of columns = 14 index size = 57
}
create table "informix".albaranes
(
nro_reg char(10) not null constraint "informix".n112_50,
is_locked char(1),
fra_reg char(10),
fecha_emision date not null constraint "informix".n179_74,
cod_centro char(12) not null constraint "informix".n112_52,
nif char(12) not null constraint "informix".n112_53,
por_reten char(2),
importe_reten decimal(16,0),
nro_pedido char(20),
vto_jefe_obra char(1),
vto_jefe_grupo char(1),
vto_proveedor char(1),
observaciones varchar(120),
expediente text
);
revoke all on "informix".albaranes from "public";
create index "informix".ix_albaranes1 on "informix".albaranes (fecha_emision);
create unique cluster index "informix".ix_albnroreg on "informix".albaranes (nro_reg);
{ TABLE "informix".aptecuentas row size = 81 number of columns = 9 index size = 123
}
create table "informix".aptecuentas
(
nro_reg char(10) not null constraint "informix".n115_66,
nro_lin integer not null constraint "informix".n114_62,
tipolin char(2),
cod_cta char(12) not null constraint "informix".n114_63,
clave char(3),
concepto char(30),
importe decimal(16,0),
tipo_apte char(1),
fecha char(10)
);
revoke all on "informix".aptecuentas from "public";
create unique cluster index "informix".ix_albctas on "informix".aptecuentas (nro_reg,
nro_lin);
create index "informix".ix_aptecuentas1 on "informix".aptecuentas (fecha);
create index "informix".ix_aptecuentas2 on "informix".aptecuentas (concepto);
{ TABLE "informix".facturas row size = 390 number of columns = 49 index size = 196
}
create table "informix".facturas
(
nro_reg char(10) not null constraint "informix".n117_68,
is_locked char(1),
mes char(2),
nro_fra char(20) not null constraint "informix".n118_65,
f_emision date,
f_recepcion date,
f_pago date,
tipo_fra char(1),
tipo_calc_iva char(1),
importe_total decimal(20,2),
nif char(12),
cod_centro char(12),
nro_pedido char(20),
cond_pago char(4),
tipo_doc_pago char(1),
nro_doc_pago char(8),
f_emision_pago date,
cod_localidad char(12),
cod_banco char(2),
base_1 decimal(16,0),
por_ret1 decimal(16),
ret_1 decimal(16),
por_iva1 smallint,
iva_1 decimal(16,2),
base_2 decimal(16,2),
por_ret2 decimal(16),
ret_2 decimal(16),
por_iva2 smallint,
iva_2 decimal(16,2),
base_3 decimal(16,2),
por_ret3 decimal(16),
ret_3 decimal(16),
por_iva3 smallint,
iva_3 decimal(16,2),
canexen decimal(16,2),
base_imponible decimal(20,2),
tipo_retencion char(1),
por_retencion smallint,
retencion decimal(16,0),
tipo_deduccion char(1),
deducciones decimal(16,2),
sin_pedido char(1),
traspaso_gasto char(1),
traspaso_pago char(1),
traspaso_vto char(1),
nro_reg_pago char(10),
vto_pago date,
observaciones varchar(20),
expediente text,
primary key (nro_reg) constraint "informix"._119_prom1
);
revoke all on "informix".facturas from "public";
create index "informix".ix_facturas1 on "informix".facturas (f_pago);
create index "informix".ix_facturas_nro on "informix".facturas (nro_fra);
create index "informix".ix_facturas_vtopag on "informix".facturas (vto_pago);
create index "informix".ix_facturas_fpago on "informix".facturas (f_emision_pago);
create index "informix".ix_facturas_frecep on "informix".facturas (f_recepcion);
create index "informix".ix_facturas_import on "informix".facturas (importe_total);
create index "informix".ix_facturas2 on "informix".facturas (nif);
create index "informix".ix_facturas3 on "informix".facturas (cod_centro);
create index "informix".ix_facturas4 on "informix".facturas (nro_reg_pago);
{ TABLE "informix".docspago row size = 105 number of columns = 14 index size = 48
}
create table "informix".docspago
(
uid integer not null constraint "informix".n182_75,
nro_reg char(10) not null constraint "informix".n182_76,
cod_centro char(12) not null constraint "informix".n182_77,
f_pago date not null constraint "informix".n182_78,
nro_fra char(20),
tipo_fra char(1) not null constraint "informix".n183_86,
nif char(12) not null constraint "informix".n182_79,
tipo_doc_pago char(1) not null constraint "informix".n182_80,
nro_doc_pago char(8) not null constraint "informix".n182_81,
f_emision_pago date not null constraint "informix".n182_82,
cod_localidad char(12) not null constraint "informix".n182_83,
vto_pago date,
cod_banco char(2) not null constraint "informix".n182_84,
importe_total decimal(20,2) not null constraint "informix".n182_85
);
revoke all on "informix".docspago from "public";
create unique cluster index "informix".ix_docspago1 on "informix".docspago (uid,
nro_reg);
create index "informix".ix_docspago2 on "informix".docspago (nro_reg);
{ TABLE "informix".bancos row size = 287 number of columns = 28 index size = 0 }
create table "informix".bancos
(
cod_banco char(4) not null constraint "informix".n122_104,
nombre char(40) not null constraint "informix".n111_45,
domicilio char(40),
localidad char(25),
cod_postal char(5),
entidad char(4) not null constraint "informix".n111_46,
sucursal char(4) not null constraint "informix".n111_47,
cod_control char(2),
nro_cc char(15) not null constraint "informix".n111_49,
nro_lins integer,
l_importe integer,
c_importe integer,
l_paguese integer,
c_paguese integer,
l1_nroletra integer,
c1_nroletra integer,
l2_nroletra integer,
c2_nroletra integer,
l_fecha integer,
c_fecha integer,
c_mes integer,
c_anno integer,
l1_firmado integer,
c1_firmado integer,
l2_firmado integer,
c2_firmado integer,
t1_firmado char(40),
t2_firmado char(40)
);
revoke all on "informix".bancos from "public";
{ TABLE "informix".sumactasfra row size = 38 number of columns = 4 index size = 0
}
create table "informix".sumactasfra
(
uid integer not null constraint "informix".n194_103,
cod_centro char(12) not null constraint "informix".n195_104,
cod_cta char(12) not null constraint "informix".n193_101,
importe decimal(16) not null constraint "informix".n193_102
);
revoke all on "informix".sumactasfra from "public";
alter table "informix".aptectasfra add constraint (foreign key (nro_reg)
references "informix".facturas on delete cascade constraint "informix".fk_aptectasfra1);
alter table "informix".pedidos add constraint (foreign key (nif_proveedor)
references "informix".proveedores constraint "informix".fk_pedidos2);
alter table "informix".albaranes add constraint (foreign key (nif) references
"informix".proveedores constraint "informix".fk_albaranes2);
alter table "informix".aptecuentas add constraint (foreign key (cod_cta)
references "informix".ctas_contables constraint "informix".fk_aptecuentas2);
grant select on "informix".plan_contable to "public" as "informix";
grant update on "informix".plan_contable to "public" as "informix";
grant insert on "informix".plan_contable to "public" as "informix";
grant delete on "informix".plan_contable to "public" as "informix";
grant index on "informix".plan_contable to "public" as "informix";
grant select on "informix".traspaso_ctas to "public" as "informix";
grant update on "informix".traspaso_ctas to "public" as "informix";
grant insert on "informix".traspaso_ctas to "public" as "informix";
grant delete on "informix".traspaso_ctas to "public" as "informix";
grant index on "informix".traspaso_ctas to "public" as "informix";
grant select on "informix".proveedores to "public" as "informix";
grant update on "informix".proveedores to "public" as "informix";
grant insert on "informix".proveedores to "public" as "informix";
grant delete on "informix".proveedores to "public" as "informix";
grant index on "informix".proveedores to "public" as "informix";
grant select on "informix".centros to "public" as "informix";
grant update on "informix".centros to "public" as "informix";
grant insert on "informix".centros to "public" as "informix";
grant delete on "informix".centros to "public" as "informix";
grant index on "informix".centros to "public" as "informix";
grant select on "informix".cond_pago to "public" as "informix";
grant update on "informix".cond_pago to "public" as "informix";
grant insert on "informix".cond_pago to "public" as "informix";
grant delete on "informix".cond_pago to "public" as "informix";
grant index on "informix".cond_pago to "public" as "informix";
grant select on "informix".ctas_contables to "public" as "informix";
grant update on "informix".ctas_contables to "public" as "informix";
grant insert on "informix".ctas_contables to "public" as "informix";
grant delete on "informix".ctas_contables to "public" as "informix";
grant index on "informix".ctas_contables to "public" as "informix";
grant select on "informix".localidades to "public" as "informix";
grant update on "informix".localidades to "public" as "informix";
grant insert on "informix".localidades to "public" as "informix";
grant delete on "informix".localidades to "public" as "informix";
grant index on "informix".localidades to "public" as "informix";
grant select on "informix".registros to "public" as "informix";
grant update on "informix".registros to "public" as "informix";
grant insert on "informix".registros to "public" as "informix";
grant delete on "informix".registros to "public" as "informix";
grant index on "informix".registros to "public" as "informix";
grant select on "informix".user to "public" as "informix";
grant update on "informix".user to "public" as "informix";
grant insert on "informix".user to "public" as "informix";
grant delete on "informix".user to "public" as "informix";
grant index on "informix".user to "public" as "informix";
grant select on "informix".albalineas to "public" as "informix";
grant update on "informix".albalineas to "public" as "informix";
grant insert on "informix".albalineas to "public" as "informix";
grant delete on "informix".albalineas to "public" as "informix";
grant index on "informix".albalineas to "public" as "informix";
grant select on "informix".claves to "public" as "informix";
grant update on "informix".claves to "public" as "informix";
grant insert on "informix".claves to "public" as "informix";
grant delete on "informix".claves to "public" as "informix";
grant index on "informix".claves to "public" as "informix";
grant select on "informix".albafras to "public" as "informix";
grant update on "informix".albafras to "public" as "informix";
grant insert on "informix".albafras to "public" as "informix";
grant delete on "informix".albafras to "public" as "informix";
grant index on "informix".albafras to "public" as "informix";
grant select on "informix".aptectasfra to "public" as "informix";
grant update on "informix".aptectasfra to "public" as "informix";
grant insert on "informix".aptectasfra to "public" as "informix";
grant delete on "informix".aptectasfra to "public" as "informix";
grant select on "informix".aptecuentas to "public" as "informix";
grant update on "informix".aptecuentas to "public" as "informix";
grant insert on "informix".aptecuentas to "public" as "informix";
grant delete on "informix".aptecuentas to "public" as "informix";
grant index on "informix".aptecuentas to "public" as "informix";
grant select on "informix".docspago to "public" as "informix";
grant update on "informix".docspago to "public" as "informix";
grant insert on "informix".docspago to "public" as "informix";
grant delete on "informix".docspago to "public" as "informix";
grant index on "informix".docspago to "public" as "informix";
grant select on "informix".bancos to "public" as "informix";
grant update on "informix".bancos to "public" as "informix";
grant insert on "informix".bancos to "public" as "informix";
grant delete on "informix".bancos to "public" as "informix";
grant index on "informix".bancos to "public" as "informix";
grant select on "informix".sumactasfra to "public" as "informix";
grant update on "informix".sumactasfra to "public" as "informix";
grant insert on "informix".sumactasfra to "public" as "informix";
grant delete on "informix".sumactasfra to "public" as "informix";
grant index on "informix".sumactasfra to "public" as "informix";

73
sql/facturas.sql Normal file
View File

@ -0,0 +1,73 @@
DBSCHEMA Schema Utility INFORMIX-SQL Version 7.12.TC3
Copyright (C) Informix Software, Inc., 1984-1996
Software Serial Number AAB#J556877
{ TABLE "informix".facturas row size = 383 number of columns = 48 index size = 139
}
create table "informix".facturas
(
nro_reg char(10) not null constraint "informix".n117_68,
is_locked char(1),
mes char(2),
nro_fra char(20) not null constraint "informix".n118_65,
f_emision date,
f_recepcion date,
f_pago date,
tipo_fra char(1),
tipo_calc_iva char(1),
importe_total decimal(20,2),
nif char(12),
cod_centro char(12),
nro_pedido char(20),
cond_pago char(4),
tipo_doc_pago char(1),
nro_doc_pago char(8),
f_emision_pago date,
cod_localidad char(12),
cod_banco char(2),
base_1 decimal(16,0),
por_ret1 decimal(16,2),
ret_1 decimal(16,2),
por_iva1 smallint,
iva_1 decimal(16,2),
base_2 decimal(16,2),
por_ret2 decimal(16,2),
ret_2 decimal(16,2),
por_iva2 smallint,
iva_2 decimal(16,2),
base_3 decimal(16,2),
por_ret3 decimal(16,2),
ret_3 decimal(16,2),
por_iva3 smallint,
iva_3 decimal(16,2),
canexen decimal(16,2),
base_imponible decimal(20,2),
tipo_retencion char(1),
por_retencion smallint,
retencion decimal(16,0),
tipo_deduccion char(1),
deducciones decimal(16,2),
sin_pedido char(1),
traspaso_ctable char(1),
traspaso_pago char(1),
nro_reg_pago char(10),
vto_pago date,
observaciones varchar(20),
expediente text,
primary key (nro_reg) constraint "informix"._119_prom1
);
revoke all on "informix".facturas from "public";
create index "informix".ix_facturas_nif on "informix".facturas (nif);
create index "informix".ix_facturas_nro on "informix".facturas (nro_fra);
create index "informix".ix_facturas_vtopag on "informix".facturas (vto_pago);
create index "informix".ix_facturas_fpago on "informix".facturas (f_emision_pago);
create index "informix".ix_facturas_frecep on "informix".facturas (f_recepcion);
create index "informix".ix_facturas_import on "informix".facturas (importe_total);

3
sql/fragrp.sql Normal file
View File

@ -0,0 +1,3 @@
select nro_doc_pago,nro_reg,importe_total from facturas
where nro_doc_pago matches "3132*" group by nro_doc_pago,nro_reg,importe_total
order by nro_doc_pago

6
sql/l.sql Normal file
View File

@ -0,0 +1,6 @@
SELECT
nro_reg,importe_total from
facturas where
tipo_doc_pago = '1' and
cod_banco = '43' and
f_emision_pago ='10/11/97'

33
sql/pagemit.sql Normal file
View File

@ -0,0 +1,33 @@
select sum(importe_total),cod_banco,vto_pago from facturas
where tipo_doc_pago="1"
and vto_pago > "1/1/98"
group by cod_banco,vto_pago
order by vto_pago, cod_banco
select sum(importe_total),f_pago,tipo_doc_pago from facturas
where f_pago > "1/1/97"
and tipo_doc_pago between "1" and "2"
and vto_pago is null
group by tipo_doc_pago,f_pago
order by f_pago, tipo_doc_pago
select sum(importe_total),cod_banco,vto_pago
from facturas
where vto_pago is not null and vto_pago > "01/10/97"
and tipo_doc_pago = "1"
group by cod_banco,vto_pago
order by vto_pago,cod_banco
select sum(importe_total),f_pago
FROM facturas,proveedores
WHERE f_pago > "1/1/97" and
facturas.nif=proveedores.nif and
f_emision_pago is null and
tipo_doc_pago between "1" and "2" and
( proveedores.cond_pago = "99" or facturas.cond_pago = "99" )
GROUP BY f_pago
ORDER BY f_pago

29
sql/parametros.sql Normal file
View File

@ -0,0 +1,29 @@
DBSCHEMA Schema Utility INFORMIX-SQL Version 7.12.TC3
Copyright (C) Informix Software, Inc., 1984-1996
Software Serial Number AAB#J556877
{ TABLE "informix".parametros row size = 77 number of columns = 14 index size = 0
}
create table "informix".parametros
(
nro_reg integer,
ultimo_actual date,
iva_1 integer,
iva_2 integer,
iva_3 integer,
por_reten integer,
dia_pago_1 integer,
dia_pago_2 integer,
grupo_ctas_1 char(12),
grupo_clave_1 char(3),
grupo_ctas_2 char(12),
grupo_clave_2 char(3),
grupo_ctas_3 char(12),
grupo_clave_3 char(3)
);
revoke all on "informix".parametros from "public";

6
sql/prev0.sql Normal file
View File

@ -0,0 +1,6 @@
select sum(importe_total),cod_banco,vto_pago
from facturas
where vto_pago is not null and vto_pago > "01/10/97"
and tipo_doc_pago = "1"
group by cod_banco,vto_pago
order by vto_pago,cod_banco

464
sql/sando-adminis.sql Normal file
View File

@ -0,0 +1,464 @@
DBSCHEMA Schema Utility INFORMIX-SQL Version 7.12.TC3
Copyright (C) Informix Software, Inc., 1984-1996
Software Serial Number AAB#J556877
grant dba to "Administ";
grant dba to "informix";
{ TABLE "informix".traspaso_ctas row size = 24 number of columns = 3 index size =
0 }
create table "informix".traspaso_ctas
(
cta_contable char(12) not null constraint "informix".n109_28,
importe decimal(20,0) not null constraint "informix".n109_29,
es_nueva char(1) not null constraint "informix".n109_30
);
revoke all on "informix".traspaso_ctas from "public";
{ TABLE "informix".proveedores row size = 511 number of columns = 17 index size =
90 }
create table "informix".proveedores
(
nif char(12) not null constraint "informix".n102_3,
razon_social char(40) not null constraint "informix".n102_4,
cta_contable char(12) not null constraint "informix".n102_5,
cond_pago char(4),
domicilio char(40),
localidad char(30),
cod_postal char(7),
attn_envio char(40),
direccion_envio char(40),
localidad_envio char(30),
cod_postal_envio char(7),
telefono_1 char(14),
telefono_2 char(14),
fax char(14),
e_mail char(30),
observaciones varchar(120),
expediente text,
primary key (nif) constraint "informix"._102_prom1
);
revoke all on "informix".proveedores from "public";
create index "informix".ix_razonsocial on "informix".proveedores (razon_social);
{ TABLE "informix".centros row size = 64 number of columns = 3 index size = 24 }
create table "informix".centros
(
cod_centro char(12) not null constraint "informix".n103_8,
cod_departamento char(12),
descripcion char(40),
primary key (cod_centro) constraint "informix"._103_prom1
);
revoke all on "informix".centros from "public";
{ TABLE "informix".cond_pago row size = 28 number of columns = 3 index size = 12
}
create table "informix".cond_pago
(
cond_pago char(4) not null constraint "informix".n104_10,
descripcion char(20),
vencimiento integer,
primary key (cond_pago) constraint "informix"._104_prom1
);
revoke all on "informix".cond_pago from "public";
{ TABLE "informix".pedidos row size = 282 number of columns = 10 index size = 0 }
create table "informix".pedidos
(
nro_pedido char(20) not null constraint "informix".n106_20,
descripcion char(40),
nif_proveedor char(12),
cod_centro char(12),
cond_pago char(4),
fecha_pedido date,
fecha_entrega date,
importe decimal(16,2),
observaciones varchar(120),
expediente text
);
revoke all on "informix".pedidos from "public";
{ TABLE "informix".ctas_contables row size = 53 number of columns = 3 index size
= 24 }
create table "informix".ctas_contables
(
cta_contable char(12) not null constraint "informix".n101_1,
descripcion char(40),
es_nueva char(1),
primary key (cta_contable) constraint "informix"._101_prom1
);
revoke all on "informix".ctas_contables from "public";
{ TABLE "informix".localidades row size = 32 number of columns = 2 index size = 9
}
create table "informix".localidades
(
cod_localidad char(2) not null constraint "informix".n120_86,
descripcion char(30),
primary key (cod_localidad) constraint "informix"._120_prom1
);
revoke all on "informix".localidades from "public";
{ TABLE "informix".registros row size = 16 number of columns = 2 index size = 12
}
create table "informix".registros
(
tipo_reg char(4) not null constraint "informix".n122_95,
nro_reg char(12) not null constraint "informix".n122_96,
primary key (tipo_reg) constraint "informix"._122_prom1
);
revoke all on "informix".registros from "public";
{ TABLE "informix".albafras row size = 151 number of columns = 4 index size = 0 }
create table "informix".albafras
(
nroreg_albafact char(10) not null constraint "informix".n125_98,
nroreg_factura char(10),
nroreg_albaran char(10),
observaciones varchar(120)
);
revoke all on "informix".albafras from "public";
{ TABLE "informix".bancos row size = 139 number of columns = 9 index size = 0 }
create table "informix".bancos
(
cod_banco char(4) not null constraint "informix".n122_104,
nombre char(40) not null constraint "informix".n111_45,
domicilio char(40),
localidad char(25),
cod_postal char(5),
entidad char(4) not null constraint "informix".n111_46,
sucursal char(4) not null constraint "informix".n111_47,
cod_control char(2),
nro_cc char(15) not null constraint "informix".n111_49
);
revoke all on "informix".bancos from "public";
{ TABLE "informix".plan_contable row size = 53 number of columns = 3 index size =
24 }
create table "informix".plan_contable
(
cta_contable char(12) not null constraint "informix".n111_32,
descirpcion char(40) not null constraint "informix".n111_33,
es_nueva char(1),
primary key (cta_contable) constraint "informix"._111_prom1
);
revoke all on "informix".plan_contable from "public";
{ TABLE "informix".user row size = 298 number of columns = 15 index size = 12 }
create table "informix".user
(
id serial not null constraint "informix".n100_1,
login varchar(10,1) not null constraint "informix".n100_2,
password varchar(10,1) not null constraint "informix".n100_3,
firstname varchar(20,1),
lastname varchar(20,1),
fullname varchar(40,1),
title varchar(80,1),
phone varchar(14,1),
email varchar(80,1),
active char(1) not null constraint "informix".n100_4,
status char(1),
admin char(1),
def_project integer,
def_category integer,
acl char(1)
);
revoke all on "informix".user from "public";
create unique index "informix".ix100_1 on "informix".user (id);
alter table "informix".user add constraint primary key (id) constraint
"informix".u100_5 ;
{ TABLE "informix".albalineas row size = 74 number of columns = 6 index size = 48
}
create table "informix".albalineas
(
nro_lin integer not null constraint "informix".n113_58,
nro_reg char(10) not null constraint "informix".n113_59,
cantidad integer,
referencia char(12),
descripcion char(40),
precio_und integer
);
revoke all on "informix".albalineas from "public";
create unique cluster index "informix".ix_alblin on "informix".albalineas (nro_reg,
nro_lin);
{ TABLE "informix".aptecuentas row size = 84 number of columns = 8 index size = 27
}
create table "informix".aptecuentas
(
nro_reg char(10) not null constraint "informix".n115_66,
nro_lin integer not null constraint "informix".n114_62,
cod_cta char(12) not null constraint "informix".n114_63,
clave char(3),
concepto char(35),
importe decimal(16,0) not null constraint "informix".n114_64,
tipo_apte char(1),
fecha char(10)
);
revoke all on "informix".aptecuentas from "public";
create unique cluster index "informix".ix_albctas on "informix".aptecuentas (nro_reg,
nro_lin);
{ TABLE "informix".claves row size = 33 number of columns = 2 index size = 0 }
create table "informix".claves
(
cod_clave char(3),
descripcion char(30)
);
revoke all on "informix".claves from "public";
{ TABLE "informix".albaranes row size = 250 number of columns = 13 index size = 21
}
create table "informix".albaranes
(
nro_reg char(10) not null constraint "informix".n112_50,
is_locked char(1),
fecha_emision date not null constraint "informix".n112_51,
cod_centro char(12) not null constraint "informix".n112_52,
nif char(12) not null constraint "informix".n112_53,
por_reten char(2),
importe_reten decimal(16,0),
nro_pedido char(20),
vto_jefe_obra char(1),
vto_jefe_grupo char(1),
vto_proveedor char(1),
observaciones varchar(120),
expediente text,
primary key (nro_reg) constraint "informix"._112_prom1
);
revoke all on "informix".albaranes from "public";
{ TABLE "informix".parametros row size = 190 number of columns = 28 index size =
12 }
create table "informix".parametros
(
id serial not null constraint "informix".n148_105,
nro_reg char(10),
ultimo_actual date,
iva_1 integer,
iva_2 integer,
iva_3 integer,
reten_1 integer,
cta_reten_1 char(12),
clave_reten_1 char(3),
reten_2 integer,
cta_reten_2 char(12),
clave_reten_2 char(3),
dia_pago_1 integer,
dia_pago_2 integer,
ex_dia_pago char(20),
longcta integer,
cta_iva char(12),
clave_iva char(3),
cta_cont char(12),
clave_cont char(3),
cta_comp char(12),
clave_comp char(3),
cta_coniva char(12),
clave_coniva char(3),
cta_siniva char(12),
clave_siniva char(3),
cta_dev char(12),
clave_dev char(3)
);
revoke all on "informix".parametros from "public";
create unique index "informix".ix145_1 on "informix".parametros (id);
{ TABLE "informix".facturas row size = 383 number of columns = 48 index size = 139
}
create table "informix".facturas
(
nro_reg char(10) not null constraint "informix".n117_68,
is_locked char(1),
mes char(2),
nro_fra char(20) not null constraint "informix".n118_65,
f_emision date,
f_recepcion date,
f_pago date,
tipo_fra char(1),
tipo_calc_iva char(1),
importe_total decimal(20,2),
nif char(12),
cod_centro char(12),
nro_pedido char(20),
cond_pago char(4),
tipo_doc_pago char(1),
nro_doc_pago char(8),
f_emision_pago date,
cod_localidad char(12),
cod_banco char(2),
base_1 decimal(16,0),
por_ret1 decimal(16,2),
ret_1 decimal(16,2),
por_iva1 smallint,
iva_1 decimal(16,2),
base_2 decimal(16,2),
por_ret2 decimal(16,2),
ret_2 decimal(16,2),
por_iva2 smallint,
iva_2 decimal(16,2),
base_3 decimal(16,2),
por_ret3 decimal(16,2),
ret_3 decimal(16,2),
por_iva3 smallint,
iva_3 decimal(16,2),
canexen decimal(16,2),
base_imponible decimal(20,2),
tipo_retencion char(1),
por_retencion smallint,
retencion decimal(16,0),
tipo_deduccion char(1),
deducciones decimal(16,2),
sin_pedido char(1),
traspaso_ctable char(1),
traspaso_pago char(1),
nro_reg_pago char(10),
vto_pago date,
observaciones varchar(20),
expediente text,
primary key (nro_reg) constraint "informix"._119_prom1
);
revoke all on "informix".facturas from "public";
create index "informix".ix_facturas_nif on "informix".facturas (nif);
create index "informix".ix_facturas_nro on "informix".facturas (nro_fra);
create index "informix".ix_facturas_vtopag on "informix".facturas (vto_pago);
create index "informix".ix_facturas_fpago on "informix".facturas (f_emision_pago);
create index "informix".ix_facturas_frecep on "informix".facturas (f_recepcion);
create index "informix".ix_facturas_import on "informix".facturas (importe_total);
{ TABLE "informix".aptectasfra row size = 84 number of columns = 9 index size = 27
}
create table "informix".aptectasfra
(
nro_reg char(10) not null constraint "informix".n104_12,
nro_lin integer not null constraint "informix".n104_13,
tipolin char(1),
cod_cta char(12) not null constraint "informix".n104_14,
clave char(2),
concepto char(35),
importe decimal(16,0) not null constraint "informix".n104_15,
tipo_apte char(1),
fecha char(10)
);
revoke all on "informix".aptectasfra from "public";
create unique cluster index "informix".ix_fractas on "informix".aptectasfra (nro_reg,
nro_lin);
alter table "informix".albalineas add constraint (foreign key (nro_reg)
references "informix".albaranes constraint "informix".fk_alblin_nroreg);
grant select on "informix".traspaso_ctas to "public" as "informix";
grant update on "informix".traspaso_ctas to "public" as "informix";
grant insert on "informix".traspaso_ctas to "public" as "informix";
grant delete on "informix".traspaso_ctas to "public" as "informix";
grant index on "informix".traspaso_ctas to "public" as "informix";
grant select on "informix".proveedores to "public" as "informix";
grant update on "informix".proveedores to "public" as "informix";
grant insert on "informix".proveedores to "public" as "informix";
grant delete on "informix".proveedores to "public" as "informix";
grant index on "informix".proveedores to "public" as "informix";
grant select on "informix".centros to "public" as "informix";
grant update on "informix".centros to "public" as "informix";
grant insert on "informix".centros to "public" as "informix";
grant delete on "informix".centros to "public" as "informix";
grant index on "informix".centros to "public" as "informix";
grant select on "informix".cond_pago to "public" as "informix";
grant update on "informix".cond_pago to "public" as "informix";
grant insert on "informix".cond_pago to "public" as "informix";
grant delete on "informix".cond_pago to "public" as "informix";
grant index on "informix".cond_pago to "public" as "informix";
grant select on "informix".pedidos to "public" as "informix";
grant update on "informix".pedidos to "public" as "informix";
grant insert on "informix".pedidos to "public" as "informix";
grant delete on "informix".pedidos to "public" as "informix";
grant index on "informix".pedidos to "public" as "informix";
grant select on "informix".ctas_contables to "public" as "informix";
grant update on "informix".ctas_contables to "public" as "informix";
grant insert on "informix".ctas_contables to "public" as "informix";
grant delete on "informix".ctas_contables to "public" as "informix";
grant index on "informix".ctas_contables to "public" as "informix";
grant select on "informix".localidades to "public" as "informix";
grant update on "informix".localidades to "public" as "informix";
grant insert on "informix".localidades to "public" as "informix";
grant delete on "informix".localidades to "public" as "informix";
grant index on "informix".localidades to "public" as "informix";
grant select on "informix".registros to "public" as "informix";
grant update on "informix".registros to "public" as "informix";
grant insert on "informix".registros to "public" as "informix";
grant delete on "informix".registros to "public" as "informix";
grant index on "informix".registros to "public" as "informix";
grant select on "informix".albafras to "public" as "informix";
grant update on "informix".albafras to "public" as "informix";
grant insert on "informix".albafras to "public" as "informix";
grant delete on "informix".albafras to "public" as "informix";
grant index on "informix".albafras to "public" as "informix";
grant select on "informix".bancos to "public" as "informix";
grant update on "informix".bancos to "public" as "informix";
grant insert on "informix".bancos to "public" as "informix";
grant delete on "informix".bancos to "public" as "informix";
grant index on "informix".bancos to "public" as "informix";
grant select on "informix".plan_contable to "public" as "informix";
grant update on "informix".plan_contable to "public" as "informix";
grant insert on "informix".plan_contable to "public" as "informix";
grant delete on "informix".plan_contable to "public" as "informix";
grant index on "informix".plan_contable to "public" as "informix";
grant select on "informix".user to "public" as "informix";
grant update on "informix".user to "public" as "informix";
grant insert on "informix".user to "public" as "informix";
grant delete on "informix".user to "public" as "informix";
grant index on "informix".user to "public" as "informix";
grant select on "informix".albalineas to "public" as "informix";
grant update on "informix".albalineas to "public" as "informix";
grant insert on "informix".albalineas to "public" as "informix";
grant delete on "informix".albalineas to "public" as "informix";
grant index on "informix".albalineas to "public" as "informix";
grant select on "informix".aptecuentas to "public" as "informix";
grant update on "informix".aptecuentas to "public" as "informix";
grant insert on "informix".aptecuentas to "public" as "informix";
grant delete on "informix".aptecuentas to "public" as "informix";
grant index on "informix".aptecuentas to "public" as "informix";
grant select on "informix".claves to "public" as "informix";
grant update on "informix".claves to "public" as "informix";
grant insert on "informix".claves to "public" as "informix";
grant delete on "informix".claves to "public" as "informix";
grant index on "informix".claves to "public" as "informix";
grant select on "informix".albaranes to "public" as "informix";
grant update on "informix".albaranes to "public" as "informix";
grant insert on "informix".albaranes to "public" as "informix";
grant delete on "informix".albaranes to "public" as "informix";
grant index on "informix".albaranes to "public" as "informix";
grant select on "informix".parametros to "public" as "informix";
grant update on "informix".parametros to "public" as "informix";
grant insert on "informix".parametros to "public" as "informix";
grant delete on "informix".parametros to "public" as "informix";
grant index on "informix".parametros to "public" as "informix";
grant select on "informix".facturas to "public" as "informix";
grant update on "informix".facturas to "public" as "informix";
grant insert on "informix".facturas to "public" as "informix";
grant delete on "informix".facturas to "public" as "informix";
grant index on "informix".facturas to "public" as "informix";
grant select on "informix".aptectasfra to "public" as "informix";
grant update on "informix".aptectasfra to "public" as "informix";
grant insert on "informix".aptectasfra to "public" as "informix";
grant delete on "informix".aptectasfra to "public" as "informix";
grant index on "informix".aptectasfra to "public" as "informix";

4
sql/verfra.sql Normal file
View File

@ -0,0 +1,4 @@
select nro_reg,nro_lin,cod_cta,importe,tipo_apte from
aptectasfra where nro_reg="199700010";
select nroreg_albafact, nroreg_albaran, sumactas from
albafras where nroreg_factura="199700010";

7
sql/vto.sql Normal file
View File

@ -0,0 +1,7 @@
SELECT
nro_reg,traspaso_vto,vto_pago,nro_reg_vto FROM
facturas
WHERE
traspaso_vto != 'S' and
vto_pago is not null and
nro_reg_vto matches ' ?*'