--
-- Host: localhost    Database: anne
-- ------------------------------------------------------


--
-- Table structure for table `app_config`
--

CREATE TABLE `app_config` (
  `id` tinyint(3) unsigned NOT NULL,
  `app_name` varchar(100) NOT NULL,
  `logo_path` varchar(255) DEFAULT NULL,
  `actualizado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `app_config`
--

INSERT INTO `app_config` VALUES (1,'BellaIdea','uploads/branding/ffb56fb95f1c3b31eb997de5754edb1a.jpg','2026-04-21 14:37:39');

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

CREATE TABLE `clientes` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(120) NOT NULL,
  `cedula` varchar(40) DEFAULT NULL,
  `telefono` varchar(40) DEFAULT NULL,
  `correo` varchar(120) DEFAULT NULL,
  `instagram` varchar(120) DEFAULT NULL,
  `direccion` varchar(255) DEFAULT NULL,
  `nota` varchar(500) DEFAULT NULL,
  `creado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

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

INSERT INTO `clientes` VALUES (1,'Peter Abboud','19077705','04249623584','','','','','2026-04-21 14:38:33');

--
-- Table structure for table `compras_materiales`
--

CREATE TABLE `compras_materiales` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `compra_ref` varchar(40) NOT NULL,
  `proveedor` varchar(120) NOT NULL DEFAULT 'Sin proveedor',
  `material_id` int(10) unsigned NOT NULL,
  `cantidad` int(11) NOT NULL,
  `costo_unitario` decimal(10,2) NOT NULL DEFAULT '0.00',
  `creado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_material_id` (`material_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `compras_materiales`
--

INSERT INTO `compras_materiales` VALUES (1,'20260421115437-188','Chino',7,10,0.18,'2026-04-21 14:54:37'),(2,'20260421125026-806','Atlantico',10,50,2.01,'2026-04-21 15:50:26');

--
-- Table structure for table `inventario_categoria_materiales`
--

CREATE TABLE `inventario_categoria_materiales` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `categoria_id` int(10) unsigned NOT NULL,
  `material_id` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uniq_categoria_material` (`categoria_id`,`material_id`),
  KEY `idx_categoria_id` (`categoria_id`),
  KEY `idx_material_id` (`material_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `inventario_categoria_materiales`
--

INSERT INTO `inventario_categoria_materiales` VALUES (4,2,4),(3,2,6),(2,2,7),(1,2,9),(9,3,3),(8,3,4),(7,3,6),(6,3,7),(5,3,9);

--
-- Table structure for table `inventario_categorias`
--

CREATE TABLE `inventario_categorias` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(120) NOT NULL,
  `parent_id` int(10) unsigned DEFAULT NULL,
  `creado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_parent_id` (`parent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `inventario_categorias`
--

INSERT INTO `inventario_categorias` VALUES (1,'Piñata',NULL,'2026-04-21 14:50:55'),(2,'Piñata Circulares 35cm',1,'2026-04-21 14:51:57'),(3,'Piñata de Nunero 55cm',1,'2026-04-21 14:52:33');

--
-- Table structure for table `inventario_materiales`
--

CREATE TABLE `inventario_materiales` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(120) NOT NULL,
  `unidad` varchar(30) NOT NULL DEFAULT 'unidad',
  `stock_minimo` int(11) NOT NULL DEFAULT '0',
  `stock_actual` int(11) NOT NULL DEFAULT '0',
  `costo` decimal(10,2) NOT NULL DEFAULT '0.00',
  `proveedor` varchar(120) NOT NULL DEFAULT 'Sin proveedor',
  `nota` varchar(500) DEFAULT NULL,
  `creado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `parent_id` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `inventario_materiales`
--

INSERT INTO `inventario_materiales` VALUES (1,'Papel Crepe','',0,0,0.00,'','','2026-04-21 14:39:22',NULL),(2,'Papel acrepe Liso Fucia','Pliegos',10,0,0.45,'Carlos','','2026-04-21 14:40:50',1),(3,'Papel acrepe Liso Amarillo','Pliego',10,0,0.45,'Carlos','','2026-04-21 14:42:16',1),(4,'Papel acrepe Liso Rosado','Pliego',10,0,0.45,'Carlos','','2026-04-21 14:45:14',1),(5,'Silicon','',0,0,0.00,'','','2026-04-21 14:46:22',NULL),(6,'Silicon Grueso','Barras',10,0,0.18,'Carlos','','2026-04-21 14:47:17',5),(7,'Silicon Fino','Barras',10,10,0.18,'Chino','','2026-04-21 14:48:04',5),(8,'Foami Normal','',0,0,0.00,'','','2026-04-21 14:48:18',NULL),(9,'Foami Normal Dorado','Hojas',10,0,0.25,'Carlos','','2026-04-21 14:50:12',8),(10,'Bolsas adhesivas 23x15','',0,50,2.01,'Atlantico','','2026-04-21 15:47:24',NULL);

--
-- Table structure for table `inventario_productos`
--

CREATE TABLE `inventario_productos` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(120) NOT NULL,
  `pedido_id` int(10) unsigned DEFAULT NULL,
  `cantidad` int(11) NOT NULL DEFAULT '0',
  `precio` decimal(10,2) NOT NULL DEFAULT '0.00',
  `creado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `inventario_productos`
--

INSERT INTO `inventario_productos` VALUES (1,'Piñata de Nunero 55cm (Pedido #1)',1,1,10.00,'2026-04-21 14:59:21');

--
-- Table structure for table `inventario_ventas_productos`
--

CREATE TABLE `inventario_ventas_productos` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `producto_id` int(10) unsigned NOT NULL,
  `pedido_id` int(10) unsigned DEFAULT NULL,
  `nombre_producto` varchar(120) NOT NULL,
  `precio_venta` decimal(10,2) NOT NULL DEFAULT '0.00',
  `cantidad` int(11) NOT NULL DEFAULT '1',
  `creado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_producto_id` (`producto_id`),
  KEY `idx_pedido_id` (`pedido_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `inventario_ventas_productos`
--


--
-- Table structure for table `parametros_trabajo`
--

CREATE TABLE `parametros_trabajo` (
  `id` tinyint(3) unsigned NOT NULL,
  `mano_obra` varchar(120) NOT NULL,
  `monto_mano_obra` decimal(10,2) NOT NULL DEFAULT '0.00',
  `actualizado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `parametros_trabajo`
--

INSERT INTO `parametros_trabajo` VALUES (1,'Mano de obra',0.50,'2026-04-21 14:37:22');

--
-- Table structure for table `pedido_fotos`
--

CREATE TABLE `pedido_fotos` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pedido_id` int(10) unsigned NOT NULL,
  `foto_path` varchar(255) NOT NULL,
  `creado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_pedido_foto` (`pedido_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `pedido_fotos`
--

INSERT INTO `pedido_fotos` VALUES (1,1,'uploads/pedidos/07c29432281aaf83dc45f0d6cffebc07.jpg','2026-04-21 14:58:34'),(2,1,'uploads/pedidos/c45704c39fe829d69baa0531716cc107.jpg','2026-04-21 14:58:40');

--
-- Table structure for table `pedido_materiales`
--

CREATE TABLE `pedido_materiales` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pedido_id` int(10) unsigned NOT NULL,
  `material_id` int(10) unsigned NOT NULL,
  `cantidad` decimal(10,2) NOT NULL DEFAULT '1.00',
  `costo_unitario` decimal(12,2) NOT NULL DEFAULT '0.00',
  `subtotal` decimal(12,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`id`),
  KEY `idx_pedido_id` (`pedido_id`),
  KEY `idx_material_id` (`material_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `pedido_materiales`
--

INSERT INTO `pedido_materiales` VALUES (7,1,9,2.00,0.25,0.50),(8,1,3,2.00,0.45,0.90),(9,1,4,2.00,0.45,0.90),(10,1,7,5.00,0.18,0.90),(11,1,6,2.00,0.18,0.36),(12,1,2,4.00,0.45,1.80);

--
-- Table structure for table `pedidos`
--

CREATE TABLE `pedidos` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cliente_id` int(10) unsigned NOT NULL,
  `template_id` int(10) unsigned NOT NULL,
  `cantidad_material` decimal(10,2) NOT NULL DEFAULT '1.00',
  `horas_trabajo` decimal(10,2) NOT NULL DEFAULT '0.00',
  `margen_porcentaje` decimal(10,2) NOT NULL DEFAULT '0.00',
  `costo_materiales` decimal(12,2) NOT NULL DEFAULT '0.00',
  `costo_mano_obra` decimal(12,2) NOT NULL DEFAULT '0.00',
  `costo_base` decimal(12,2) NOT NULL DEFAULT '0.00',
  `margen_monto` decimal(12,2) NOT NULL DEFAULT '0.00',
  `total` decimal(12,2) NOT NULL DEFAULT '0.00',
  `estado` varchar(20) NOT NULL DEFAULT 'pendiente',
  `foto_path` varchar(255) DEFAULT NULL,
  `creado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_cliente_id` (`cliente_id`),
  KEY `idx_template_id` (`template_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `pedidos`
--

INSERT INTO `pedidos` VALUES (1,1,3,17.00,2.00,57.23,5.36,1.00,6.36,3.64,10.00,'producto',NULL,'2026-04-21 14:57:16');

--
-- Table structure for table `temas_custom`
--

CREATE TABLE `temas_custom` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `nombre` varchar(80) NOT NULL,
  `bg` varchar(20) NOT NULL,
  `card` varchar(20) NOT NULL,
  `text` varchar(20) NOT NULL,
  `muted` varchar(20) NOT NULL,
  `linea` varchar(20) NOT NULL,
  `primary_color` varchar(20) NOT NULL,
  `ok_bg` varchar(20) NOT NULL,
  `ok_text` varchar(20) NOT NULL,
  `creado_en` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `temas_custom`
--


--
-- Dumping events for database 'anne'
--

--
-- Dumping routines for database 'anne'
--


