CREATE DATABASE  IF NOT EXISTS `kiosko` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `kiosko`;
--
-- Host: 127.0.0.1    Database: kiosko
-- ------------------------------------------------------


--
-- Table structure for table `albaran`
--

CREATE TABLE `albaran` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nalbaran` varchar(15) DEFAULT NULL,
  `fecha` date NOT NULL,
  `proveedor` int(11) NOT NULL,
  `pagado` tinyint(4) DEFAULT '0',
  `precio` decimal(10,2) DEFAULT '0.00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `albaran`
--


--
-- Table structure for table `articulos`
--

CREATE TABLE `articulos` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigo` varchar(18) NOT NULL,
  `descripcion` varchar(100) NOT NULL,
  `proveedor` int(11) NOT NULL,
  `dto` decimal(6,2) NOT NULL DEFAULT '20.00',
  `neto` decimal(10,4) NOT NULL,
  `iva` decimal(8,2) NOT NULL DEFAULT '4.00',
  `rec` decimal(8,2) NOT NULL DEFAULT '0.50',
  `pvp` decimal(8,2) NOT NULL,
  `neto2` decimal(10,4) DEFAULT NULL,
  `iva2` decimal(8,2) DEFAULT '21.00',
  `rec2` decimal(8,2) DEFAULT '5.20',
  `pvp2` decimal(8,2) NOT NULL,
  `multiprecio` tinyint(4) NOT NULL DEFAULT '0',
  `minimo` int(11) DEFAULT '0',
  `pack` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `articulos`
--


--
-- Table structure for table `atajos`
--

