CREATE TABLE `RES` (
  `res_id` int(11) NOT NULL AUTO_INCREMENT,
  `res_id_public` char(15) COLLATE utf8_spanish_ci NOT NULL,
  `res_hot_id` int(11) NOT NULL,
  `res_usr_id` int(11) NOT NULL,
  `res_channel` enum('---','reg','ids','web') COLLATE utf8_spanish_ci NOT NULL,
  `res_in` date DEFAULT NULL,
  `res_out` date DEFAULT NULL,
  `res_status` enum('---','0-Creando','1-Solicitando','2-Pagando','3-Verificando Pago','4-Confirmada','9-Reservada') COLLATE utf8_spanish_ci NOT NULL,
  `res_pax_names` char(0) COLLATE utf8_spanish_ci NOT NULL DEFAULT '',
  `res_pax_obs` char(0) COLLATE utf8_spanish_ci NOT NULL DEFAULT '',
  `res_status_obs` char(0) COLLATE utf8_spanish_ci NOT NULL DEFAULT '',
  `res_pay_method` enum('---','1-Tarjeta Crédito','2-Tarjeta Débito','3-Transferencia Misma Banco','4-Transferencia Interbancaria','5-Depósito Efectivo','6-Depósito Cheque','7-Cheques','8-Efectivo') COLLATE utf8_spanish_ci NOT NULL,
  `res_pay_currency` enum('---','Bs','BsF','US$','€') COLLATE utf8_spanish_ci NOT NULL,
  `res_cost` double NOT NULL DEFAULT '0',
  `res_cost_calc` double NOT NULL DEFAULT '0',
  `res_adults` int(11) NOT NULL DEFAULT '0',
  `res_children` int(11) NOT NULL DEFAULT '0',
  `res_active` bit(1) NOT NULL DEFAULT b'0',
  `res_canc_reason` enum('---','Abandonada','Cancelada hotel','Cancelada pasajero','No show','Pago insuficiente','Perdida','Pago invalido') COLLATE utf8_spanish_ci NOT NULL,
  `res_inv_name` char(40) COLLATE utf8_spanish_ci NOT NULL DEFAULT '',
  `res_inv_id` char(40) COLLATE utf8_spanish_ci NOT NULL DEFAULT '',
  `res_inv_city` char(40) COLLATE utf8_spanish_ci NOT NULL DEFAULT '',
  `res_inv_address` char(0) COLLATE utf8_spanish_ci NOT NULL DEFAULT '',
  `res_inv_ship_ser` enum('---','Oficina','Ipostel','Courier') COLLATE utf8_spanish_ci NOT NULL,
  `res_paid_amount` double NOT NULL DEFAULT '0',
  `res_paid_status` enum('---','1-Pago Parcial','2-Pago Total') COLLATE utf8_spanish_ci NOT NULL,
  `res_status_time` timestamp NOT NULL DEFAULT '1970-01-01 00:00:00',
  `res_lock_time` timestamp NULL DEFAULT NULL,
  `res_created` timestamp NOT NULL DEFAULT '1970-01-01 00:00:00',
  `res_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`res_id`),
  UNIQUE KEY `res_id_public` (`res_id_public`),
  KEY `res_hot_id` (`res_hot_id`),
  KEY `res_usr_id` (`res_usr_id`),
  CONSTRAINT `RES-HOT` FOREIGN KEY (`res_hot_id`) REFERENCES `HOT` (`hot_id`),
  CONSTRAINT `RES-USR` FOREIGN KEY (`res_usr_id`) REFERENCES `USR` (`usr_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci;