-- http://www.phpmyadmin.net
--
-- Servidor: localhost
-- Tiempo de generación: 20-08-2014 a las 22:43:16
-- Versión del servidor: 5.5.37-cll
-- Versión de PHP: 5.4.23




--
-- Base de datos: `augusto_planillas`
--

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

--
-- Estructura de tabla para la tabla `accounts`
--

CREATE TABLE IF NOT EXISTS `accounts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `bank_id` int(11) NOT NULL,
  `person_id` int(11) NOT NULL,
  `company_id` int(11) NOT NULL,
  `name` varchar(75) NOT NULL,
  `currency` varchar(3) NOT NULL,
  `balance` double NOT NULL,
  `number` varchar(20) NOT NULL,
  `account_type_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `bank_id` (`bank_id`),
  KEY `person_id` (`person_id`),
  KEY `company_id` (`company_id`),
  KEY `account_type_is` (`account_type_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

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

INSERT INTO `accounts` (`id`, `bank_id`, `person_id`, `company_id`, `name`, `currency`, `balance`, `number`, `account_type_id`) VALUES
(8, 1, 2, 0, 'Cuenta Corriente', '$U', 53015, '1234', 1),
(9, 1, 2, 0, 'Caja de Ahorro', '$U', 77553, '4321', 2);

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

--
-- Estructura de tabla para la tabla `account_types`
--

CREATE TABLE IF NOT EXISTS `account_types` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

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

INSERT INTO `account_types` (`id`, `name`) VALUES
(1, 'Cuenta Corriente'),
(2, 'Caja de Ahorro');

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

--
-- Estructura de tabla para la tabla `alerts`
--

CREATE TABLE IF NOT EXISTS `alerts` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(75) NOT NULL,
  `date` date NOT NULL,
  `time` time NOT NULL,
  `description` longtext NOT NULL,
  `alert_state_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `alert_states`
--

CREATE TABLE IF NOT EXISTS `alert_states` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

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

INSERT INTO `alert_states` (`id`, `name`) VALUES
(1, 'Activa'),
(2, 'Pendiente'),
(4, 'Finalizado');

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

--
-- Estructura de tabla para la tabla `banks`
--

CREATE TABLE IF NOT EXISTS `banks` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(75) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

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

INSERT INTO `banks` (`id`, `name`) VALUES
(1, 'Santander'),
(2, 'ITAU'),
(3, 'Comercial');

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

--
-- Estructura de tabla para la tabla `companies`
--

CREATE TABLE IF NOT EXISTS `companies` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(75) NOT NULL,
  `address` varchar(100) NOT NULL,
  `phone` varchar(25) NOT NULL,
  `email` varchar(25) NOT NULL,
  `web` varchar(35) NOT NULL,
  `rut` varchar(15) NOT NULL,
  `observations` longtext NOT NULL,
  `rate` int(3) DEFAULT NULL,
  `IVA` int(3) NOT NULL,
  `public_health` tinyint(1) NOT NULL DEFAULT '0',
  `company_group_id` int(11) DEFAULT '0',
  `estimate_days` int(3) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `company_group_id` (`company_group_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

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

INSERT INTO `companies` (`id`, `name`, `address`, `phone`, `email`, `web`, `rut`, `observations`, `rate`, `IVA`, `public_health`, `company_group_id`, `estimate_days`) VALUES
(3, 'UTE', '', '', 'info@ute.com.uy', 'www.ute.com.uy', '', 'Es UTE', NULL, 0, 0, 1, NULL),
(4, 'FEBYSOL', 'Trinidad', '099 364 343 / 4364 3027', 'piapedemonte@hotmail.com', 'feby.com.uy', '216129320012', '', 3, 0, 0, NULL, 60),
(5, 'Hospital de Flores', '', '', '', '', '', '', NULL, 0, 0, 1, NULL);

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

--
-- Estructura de tabla para la tabla `company_groups`
--

CREATE TABLE IF NOT EXISTS `company_groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

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

INSERT INTO `company_groups` (`id`, `name`) VALUES
(1, 'ASSE');

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

--
-- Estructura de tabla para la tabla `invoices`
--

CREATE TABLE IF NOT EXISTS `invoices` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `supplier_id` int(11) NOT NULL,
  `entity_id` int(11) NOT NULL,
  `invoice_number` varchar(20) NOT NULL,
  `transaction_id` int(11) NOT NULL,
  `invoice_date` date NOT NULL,
  `estimate_days` int(3) NOT NULL,
  `transaction_date` date NOT NULL,
  `expiration_date` date NOT NULL,
  `currency` varchar(3) NOT NULL,
  `subtotal` float NOT NULL,
  `total` float NOT NULL,
  `receivable_total` float NOT NULL,
  `is_OSE` tinyint(1) NOT NULL DEFAULT '0',
  `discount` int(3) NOT NULL,
  `is_done` tinyint(1) NOT NULL DEFAULT '0',
  `payment_generated` tinyint(1) NOT NULL DEFAULT '0',
  `parent_id` int(11) NOT NULL,
  `iva` int(3) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `supplier_id` (`supplier_id`,`entity_id`),
  KEY `transaction_id` (`transaction_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

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

INSERT INTO `invoices` (`id`, `supplier_id`, `entity_id`, `invoice_number`, `transaction_id`, `invoice_date`, `estimate_days`, `transaction_date`, `expiration_date`, `currency`, `subtotal`, `total`, `receivable_total`, `is_OSE`, `discount`, `is_done`, `payment_generated`, `parent_id`, `iva`) VALUES
(1, 4, 5, '2737', 2, '2014-08-12', 75, '2014-08-15', '2014-10-12', '$U', 67653, 0, 0, 0, 0, 1, 0, 0, 22);

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

--
-- Estructura de tabla para la tabla `invoice_files`
--

CREATE TABLE IF NOT EXISTS `invoice_files` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `file` varchar(255) NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `file_dir` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

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

--
-- Estructura de tabla para la tabla `payments`
--

CREATE TABLE IF NOT EXISTS `payments` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `date` date NOT NULL,
  `amount` float NOT NULL,
  `observations` longtext NOT NULL,
  `invoice_id` int(11) NOT NULL,
  `transaction_id` int(11) NOT NULL,
  `account_id` int(11) NOT NULL,
  `currency` varchar(3) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `invoice_id` (`invoice_id`),
  KEY `transaction_id` (`transaction_id`,`account_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

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

INSERT INTO `payments` (`id`, `date`, `amount`, `observations`, `invoice_id`, `transaction_id`, `account_id`, `currency`) VALUES
(1, '2014-08-15', 56985, 'jghjhvjhvjhv ', 0, 2, 8, '$U'),
(2, '2014-08-18', 67553, '100 menos', 1, 0, 9, '');

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

--
-- Estructura de tabla para la tabla `people`
--

CREATE TABLE IF NOT EXISTS `people` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(75) NOT NULL,
  `ci` varchar(15) NOT NULL,
  `phone` varchar(15) NOT NULL,
  `email` varchar(25) NOT NULL,
  `address` varchar(100) NOT NULL,
  `observations` longtext NOT NULL,
  `company_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `company_id` (`company_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

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

INSERT INTO `people` (`id`, `name`, `ci`, `phone`, `email`, `address`, `observations`, `company_id`) VALUES
(2, 'Emiliano', '3.456.789-4', '099 00 00 00', 'emiliano@kraken.uy', 'AV. Gral. Paz 1615', 'El admin del sistema', NULL),
(3, 'Pia Pedemonte', '', '', 'piapedemonte@hotmail.com', '', '', 4);

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

--
-- Estructura de tabla para la tabla `transactions`
--

CREATE TABLE IF NOT EXISTS `transactions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `created` datetime NOT NULL,
  `notary_amount` double NOT NULL,
  `is_paid` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

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

INSERT INTO `transactions` (`id`, `created`, `notary_amount`, `is_paid`) VALUES
(1, '2014-08-12 15:42:38', 0, 0),
(2, '2014-08-12 16:46:12', 4850, 1),
(3, '2014-08-12 17:21:12', 0, 0),
(4, '2014-08-12 17:40:45', 0, 0),
(5, '2014-08-12 17:41:10', 0, 0);

