create table notificaciones (id int(11) auto_increment,emisor varchar(200) default '',receptor varchar(200) default '',mensaje varchar(250) default '',leido char(1) default 'N',primary key (id)) type=innodb; alter table notificaciones add fecha date; alter table notificaciones add hora time; create table camarero_priv (id_camarero int(3) not null,priv varchar(3) not null,primary key (id_camarero,priv), foreign key (id_camarero) references camareros(id_camarero) on delete cascade on update cascade); alter table proveedor modify Nif varchar(15); alter table proveedor modify telefono varchar(20); alter table proveedor modify fax varchar(20); alter table proveedor modify movil varchar(20); alter table cliente add apellido2 varchar(250) default ''; alter table cliente_cardex modify dni varchar(15) not null; create table eacuenta (id int(11) auto_increment,locself varchar(10) not null,fecha date,hora time,importe float default 0,modo_pago char(2),facturado char(1) default 'Y',primary key (id,locself)) type=innodb; alter table eacuenta add id_factura int(11); alter table inventario_complementg add cantidad_anterior float default 0; create table backup (id int(11) auto_increment,fecha date,ruta varchar(250) default '', primary key (id)) type=innodb; alter table combinados add cocina char(1) default 'N'; alter table complementog add impresora varchar(200) default ''; create table venta_cocina (id_venta int(7) not null, primary key (id_venta)) type=innodb; alter table ventadir_comg add servido_cocina int(1) default 0; alter table ventadir_comg modify servido_cocina float default 0; alter table complementog add sort_order int(6) default 0; alter table tipo_comg add sort_order int(6) default 0; alter table inventario modify id_inventario varchar(12) default ''; alter table inventario_complementg modify id_inventario varchar(12) default ''; alter table tiquet drop primary key,add primary key (serie,id_tiquet); alter table tiquet modify serie char(5); alter table ventadirecta modify serie char(5); alter table ventadir_comg modify serie char(5); alter table ventadirecta add comensales int(4) default 0; alter table complementog add autoadd char(1) default 'N'; alter table camareros add modtraspreticket char(1) default 'S'; alter table camareros add finrotura char(1) default 'S'; alter table camareros add fininvitacion char(1) default 'S'; alter table camareros add finautoconsumo char(1) default 'S'; alter table camareros add finotros char(1) default 'S'; alter table camareros add dividirventa char(1) default 'S'; alter table camareros add eliminarimpuestos char(1) default 'S'; alter table complementog add permitircambioprecio char(1) default 'S'; alter table camareros add aparcarticket char(1) default 'S'; alter table camareros add cambiartarifa char(1) default 'S'; alter table clientes_docs modify dni varchar(15) not null; alter table camareros add recuperarpendientes char(1) default 'S'; alter table camareros add anulartickets char(1) default 'S'; alter table camareros add anularfacturas char(1) default 'S'; alter table camareros add configurarventas char(1) default 'S'; create table pfactura (id_factura varchar(20) not null,id_proveedor varchar(4) not null,primary key (id_factura,id_proveedor)) type=innodb; alter table pfactura add (bi float default 0,ci float default 0,ret float default 0,re float default 0,tf float default 0); alter table pfactura add (filename varchar(250) default '',file blob); alter table pfactura add foreign key (id_proveedor) references proveedor(id_proveedor) on delete restrict on update cascade; alter table pfactura add (fecha date,fecha_pago date,pagada char(1) default 'N'); alter table pfactura modify file mediumblob; alter table tipo_comg add padre varchar(4) default null; create table tipo_comg_comg (id_tipo_comg varchar(4) not null, id_complementog varchar(5) not null) type=innodb; alter table tipo_comg_comg add primary key (id_tipo_comg,id_complementog); create table venta_preticket (id_venta int(7) not null, primary key (id_venta)) type=innodb; alter table cliente_cardex add id_fichapolicia varchar(10); ALTER TABLE car_com DROP FOREIGN KEY fk_car_com_contrato; ALTER TABLE res_com DROP FOREIGN KEY fk_res_com_contrato; alter table complementog add solicitaopciones char(1) default 'N'; alter table salon add imagen mediumblob; alter table promociones modify dto float default 0; alter table promociones add tipodto char(1) default 'P'; alter table ventadir_comg add bloque_cocina int(1) default 1; alter table complementog modify avgiva float; alter table ventadir_comg modify avgiva float; alter table alb_comg modify avgiva float; alter table car_com modify iva float; alter table car_comg modify iva float; alter table res_com modify iva float; alter table complemento modify avgiva float; alter table car_com modify impuesto2 float; alter table car_comg modify impuesto2 float default 0; alter table res_com modify impuesto2 float; alter table complemento modify impuesto2 float; alter table eacuenta add serie char(5) default ''; alter table complementog add tipo_combinado char(1) default '1'; alter table complementog add opcion_combinado char(1) default '1'; alter table complementog modify imagen mediumblob; alter table tipo_comg modify imagen mediumblob; update factura set origen = 'T' where origen is null; alter table auxiliar modify foto1 mediumblob; alter table contrato add activo char(1) default 'S'; alter table reserva add apellido2 varchar(200) default ''; alter table reserva add apellido2dnifact varchar(200) default ''; alter table cardex add apellido2dnifact varchar(50) default ''; update pagoscobros set importe = importe - importe - importe,tipo = "E" where tipo = "S"; create table pproveedor (id_complementog varchar(5) not null,id_proveedor varchar(4) not null,primary key (id_complementog,id_proveedor)) type=innodb; create table albaran_factura (id_albaran varchar(15) not null,id_factura varchar(20) not null,id_proveedor varchar(4) not null,primary key (id_albaran,id_factura,id_proveedor)) type=innodb; alter table ventadir_comg add z int(11) default 0; insert into reports (Clave,Descripcion,Mascara,Orden,Impresora,copias,Impresora2) values ("zreport","Z","Listados\\zreport.fr3",0,"Default",1,"None"); alter table complementog modify descripcion text; create table bitchange (symbol varchar(15) not null,currency varchar(3) default '',close float default 0,last_trade float default 0, primary key (symbol)) type=innodb; create table bitcoin (active char(1) not null default "N",id_modo_pago char(2) default "",currency varchar(5) default "", primary key (active)) type=innodb; alter table bitcoin add rpchost varchar(50) default "localhost"; alter table bitcoin add rpcport varchar(5) default "8332"; alter table bitcoin add rpcuser varchar(50) default ""; alter table bitcoin add rpcpasswd varchar(50) default ""; create table bitcoinlabel (address varchar(100) not null,label varchar (50) default "",primary key (address)) type=innodb; alter table bitcoinlabel add amount float default 0; alter table bitcoinlabel add receibed char(1) default "N"; alter table bitcoinlabel add confirmations int(3) default 0; alter table bitcoinlabel add qr mediumblob default null; alter table tipo_comg modify tipo_comg varchar(150) default ""; alter table cliente modify provincia varchar(250) default ""; update cliente set provincia = "" where provincia is null; create table productoimg (id varchar(5) not null, imagen mediumblob, primary key(id)) type = innodb; create table productoimgs (id varchar(3) not null, id_complementog varchar(5) not null, imagen mediumblob, primary key(id,id_complementog)) type = innodb; create table fabricante (id varchar(10) not null,nombre varchar(200) default "",friendly varchar(200) default "",imagen mediumblob,primary key(id)) type = innodb; alter table complementog add id_fabricante varchar(10); alter table complementog add friendly varchar(200); alter table tipo_comg add friendly varchar(200); alter table complementog add html text; alter table tipo_comg add html text; create table opencart (activo char(1) default "N",token varchar(200),ftphost varchar(250),ftpuser varchar(250),ftppasswd varchar(250),ftpport int(5),ftppath varchar(250),primary key(activo)) type = innodb; alter table complementog add sincopencart char(1) default "N"; alter table complementog add date_mod datetime; alter table complementog add date_sinc datetime; update complementog set date_mod = "2001-01-01" where date_mod is null; update complementog set date_sinc = "2000-01-01" where date_sinc is null; alter table opencart add opencarturl varchar(250) default "www."; alter table productoimg add extension varchar(5) default ""; alter table productoimgs add extension varchar(5) default ""; alter table tipo_comg add sinc char(1) default "N"; create table opencart_remove (tipo varchar(3) default "",item varchar(10) default "") type = innodb; alter table complementog add alias varchar(10) default ""; alter table tipo_comg add alias varchar(10) default ""; alter table camareros add finalizarventas char(1) default "Y"; alter table tipo_cliente add id_tarifa varchar(4) default null; create table complementogimg select id_complementog,imagen from complementog; alter table complementogimg add primary key (id_complementog); alter table complementog add index (id_complementog); alter table complementogimg add constraint fk_comg_img foreign key (id_complementog) references complementog(id_complementog) on delete cascade on update cascade; update complementog set imagen = null; alter table tipo_comg add sincopencart char(1) not null default "Y"; alter table ventadir_comg add precio_compra float default 0; update ventadir_comg INNER JOIN complementog ON ventadir_comg.id_complementog = complementog.id_complementog SET ventadir_comg.precio_compra = complementog.precio_compra; UPDATE ventadirecta INNER JOIN ventadir_comg ON ventadir_comg.id_venta = ventadirecta.id_venta INNER JOIN factura ON (factura.serie,factura.id_factura) = (ventadir_comg.serie,ventadir_comg.id_factura) SET ventadirecta.dni = factura.dni where ventadirecta.dni is null and ventadir_comg.id_factura is not null; UPDATE pagoscobros INNER JOIN factura ON pagoscobros.id_factura = factura.id_factura and pagoscobros.id_apcajas = factura.id_apcajas SET pagoscobros.serie_fac = factura.serie; //UPDATE pagoscobros INNER JOIN tiquet ON pagoscobros.id_tiquet = tiquet.id_tiquet and pagoscobros.id_apcajas = tiquet.id_apcajas SET pagoscobros.serie_fac = tiquet.serie; alter table pagoscobros add id_venta int(11) default 0; alter table cliente add (contador int(11) AUTO_INCREMENT,key contador (contador)); alter table cliente add contador2 varchar(20) default ""; alter table modo_pago add activo char(1) default "Y"; alter table modo_pago add defecto char(1) default "N"; alter table ventadirecta add alias varchar(200) default ""; create table zreport (id int(11) default 0,fecha date,hora time,fecha_ini date,hora_ini time,fecha_fin date,hora_fin time,primary key (id)) type = innodb; insert into zreport (id) select distinct z from ventadir_comg where z > 0 and z not in (select id from zreport); alter table complementog add panelcocina int(2) default 1; alter table camareros add preticket char(1) default "Y"; alter table camareros add recuperadeotros char(1) default "Y"; alter table proveedor add Direccion varchar(200) default ""; create table consultas (id int(11) auto_increment,titulo varchar(250) default "",consulta text, primary key(id)) type=innodb; alter table reserva add color varchar(50) default ""; alter table cardex add color varchar(50) default ""; delete from hora; INSERT INTO `hora` VALUES ('00:00:00', 'N', 96); INSERT INTO `hora` VALUES ('00:01:00', 'N', 0); INSERT INTO `hora` VALUES ('00:15:00', 'N', 1); INSERT INTO `hora` VALUES ('00:30:00', 'N', 2); INSERT INTO `hora` VALUES ('00:45:00', 'N', 3); INSERT INTO `hora` VALUES ('01:00:00', 'N', 4); INSERT INTO `hora` VALUES ('01:15:00', 'N', 5); INSERT INTO `hora` VALUES ('01:30:00', 'N', 6); INSERT INTO `hora` VALUES ('01:45:00', 'N', 7); INSERT INTO `hora` VALUES ('02:00:00', 'N', 8); INSERT INTO `hora` VALUES ('02:15:00', 'N', 9); INSERT INTO `hora` VALUES ('02:30:00', 'N', 10); INSERT INTO `hora` VALUES ('02:45:00', 'N', 11); INSERT INTO `hora` VALUES ('03:00:00', 'N', 12); INSERT INTO `hora` VALUES ('03:15:00', 'N', 13); INSERT INTO `hora` VALUES ('03:30:00', 'N', 14); INSERT INTO `hora` VALUES ('03:45:00', 'N', 15); INSERT INTO `hora` VALUES ('04:00:00', 'N', 16); INSERT INTO `hora` VALUES ('04:15:00', 'N', 17); INSERT INTO `hora` VALUES ('04:30:00', 'N', 18); INSERT INTO `hora` VALUES ('04:45:00', 'N', 19); INSERT INTO `hora` VALUES ('05:00:00', 'N', 20); INSERT INTO `hora` VALUES ('05:15:00', 'N', 21); INSERT INTO `hora` VALUES ('05:30:00', 'N', 22); INSERT INTO `hora` VALUES ('05:45:00', 'N', 23); INSERT INTO `hora` VALUES ('06:00:00', 'N', 24); INSERT INTO `hora` VALUES ('06:15:00', 'N', 25); INSERT INTO `hora` VALUES ('06:30:00', 'N', 26); INSERT INTO `hora` VALUES ('06:45:00', 'N', 27); INSERT INTO `hora` VALUES ('07:00:00', 'N', 28); INSERT INTO `hora` VALUES ('07:15:00', 'N', 29); INSERT INTO `hora` VALUES ('07:30:00', 'N', 30); INSERT INTO `hora` VALUES ('07:45:00', 'N', 31); INSERT INTO `hora` VALUES ('08:00:00', 'N', 32); INSERT INTO `hora` VALUES ('08:15:00', 'N', 33); INSERT INTO `hora` VALUES ('08:30:00', 'N', 34); INSERT INTO `hora` VALUES ('08:45:00', 'N', 35); INSERT INTO `hora` VALUES ('09:00:00', 'Y', 36); INSERT INTO `hora` VALUES ('09:15:00', 'Y', 37); INSERT INTO `hora` VALUES ('09:30:00', 'Y', 38); INSERT INTO `hora` VALUES ('09:45:00', 'Y', 39); INSERT INTO `hora` VALUES ('10:00:00', 'Y', 40); INSERT INTO `hora` VALUES ('10:15:00', 'Y', 41); INSERT INTO `hora` VALUES ('10:30:00', 'Y', 42); INSERT INTO `hora` VALUES ('10:45:00', 'Y', 43); INSERT INTO `hora` VALUES ('11:00:00', 'Y', 44); INSERT INTO `hora` VALUES ('11:15:00', 'Y', 45); INSERT INTO `hora` VALUES ('11:30:00', 'Y', 46); INSERT INTO `hora` VALUES ('11:45:00', 'Y', 47); INSERT INTO `hora` VALUES ('12:00:00', 'Y', 48); INSERT INTO `hora` VALUES ('12:15:00', 'Y', 49); INSERT INTO `hora` VALUES ('12:30:00', 'Y', 50); INSERT INTO `hora` VALUES ('12:45:00', 'Y', 51); INSERT INTO `hora` VALUES ('13:00:00', 'Y', 52); INSERT INTO `hora` VALUES ('13:15:00', 'Y', 53); INSERT INTO `hora` VALUES ('13:30:00', 'Y', 54); INSERT INTO `hora` VALUES ('13:45:00', 'Y', 55); INSERT INTO `hora` VALUES ('14:00:00', 'Y', 56); INSERT INTO `hora` VALUES ('14:15:00', 'Y', 57); INSERT INTO `hora` VALUES ('14:30:00', 'Y', 58); INSERT INTO `hora` VALUES ('14:45:00', 'Y', 59); INSERT INTO `hora` VALUES ('15:00:00', 'Y', 60); INSERT INTO `hora` VALUES ('15:15:00', 'Y', 61); INSERT INTO `hora` VALUES ('15:30:00', 'Y', 62); INSERT INTO `hora` VALUES ('15:45:00', 'Y', 63); INSERT INTO `hora` VALUES ('16:00:00', 'Y', 64); INSERT INTO `hora` VALUES ('16:15:00', 'Y', 65); INSERT INTO `hora` VALUES ('16:30:00', 'Y', 66); INSERT INTO `hora` VALUES ('16:45:00', 'Y', 67); INSERT INTO `hora` VALUES ('17:00:00', 'Y', 68); INSERT INTO `hora` VALUES ('17:15:00', 'Y', 69); INSERT INTO `hora` VALUES ('17:30:00', 'Y', 70); INSERT INTO `hora` VALUES ('17:45:00', 'Y', 71); INSERT INTO `hora` VALUES ('18:00:00', 'Y', 72); INSERT INTO `hora` VALUES ('18:15:00', 'Y', 73); INSERT INTO `hora` VALUES ('18:30:00', 'Y', 74); INSERT INTO `hora` VALUES ('18:45:00', 'Y', 75); INSERT INTO `hora` VALUES ('19:00:00', 'Y', 76); INSERT INTO `hora` VALUES ('19:15:00', 'Y', 77); INSERT INTO `hora` VALUES ('19:30:00', 'Y', 78); INSERT INTO `hora` VALUES ('19:45:00', 'Y', 79); INSERT INTO `hora` VALUES ('20:00:00', 'Y', 80); INSERT INTO `hora` VALUES ('20:15:00', 'Y', 81); INSERT INTO `hora` VALUES ('20:30:00', 'Y', 82); INSERT INTO `hora` VALUES ('20:45:00', 'Y', 83); INSERT INTO `hora` VALUES ('21:00:00', 'Y', 84); INSERT INTO `hora` VALUES ('21:15:00', 'Y', 85); INSERT INTO `hora` VALUES ('21:30:00', 'Y', 86); INSERT INTO `hora` VALUES ('21:45:00', 'Y', 87); INSERT INTO `hora` VALUES ('22:00:00', 'Y', 88); INSERT INTO `hora` VALUES ('22:15:00', 'N', 89); INSERT INTO `hora` VALUES ('22:30:00', 'N', 90); INSERT INTO `hora` VALUES ('22:45:00', 'N', 91); INSERT INTO `hora` VALUES ('23:00:00', 'N', 92); INSERT INTO `hora` VALUES ('23:15:00', 'N', 93); INSERT INTO `hora` VALUES ('23:30:00', 'N', 94); INSERT INTO `hora` VALUES ('23:45:00', 'N', 95); alter table opencart add version char(10) default "1.5"; alter table cliente add idoc char(15) default "0"; update cliente set idoc = dni where idoc = "0"; create table variaciones (id int(11) AUTO_INCREMENT,codbarras varchar(50),tipo char(1),id_complementog varchar(5),id_color varchar(4),id_talla varchar(4),caducidad date,lote varchar(50), primary key (id)) type = innodb; ALTER TABLE almacen_complementg ADD COLUMN variacion int(11) NULL DEFAULT 0; ALTER TABLE almacen_complementg ADD COLUMN desc_variacion varchar(100) default ""; ALTER TABLE almacen_complementg DROP PRIMARY KEY; ALTER TABLE almacen_complementg ADD PRIMARY KEY (id_centro,id_empresa,id_almacen,id_tipo_comg,id_complementog,variacion); ALTER TABLE inventario_complementg ADD COLUMN variacion int(11) NULL DEFAULT 0; ALTER TABLE inventario_complementg ADD COLUMN desc_variacion varchar(100) default ""; ALTER TABLE inventario_complementg DROP PRIMARY KEY; ALTER TABLE inventario_complementg ADD PRIMARY KEY (id_centro,id_empresa,id_inventario,id_tipo_comg,id_complementog,variacion); alter table ventadir_comg ADD COLUMN variacion int(11) NULL DEFAULT 0; ALTER TABLE alb_comg ADD COLUMN variacion int(11) NULL DEFAULT 0; ALTER TABLE alb_comg ADD COLUMN desc_variacion varchar(100) default ""; ALTER TABLE alb_comg DROP PRIMARY KEY; ALTER TABLE alb_comg ADD PRIMARY KEY (id_albaran,id_empresa,id_centro,id_tipo_comg,id_complementog,variacion); ALTER TABLE traspasos_complementog ADD COLUMN variacion int(11) NULL DEFAULT 0; ALTER TABLE traspasos_complementog ADD COLUMN desc_variacion varchar(100) default ""; ALTER TABLE traspasos_complementog DROP PRIMARY KEY, ADD PRIMARY KEY (id_empresa,id_centro,id_traspaso,id_tipo_comg,id_complementog,variacion); alter table complementog add peso float default 0; alter table complementog add pvr float default 0; alter table opencart add txttallas varchar(200) default "Options"; alter table opencart add id_tarifa_oferta varchar(4) default ""; alter table complementog modify impuesto2 float default 0; alter table ventadir_comg add impuesto2 float default 0; alter table cliente add sujetoimp2 char(1) default "N"; alter table camareros add verpreciocompra char(1) default "Y"; alter table venta_cocina add id_caja int(2); alter table complementog add sinchtml char(1) default "Y"; alter table tipo_comg add sinchtml char(1) default "Y"; alter table ventadirecta add tarifa varchar(200) default ""; alter table ventadir_comg modify cocina float default 0; alter table ventadirecta add turno int(11) default 0; create table pnotacocina (id_complementog varchar(5) not null, id_nota varchar(4) not null, primary key (id_complementog,id_nota)) type = innodb; alter table opencart drop primary key; alter table opencart add id int(11) default 0; alter table opencart add primary key (id); alter table opencart modify id int(11) auto_increment; alter table complementog add impresora2 varchar(200) default ""; alter table complementog add bloque_cocina int(1) default 0; alter table alb_comg add impuesto2 float default 0; alter table complementog modify alias varchar(15) default ""; alter table alb_comg add fecha datetime; alter table camareros add puedeimprimircierre char(1) default "Y"; alter table opencart add sinctallas char(1) default "Y"; ALTER TABLE variaciones ADD INDEX v_codbarras (codbarras), ADD INDEX v_idcomplementog (id_complementog); alter table tarifa add autoreduce char(1) default "N"; create table opencart_comg (id_complementog varchar(5) not null, id_opencart int(2) not null, primary key (id_complementog,id_opencart)) type=innodb; create table opencart_tipo_comg (id_tipo_comg varchar(4) not null, id_opencart int(2) not null, primary key (id_tipo_comg,id_opencart)) type=innodb; create table lineaseliminadas select * from ventadir_comg limit 0; alter table albaran add observaciones varchar(250) default ""; create table venta_ticket (id_venta int(7) not null, primary key (id_venta)) type=innodb; create table almacen_complementg2 select * from almacen_complementg; insert into almacen_complementg (id_centro,id_empresa,id_almacen,id_tipo_comg,id_complementog,cantidad,stock_minimo,complementog,variacion,desc_variacion) select "01","001","01",id_tipo_comg,id_complementog,0,0,complementog,0,"" from complementog where cafeteria = "S" and id_complementog not in (select id_complementog from almacen_complementg2); drop table almacen_complementg2; alter table almacen_complementg modify stock_minimo float; alter table opencart add ftppasivo char(1) default "N"; alter table comg_tarifa add activo boolean default false; alter table complementog add fifo char(1) default "Y"; create table opencart_log (id mediumint auto_increment,fecha datetime,item varchar(250),resultado text, primary key (id)) type = innodb; alter table auxiliar modify campo8 text; alter table complementog modify alias varchar(100); alter table tipo_comg modify alias varchar(100); alter table inventario add hora time; alter table camareros add cambiastock char(1) default "Y"; alter table cliente add boletin char(1) default 'N'; create table efactura (id int not null,tipo varchar(2) not null default 'FS',fecha varchar(10) not null default '',serie varchar(5) not null default '',factura int default 0,signaturevalue text,crc varchar(3) default '',qrtext varchar(250),qrimagen mediumblob,primary key(id,tipo,serie,factura)) type = innodb; alter table efactura add tbaiid varchar(250) default ''; alter table efactura add enviado char(1) default 'N'; alter table efactura add respuesta text; alter table efactura modify signaturevalue text; alter table efactura add xmlsigned mediumblob; alter table backup add version int(4) default 0; alter table complementog add impuesto3 int(3) default 0; create table paytef (id int(3),alias varchar(100), ip varchar(50),id_modo_pago char(2),primary key (id)) type innodb; alter table camareros add botonmenos char(1) default "Y";