CREATE TABLE `atajos` (
  `pestana` int(11) NOT NULL,
  `pos` int(11) DEFAULT NULL,
  `nombre` varchar(45) DEFAULT 'vacio',
  `codigo` varchar(18) DEFAULT '0',
  `corto` tinyint(4) DEFAULT '0',
  `imagen` varchar(80) NOT NULL,
  `id` int(11) NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=289 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `atajos`
--

INSERT INTO `atajos` VALUES (1,1,'','009423540001',0,'diariomontanes.png',1),(1,2,'MARCA','8423793110008',0,'marca.jpg',2),(1,3,'AS','842373900002880417',1,'as.png',3),(1,4,'EL PAIS ','842553600002780417',1,'elpais.jpg',4),(1,5,'','8423793280206',0,'elmundo.jpg',5),(1,6,'','8420565030007',0,'sport.jpg',6),(1,7,'','8427626000900',0,'mundodeportivo.jpg',7),(1,8,'','8430742009023',0,'larazon.jpg',8),(1,9,'','8424499000013',0,'abc.png',9),(1,10,'ALERTA','8427999000019',0,'alerta.jpg',10),(1,11,'','8423793120007',0,'expansion.jpg',11),(1,12,'','1118430742201',0,'diariopalentino.jpg',12),(1,13,'DEIA','1118455555201',0,'deia.png',13),(1,14,' ','',1,'',14),(1,15,' ','',1,'',15),(1,16,' ','',1,'',16),(1,17,' ','',1,'',17),(1,18,' ','',1,'',18),(1,19,' ','',1,'',19),(1,20,' ','',1,'',20),(1,21,' ','',1,'',21),(1,22,' ','',1,'',22),(1,23,' ','',1,'',23),(1,24,' ','',1,'',24),(1,25,'gorjus','8018190086959',1,'gorjus.png',25),(1,26,' ','',1,'',26),(1,27,' ','',1,'',27),(1,28,'TUS','0000000000014',0,'tus.png',28),(1,29,'ligaeste','8424248915100',1,'ligaeste.png',29),(1,30,' ','',1,'',30),(1,31,' ','',1,'',31),(1,32,'ALSA','0000000000015',1,'alsa.png',32),(1,33,'megacrack','8424248915209',1,'megacrack.png',33),(1,34,'CARAMELOS HALLS','7622210780157',1,'',34),(1,35,'DM*LIBROS CARNES','0000000000069',1,'',35),(1,36,'DM*CORAZON CNZ TV','8401100808589',0,'',36),(2,1,'PRONTO','8410534000018',0,'pronto.jpg',37),(2,2,'','9770214389000',0,'hola.jpg',38),(2,3,'','8423739100001',0,'semana.jpg',39),(2,4,'','8428019000019',0,'lecturas.jpg',40),(2,5,'','8413042018100',0,'diezminutos.jpg',41),(2,6,'','8413042748007',0,'love.jpg',42),(2,7,'','8401100010883',0,'masymas.jpg',43),(2,8,'','8420565000772',0,'rumores.jpg',44),(2,9,'QUE ME DICES','8413042018155',0,'qmd.jpg',45),(2,10,'MUY INTERESANTE','8414237000023',0,'muyinteresante.jpg',46),(2,11,'MOTOCICLISMO','8414520000020',0,'motociclismo.jpg',47),(2,12,'MIA','8414237000054',0,'mia.jpg',48),(2,13,'COSMOPOLITAN','8414237000306',0,'cosmopolitan.jpg',49),(2,14,'','8414090106023',0,'eljueves.jpg',50),(2,15,'','8414237001730',0,'divinity.jpg',51),(2,16,'CUORE','8420565000499',0,'cuore.png',52),(2,17,'INTERVIU','8420565001007',0,'interviu.png',53),(2,18,'QUO','8413042873013',0,'quo.png',54),(2,19,'STILO','8420565000468',0,'stilo.png',55),(2,20,'GLAMOUR','8413042772804',0,'glamour.png',56),(2,21,'TELENOVELA','8413042141679',0,'telenovela.png',57),(2,22,'COCHES','8413042747734',0,'coches.png',58),(2,23,'AUTOFÁCIL','8424094001811',0,'autofacil.png',59),(2,24,'MOTORVISIÓN','9771139452008',0,'motorvision.png',60),(2,25,'AUTOPISTA','8414520000013',0,'autopista.png',61),(2,26,'MOTOR 16','8480002030168',0,'motor16.png',62),(2,27,'AUTOVÍA','8414520000365',0,'autovia.png',63),(2,28,'AUTOBILD','8424094009251',0,'autobild.png',64),(2,29,' ','',1,'',65),(2,30,' ','',1,'',66),(2,31,' ','',1,'',67),(2,32,' ','',1,'',68),(2,33,' ','',1,'',69),(2,34,' ','',1,'',70),(2,35,' ','',1,'',71),(2,36,' ','',1,'',72),(3,1,'KINDER BUENO','80052760',1,'kinderbueno.png',73),(3,2,'CARAMELOS MENTA','0000000000027',0,'caramelomenta.png',74),(3,3,'HUEVO KINDER','40084107',1,'huevokinder.png',75),(3,4,'HALLS EXTRAFUERTE','84164018',0,'hallsextra.png',76),(3,5,'REGALIZ MENTOL','8410034548010',1,'caramelorespiral.png',77),(3,6,'','0000000000003',1,'caserio.png',78),(3,7,'CHUPA CHUPS','0000000000004',1,'chupachups (2).png',79),(3,8,'HALLS MENTA','84164391',1,'hallsmenta.png',80),(3,9,'','0000000000009',0,'chicle.png',81),(3,10,'CHICLE FRESA','0000000000011',1,'chiclef.png',82),(3,11,' ','0000000000013',0,'chicleliga.png',83),(3,12,'','84198808',0,'hallsandia.png',84),(3,13,'','0000000000016',1,'happydent limon.png',85),(3,14,' ','',1,'',86),(3,15,' ','',1,'',87),(3,16,' ','',1,'',88),(3,17,' ','',1,'',89),(3,18,' ','',1,'',90),(3,19,' ','',1,'',91),(3,20,' ','',1,'',92),(3,21,' ','',1,'',93),(3,22,' ','',1,'',94),(3,23,' ','',1,'',95),(3,24,' ','',1,'',96),(3,25,' ','',1,'',97),(3,26,' ','',1,'',98),(3,27,' ','',1,'',99),(3,28,' ','',1,'',100),(3,29,' ','',1,'',101),(3,30,' ','',1,'',102),(3,31,' ','',1,'',103),(3,32,' ','',1,'',104),(3,33,' ','',1,'',105),(3,34,' ','',1,'',106),(3,35,' ','',1,'',107),(3,36,' ','',1,'',108),(4,1,' ','',1,'',109),(4,2,' ','',1,'',110),(4,3,' ','',1,'',111),(4,4,' ','',1,'',112),(4,5,' ','',1,'',113),(4,6,' ','',1,'',114),(4,7,' ','',1,'',115),(4,8,' ','',1,'',116),(4,9,' ','',1,'',117),(4,10,' ','',1,'',118),(4,11,' ','',1,'',119),(4,12,' ','',1,'',120),(4,13,' ','',1,'',121),(4,14,' ','',1,'',122),(4,15,' ','',1,'',123),(4,16,' ','',1,'',124),(4,17,' ','',1,'',125),(4,18,' ','',1,'',126),(4,19,' ','',1,'',127),(4,20,' ','',1,'',128),(4,21,' ','',1,'',129),(4,22,' ','',1,'',130),(4,23,' ','',1,'',131),(4,24,' ','',1,'',132),(4,25,' ','',1,'',133),(4,26,' ','',1,'',134),(4,27,' ','',1,'',135),(4,28,' ','',1,'',136),(4,29,' ','',1,'',137),(4,30,' ','',1,'',138),(4,31,' ','',1,'',139),(4,32,' ','',1,'',140),(4,33,' ','',1,'',141),(4,34,' ','',1,'',142),(4,35,' ','',1,'',143),(4,36,' ','',1,'',144),(5,1,'SOBRE  A4','0000000000005',1,'',145),(5,2,'SOBRES','0000000000023',1,'',146),(5,3,'SOBRES TARJETA','0000000000036',1,'',147),(5,4,'','0000000000018',1,'encendedor.png',148),(5,5,'INOXCROM IX PENS','0000000000039',1,'KOMIC-2.png',149),(5,6,' ','',1,'',150),(5,7,' ','',1,'',151),(5,8,' ','',1,'',152),(5,9,' ','',1,'',153),(5,10,' ','',1,'',154),(5,11,' ','',1,'',155),(5,12,' ','',1,'',156),(5,13,' ','',1,'',157),(5,14,' ','',1,'',158),(5,15,' ','',1,'',159),(5,16,' ','',1,'',160),(5,17,' ','',1,'',161),(5,18,' ','',1,'',162),(5,19,' ','',1,'',163),(5,20,' ','',1,'',164),(5,21,' ','',1,'',165),(5,22,' ','',1,'',166),(5,23,' ','',1,'',167),(5,24,' ','',1,'',168),(5,25,' ','',1,'',169),(5,26,' ','',1,'',170),(5,27,' ','',1,'',171),(5,28,' ','',1,'',172),(5,29,' ','',1,'',173),(5,30,' ','',1,'',174),(5,31,' ','',1,'',175),(5,32,' ','',1,'',176),(5,33,' ','',1,'',177),(5,34,' ','',1,'',178),(5,35,' ','',1,'',179),(5,36,' ','',1,'',180),(6,1,' ','',1,'',181),(6,2,' ','',1,'',182),(6,3,' ','',1,'',183),(6,4,' ','',1,'',184),(6,5,' ','',1,'',185),(6,6,' ','',1,'',186),(6,7,' ','',1,'',187),(6,8,' ','',1,'',188),(6,9,' ','',1,'',189),(6,10,' ','',1,'',190),(6,11,' ','',1,'',191),(6,12,' ','',1,'',192),(6,13,' ','',1,'',193),(6,14,' ','',1,'',194),(6,15,' ','',1,'',195),(6,16,' ','',1,'',196),(6,17,' ','',1,'',197),(6,18,' ','',1,'',198),(6,19,' ','',1,'',199),(6,20,' ','',1,'',200),(6,21,' ','',1,'',201),(6,22,' ','',1,'',202),(6,23,' ','',1,'',203),(6,24,' ','',1,'',204),(6,25,' ','',1,'',205),(6,26,' ','',1,'',206),(6,27,' ','',1,'',207),(6,28,' ','',1,'',208),(6,29,' ','',1,'',209),(6,30,' ','',1,'',210),(6,31,' ','',1,'',211),(6,32,' ','',1,'',212),(6,33,' ','',1,'',213),(6,34,' ','',1,'',214),(6,35,' ','',1,'',215),(6,36,' ','',1,'',216),(7,1,' ','',1,'',217),(7,2,' ','',1,'',218),(7,3,' ','',1,'',219),(7,4,' ','',1,'',220),(7,5,' ','',1,'',221),(7,6,' ','',1,'',222),(7,7,' ','',1,'',223),(7,8,' ','',1,'',224),(7,9,' ','',1,'',225),(7,10,' ','',1,'',226),(7,11,' ','',1,'',227),(7,12,' ','',1,'',228),(7,13,' ','',1,'',229),(7,14,' ','',1,'',230),(7,15,' ','',1,'',231),(7,16,' ','',1,'',232),(7,17,' ','',1,'',233),(7,18,' ','',1,'',234),(7,19,' ','',1,'',235),(7,20,' ','',1,'',236),(7,21,' ','',1,'',237),(7,22,' ','',1,'',238),(7,23,' ','',1,'',239),(7,24,' ','',1,'',240),(7,25,' ','',1,'',241),(7,26,' ','',1,'',242),(7,27,' ','',1,'',243),(7,28,' ','',1,'',244),(7,29,' ','',1,'',245),(7,30,' ','',1,'',246),(7,31,' ','',1,'',247),(7,32,' ','',1,'',248),(7,33,' ','',1,'',249),(7,34,' ','',1,'',250),(7,35,' ','',1,'',251),(7,36,' ','',1,'',252),(8,1,' ','',1,'',253),(8,2,' ','',1,'',254),(8,3,' ','',1,'',255),(8,4,' ','',1,'',256),(8,5,' ','',1,'',257),(8,6,' ','',1,'',258),(8,7,' ','',1,'',259),(8,8,' ','',1,'',260),(8,9,' ','',1,'',261),(8,10,' ','',1,'',262),(8,11,' ','',1,'',263),(8,12,' ','',1,'',264),(8,13,' ','',1,'',265),(8,14,' ','',1,'',266),(8,15,' ','',1,'',267),(8,16,' ','',1,'',268),(8,17,' ','',1,'',269),(8,18,' ','',1,'',270),(8,19,' ','',1,'',271),(8,20,' ','',1,'',272),(8,21,' ','',1,'',273),(8,22,' ','',1,'',274),(8,23,' ','',1,'',275),(8,24,' ','',1,'',276),(8,25,' ','',1,'',277),(8,26,' ','',1,'',278),(8,27,' ','',1,'',279),(8,28,' ','',1,'',280),(8,29,' ','',1,'',281),(8,30,' ','',1,'',282),(8,31,' ','',1,'',283),(8,32,' ','',1,'',284),(8,33,' ','',1,'',285),(8,34,' ','',1,'',286),(8,35,' ','',1,'',287),(8,36,' ','',1,'',288);

--
-- Table structure for table `caja`
--

CREATE TABLE `caja` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cantidad` decimal(10,2) NOT NULL,
  `fecha` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `motivo` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `caja`
--

INSERT INTO `caja` VALUES (1,318370.97,'2017-07-07 13:33:02',NULL);

--
-- Table structure for table `clientes`
--

CREATE TABLE `clientes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `apellidos` varchar(80) DEFAULT NULL,
  `nombre` varchar(45) DEFAULT NULL,
  `dni` varchar(10) DEFAULT NULL,
  `telefono` varchar(12) DEFAULT NULL,
  `movil` varchar(12) DEFAULT NULL,
  `email` varchar(65) DEFAULT NULL,
  `direccion` varchar(120) DEFAULT NULL,
  `cp` varchar(6) DEFAULT NULL,
  `poblacion` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `clientes`
--


--
-- Table structure for table `config`
--

CREATE TABLE `config` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigo` varchar(13) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `config`
--

INSERT INTO `config` VALUES (1,'87');

--
-- Table structure for table `devolucion`
--

CREATE TABLE `devolucion` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `ndevolucion` varchar(40) DEFAULT NULL,
  `fecha` date NOT NULL,
  `proveedor` int(11) NOT NULL,
  `precio` decimal(10,2) DEFAULT '0.00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `devolucion`
--


--
-- Table structure for table `facturas`
--

CREATE TABLE `facturas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fechainicio` varchar(10) NOT NULL,
  `fechafin` varchar(10) NOT NULL,
  `cliente` int(11) NOT NULL,
  `precio` decimal(10,2) DEFAULT '0.00',
  `pagada` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `facturas`
--


--
-- Table structure for table `facturasproveedores`
--

CREATE TABLE `facturasproveedores` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fecha` varchar(10) DEFAULT NULL,
  `numero` varchar(45) DEFAULT NULL,
  `proveedor` varchar(45) DEFAULT NULL,
  `precio` decimal(10,2) DEFAULT '0.00',
  `pagada` tinyint(4) DEFAULT '0',
  `libro` int(11) DEFAULT '0',
  `bi1` decimal(10,2) DEFAULT '0.00',
  `iva1` decimal(10,2) DEFAULT '0.00',
  `br1` decimal(10,2) DEFAULT '0.00',
  `rec1` decimal(10,2) DEFAULT '0.00',
  `irpf1` decimal(10,2) DEFAULT '0.00',
  `bi2` decimal(10,2) DEFAULT '0.00',
  `iva2` decimal(10,2) DEFAULT '0.00',
  `br2` decimal(10,2) DEFAULT '0.00',
  `rec2` decimal(10,2) DEFAULT '0.00',
  `irpf2` decimal(10,2) DEFAULT '0.00',
  `bi3` decimal(10,2) DEFAULT '0.00',
  `iva3` decimal(10,2) DEFAULT '0.00',
  `br3` decimal(10,2) DEFAULT '0.00',
  `rec3` decimal(10,2) DEFAULT '0.00',
  `irpf3` decimal(10,2) DEFAULT '0.00',
  `cliente` varchar(45) DEFAULT 'Clientes',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `facturasproveedores`
--


--
-- Table structure for table `libros`
--

CREATE TABLE `libros` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nombre` varchar(45) DEFAULT NULL,
  `tipo` int(11) DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `libros`
--


--
-- Table structure for table `linea`
--

CREATE TABLE `linea` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigolinea` varchar(15) NOT NULL,
  `cantidad` decimal(10,4) NOT NULL,
  `codigo` varchar(18) NOT NULL,
  `descripcion` varchar(100) NOT NULL,
  `proveedor` int(11) NOT NULL,
  `dto` decimal(6,2) NOT NULL DEFAULT '20.00',
  `neto` decimal(10,4) NOT NULL,
  `iva` decimal(8,2) NOT NULL DEFAULT '4.00',
  `rec` decimal(8,2) NOT NULL DEFAULT '0.50',
  `pvp` decimal(8,2) NOT NULL,
  `neto2` decimal(10,4) DEFAULT NULL,
  `iva2` decimal(8,2) DEFAULT '21.00',
  `rec2` decimal(8,2) DEFAULT '5.20',
  `pvp2` decimal(8,2) NOT NULL,
  `marcado` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `linea`
--


--
-- Table structure for table `lineaa`
--

CREATE TABLE `lineaa` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigolinea` varchar(15) NOT NULL,
  `cantidad` decimal(10,4) NOT NULL,
  `codigo` varchar(18) NOT NULL,
  `descripcion` varchar(100) NOT NULL,
  `proveedor` int(11) NOT NULL,
  `dto` decimal(6,2) NOT NULL DEFAULT '20.00',
  `neto` decimal(10,4) NOT NULL,
  `iva` decimal(8,2) NOT NULL DEFAULT '4.00',
  `rec` decimal(8,2) NOT NULL DEFAULT '0.50',
  `pvp` decimal(8,2) NOT NULL,
  `neto2` decimal(10,4) DEFAULT NULL,
  `iva2` decimal(8,2) DEFAULT '21.00',
  `rec2` decimal(8,2) DEFAULT '5.20',
  `pvp2` decimal(8,2) NOT NULL,
  `marcado` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `lineaa`
--


--
-- Table structure for table `linead`
--

CREATE TABLE `linead` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigolinea` varchar(40) NOT NULL,
  `cantidad` decimal(10,4) NOT NULL,
  `codigo` varchar(18) NOT NULL,
  `descripcion` varchar(100) NOT NULL,
  `proveedor` int(11) NOT NULL,
  `dto` decimal(6,2) NOT NULL DEFAULT '20.00',
  `neto` decimal(10,4) NOT NULL,
  `iva` decimal(8,2) NOT NULL DEFAULT '4.00',
  `rec` decimal(8,2) NOT NULL DEFAULT '0.50',
  `pvp` decimal(8,2) NOT NULL,
  `neto2` decimal(10,4) DEFAULT NULL,
  `iva2` decimal(8,2) DEFAULT '21.00',
  `rec2` decimal(8,2) DEFAULT '5.20',
  `pvp2` decimal(8,2) NOT NULL,
  `marcado` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `linead`
--


--
-- Table structure for table `lineaf`
--

CREATE TABLE `lineaf` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigolinea` varchar(15) NOT NULL,
  `cantidad` decimal(10,4) NOT NULL,
  `codigo` varchar(18) NOT NULL,
  `descripcion` varchar(100) NOT NULL,
  `proveedor` int(11) NOT NULL,
  `dto` decimal(6,2) NOT NULL DEFAULT '20.00',
  `neto` decimal(10,4) NOT NULL,
  `iva` decimal(8,2) NOT NULL DEFAULT '4.00',
  `rec` decimal(8,2) NOT NULL DEFAULT '0.50',
  `pvp` decimal(8,2) NOT NULL,
  `neto2` decimal(10,4) DEFAULT NULL,
  `iva2` decimal(8,2) DEFAULT '21.00',
  `rec2` decimal(8,2) DEFAULT '5.20',
  `pvp2` decimal(8,2) NOT NULL,
  `marcado` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `lineaf`
--


--
-- Table structure for table `lineafa`
--

CREATE TABLE `lineafa` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigolinea` varchar(15) NOT NULL,
  `cantidad` decimal(10,4) NOT NULL,
  `codigo` varchar(18) NOT NULL,
  `descripcion` varchar(100) NOT NULL,
  `proveedor` int(11) NOT NULL,
  `dto` decimal(6,2) NOT NULL DEFAULT '20.00',
  `neto` decimal(10,4) NOT NULL,
  `iva` decimal(8,2) NOT NULL DEFAULT '4.00',
  `rec` decimal(8,2) NOT NULL DEFAULT '0.50',
  `pvp` decimal(8,2) NOT NULL,
  `neto2` decimal(10,4) DEFAULT NULL,
  `iva2` decimal(8,2) DEFAULT '21.00',
  `rec2` decimal(8,2) DEFAULT '5.20',
  `pvp2` decimal(8,2) NOT NULL,
  `marcado` tinyint(1) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `lineafa`
--


--
-- Table structure for table `lineat`
--

CREATE TABLE `lineat` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigolinea` varchar(15) NOT NULL,
  `cantidad` decimal(10,4) NOT NULL,
  `codigo` varchar(18) NOT NULL,
  `descripcion` varchar(100) NOT NULL,
  `proveedor` int(11) NOT NULL,
  `dto` decimal(6,2) NOT NULL DEFAULT '20.00',
  `neto` decimal(10,4) NOT NULL,
  `iva` decimal(8,2) NOT NULL DEFAULT '4.00',
  `rec` decimal(8,2) NOT NULL DEFAULT '0.50',
  `pvp` decimal(8,2) NOT NULL,
  `neto2` decimal(10,4) DEFAULT NULL,
  `iva2` decimal(8,2) DEFAULT '21.00',
  `rec2` decimal(8,2) DEFAULT '5.20',
  `pvp2` decimal(8,2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `lineat`
--


--
-- Table structure for table `loteria`
--

CREATE TABLE `loteria` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fecha` varchar(10) DEFAULT NULL,
  `primitiva` decimal(10,2) DEFAULT NULL,
  `bonoloto` decimal(10,2) DEFAULT NULL,
  `quiniela` decimal(10,2) DEFAULT NULL,
  `gordo` decimal(10,2) DEFAULT NULL,
  `nacional` decimal(10,2) DEFAULT NULL,
  `quinigol` decimal(10,2) DEFAULT NULL,
  `euromillones` decimal(10,2) DEFAULT NULL,
  `lototurf` decimal(10,2) DEFAULT NULL,
  `quintuple` decimal(10,2) DEFAULT NULL,
  `nacionaljueves` decimal(10,2) DEFAULT NULL,
  `premios` decimal(10,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `loteria`
--


--
-- Table structure for table `ministock`
--

CREATE TABLE `ministock` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `grupo` varchar(45) DEFAULT NULL,
  `nombre` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `ministock`
--


--
-- Table structure for table `multiprecio`
--

CREATE TABLE `multiprecio` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigo` varchar(18) NOT NULL,
  `dto` decimal(6,2) DEFAULT NULL,
  `neto1` decimal(10,4) DEFAULT NULL,
  `iva1` decimal(8,2) DEFAULT NULL,
  `rec1` decimal(8,2) DEFAULT NULL,
  `pvp1` decimal(8,2) DEFAULT NULL,
  `neto2` decimal(10,4) DEFAULT NULL,
  `iva2` decimal(8,2) DEFAULT NULL,
  `rec2` decimal(8,2) DEFAULT NULL,
  `pvp2` decimal(8,2) DEFAULT NULL,
  `neto3` decimal(10,4) DEFAULT NULL,
  `iva3` decimal(8,2) DEFAULT NULL,
  `rec3` decimal(8,2) DEFAULT NULL,
  `pvp3` decimal(8,2) DEFAULT NULL,
  `neto4` decimal(10,4) DEFAULT NULL,
  `iva4` decimal(8,2) DEFAULT NULL,
  `rec4` decimal(8,2) DEFAULT NULL,
  `pvp4` decimal(8,2) DEFAULT NULL,
  `neto5` decimal(10,4) DEFAULT NULL,
  `iva5` decimal(8,2) DEFAULT NULL,
  `rec5` decimal(8,2) DEFAULT NULL,
  `pvp5` decimal(8,2) DEFAULT NULL,
  `neto6` decimal(10,4) DEFAULT NULL,
  `iva6` decimal(8,2) DEFAULT NULL,
  `rec6` decimal(8,2) DEFAULT NULL,
  `pvp6` decimal(8,2) DEFAULT NULL,
  `neto7` decimal(10,4) DEFAULT NULL,
  `iva7` decimal(8,2) DEFAULT NULL,
  `rec7` decimal(8,2) DEFAULT NULL,
  `pvp7` decimal(8,2) DEFAULT NULL,
  `neto8` decimal(10,4) DEFAULT NULL,
  `iva8` decimal(8,2) DEFAULT NULL,
  `rec8` decimal(8,2) DEFAULT NULL,
  `pvp8` decimal(8,2) DEFAULT NULL,
  `neto9` decimal(10,4) DEFAULT NULL,
  `iva9` decimal(8,2) DEFAULT NULL,
  `rec9` decimal(8,2) DEFAULT NULL,
  `pvp9` decimal(8,2) DEFAULT NULL,
  `neto10` decimal(10,4) DEFAULT NULL,
  `iva10` decimal(8,2) DEFAULT NULL,
  `rec10` decimal(8,2) DEFAULT NULL,
  `pvp10` decimal(8,2) DEFAULT NULL,
  `neto11` decimal(10,4) DEFAULT NULL,
  `iva11` decimal(8,2) DEFAULT NULL,
  `rec11` decimal(8,2) DEFAULT NULL,
  `pvp11` decimal(8,2) DEFAULT NULL,
  `neto12` decimal(10,4) DEFAULT NULL,
  `iva12` decimal(8,2) DEFAULT NULL,
  `rec12` decimal(8,2) DEFAULT NULL,
  `pvp12` decimal(8,2) DEFAULT NULL,
  `neto13` decimal(10,4) DEFAULT NULL,
  `iva13` decimal(8,2) DEFAULT NULL,
  `rec13` decimal(8,2) DEFAULT NULL,
  `pvp13` decimal(8,2) DEFAULT NULL,
  `neto14` decimal(10,4) DEFAULT NULL,
  `iva14` decimal(8,2) DEFAULT NULL,
  `rec14` decimal(8,2) DEFAULT NULL,
  `pvp14` decimal(8,2) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `codigo_UNIQUE` (`codigo`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `multiprecio`
--

INSERT INTO `multiprecio` VALUES (1,'009423540001',20.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.3077,4.00,0.50,1.70,0.0000,0.00,0.00,0.00,1.9230,4.00,0.50,2.50,0.0000,0.00,0.00,0.00),(2,'8433442718011',20.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.3077,4.00,0.50,1.70,0.0000,0.00,0.00,0.00,1.8029,4.00,0.50,2.50,0.0000,0.00,0.00,0.00),(3,'8423793110008',20.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00),(4,'8420565030007',20.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00),(5,'8427626000900',20.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00),(6,'8423739000073',20.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00),(7,'9779968966031',20.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.3077,4.00,0.50,1.70,0.0000,0.00,0.00,0.00,1.9230,4.00,0.50,2.50,0.0000,0.00,0.00,0.00),(9,'9770213457007',20.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.3077,4.00,0.50,1.70,0.0000,0.00,0.00,0.00,1.9230,4.00,0.50,2.50,0.0000,0.00,0.00,0.00),(10,'8437013934008',20.00,1.0000,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.0000,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.0000,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.0000,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.0000,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.0817,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.9230,4.00,0.50,2.50,0.0000,0.00,0.00,0.00),(12,'9772171468101',20.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.3077,4.00,0.50,1.70,0.0000,0.00,0.00,0.00,1.9230,4.00,0.50,2.50,0.0000,0.00,0.00,0.00),(13,'8435102100112',20.00,0.9230,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,0.9230,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,0.9230,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,0.9230,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,0.9230,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.5865,4.00,0.50,2.20,0.0000,0.00,0.00,0.00),(15,'8425536000010',20.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.4423,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,2.0192,4.00,0.50,2.80,0.0000,0.00,0.00,0.00),(16,'8423793280206',20.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.4423,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,2.0192,4.00,0.50,2.80,0.0000,0.00,0.00,0.00),(17,'8430742009023',20.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.3077,4.00,0.50,1.70,0.0000,0.00,0.00,0.00,1.5385,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,1.4615,4.00,0.50,1.90,0.0000,0.00,0.00,0.00),(18,'8424499000013',20.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.5385,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,2.3077,4.00,0.50,3.00,0.0000,0.00,0.00,0.00),(19,'8427999000019',20.00,1.2500,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.2500,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.2500,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.2500,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.2500,4.00,0.50,1.30,0.0000,0.00,0.00,0.00,1.5385,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,2.2115,4.00,0.50,2.40,0.0000,0.00,0.00,0.00),(20,'8423793120007',20.00,1.5385,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,1.5385,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,1.5385,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,1.5385,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,1.5385,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,1.9230,4.00,0.50,2.50,0.0000,0.00,0.00,0.00,0.0000,0.00,0.00,0.00,0.0000,0.00,0.00,0.00),(21,'8426318000013',20.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,1.2308,4.00,0.50,1.60,0.0000,0.00,0.00,0.00,0.0000,0.00,0.00,0.00,0.0000,0.00,0.00,0.00),(22,'8423739000011',20.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00,0.7692,4.00,0.50,1.00,0.0000,0.00,0.00,0.00),(25,'1118430742201',20.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.5385,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,2.1538,4.00,0.50,2.80,0.0000,0.00,0.00,0.00),(26,'1118455555201',20.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.0770,4.00,0.50,1.40,0.0000,0.00,0.00,0.00,1.3077,4.00,0.50,1.70,0.0000,0.00,0.00,0.00,1.9230,4.00,0.50,2.50,0.0000,0.00,0.00,0.00),(27,'8425536000065',20.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.4423,4.00,0.50,2.00,0.0000,0.00,0.00,0.00,2.0192,4.00,0.50,2.80,0.0000,0.00,0.00,0.00),(28,'8435102100174',20.00,0.9231,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,0.9231,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,0.9231,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,0.9231,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,0.9231,4.00,0.50,1.20,0.0000,0.00,0.00,0.00,1.1538,4.00,0.50,1.50,0.0000,0.00,0.00,0.00,1.5866,4.00,0.50,2.20,0.0000,0.00,0.00,0.00);

--
-- Table structure for table `pack`
--

CREATE TABLE `pack` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `codigo` varchar(18) DEFAULT NULL,
  `cantidad` decimal(10,4) DEFAULT NULL,
  `codigocomponente` varchar(18) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `pack`
--

INSERT INTO `pack` VALUES (2,'7622210780157',1.0000,''),(3,'7622210780157',1.0000,'');

--
-- Table structure for table `paquetes`
--

CREATE TABLE `paquetes` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fechaentrada` varchar(10) NOT NULL,
  `fechaentrega` varchar(10) NOT NULL DEFAULT '0',
  `precio` decimal(8,2) DEFAULT '0.00',
  `referencia` varchar(25) NOT NULL,
  `nombre` varchar(80) NOT NULL,
  `entregado` tinyint(4) DEFAULT '0',
  `pagado` tinyint(4) DEFAULT '0',
  `devuelto` tinyint(4) DEFAULT '0',
  `proveedor` varchar(15) NOT NULL,
  `lugar` varchar(5) NOT NULL,
  `devolucion` tinyint(4) DEFAULT '0',
  `pdevolucion` decimal(8,2) DEFAULT '0.00',
  PRIMARY KEY (`id`,`fechaentrega`,`referencia`,`fechaentrada`,`nombre`,`proveedor`,`lugar`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `paquetes`
--


--
-- Table structure for table `proveedores`
--

CREATE TABLE `proveedores` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `nombre` varchar(50) NOT NULL,
  `ncliente` varchar(15) NOT NULL,
  `direccion` varchar(200) DEFAULT NULL,
  `tlfno` varchar(9) DEFAULT NULL,
  `tlfno2` varchar(9) DEFAULT NULL,
  `codcliente` varchar(15) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `proveedores`
--


--
-- Table structure for table `reservas`
--

CREATE TABLE `reservas` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cliente` int(11) DEFAULT NULL,
  `codigo` varchar(18) DEFAULT NULL,
  `fecha` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `pagado` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `reservas`
--


--
-- Table structure for table `stock`
--

CREATE TABLE `stock` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `cantidad` decimal(10,4) NOT NULL,
  `codigo` varchar(18) NOT NULL,
  `descripcion` varchar(100) NOT NULL,
  `dto` decimal(6,2) NOT NULL DEFAULT '20.00',
  `neto` decimal(10,4) NOT NULL,
  `iva` decimal(8,2) NOT NULL DEFAULT '4.00',
  `rec` decimal(8,2) NOT NULL DEFAULT '0.50',
  `pvp` decimal(8,2) NOT NULL,
  `neto2` decimal(10,4) DEFAULT NULL,
  `iva2` decimal(8,2) DEFAULT '21.00',
  `rec2` decimal(8,2) DEFAULT '5.20',
  `pvp2` decimal(8,2) NOT NULL,
  `fecha` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `stock`
--


--
-- Table structure for table `ticket`
--

CREATE TABLE `ticket` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fecha` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `relleno` tinyint(4) NOT NULL,
  `precio` decimal(10,2) DEFAULT '0.00',
  `vendedor` int(11) DEFAULT '0',
  `cliente` int(11) DEFAULT '0',
  `tipopago` int(11) DEFAULT '0',
  `pertenece` int(11) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `ticket`
--


--
-- Dumping events for database 'kiosko'
--

--
-- Dumping routines for database 'kiosko'
--
/*!50003 DROP FUNCTION IF EXISTS `precio_albaran` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `precio_albaran`(vcodigo varchar(15)) RETURNS decimal(10,2)
BEGIN
declare vprecio decimal(10,2);
SELECT sum(neto*cantidad+(cantidad*neto2)) into vprecio FROM kiosko.linea
where codigolinea=vcodigo;

RETURN vprecio;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `corrige` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `corrige`()
BEGIN

declare vneto2 decimal(10,4);

declare vrec2 decimal(8,2);

declare vpvp2 decimal(8,2);

declare viva2 decimal(8,2);

declare vcodigo varchar(18);



declare flag boolean default false;



declare cursor1 cursor for select linea.neto2,linea.rec2,linea.pvp2,linea.iva2,linea.codigo from linea,articulos

where linea.codigo=articulos.codigo

and linea.dto=articulos.dto

and linea.neto=articulos.neto

and linea.iva=articulos.iva

and linea.rec=articulos.rec

and linea.pvp=articulos.pvp

;



declare continue handler for not found set flag=true;



open cursor1;



contar: loop





    fetch cursor1 into vneto2,vrec2,vpvp2,viva2,vcodigo;

    IF flag THEN    

        LEAVE contar; 

    ELSE

    

		update articulos set neto2=vneto2, rec2=vrec2,pvp2=vpvp2,iva2=viva2 where codigo=vcodigo ; 

        update articulos set neto2=vneto2, rec2=vrec2,pvp2=vpvp2,iva2=viva2 where codigo=left(vcodigo,13) ; 

    END IF; 



end loop;





close cursor1;









END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `prueba` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `prueba`()
BEGIN
SELECT nalbaran,fecha,nombre FROM kiosko.albaran,proveedores 
where albaran.proveedor=proveedores.id 
group by nalbaran
order by fecha desc

limit 100;


END ;;
DELIMITER ;


