-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Servidor: 127.0.0.1:3306
-- Tiempo de generación: 13-04-2020 a las 22:35:03
-- Versión del servidor: 5.7.26
-- Versión de PHP: 7.0.33

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Base de datos: `apiadministrador`


DROP TABLE IF EXISTS `contactos`;
CREATE TABLE IF NOT EXISTS `contactos` (
  `id_contactos` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `id_persona` int(11) DEFAULT NULL,
  `id_empresa` int(11) DEFAULT NULL,
  `email1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `email2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `movil1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `movil2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `movil3` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_user` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_user` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `status` int(11) NOT NULL,
  PRIMARY KEY (`id_contactos`),
  KEY `contactos_id_empresa_foreign` (`id_empresa`),
  KEY `contactos_id_persona_foreign` (`id_persona`)
) ENGINE=MyISAM AUTO_INCREMENT=0  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


--
-- Estructura de tabla para la tabla `empresas`
--

DROP TABLE IF EXISTS `empresas`;
CREATE TABLE IF NOT EXISTS `empresas` (
  `id_empresa` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `id_persona` int(11) DEFAULT NULL,
  `direccion` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ubigeo` int(11) NOT NULL,
  `sub_dominio` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `db_host` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `db_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `db_usuario` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `db_contrasena` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `fec_afiliacion` datetime NOT NULL,
  `fec_suspencion` datetime DEFAULT NULL,
  `fec_cancelacion` datetime DEFAULT NULL,
  `id_vendedor` int(11) DEFAULT NULL,
  `flg_reconexion` char(255) COLLATE utf8_unicode_ci NOT NULL,
  `estado` char(255) COLLATE utf8_unicode_ci NOT NULL,
  `created_user` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_user` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `status` int(11) NOT NULL,
  PRIMARY KEY (`id_empresa`),
  KEY `empresas_id_vendedor_foreign` (`id_vendedor`),
  KEY `id_persona` (`id_persona`)
) ENGINE=MyISAM AUTO_INCREMENT=0  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;




--
-- Estructura de tabla para la tabla `migrations`
--

DROP TABLE IF EXISTS `migrations`;
CREATE TABLE IF NOT EXISTS `migrations` (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `batch` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=0  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



--
-- Estructura de tabla para la tabla `personas`
--

DROP TABLE IF EXISTS `personas`;
CREATE TABLE IF NOT EXISTS `personas` (
  `id_persona` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `id_tip_doc` int(11) DEFAULT NULL,
  `num_documento` varchar(8) COLLATE utf8_unicode_ci NOT NULL,
  `tip_persona` char(1) COLLATE utf8_unicode_ci NOT NULL,
  `nombres` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `ape_paterno` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ape_materno` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ruc` varchar(11) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_user` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_user` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `status` int(11) NOT NULL,
  PRIMARY KEY (`id_persona`),
  KEY `personas_id_tip_doc_foreign` (`id_tip_doc`)
) ENGINE=MyISAM AUTO_INCREMENT=0  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


-- Estructura de tabla para la tabla `tickets`
--

DROP TABLE IF EXISTS `tickets`;
CREATE TABLE IF NOT EXISTS `tickets` (
  `id_ticket` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `id_empresa` int(11) DEFAULT NULL,
  `numero` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
  `fec_emision` char(1) COLLATE utf8_unicode_ci NOT NULL,
  `fec_vencimiento` date NOT NULL,
  `periodo` char(6) COLLATE utf8_unicode_ci NOT NULL,
  `imp_total` decimal(8,2) NOT NULL,
  `fec_pago` datetime NOT NULL,
  `flg_reconexion` char(2) COLLATE utf8_unicode_ci NOT NULL,
  `estado` char(1) COLLATE utf8_unicode_ci NOT NULL,
  `created_user` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_user` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `status` int(11) NOT NULL,
  PRIMARY KEY (`id_ticket`),
  KEY `tickets_id_empresa_foreign` (`id_empresa`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `tickets_det`
--

DROP TABLE IF EXISTS `tickets_det`;
CREATE TABLE IF NOT EXISTS `tickets_det` (
  `id_ticket_det` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `id_ticket` int(11) DEFAULT NULL,
  `cantidad` int(11) NOT NULL,
  `descripcion` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `importe` decimal(8,2) NOT NULL,
  `created_user` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_user` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `status` int(11) NOT NULL,
  PRIMARY KEY (`id_ticket_det`),
  KEY `tickets_det_id_ticket_foreign` (`id_ticket`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `tiposdocumento`
--

DROP TABLE IF EXISTS `tiposdocumento`;
CREATE TABLE IF NOT EXISTS `tiposdocumento` (
  `id_tip_doc` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `tipo` char(4) COLLATE utf8_unicode_ci NOT NULL,
  `nombre` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `nom_corto` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id_tip_doc`)
) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- Volcado de datos para la tabla `tiposdocumento`
--

INSERT INTO `tiposdocumento` (`id_tip_doc`, `tipo`, `nombre`, `nom_corto`, `created_at`, `updated_at`) VALUES
(1, '01', 'DOCUMENTO NACIONAL DE IDENTIDAD', 'DNI', '2020-03-25 20:37:09', '2020-03-25 20:37:09'),
(2, '04', 'CARNET DE EXTRANJERIA', 'CARNET EXT.', '2020-03-25 20:37:09', '2020-03-25 20:37:09'),
(3, '06', 'REGISTRO UNICO DE CONTRIBUYENTES', 'RUC', '2020-03-25 20:37:09', '2020-03-25 20:37:09'),
(4, '07', 'PASAPORTE', 'PASAPORTE ', '2020-03-25 20:37:09', '2020-03-25 20:37:09'),
(5, '11', 'PART. DE NACIMIENTO-IDENTIDAD', 'P.NAC.', '2020-03-25 20:37:09', '2020-03-25 20:37:09'),
(6, '00', 'OTROS ', 'OTROS ', '2020-03-25 20:37:09', '2020-03-25 20:37:09');

-- --------------------------------------------------------

--
-- Estructura de tabla para la tabla `vendedores`
--

DROP TABLE IF EXISTS `vendedores`;
CREATE TABLE IF NOT EXISTS `vendedores` (
  `id_vendedor` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `id_persona` int(11) DEFAULT NULL,
  `fec_activacion` datetime NOT NULL,
  `estado` char(1) COLLATE utf8_unicode_ci NOT NULL,
  `created_user` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `updated_user` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  `status` int(11) NOT NULL,
  PRIMARY KEY (`id_vendedor`),
  KEY `vendedores_id_persona_foreign` (`id_persona`)
) ENGINE=MyISAM AUTO_INCREMENT=0  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;



/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
