añadido sistema de auto actualizacion a travez de scripts sql numerados los cuales son almacenados en un simple archivo zip para evitar editarlos por error por un usuario comun )yn (ya si alguien los edita no es mi problema)
This commit is contained in:
29
database/1.sql
Normal file
29
database/1.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
pragma foreign_keys = ON;
|
||||
drop table if exists egresos;
|
||||
drop table if exists tipos_egreso;
|
||||
drop table if exists ingresos;
|
||||
drop table if exists tipos_ingreso;
|
||||
drop table if exists efectivos;
|
||||
drop table if exists documentos;
|
||||
drop table if exists caja;
|
||||
create table caja ( id integer primary key, fecha date not null );
|
||||
create table tipos_egreso ( id integer primary key, nombre text not null );
|
||||
create table egresos ( id integer primary key, nro text not null, descripcion text not null, valor integer not null, tipo_egreso_id integer not null, caja_id integer not null, foreign key (tipo_egreso_id) references tipos_egreso (id) on update cascade on delete restrict, foreign key (caja_id) references caja (id) on update cascade on delete restrict );
|
||||
create table tipos_ingreso ( id integer primary key, nombre text not null );
|
||||
create table ingresos ( id integer primary key, valor integer not null, nro_inicial text not null, nro_final text not null, tipo_ingreso_id integer unsigned not null, caja_id integer unsigned not null, foreign key (tipo_ingreso_id) references tipos_ingreso (id) on update cascade on delete restrict, foreign key (caja_id) references caja (id) on update cascade on delete restrict );
|
||||
create table efectivos ( id integer primary key, veinte_mil integer not null, diez_mil integer not null, cinco_mil integer not null, dos_mil integer not null, mil integer not null, quinientos integer not null, cien integer not null, cincuenta integer not null, diez integer not null, caja_id integer not null, foreign key (caja_id) references caja (id) on update cascade on delete restrict );
|
||||
create table documentos ( id integer primary key, cheques integer not null, tarjetas integer not null, caja_id integer not null, foreign key (caja_id) references caja (id) on update cascade on delete restrict );
|
||||
insert into tipos_egreso (nombre) values ('Factura Materia Prima'), ('Factura Gastos Generales'), ('Gasto Menor Materia Prima'), ('Gasto General Sin Respaldo'), ('Gasto General Con Boleta'), ('Guia Materia Prima'), ('Anticipo Arriendo'), ('Anticipo Personal'), ('Pago Partime'), ('Retiros Gerencia'), ('Otro');
|
||||
insert into tipos_ingreso (nombre) values ('Boletas Fiscales'), ('Boletas Manuales'), ('Facturas'), ('Guias');
|
||||
alter table ingresos add column nro_z_inicial text;
|
||||
alter table ingresos add column nro_z_final text;
|
||||
insert into tipos_ingreso (nombre) values ('Boleta Exenta');
|
||||
alter table documentos add column retiros integer default 0;
|
||||
drop table if exists calculo_fondo;
|
||||
create table calculo_fondo ( id integer primary key, valor integer not null, descripcion text not null, caja_id integer not null, foreign key (caja_id) references caja (id) on update cascade on delete restrict );
|
||||
drop table if exists estado_resultado;
|
||||
create table estado_resultado ( id integer primary key, mes date unique not null, costo_venta integer null, cuenta_corriente_factura integer null, cuenta_corriente_boleta integer null, cuenta_corriente_sin_respaldo integer null, remuneraciones integer null, finiquitos integer null, aguinaldo integer null, bonos_personal integer null, honorarios_contador integer null, arriendo integer null, agua integer null, luz integer null, gas integer null, telefono integer null, otro_servicio integer null, ppm real null, ivaFavor int null );
|
||||
drop table if exists version;
|
||||
create table version (version int not null );
|
||||
insert into version (version) values (1);
|
||||
|
||||
2
database/2.sql
Normal file
2
database/2.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
alter table caja add column fondo integer default 0;
|
||||
update version set version = 2;
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2019 Daniel Cortes
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
drop table if exists egresos;
|
||||
drop table if exists tipos_egreso;
|
||||
drop table if exists ingresos;
|
||||
drop table if exists tipos_ingreso;
|
||||
drop table if exists efectivos;
|
||||
drop table if exists documentos;
|
||||
drop table if exists caja;
|
||||
|
||||
create table caja
|
||||
(
|
||||
id int(10) unsigned primary key auto_increment,
|
||||
fecha date not null
|
||||
);
|
||||
|
||||
create table tipos_egreso
|
||||
(
|
||||
id int(10) unsigned primary key auto_increment,
|
||||
nombre varchar(191) not null
|
||||
);
|
||||
|
||||
create table egresos
|
||||
(
|
||||
id int(10) unsigned primary key auto_increment,
|
||||
nro varchar(191) not null,
|
||||
descripcion varchar(191) not null,
|
||||
valor int(10) not null,
|
||||
tipo_egreso_id int(10) unsigned not null,
|
||||
caja_id int(10) unsigned not null,
|
||||
foreign key fk_egresos_tipo_egreso (tipo_egreso_id) references tipos_egreso (id) on update cascade on delete restrict,
|
||||
foreign key fk_egresos_caja (caja_id) references caja (id) on update cascade on delete restrict
|
||||
);
|
||||
|
||||
create table tipos_ingreso
|
||||
(
|
||||
id int(10) unsigned primary key auto_increment,
|
||||
nombre varchar(191) not null
|
||||
);
|
||||
|
||||
create table ingresos
|
||||
(
|
||||
id int(10) unsigned primary key auto_increment,
|
||||
valor int(10) not null,
|
||||
nro_inicial varchar(191) not null,
|
||||
nro_final varchar(191) not null,
|
||||
tipo_ingreso_id int(10) unsigned not null,
|
||||
caja_id int(10) unsigned not null,
|
||||
foreign key fk_tipo_ingreso (tipo_ingreso_id) references tipos_ingreso (id) on update cascade on delete restrict,
|
||||
foreign key fk_ingresos_caja (caja_id) references caja (id) on update cascade on delete restrict
|
||||
);
|
||||
|
||||
create table efectivos
|
||||
(
|
||||
id int(10) unsigned primary key auto_increment,
|
||||
veinte_mil int(10) not null,
|
||||
diez_mil int(10) not null,
|
||||
cinco_mil int(10) not null,
|
||||
dos_mil int(10) not null,
|
||||
mil int(10) not null,
|
||||
quinientos int(10) not null,
|
||||
cien int(10) not null,
|
||||
cincuenta int(10) not null,
|
||||
diez int(10) not null,
|
||||
caja_id int(10) unsigned not null,
|
||||
foreign key fk_efectivos_caja (caja_id) references caja (id) on update cascade on delete restrict
|
||||
);
|
||||
|
||||
create table documentos
|
||||
(
|
||||
id int(10) unsigned primary key auto_increment,
|
||||
cheques int(10) not null,
|
||||
tarjetas int(10) not null,
|
||||
caja_id int(10) unsigned not null,
|
||||
foreign key fk_documentos_caja (caja_id) references caja (id) on update cascade on delete restrict
|
||||
);
|
||||
|
||||
|
||||
insert into tipos_egreso (nombre)
|
||||
values ('Factura Materia Prima'),
|
||||
('Factura Gastos Generales'),
|
||||
('Gasto Menor Materia Prima'),
|
||||
('Gasto General Sin Respaldo'),
|
||||
('Gasto General Con Boleta'),
|
||||
('Guia Materia Prima'),
|
||||
('Anticipo Arriendo'),
|
||||
('Anticipo Personal'),
|
||||
('Pago Partime'),
|
||||
('Retiros Gerencia'),
|
||||
('Otro');
|
||||
|
||||
insert into tipos_ingreso (nombre)
|
||||
values ('Boletas Fiscales'),
|
||||
('Boletas Manuales'),
|
||||
('Facturas'),
|
||||
('Guias')
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-2019 Daniel Cortes
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
pragma foreign_keys = ON;
|
||||
|
||||
drop table if exists egresos;
|
||||
drop table if exists tipos_egreso;
|
||||
drop table if exists ingresos;
|
||||
drop table if exists tipos_ingreso;
|
||||
drop table if exists efectivos;
|
||||
drop table if exists documentos;
|
||||
drop table if exists caja;
|
||||
|
||||
create table caja
|
||||
(
|
||||
id integer primary key,
|
||||
fecha date not null
|
||||
);
|
||||
|
||||
create table tipos_egreso
|
||||
(
|
||||
id integer primary key,
|
||||
nombre text not null
|
||||
);
|
||||
|
||||
create table egresos
|
||||
(
|
||||
id integer primary key,
|
||||
nro text not null,
|
||||
descripcion text not null,
|
||||
valor integer not null,
|
||||
tipo_egreso_id integer not null,
|
||||
caja_id integer not null,
|
||||
foreign key (tipo_egreso_id) references tipos_egreso (id) on update cascade on delete restrict,
|
||||
foreign key (caja_id) references caja (id) on update cascade on delete restrict
|
||||
);
|
||||
|
||||
create table tipos_ingreso
|
||||
(
|
||||
id integer primary key,
|
||||
nombre text not null
|
||||
);
|
||||
|
||||
create table ingresos
|
||||
(
|
||||
id integer primary key,
|
||||
valor integer not null,
|
||||
nro_inicial text not null,
|
||||
nro_final text not null,
|
||||
tipo_ingreso_id integer unsigned not null,
|
||||
caja_id integer unsigned not null,
|
||||
foreign key (tipo_ingreso_id) references tipos_ingreso (id) on update cascade on delete restrict,
|
||||
foreign key (caja_id) references caja (id) on update cascade on delete restrict
|
||||
);
|
||||
|
||||
create table efectivos
|
||||
(
|
||||
id integer primary key,
|
||||
veinte_mil integer not null,
|
||||
diez_mil integer not null,
|
||||
cinco_mil integer not null,
|
||||
dos_mil integer not null,
|
||||
mil integer not null,
|
||||
quinientos integer not null,
|
||||
cien integer not null,
|
||||
cincuenta integer not null,
|
||||
diez integer not null,
|
||||
caja_id integer not null,
|
||||
foreign key (caja_id) references caja (id) on update cascade on delete restrict
|
||||
);
|
||||
|
||||
create table documentos
|
||||
(
|
||||
id integer primary key,
|
||||
cheques integer not null,
|
||||
tarjetas integer not null,
|
||||
caja_id integer not null,
|
||||
foreign key (caja_id) references caja (id) on update cascade on delete restrict
|
||||
);
|
||||
|
||||
insert into tipos_egreso (nombre)
|
||||
values ('Factura Materia Prima'),
|
||||
('Factura Gastos Generales'),
|
||||
('Gasto Menor Materia Prima'),
|
||||
('Gasto General Sin Respaldo'),
|
||||
('Gasto General Con Boleta'),
|
||||
('Guia Materia Prima'),
|
||||
('Anticipo Arriendo'),
|
||||
('Anticipo Personal'),
|
||||
('Pago Partime'),
|
||||
('Retiros Gerencia'),
|
||||
('Otro');
|
||||
|
||||
insert into tipos_ingreso (nombre)
|
||||
values ('Boletas Fiscales'),
|
||||
('Boletas Manuales'),
|
||||
('Facturas'),
|
||||
('Guias');
|
||||
|
||||
-- Primera Migracion, se agrega las columnas de nro de z inicial y final para el ingreso.
|
||||
|
||||
alter table ingresos
|
||||
add column nro_z_inicial text;
|
||||
alter table ingresos
|
||||
add column nro_z_final text;
|
||||
|
||||
-- Segunda migracion, se necesita un tipo de ingresos de boleta exenta
|
||||
insert into tipos_ingreso (nombre)
|
||||
values ('Boleta Exenta');
|
||||
|
||||
-- Tercera migracion, necesidad de un campo de retiro en documentos
|
||||
alter table documentos
|
||||
add column retiros integer default 0;
|
||||
|
||||
-- Cuarta migracion, es requerida una tabla en la que se pueda calcular el fondo de la caja
|
||||
drop table if exists calculo_fondo;
|
||||
create table calculo_fondo
|
||||
(
|
||||
id integer primary key,
|
||||
valor integer not null,
|
||||
descripcion text not null,
|
||||
caja_id integer not null,
|
||||
foreign key (caja_id) references caja (id) on update cascade on delete restrict
|
||||
);
|
||||
|
||||
-- Quinta migracion, tabla para generar y guardar el estado de resultado
|
||||
drop table if exists estado_resultado;
|
||||
create table estado_resultado
|
||||
(
|
||||
id integer primary key,
|
||||
mes date unique not null,
|
||||
costo_venta integer null,
|
||||
cuenta_corriente_factura integer null,
|
||||
cuenta_corriente_boleta integer null,
|
||||
cuenta_corriente_sin_respaldo integer null,
|
||||
remuneraciones integer null,
|
||||
finiquitos integer null,
|
||||
aguinaldo integer null,
|
||||
bonos_personal integer null,
|
||||
honorarios_contador integer null,
|
||||
arriendo integer null,
|
||||
agua integer null,
|
||||
luz integer null,
|
||||
gas integer null,
|
||||
telefono integer null,
|
||||
otro_servicio integer null,
|
||||
ppm real null,
|
||||
ivaFavor int null
|
||||
);
|
||||
|
||||
-- Sexta migracion, se necesita guardar el fondo diario de una caja asi que se le agrega a la tabla de caja
|
||||
alter table caja
|
||||
add column fondo integer default 0;
|
||||
Reference in New Issue
Block a user