-- MySQL dump 10.13  Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: db.verdnatura.es    Database: edi
-- ------------------------------------------------------
-- Server version	5.6.25-4-log

/*!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 utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Current Database: `edi`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `edi` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;

USE `edi`;

--
-- Table structure for table `PriceDetails`
--

DROP TABLE IF EXISTS `PriceDetails`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `PriceDetails` (
  `ID` int(11) NOT NULL,
  `SuplyResponseID` int(11) NOT NULL,
  `PriceType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Price` decimal(10,2) DEFAULT NULL,
  `BasisQuantitiy` int(11) DEFAULT NULL,
  `BasisQuantityType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `MinimumQuantity` int(11) DEFAULT NULL,
  `MinimumQuantityType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `MaximumQuantity Integer` int(11) DEFAULT NULL,
  `MaximumQuantityType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `LatestDeliveryDateTime` datetime DEFAULT NULL,
  `EarliestDespatchDateTime` datetime DEFAULT NULL,
  `FirstOrderDateTime` datetime DEFAULT NULL,
  `LatestOrderDateTime` datetime DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `batch`
--

DROP TABLE IF EXISTS `batch`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `batch` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `message_id` int(10) unsigned NOT NULL,
  `type_id` smallint(5) unsigned NOT NULL,
  `buy_edi_id` int(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `type_id` (`type_id`,`buy_edi_id`),
  KEY `message_id` (`message_id`),
  KEY `buy_edi_id` (`buy_edi_id`),
  CONSTRAINT `batch_ibfk_1` FOREIGN KEY (`message_id`) REFERENCES `message` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `batch_ibfk_2` FOREIGN KEY (`buy_edi_id`) REFERENCES `vn2008`.`buy_edi` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=274346 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `batch_type`
--

DROP TABLE IF EXISTS `batch_type`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `batch_type` (
  `id` mediumint(8) unsigned NOT NULL,
  `description` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `bucket`
--

DROP TABLE IF EXISTS `bucket`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bucket` (
  `bucket_id` int(11) unsigned NOT NULL,
  `bucket_type_id` mediumint(8) unsigned NOT NULL,
  `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `x_size` mediumint(8) unsigned NOT NULL,
  `y_size` mediumint(8) unsigned NOT NULL,
  `z_size` mediumint(8) unsigned NOT NULL,
  `entry_date` date DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `change_date_time` datetime DEFAULT NULL,
  PRIMARY KEY (`bucket_id`),
  KEY `group_id` (`y_size`),
  KEY `plant_id` (`x_size`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/VBN020101/CK090916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `bucket_type`
--

DROP TABLE IF EXISTS `bucket_type`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bucket_type` (
  `bucket_type_id` mediumint(8) unsigned NOT NULL,
  `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `entry_date` date DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `change_date_time` datetime DEFAULT NULL,
  PRIMARY KEY (`bucket_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/VBN020101/FB090916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

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

DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
  `log_mail` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Mail where the log information is sent',
  `presale_id` mediumint(8) unsigned DEFAULT NULL,
  `default_kop` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `presale_id` (`presale_id`),
  CONSTRAINT `config_ibfk_1` FOREIGN KEY (`presale_id`) REFERENCES `batch_type` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `deliveryInformation`
--

DROP TABLE IF EXISTS `deliveryInformation`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `deliveryInformation` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `DeliveryType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `DeliveryPrice` decimal(10,2) DEFAULT NULL,
  `ChargeAmount` decimal(10,2) DEFAULT NULL,
  `BasisQuantitiy` int(11) DEFAULT NULL,
  `MinimumQuantity` int(11) DEFAULT NULL,
  `MaximumQuantity Integer` int(11) DEFAULT NULL,
  `LatestDeliveryDateTime` datetime DEFAULT NULL,
  `EarliestDespatchDateTime` datetime DEFAULT NULL,
  `FirstOrderDateTime` datetime DEFAULT NULL,
  `LatestOrderDateTime` datetime DEFAULT NULL,
  `supplyResponseID` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `feature`
--

DROP TABLE IF EXISTS `feature`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `feature` (
  `item_id` int(11) unsigned NOT NULL,
  `feature_type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
  `feature_value` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
  `entry_date` date NOT NULL,
  `expiry_date` date NOT NULL,
  `change_date_time` datetime NOT NULL,
  PRIMARY KEY (`item_id`,`feature_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FF130916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `file_config`
--

DROP TABLE IF EXISTS `file_config`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `file_config` (
  `file_name` varchar(2) COLLATE utf8_unicode_ci NOT NULL,
  `to_table` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
  `file` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `updated` date DEFAULT NULL,
  PRIMARY KEY (`file_name`),
  UNIQUE KEY `to_table` (`to_table`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `ftp_config`
--

DROP TABLE IF EXISTS `ftp_config`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ftp_config` (
  `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
  `host` varchar(255) CHARACTER SET utf8 NOT NULL,
  `user` varchar(50) CHARACTER SET utf8 NOT NULL,
  `password` varchar(50) CHARACTER SET utf8 NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `genus`
--

DROP TABLE IF EXISTS `genus`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `genus` (
  `genus_id` mediumint(8) unsigned NOT NULL,
  `latin_genus_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `entry_date` date DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `change_date_time` datetime DEFAULT NULL,
  PRIMARY KEY (`genus_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FG130916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `goodCharacteristic`
--

DROP TABLE IF EXISTS `goodCharacteristic`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `goodCharacteristic` (
  `supplyResponse` varchar(26) COLLATE utf8_unicode_ci NOT NULL,
  `type` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'edi.type',
  `value` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'edi.value',
  PRIMARY KEY (`supplyResponse`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `imap_config`
--

DROP TABLE IF EXISTS `imap_config`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `imap_config` (
  `id` tinyint(3) unsigned NOT NULL,
  `host` varchar(150) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'localhost',
  `user` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `pass` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `clean_period` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'How long the old mails are preserved',
  `success_folder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
  `error_folder` varchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='IMAP configuration parameters';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `item`
--

DROP TABLE IF EXISTS `item`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item` (
  `id` int(11) unsigned NOT NULL,
  `product_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `plant_id` mediumint(8) unsigned DEFAULT NULL,
  `group_id` int(11) DEFAULT NULL,
  `entry_date` date DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `change_date_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `group_id` (`group_id`),
  KEY `plant_id` (`plant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FP130916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `item_feature`
--

DROP TABLE IF EXISTS `item_feature`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_feature` (
  `item_id` int(11) NOT NULL,
  `presentation_order` tinyint(11) unsigned NOT NULL,
  `feature` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
  `regulation_type` tinyint(3) unsigned NOT NULL,
  `entry_date` date NOT NULL,
  `expiry_date` date DEFAULT NULL,
  `change_date_time` datetime NOT NULL,
  PRIMARY KEY (`item_id`,`presentation_order`,`entry_date`,`change_date_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FY130916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection  = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = '' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `item_feature_bi` BEFORE INSERT ON `item_feature` FOR EACH ROW
BEGIN
	IF NEW.expiry_date = '0000-00-00' THEN
		SET NEW.expiry_date = NULL;
	END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;

--
-- Table structure for table `item_group`
--

DROP TABLE IF EXISTS `item_group`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_group` (
  `group_code` int(11) unsigned NOT NULL,
  `dutch_group_description` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `entry_date` date NOT NULL,
  `expiry_date` date NOT NULL,
  `change_date_time` datetime NOT NULL,
  PRIMARY KEY (`group_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FO130916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `item_track`
--

DROP TABLE IF EXISTS `item_track`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_track` (
  `item_id` int(10) unsigned NOT NULL,
  `s1` tinyint(3) NOT NULL DEFAULT '0',
  `s2` tinyint(3) NOT NULL DEFAULT '0',
  `s3` tinyint(3) NOT NULL DEFAULT '0',
  `s4` tinyint(3) NOT NULL DEFAULT '0',
  `pac` tinyint(3) NOT NULL DEFAULT '0',
  `cat` tinyint(3) NOT NULL DEFAULT '0',
  `ori` tinyint(3) NOT NULL DEFAULT '0',
  `pro` tinyint(3) NOT NULL DEFAULT '0',
  `package` tinyint(3) NOT NULL DEFAULT '0',
  `s5` tinyint(3) NOT NULL DEFAULT '0',
  `s6` tinyint(3) NOT NULL DEFAULT '0',
  `kop` tinyint(3) NOT NULL DEFAULT '0',
  `sub` tinyint(3) NOT NULL DEFAULT '0',
  PRIMARY KEY (`item_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `mail`
--

DROP TABLE IF EXISTS `mail`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mail` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mail` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `kop` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `mail` (`mail`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='List of allowed mailers';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `message`
--

DROP TABLE IF EXISTS `message`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `message` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `sender_id` int(10) unsigned DEFAULT NULL,
  `mail_id` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `mail_id` (`mail_id`),
  KEY `sender_id` (`sender_id`),
  CONSTRAINT `message_ibfk_2` FOREIGN KEY (`sender_id`) REFERENCES `mail` (`id`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=293788 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `param`
--

DROP TABLE IF EXISTS `param`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `param` (
  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
  `subname` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
  `position` tinyint(3) unsigned NOT NULL DEFAULT '1',
  `type` enum('INTEGER','DOUBLE','STRING','DATE','TIME') COLLATE utf8_unicode_ci NOT NULL,
  `required` tinyint(3) unsigned NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`,`subname`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Parameters to capture of every exchange';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `plant`
--

DROP TABLE IF EXISTS `plant`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `plant` (
  `plant_id` mediumint(8) unsigned NOT NULL,
  `genus_id` mediumint(8) unsigned NOT NULL,
  `specie_id` mediumint(8) unsigned DEFAULT NULL,
  `entry_date` date DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `change_date_time` datetime DEFAULT NULL,
  PRIMARY KEY (`plant_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FT130916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `putOrder`
--

DROP TABLE IF EXISTS `putOrder`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `putOrder` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `deliveryInformationID` int(11) DEFAULT NULL,
  `supplyResponsID` int(11) DEFAULT NULL,
  `orderTradelineItemID` int(11) DEFAULT NULL COMMENT 'ticketFk',
  `OrderTradeLineDateTime` datetime DEFAULT NULL,
  `quantity` int(11) DEFAULT NULL,
  `EndUserPartyID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EndUserPartyGLN` tinyint(4) DEFAULT NULL,
  `OrderStatus` int(11) DEFAULT NULL COMMENT '1 pending\n2 confirmed\n3 canceled',
  `isOrderProcessed` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `orderTradelineItemID_UNIQUE` (`orderTradelineItemID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `specie`
--

DROP TABLE IF EXISTS `specie`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `specie` (
  `specie_id` mediumint(8) unsigned NOT NULL,
  `genus_id` mediumint(8) unsigned NOT NULL,
  `latin_species_name` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `entry_date` date DEFAULT NULL,
  `expiry_date` date DEFAULT NULL,
  `change_date_time` datetime DEFAULT NULL,
  PRIMARY KEY (`specie_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FS130916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `supplier`
--

DROP TABLE IF EXISTS `supplier`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `supplier` (
  `supplier_id` int(10) unsigned NOT NULL COMMENT 'FHRegistrationNr',
  `glnAddressCode` varchar(13) CHARACTER SET utf8 DEFAULT NULL,
  `company_name` varchar(70) COLLATE utf8_unicode_ci NOT NULL,
  `entry_date` date NOT NULL,
  `expiry_date` date NOT NULL,
  `change_date_time` datetime NOT NULL,
  PRIMARY KEY (`supplier_id`),
  KEY `glnaddressCodeidx` (`glnAddressCode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/FEC010104/CC090916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `supplyResponse`
--

DROP TABLE IF EXISTS `supplyResponse`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `supplyResponse` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `NumberBunchesPerCask` int(11) DEFAULT NULL,
  `SupplierGLN` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `NewItem` tinyint(1) DEFAULT NULL,
  `SendererID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ItemSupplierID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `TransactionDate` datetime DEFAULT NULL,
  `TransactionNumber` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `AuctionClockNumber` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `SupplierID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ItemDatesupplyResponsecol` datetime DEFAULT NULL,
  `Item_ArticleCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `VBNOmschrijving` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ExtraRemark` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ArtCodeType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `VBNGroupCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `VBNGroupDescription` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `TransactionTime` time DEFAULT NULL,
  `CountryOfOrigin` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `NumberOfItemsPerCask` int(11) DEFAULT NULL,
  `NumberOfLayersPerTrolley` int(11) DEFAULT NULL,
  `NumberOfUnits` int(11) DEFAULT NULL,
  `MinimumNumberToOrder` int(11) DEFAULT NULL,
  `MinimumOrderUnitType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Price` decimal(10,2) DEFAULT NULL,
  `PotSize` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Height` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Length` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Weight` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Quality` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `NumberOfBuds` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `NumberOfBudsPerStem` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ExaminiationCode1` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `ExaminiationCode2` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Diameter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PlantDiameter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Potshape` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `FlowerShape` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `FlowerColor` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PotColor` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PotMaterial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `MaterialHeight` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `MaterialDiameter` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `OtherMaterial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `OrderUnitType` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `EmbalageCode` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PictureReference` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `AgentGLN` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `MaximumNumberToOrder` int(11) DEFAULT NULL,
  `MaximumOrderType` tinyint(1) DEFAULT NULL COMMENT 'Unit: 1 = piece, 2 = bunch, 3 = box, 4 = layer, 5 = load carrier/trolley',
  `IncrementalOrderableQuantity` int(11) DEFAULT NULL,
  `IncrementalOrderableQuantityType` tinyint(1) DEFAULT NULL COMMENT 'Unit: 1 = piece, 2 = bunch, 3 = box, 4 = layer, 5 = load carrier/trolley',
  `PackingPrice` decimal(10,2) DEFAULT NULL,
  `PackingPriceType` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
  `PackingPriceQuantity` int(11) DEFAULT NULL,
  `PackingQuantityType` tinyint(1) DEFAULT NULL COMMENT 'Unit: 1 = piece, 2 = bunch, 3 = box, 4 = layer, 5 = load carrier/trolley',
  `MarketPlaceID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID_UNIQUE` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `type`
--

DROP TABLE IF EXISTS `type`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `type` (
  `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
  `type_group_id` tinyint(3) unsigned NOT NULL,
  `description` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
  `entry_date` date NOT NULL,
  `expiry_date` date NOT NULL,
  `change_date_time` datetime NOT NULL,
  PRIMARY KEY (`type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FE130916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `value`
--

DROP TABLE IF EXISTS `value`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `value` (
  `type_id` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
  `type_value` varchar(3) COLLATE utf8_unicode_ci NOT NULL,
  `type_description` varchar(70) COLLATE utf8_unicode_ci NOT NULL,
  `entry_date` date NOT NULL,
  `expiry_date` date NOT NULL,
  `change_date_time` datetime NOT NULL,
  PRIMARY KEY (`type_id`,`type_value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='/tmp/floricode/florecompc2/FV130916.txt';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Current Database: `vncontrol`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `vncontrol` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;

USE `vncontrol`;

--
-- Table structure for table `accion`
--

DROP TABLE IF EXISTS `accion`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `accion` (
  `accion_id` int(11) NOT NULL AUTO_INCREMENT,
  `accion` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (`accion_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `clientes_match`
--

DROP TABLE IF EXISTS `clientes_match`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clientes_match` (
  `Id_cliente` int(11) NOT NULL,
  `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `dailyTaskLog`
--

DROP TABLE IF EXISTS `dailyTaskLog`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dailyTaskLog` (
  `state` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='No he encontrado el lugar en el que vicente almacena la hora en que se ejecutan las daily tasks, asi que he hecho esta tabla, a eliminar cuando se considere oportuno';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `fallo`
--

DROP TABLE IF EXISTS `fallo`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fallo` (
  `queja_id` int(10) unsigned NOT NULL,
  `accion_id` int(11) NOT NULL,
  PRIMARY KEY (`queja_id`,`accion_id`),
  KEY `accion` (`accion_id`,`queja_id`),
  KEY `fallo` (`queja_id`),
  CONSTRAINT `accion` FOREIGN KEY (`accion_id`) REFERENCES `accion` (`accion_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `inter`
--

DROP TABLE IF EXISTS `inter`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `inter` (
  `inter_id` int(11) NOT NULL AUTO_INCREMENT,
  `state_id` tinyint(3) unsigned NOT NULL,
  `fallo_id` int(10) unsigned NOT NULL DEFAULT '21',
  `nota` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `odbc_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `Id_Ticket` int(11) DEFAULT NULL,
  `Id_Trabajador` int(11) DEFAULT NULL,
  `Id_Supervisor` int(11) DEFAULT NULL,
  PRIMARY KEY (`inter_id`),
  KEY `currante` (`Id_Trabajador`),
  KEY `responsable` (`Id_Supervisor`),
  KEY `ticket` (`Id_Ticket`),
  KEY `inter_state` (`state_id`),
  CONSTRAINT `currante` FOREIGN KEY (`Id_Trabajador`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE,
  CONSTRAINT `inter_ibfk_1` FOREIGN KEY (`Id_Ticket`) REFERENCES `vn2008`.`Tickets` (`Id_Ticket`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `inter_state` FOREIGN KEY (`state_id`) REFERENCES `vn2008`.`state` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `responsable` FOREIGN KEY (`Id_Supervisor`) REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=8715626 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection  = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `interBeforeInsert`
BEFORE INSERT ON `inter` FOR EACH ROW
BEGIN

	DECLARE contados INT;
	DECLARE vSupervisor INT;
    
	SELECT Id_Trabajador INTO vSupervisor FROM vn2008.Trabajadores WHERE user_id = account.userGetId();
    
    SET NEW.Id_Supervisor = IFNULL(vSupervisor,20);

	IF NEW.state_id = 5
    THEN 
		SELECT count(Id_Ticket) INTO contados
			FROM vncontrol.inter 
				WHERE state_id = 5
                AND Id_Ticket = NEW.Id_Ticket
                AND IFNULL(Id_Supervisor,-1) <> vSupervisor
                AND TIMESTAMPADD(SECOND, 60, odbc_date) >= NOW();
            
		IF contados <> 0 THEN
			CALL util.throw ('FALLO_AL_INSERTAR');
		END IF;
	END IF;
    
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection  = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vncontrol`.`interAfterInsert`
AFTER INSERT ON `inter` FOR EACH ROW
BEGIN
 REPLACE vn2008.Tickets_state(Id_Ticket, inter_id,state_name)
    SELECT NEW.Id_Ticket, NEW.inter_id, s.`name` FROM vn2008.state s WHERE s.id = NEW.state_id;
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection  = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vncontrol`.`interAfterUpdate`
AFTER UPDATE ON `inter` FOR EACH ROW
BEGIN
	DECLARE intIdTicket INT;
    DECLARE intInterId INT;
    DECLARE strName VARCHAR(15);
    
	IF (NEW.state_id <> OLD.state_id)  THEN
		REPLACE INTO vn2008.Tickets_state(Id_Ticket, inter_id,state_name)
			SELECT NEW.Id_Ticket, NEW.inter_id, s.`name` 
				FROM vn2008.state s WHERE s.id = NEW.state_id;
    END IF;
    IF (NEW.Id_Ticket <> OLD.Id_Ticket) THEN
	
		SELECT i.Id_Ticket, i.inter_id, s.`name`
		INTO intIdTicket, intInterId, strName 
			FROM vncontrol.inter i 
				JOIN vn2008.state s ON i.state_id = s.id 
			WHERE Id_Ticket = NEW.Id_Ticket 
			ORDER BY odbc_date DESC 
			LIMIT 1;
		IF intIdTicket > 0 THEN
			REPLACE INTO vn2008.Tickets_state(Id_Ticket, inter_id,state_name)
				VALUES(intIdTicket, intInterId, strName);
		END IF;
	END IF;
END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client      = @@character_set_client */ ;
/*!50003 SET @saved_cs_results     = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client  = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection  = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
/*!50003 SET sql_mode              = 'NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `vncontrol`.`interAfterDelete`
AFTER DELETE ON `inter` FOR EACH ROW
BEGIN
	DECLARE intIdTicket INT;
	DECLARE intInterId INT;
	DECLARE strName VARCHAR(15);

	DECLARE CONTINUE HANDLER FOR SQLSTATE '23000'
	BEGIN
		DELETE FROM vn2008.Tickets_state
			WHERE Id_Ticket = OLD.Id_Ticket;
	END;

	IF OLD.odbc_date > TIMESTAMPADD(WEEK, -1, CURDATE()) THEN
    
		SELECT i.Id_Ticket, i.inter_id, s.`name`
			INTO intIdTicket, intInterId, strName 
			FROM vncontrol.inter i 
				JOIN vn2008.state s ON i.state_id = s.id 
			WHERE Id_Ticket = OLD.Id_Ticket 
			ORDER BY odbc_date DESC 
			LIMIT 1;

		IF intIdTicket > 0 THEN
			REPLACE INTO vn2008.Tickets_state(Id_Ticket, inter_id,state_name)
				VALUES (intIdTicket, intInterId, strName);
		END IF;
        
	END IF;

END */;;
DELIMITER ;
/*!50003 SET sql_mode              = @saved_sql_mode */ ;
/*!50003 SET character_set_client  = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection  = @saved_col_connection */ ;

--
-- Current Database: `cache`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `cache` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;

USE `cache`;

--
-- Table structure for table `available`
--

DROP TABLE IF EXISTS `available`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `available` (
  `calc_id` int(10) unsigned NOT NULL,
  `item_id` int(11) NOT NULL,
  `available` int(11) NOT NULL,
  KEY `calc_id_4` (`calc_id`) USING BTREE,
  KEY `calc_id` (`item_id`,`calc_id`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `barcodes`
--

DROP TABLE IF EXISTS `barcodes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `barcodes` (
  `code` varchar(22) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `Id_Article` int(11) NOT NULL DEFAULT '0',
  `Article` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Medida` int(10) unsigned DEFAULT NULL,
  `Color` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Categoria` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL,
  `Producer` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cache`
--

DROP TABLE IF EXISTS `cache`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cache` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) CHARACTER SET utf8 NOT NULL,
  `lifetime` time NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cache_calc`
--

DROP TABLE IF EXISTS `cache_calc`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cache_calc` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `cache_id` int(10) unsigned NOT NULL,
  `cacheName` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
  `params` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `last_refresh` datetime DEFAULT NULL,
  `expires` datetime DEFAULT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `connection_id` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `cache_name` (`cache_id`,`params`),
  KEY `cache_id` (`cache_id`),
  KEY `cacheName` (`cacheName`),
  KEY `expires` (`expires`)
) ENGINE=InnoDB AUTO_INCREMENT=61385 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cache_valid`
--

DROP TABLE IF EXISTS `cache_valid`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cache_valid` (
  `valid` tinyint(3) unsigned NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `dailyTaskLog`
--

DROP TABLE IF EXISTS `dailyTaskLog`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dailyTaskLog` (
  `state` varchar(250) COLLATE utf8_unicode_ci NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='No he encontrado el lugar en el que vicente almacena la hora en que se ejecutan las daily tasks, asi que he hecho esta tabla, a eliminar cuando se considere oportuno';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `departure_limit`
--

DROP TABLE IF EXISTS `departure_limit`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `departure_limit` (
  `warehouse_id` smallint(6) unsigned NOT NULL,
  `fecha` date NOT NULL,
  `hora` int(11) NOT NULL DEFAULT '0',
  `minSpeed` decimal(10,2) NOT NULL DEFAULT '0.00',
  PRIMARY KEY (`warehouse_id`,`fecha`),
  CONSTRAINT `warehouse_departure` FOREIGN KEY (`warehouse_id`) REFERENCES `vn2008`.`warehouse` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `equalizator`
--

DROP TABLE IF EXISTS `equalizator`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `equalizator` (
  `warehouse_id` int(11) NOT NULL,
  `Vista` int(11) NOT NULL,
  `Pedido` int(11) DEFAULT NULL,
  `Impreso` int(11) DEFAULT NULL,
  `Encajado` int(11) DEFAULT NULL,
  PRIMARY KEY (`Vista`,`warehouse_id`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `itemTagFormat`
--

DROP TABLE IF EXISTS `itemTagFormat`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `itemTagFormat` (
  `itemFk` int(11) NOT NULL,
  `labels1` varchar(80) CHARACTER SET utf8 DEFAULT NULL,
  `values1` varchar(80) CHARACTER SET utf8 DEFAULT NULL,
  `labels2` varchar(80) CHARACTER SET utf8 DEFAULT NULL,
  `values2` varchar(80) CHARACTER SET utf8 DEFAULT NULL,
  `description` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
  PRIMARY KEY (`itemFk`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Almacena el formato para los tags de los articulos';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `item_range`
--

DROP TABLE IF EXISTS `item_range`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `item_range` (
  `calc_id` int(11) NOT NULL,
  `item_id` int(11) NOT NULL,
  `date_end` datetime DEFAULT NULL,
  KEY `calc_item` (`calc_id`,`item_id`),
  KEY `calc_id` (`calc_id`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `last_buy`
--

DROP TABLE IF EXISTS `last_buy`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `last_buy` (
  `item_id` int(10) unsigned NOT NULL,
  `warehouse_id` smallint(5) unsigned NOT NULL,
  `buy_id` int(10) unsigned DEFAULT NULL,
  `landing` date DEFAULT NULL,
  KEY `buy_id` (`buy_id`),
  KEY `item_id` (`item_id`,`warehouse_id`),
  KEY `warehouse_id` (`warehouse_id`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `prod_graphic_source`
--

DROP TABLE IF EXISTS `prod_graphic_source`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `prod_graphic_source` (
  `m3` double NOT NULL DEFAULT '0',
  `warehouse_id` int(11) NOT NULL,
  `hora` int(11) NOT NULL,
  `order` int(11) NOT NULL DEFAULT '0',
  `alert_level` int(11) NOT NULL DEFAULT '0',
  `Agencia` varchar(45) CHARACTER SET utf8 NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

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

DROP TABLE IF EXISTS `stock`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `stock` (
  `warehouse_id` smallint(5) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `amount` int(11) NOT NULL,
  KEY `warehouse_id` (`warehouse_id`,`item_id`),
  KEY `warehouse_id_2` (`warehouse_id`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `visible`
--

DROP TABLE IF EXISTS `visible`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `visible` (
  `calc_id` int(10) unsigned NOT NULL,
  `item_id` int(11) NOT NULL,
  `visible` int(11) NOT NULL,
  KEY `id` (`calc_id`) USING BTREE,
  KEY `calc_id` (`calc_id`,`item_id`)
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `weekly_sales`
--

DROP TABLE IF EXISTS `weekly_sales`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `weekly_sales` (
  `week` int(10) unsigned NOT NULL,
  `item_id` int(10) unsigned NOT NULL,
  `warehouse_id` smallint(5) unsigned NOT NULL,
  `amount` int(11) NOT NULL,
  `price` double NOT NULL,
  KEY `item_id` (`item_id`,`warehouse_id`),
  KEY `week` (`week`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Current Database: `bi`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bi` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;

USE `bi`;

--
-- Temporary view structure for view `analisis_grafico_ventas`
--

DROP TABLE IF EXISTS `analisis_grafico_ventas`;
/*!50001 DROP VIEW IF EXISTS `analisis_grafico_ventas`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `analisis_grafico_ventas` AS SELECT 
 1 AS `Año`,
 1 AS `Semana`,
 1 AS `Importe`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `analisis_ventas_simple`
--

DROP TABLE IF EXISTS `analisis_ventas_simple`;
/*!50001 DROP VIEW IF EXISTS `analisis_ventas_simple`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `analisis_ventas_simple` AS SELECT 
 1 AS `Año`,
 1 AS `Semana`,
 1 AS `Importe`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `customerRiskOverdue`
--

DROP TABLE IF EXISTS `customerRiskOverdue`;
/*!50001 DROP VIEW IF EXISTS `customerRiskOverdue`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `customerRiskOverdue` AS SELECT 
 1 AS `customer_id`,
 1 AS `amount`,
 1 AS `company_id`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `last_Id_Cubo`
--

DROP TABLE IF EXISTS `last_Id_Cubo`;
/*!50001 DROP VIEW IF EXISTS `last_Id_Cubo`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `last_Id_Cubo` AS SELECT 
 1 AS `Id_Compra`,
 1 AS `Id_Article`,
 1 AS `warehouse_id`,
 1 AS `Id_Cubo`,
 1 AS `Packing`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `v_clientes_jerarquia`
--

DROP TABLE IF EXISTS `v_clientes_jerarquia`;
/*!50001 DROP VIEW IF EXISTS `v_clientes_jerarquia`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `v_clientes_jerarquia` AS SELECT 
 1 AS `Id_Cliente`,
 1 AS `Cliente`,
 1 AS `Comercial`,
 1 AS `Jefe`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `v_ventas_contables`
--

DROP TABLE IF EXISTS `v_ventas_contables`;
/*!50001 DROP VIEW IF EXISTS `v_ventas_contables`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `v_ventas_contables` AS SELECT 
 1 AS `year`,
 1 AS `month`,
 1 AS `importe`*/;
SET character_set_client = @saved_cs_client;
--
-- Current Database: `pbx`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `pbx` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;

USE `pbx`;

--
-- Temporary view structure for view `cdrConf`
--

DROP TABLE IF EXISTS `cdrConf`;
/*!50001 DROP VIEW IF EXISTS `cdrConf`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `cdrConf` AS SELECT 
 1 AS `calldate`,
 1 AS `clid`,
 1 AS `src`,
 1 AS `dst`,
 1 AS `dcontext`,
 1 AS `channel`,
 1 AS `dstchannel`,
 1 AS `lastapp`,
 1 AS `lastdata`,
 1 AS `duration`,
 1 AS `billsec`,
 1 AS `disposition`,
 1 AS `amaflags`,
 1 AS `accountcode`,
 1 AS `uniqueid`,
 1 AS `userfield`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `followmeConf`
--

DROP TABLE IF EXISTS `followmeConf`;
/*!50001 DROP VIEW IF EXISTS `followmeConf`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `followmeConf` AS SELECT 
 1 AS `name`,
 1 AS `music`,
 1 AS `context`,
 1 AS `takecall`,
 1 AS `declinecall`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `followmeNumberConf`
--

DROP TABLE IF EXISTS `followmeNumberConf`;
/*!50001 DROP VIEW IF EXISTS `followmeNumberConf`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `followmeNumberConf` AS SELECT 
 1 AS `name`,
 1 AS `ordinal`,
 1 AS `phonenumber`,
 1 AS `timeout`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `queueConf`
--

DROP TABLE IF EXISTS `queueConf`;
/*!50001 DROP VIEW IF EXISTS `queueConf`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `queueConf` AS SELECT 
 1 AS `name`,
 1 AS `strategy`,
 1 AS `timeout`,
 1 AS `retry`,
 1 AS `weight`,
 1 AS `maxlen`,
 1 AS `ringinuse`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `queueMemberConf`
--

DROP TABLE IF EXISTS `queueMemberConf`;
/*!50001 DROP VIEW IF EXISTS `queueMemberConf`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `queueMemberConf` AS SELECT 
 1 AS `uniqueid`,
 1 AS `queue_name`,
 1 AS `interface`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `sipConf`
--

DROP TABLE IF EXISTS `sipConf`;
/*!50001 DROP VIEW IF EXISTS `sipConf`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `sipConf` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `secret`,
 1 AS `callerid`,
 1 AS `host`,
 1 AS `deny`,
 1 AS `permit`,
 1 AS `type`,
 1 AS `context`,
 1 AS `incominglimit`,
 1 AS `pickupgroup`,
 1 AS `careinvite`,
 1 AS `ipaddr`,
 1 AS `regseconds`,
 1 AS `port`,
 1 AS `defaultuser`,
 1 AS `useragent`,
 1 AS `lastms`,
 1 AS `fullcontact`,
 1 AS `regserver`*/;
SET character_set_client = @saved_cs_client;

--
-- Current Database: `salix`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `salix` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;

USE `salix`;

--
-- Temporary view structure for view `Account`
--

DROP TABLE IF EXISTS `Account`;
/*!50001 DROP VIEW IF EXISTS `Account`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Account` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `password`,
 1 AS `roleFk`,
 1 AS `active`,
 1 AS `email`,
 1 AS `created`,
 1 AS `updated`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Accounting`
--

DROP TABLE IF EXISTS `Accounting`;
/*!50001 DROP VIEW IF EXISTS `Accounting`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Accounting` AS SELECT 
 1 AS `id`,
 1 AS `bank`,
 1 AS `account`,
 1 AS `accountingTypeFk`,
 1 AS `entityFk`,
 1 AS `isActive`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Address`
--

DROP TABLE IF EXISTS `Address`;
/*!50001 DROP VIEW IF EXISTS `Address`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Address` AS SELECT 
 1 AS `id`,
 1 AS `consignee`,
 1 AS `street`,
 1 AS `city`,
 1 AS `postcode`,
 1 AS `provinceFk`,
 1 AS `phone`,
 1 AS `mobile`,
 1 AS `isEnabled`,
 1 AS `isDefaultAddress`,
 1 AS `clientFk`,
 1 AS `defaultAgencyFk`,
 1 AS `longitude`,
 1 AS `latitude`,
 1 AS `isEqualizated`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Agency`
--

DROP TABLE IF EXISTS `Agency`;
/*!50001 DROP VIEW IF EXISTS `Agency`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Agency` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `warehouseFk`,
 1 AS `isVolumetric`,
 1 AS `bankFk`,
 1 AS `warehouseAliasFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `AgencyMode`
--

DROP TABLE IF EXISTS `AgencyMode`;
/*!50001 DROP VIEW IF EXISTS `AgencyMode`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `AgencyMode` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `description`,
 1 AS `agencyTypeFk`,
 1 AS `m3`,
 1 AS `agencyFk`,
 1 AS `inflation`,
 1 AS `sendMailTo`,
 1 AS `isForTicket`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Bank`
--

DROP TABLE IF EXISTS `Bank`;
/*!50001 DROP VIEW IF EXISTS `Bank`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Bank` AS SELECT 
 1 AS `id`,
 1 AS `bank`,
 1 AS `account`,
 1 AS `cash`,
 1 AS `entityFk`,
 1 AS `isActive`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `City`
--

DROP TABLE IF EXISTS `City`;
/*!50001 DROP VIEW IF EXISTS `City`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `City` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `provinceFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Client`
--

DROP TABLE IF EXISTS `Client`;
/*!50001 DROP VIEW IF EXISTS `Client`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Client` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `fi`,
 1 AS `socialName`,
 1 AS `contact`,
 1 AS `street`,
 1 AS `city`,
 1 AS `postcode`,
 1 AS `provinceFk`,
 1 AS `countryFk`,
 1 AS `email`,
 1 AS `phone`,
 1 AS `mobile`,
 1 AS `fax`,
 1 AS `active`,
 1 AS `discount`,
 1 AS `credit`,
 1 AS `creditInsurance`,
 1 AS `iban`,
 1 AS `dueDay`,
 1 AS `equalizationTax`,
 1 AS `hasToInvoice`,
 1 AS `invoiceByEmail`,
 1 AS `payMethodFk`,
 1 AS `salesPersonFk`,
 1 AS `contactChannelFk`,
 1 AS `sepaVnl`,
 1 AS `coreVnl`,
 1 AS `coreVnh`,
 1 AS `eypbc`,
 1 AS `quality`,
 1 AS `vies`,
 1 AS `isRelevant`,
 1 AS `typeFk`,
 1 AS `accountingAccount`,
 1 AS `created`,
 1 AS `hasToInvoiceByAddress`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `ClientCredit`
--

DROP TABLE IF EXISTS `ClientCredit`;
/*!50001 DROP VIEW IF EXISTS `ClientCredit`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `ClientCredit` AS SELECT 
 1 AS `id`,
 1 AS `clientFk`,
 1 AS `employeeFk`,
 1 AS `amount`,
 1 AS `created`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `ClientCreditLimit`
--

DROP TABLE IF EXISTS `ClientCreditLimit`;
/*!50001 DROP VIEW IF EXISTS `ClientCreditLimit`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `ClientCreditLimit` AS SELECT 
 1 AS `id`,
 1 AS `maxAmount`,
 1 AS `roleFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `ClientObservation`
--

DROP TABLE IF EXISTS `ClientObservation`;
/*!50001 DROP VIEW IF EXISTS `ClientObservation`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `ClientObservation` AS SELECT 
 1 AS `id`,
 1 AS `clientFk`,
 1 AS `employeeFk`,
 1 AS `text`,
 1 AS `created`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `ClientType`
--

DROP TABLE IF EXISTS `ClientType`;
/*!50001 DROP VIEW IF EXISTS `ClientType`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `ClientType` AS SELECT 
 1 AS `id`,
 1 AS `code`,
 1 AS `type`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `ContactChannel`
--

DROP TABLE IF EXISTS `ContactChannel`;
/*!50001 DROP VIEW IF EXISTS `ContactChannel`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `ContactChannel` AS SELECT 
 1 AS `id`,
 1 AS `name`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Country`
--

DROP TABLE IF EXISTS `Country`;
/*!50001 DROP VIEW IF EXISTS `Country`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Country` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `inCee`,
 1 AS `code`,
 1 AS `currencyFk`,
 1 AS `realCountryFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `CreditClassification`
--

DROP TABLE IF EXISTS `CreditClassification`;
/*!50001 DROP VIEW IF EXISTS `CreditClassification`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `CreditClassification` AS SELECT 
 1 AS `id`,
 1 AS `clientFk`,
 1 AS `started`,
 1 AS `ended`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Delivery`
--

DROP TABLE IF EXISTS `Delivery`;
/*!50001 DROP VIEW IF EXISTS `Delivery`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Delivery` AS SELECT 
 1 AS `id`,
 1 AS `date`,
 1 AS `m3`,
 1 AS `warehouseFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Employee`
--

DROP TABLE IF EXISTS `Employee`;
/*!50001 DROP VIEW IF EXISTS `Employee`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Employee` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `surname`,
 1 AS `userFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `PayMethod`
--

DROP TABLE IF EXISTS `PayMethod`;
/*!50001 DROP VIEW IF EXISTS `PayMethod`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `PayMethod` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `graceDays`,
 1 AS `outstandingDebt`,
 1 AS `ibanRequired`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Province`
--

DROP TABLE IF EXISTS `Province`;
/*!50001 DROP VIEW IF EXISTS `Province`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Province` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `countryFk`,
 1 AS `warehouseFk`,
 1 AS `zoneFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Role`
--

DROP TABLE IF EXISTS `Role`;
/*!50001 DROP VIEW IF EXISTS `Role`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Role` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `description`,
 1 AS `created`,
 1 AS `modified`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `RoleMapping`
--

DROP TABLE IF EXISTS `RoleMapping`;
/*!50001 DROP VIEW IF EXISTS `RoleMapping`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `RoleMapping` AS SELECT 
 1 AS `id`,
 1 AS `principalType`,
 1 AS `principalId`,
 1 AS `roleId`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Route`
--

DROP TABLE IF EXISTS `Route`;
/*!50001 DROP VIEW IF EXISTS `Route`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Route` AS SELECT 
 1 AS `id`,
 1 AS `date`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `State`
--

DROP TABLE IF EXISTS `State`;
/*!50001 DROP VIEW IF EXISTS `State`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `State` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `order`,
 1 AS `alertLevel`,
 1 AS `code`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Ticket`
--

DROP TABLE IF EXISTS `Ticket`;
/*!50001 DROP VIEW IF EXISTS `Ticket`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Ticket` AS SELECT 
 1 AS `id`,
 1 AS `agencyFk`,
 1 AS `employeeFk`,
 1 AS `date`,
 1 AS `hour`,
 1 AS `clientFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `TicketState`
--

DROP TABLE IF EXISTS `TicketState`;
/*!50001 DROP VIEW IF EXISTS `TicketState`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `TicketState` AS SELECT 
 1 AS `id`,
 1 AS `ticketFk`,
 1 AS `stateFk`,
 1 AS `employeeFk`,
 1 AS `updated`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Vehicle`
--

DROP TABLE IF EXISTS `Vehicle`;
/*!50001 DROP VIEW IF EXISTS `Vehicle`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Vehicle` AS SELECT 
 1 AS `id`,
 1 AS `numberPlate`,
 1 AS `tradeMark`,
 1 AS `model`,
 1 AS `companyFk`,
 1 AS `warehouseFk`,
 1 AS `description`,
 1 AS `m3`,
 1 AS `isActive`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Warehouse`
--

DROP TABLE IF EXISTS `Warehouse`;
/*!50001 DROP VIEW IF EXISTS `Warehouse`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Warehouse` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `tpv`,
 1 AS `inventory`,
 1 AS `isManaged`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `WarehouseAlias`
--

DROP TABLE IF EXISTS `WarehouseAlias`;
/*!50001 DROP VIEW IF EXISTS `WarehouseAlias`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `WarehouseAlias` AS SELECT 
 1 AS `id`,
 1 AS `name`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Worker`
--

DROP TABLE IF EXISTS `Worker`;
/*!50001 DROP VIEW IF EXISTS `Worker`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Worker` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `surname`,
 1 AS `userFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `Zone`
--

DROP TABLE IF EXISTS `Zone`;
/*!50001 DROP VIEW IF EXISTS `Zone`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `Zone` AS SELECT 
 1 AS `id`,
 1 AS `name`,
 1 AS `printingOrder`*/;
SET character_set_client = @saved_cs_client;

--
-- Current Database: `hedera`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `hedera` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;

USE `hedera`;

--
-- Temporary view structure for view `address_view`
--

DROP TABLE IF EXISTS `address_view`;
/*!50001 DROP VIEW IF EXISTS `address_view`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `address_view` AS SELECT 
 1 AS `id`,
 1 AS `customer_id`,
 1 AS `warehouse_id`,
 1 AS `name`,
 1 AS `city`,
 1 AS `province_id`,
 1 AS `zip_code`,
 1 AS `consignee`,
 1 AS `default`,
 1 AS `type_id`,
 1 AS `specs`,
 1 AS `insurance`,
 1 AS `postage`,
 1 AS `active`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `basket`
--

DROP TABLE IF EXISTS `basket`;
/*!50001 DROP VIEW IF EXISTS `basket`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `basket` AS SELECT 
 1 AS `id`,
 1 AS `date_make`,
 1 AS `date_send`,
 1 AS `customer_id`,
 1 AS `delivery_method_id`,
 1 AS `agency_id`,
 1 AS `address_id`,
 1 AS `company_id`,
 1 AS `note`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `basket_defaults`
--

DROP TABLE IF EXISTS `basket_defaults`;
/*!50001 DROP VIEW IF EXISTS `basket_defaults`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `basket_defaults` AS SELECT 
 1 AS `address_id`,
 1 AS `agency_id`,
 1 AS `delivery_method`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `basket_item`
--

DROP TABLE IF EXISTS `basket_item`;
/*!50001 DROP VIEW IF EXISTS `basket_item`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `basket_item` AS SELECT 
 1 AS `id`,
 1 AS `order_id`,
 1 AS `warehouse_id`,
 1 AS `item_id`,
 1 AS `amount`,
 1 AS `price`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `customer_view`
--

DROP TABLE IF EXISTS `customer_view`;
/*!50001 DROP VIEW IF EXISTS `customer_view`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `customer_view` AS SELECT 
 1 AS `user_id`,
 1 AS `name`,
 1 AS `email`,
 1 AS `mail`,
 1 AS `default_address`,
 1 AS `credit`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `invoice_view`
--

DROP TABLE IF EXISTS `invoice_view`;
/*!50001 DROP VIEW IF EXISTS `invoice_view`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `invoice_view` AS SELECT 
 1 AS `invoice_id`,
 1 AS `serial_num`,
 1 AS `issued`,
 1 AS `amount`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `myAddress`
--

DROP TABLE IF EXISTS `myAddress`;
/*!50001 DROP VIEW IF EXISTS `myAddress`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `myAddress` AS SELECT 
 1 AS `id`,
 1 AS `clientFk`,
 1 AS `street`,
 1 AS `city`,
 1 AS `postalCode`,
 1 AS `provinceFk`,
 1 AS `nickname`,
 1 AS `isDefaultAddress`,
 1 AS `isActive`,
 1 AS `longitude`,
 1 AS `latitude`,
 1 AS `warehouseFk`,
 1 AS `agencyFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `myClient`
--

DROP TABLE IF EXISTS `myClient`;
/*!50001 DROP VIEW IF EXISTS `myClient`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `myClient` AS SELECT 
 1 AS `id`,
 1 AS `isToBeMailed`,
 1 AS `defaultAddressFk`,
 1 AS `credit`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `myInvoice`
--

DROP TABLE IF EXISTS `myInvoice`;
/*!50001 DROP VIEW IF EXISTS `myInvoice`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `myInvoice` AS SELECT 
 1 AS `id`,
 1 AS `ref`,
 1 AS `issued`,
 1 AS `amount`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `myMenu`
--

DROP TABLE IF EXISTS `myMenu`;
/*!50001 DROP VIEW IF EXISTS `myMenu`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `myMenu` AS SELECT 
 1 AS `id`,
 1 AS `path`,
 1 AS `description`,
 1 AS `parentFk`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `myTpvTransaction`
--

DROP TABLE IF EXISTS `myTpvTransaction`;
/*!50001 DROP VIEW IF EXISTS `myTpvTransaction`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `myTpvTransaction` AS SELECT 
 1 AS `id`,
 1 AS `merchantFk`,
 1 AS `clientFk`,
 1 AS `receiptFk`,
 1 AS `amount`,
 1 AS `response`,
 1 AS `status`,
 1 AS `created`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `order_basket`
--

DROP TABLE IF EXISTS `order_basket`;
/*!50001 DROP VIEW IF EXISTS `order_basket`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `order_basket` AS SELECT 
 1 AS `customer_id`,
 1 AS `order_id`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `order_component`
--

DROP TABLE IF EXISTS `order_component`;
/*!50001 DROP VIEW IF EXISTS `order_component`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `order_component` AS SELECT 
 1 AS `order_row_id`,
 1 AS `component_id`,
 1 AS `price`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `order_confirm_time`
--

DROP TABLE IF EXISTS `order_confirm_time`;
/*!50001 DROP VIEW IF EXISTS `order_confirm_time`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `order_confirm_time` AS SELECT 
 1 AS `date_make`,
 1 AS `source_app`,
 1 AS `customer_id`,
 1 AS `confirm_date`,
 1 AS `first_row_stamp`,
 1 AS `minutos`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `order_row`
--

DROP TABLE IF EXISTS `order_row`;
/*!50001 DROP VIEW IF EXISTS `order_row`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `order_row` AS SELECT 
 1 AS `id`,
 1 AS `order_id`,
 1 AS `item_id`,
 1 AS `warehouse_id`,
 1 AS `shipment`,
 1 AS `amount`,
 1 AS `price`,
 1 AS `rate`,
 1 AS `created`,
 1 AS `Id_Movimiento`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `order_row_view`
--

DROP TABLE IF EXISTS `order_row_view`;
/*!50001 DROP VIEW IF EXISTS `order_row_view`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `order_row_view` AS SELECT 
 1 AS `id`,
 1 AS `order_id`,
 1 AS `warehouse_id`,
 1 AS `item_id`,
 1 AS `amount`,
 1 AS `price2`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `order_view`
--

DROP TABLE IF EXISTS `order_view`;
/*!50001 DROP VIEW IF EXISTS `order_view`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `order_view` AS SELECT 
 1 AS `id`,
 1 AS `date_make`,
 1 AS `date_send`,
 1 AS `customer_id`,
 1 AS `delivery_method_id`,
 1 AS `agency_id`,
 1 AS `note`,
 1 AS `address_id`,
 1 AS `company_id`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `user_android`
--

DROP TABLE IF EXISTS `user_android`;
/*!50001 DROP VIEW IF EXISTS `user_android`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `user_android` AS SELECT 
 1 AS `android_id`,
 1 AS `user_id`*/;
SET character_set_client = @saved_cs_client;

--
-- Current Database: `bs`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `bs` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;

USE `bs`;

--
-- Temporary view structure for view `VentasPorCliente`
--

DROP TABLE IF EXISTS `VentasPorCliente`;
/*!50001 DROP VIEW IF EXISTS `VentasPorCliente`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `VentasPorCliente` AS SELECT 
 1 AS `Id_Cliente`,
 1 AS `VentaBasica`,
 1 AS `year`,
 1 AS `month`*/;
SET character_set_client = @saved_cs_client;

--
-- Temporary view structure for view `v_ventas`
--

DROP TABLE IF EXISTS `v_ventas`;
/*!50001 DROP VIEW IF EXISTS `v_ventas`*/;
SET @saved_cs_client     = @@character_set_client;
SET character_set_client = utf8;
/*!50001 CREATE VIEW `v_ventas` AS SELECT 
 1 AS `importe`,
 1 AS `recargo`,
 1 AS `year`,
 1 AS `month`,
 1 AS `week`,
 1 AS `day`*/;
SET character_set_client = @saved_cs_client;

--
-- Current Database: `edi`
--

USE `edi`;

--
-- Current Database: `vncontrol`
--

USE `vncontrol`;

--
-- Current Database: `cache`
--

USE `cache`;

--
-- Current Database: `bi`
--

USE `bi`;

--
-- Final view structure for view `analisis_grafico_ventas`
--

/*!50001 DROP VIEW IF EXISTS `analisis_grafico_ventas`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `analisis_grafico_ventas` AS select `analisis_ventas`.`Año` AS `Año`,`analisis_ventas`.`Semana` AS `Semana`,sum(`analisis_ventas`.`Importe`) AS `Importe` from `analisis_ventas` group by `analisis_ventas`.`Año`,`analisis_ventas`.`Semana` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `analisis_ventas_simple`
--

/*!50001 DROP VIEW IF EXISTS `analisis_ventas_simple`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `analisis_ventas_simple` AS select `analisis_ventas`.`Año` AS `Año`,`analisis_ventas`.`Semana` AS `Semana`,sum(`analisis_ventas`.`Importe`) AS `Importe` from `analisis_ventas` group by `analisis_ventas`.`Año`,`analisis_ventas`.`Semana` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `customerRiskOverdue`
--

/*!50001 DROP VIEW IF EXISTS `customerRiskOverdue`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `customerRiskOverdue` AS select `cr`.`customer_id` AS `customer_id`,`cr`.`amount` AS `amount`,`cr`.`company_id` AS `company_id` from (((`bi`.`customer_risk` `cr` join `vn2008`.`empresa` `e` on((`e`.`id` = `cr`.`company_id`))) join `vn2008`.`Clientes` `c` on((`cr`.`customer_id` = `c`.`id_cliente`))) join `vn2008`.`pay_met` `pm` on((`pm`.`id` = `c`.`pay_met_id`))) where (`cr`.`amount` and `e`.`morosidad` and `pm`.`deudaviva`) union all select `f`.`Id_Cliente` AS `Id_Cliente`,-(round(`f`.`Importe`,2)) AS `importe`,`f`.`empresa_id` AS `empresa_id` from (((`vn2008`.`Facturas` `f` join `vn2008`.`Clientes` `c` on((`f`.`Id_Cliente` = `c`.`id_cliente`))) join `vn2008`.`empresa` `e` on((`e`.`id` = `f`.`empresa_id`))) join `vn2008`.`pay_met` `pm` on((`pm`.`id` = `c`.`pay_met_id`))) where ((`f`.`Fecha` > (curdate() + interval -(101) day)) and ((`vn2008`.`paymentday`(`f`.`Fecha`,`c`.`vencimiento`) + interval `pm`.`graceDays` day) > curdate()) and (`f`.`Importe` > 0) and `e`.`morosidad` and `pm`.`deudaviva`) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `last_Id_Cubo`
--

/*!50001 DROP VIEW IF EXISTS `last_Id_Cubo`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `last_Id_Cubo` AS select `C`.`Id_Compra` AS `Id_Compra`,`C`.`Id_Article` AS `Id_Article`,`tr`.`warehouse_id` AS `warehouse_id`,`C`.`Id_Cubo` AS `Id_Cubo`,`C`.`Packing` AS `Packing` from ((`vn2008`.`Compres` `C` join `vn2008`.`Entradas` `E` on((`C`.`Id_Entrada` = `E`.`Id_Entrada`))) join `vn2008`.`travel` `tr` on((`E`.`travel_id` = `tr`.`id`))) where ((`C`.`Id_Cubo` is not null) and (`C`.`Id_Cubo` <> '--') and (`tr`.`landing` > (curdate() - interval 18 month))) order by `C`.`Id_Compra` desc */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `v_clientes_jerarquia`
--

/*!50001 DROP VIEW IF EXISTS `v_clientes_jerarquia`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_clientes_jerarquia` AS select `c`.`id_cliente` AS `Id_Cliente`,`c`.`cliente` AS `Cliente`,`t`.`CodigoTrabajador` AS `Comercial`,`tj`.`CodigoTrabajador` AS `Jefe` from (((`vn2008`.`Clientes` `c` join `vn2008`.`Trabajadores` `t` on((`t`.`Id_Trabajador` = `c`.`Id_Trabajador`))) join `vn2008`.`jerarquia` on((`vn2008`.`jerarquia`.`worker_id` = `c`.`Id_Trabajador`))) join `vn2008`.`Trabajadores` `tj` on((`tj`.`Id_Trabajador` = `vn2008`.`jerarquia`.`boss_id`))) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `v_ventas_contables`
--

/*!50001 DROP VIEW IF EXISTS `v_ventas_contables`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_ventas_contables` AS select `vn2008`.`time`.`year` AS `year`,`vn2008`.`time`.`month` AS `month`,cast(sum((((`m`.`Cantidad` * `m`.`Preu`) * (100 - `m`.`Descuento`)) / 100)) as decimal(10,0)) AS `importe` from (((`vn2008`.`Tickets` `t` join `bi`.`f_tvc` on((`t`.`Id_Ticket` = `bi`.`f_tvc`.`Id_Ticket`))) join `vn2008`.`Movimientos` `m` on((`t`.`Id_Ticket` = `m`.`Id_Ticket`))) join `vn2008`.`time` on((`vn2008`.`time`.`date` = cast(`t`.`Fecha` as date)))) where (`t`.`Fecha` >= '2014-01-01') group by `vn2008`.`time`.`year`,`vn2008`.`time`.`month` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;
--
-- Current Database: `pbx`
--

USE `pbx`;

--
-- Final view structure for view `cdrConf`
--

/*!50001 DROP VIEW IF EXISTS `cdrConf`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `cdrConf` AS select `c`.`call_date` AS `calldate`,`c`.`clid` AS `clid`,`c`.`src` AS `src`,`c`.`dst` AS `dst`,`c`.`dcontext` AS `dcontext`,`c`.`channel` AS `channel`,`c`.`dst_channel` AS `dstchannel`,`c`.`last_app` AS `lastapp`,`c`.`last_data` AS `lastdata`,`c`.`duration` AS `duration`,`c`.`billsec` AS `billsec`,`c`.`disposition` AS `disposition`,`c`.`ama_flags` AS `amaflags`,`c`.`account_code` AS `accountcode`,`c`.`unique_id` AS `uniqueid`,`c`.`user_field` AS `userfield` from `cdr` `c` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `followmeConf`
--

/*!50001 DROP VIEW IF EXISTS `followmeConf`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `followmeConf` AS select `f`.`extension` AS `name`,`c`.`music` AS `music`,`c`.`context` AS `context`,`c`.`takeCall` AS `takecall`,`c`.`declineCall` AS `declinecall` from (`followme` `f` join `followmeConfig` `c`) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `followmeNumberConf`
--

/*!50001 DROP VIEW IF EXISTS `followmeNumberConf`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `followmeNumberConf` AS select `f`.`extension` AS `name`,1 AS `ordinal`,`f`.`phone` AS `phonenumber`,`c`.`timeout` AS `timeout` from (`followme` `f` join `followmeConfig` `c`) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `queueConf`
--

/*!50001 DROP VIEW IF EXISTS `queueConf`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `queueConf` AS select `q`.`name` AS `name`,`c`.`strategy` AS `strategy`,`c`.`timeout` AS `timeout`,`c`.`retry` AS `retry`,`c`.`weight` AS `weight`,`c`.`maxLen` AS `maxlen`,`c`.`ringInUse` AS `ringinuse` from (`queue` `q` join `queueConfig` `c` on((`q`.`config` = `c`.`id`))) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `queueMemberConf`
--

/*!50001 DROP VIEW IF EXISTS `queueMemberConf`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `queueMemberConf` AS select `m`.`id` AS `uniqueid`,`m`.`queue` AS `queue_name`,concat('SIP/',`m`.`extension`) AS `interface` from `queueMember` `m` union all select `p`.`id` AS `id`,`p`.`queue` AS `queue`,concat('Local/',`p`.`phone`,'@outgoing') AS `phone` from `queuePhone` `p` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `sipConf`
--

/*!50001 DROP VIEW IF EXISTS `sipConf`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `sipConf` AS select `s`.`user_id` AS `id`,`s`.`extension` AS `name`,`s`.`secret` AS `secret`,`s`.`caller_id` AS `callerid`,`c`.`host` AS `host`,`c`.`deny` AS `deny`,`c`.`permit` AS `permit`,`c`.`type` AS `type`,`c`.`context` AS `context`,`c`.`incomingLimit` AS `incominglimit`,`c`.`pickupGroup` AS `pickupgroup`,`c`.`careInvite` AS `careinvite`,`r`.`ipAddr` AS `ipaddr`,`r`.`regSeconds` AS `regseconds`,`r`.`port` AS `port`,`r`.`defaultUser` AS `defaultuser`,`r`.`userAgent` AS `useragent`,`r`.`lastMs` AS `lastms`,`r`.`fullContact` AS `fullcontact`,`r`.`regServer` AS `regserver` from ((`sip` `s` left join `sipReg` `r` on((`s`.`user_id` = `r`.`userId`))) join `sipConfig` `c`) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Current Database: `salix`
--

USE `salix`;

--
-- Final view structure for view `Account`
--

/*!50001 DROP VIEW IF EXISTS `Account`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Account` AS select `u`.`id` AS `id`,`u`.`name` AS `name`,`u`.`password` AS `password`,`u`.`role` AS `roleFk`,`u`.`active` AS `active`,`u`.`email` AS `email`,`u`.`created` AS `created`,`u`.`updated` AS `updated` from `account`.`user` `u` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Accounting`
--

/*!50001 DROP VIEW IF EXISTS `Accounting`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Accounting` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `accountingTypeFk`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `b` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Address`
--

/*!50001 DROP VIEW IF EXISTS `Address`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Address` AS select `a`.`id_consigna` AS `id`,`a`.`consignatario` AS `consignee`,`a`.`domicilio` AS `street`,`a`.`poblacion` AS `city`,`a`.`codPostal` AS `postcode`,`a`.`province_id` AS `provinceFk`,`a`.`telefono` AS `phone`,`a`.`movil` AS `mobile`,`a`.`active` AS `isEnabled`,`a`.`predeterminada` AS `isDefaultAddress`,`a`.`Id_cliente` AS `clientFk`,`a`.`Id_Agencia` AS `defaultAgencyFk`,`a`.`longitude` AS `longitude`,`a`.`latitude` AS `latitude`,`a`.`isEqualizated` AS `isEqualizated` from `vn2008`.`Consignatarios` `a` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Agency`
--

/*!50001 DROP VIEW IF EXISTS `Agency`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Agency` AS select `a`.`agency_id` AS `id`,`a`.`name` AS `name`,`a`.`warehouse_id` AS `warehouseFk`,`a`.`por_volumen` AS `isVolumetric`,`a`.`Id_Banco` AS `bankFk`,`a`.`warehouse_alias_id` AS `warehouseAliasFk` from `vn2008`.`agency` `a` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `AgencyMode`
--

/*!50001 DROP VIEW IF EXISTS `AgencyMode`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `AgencyMode` AS select `a`.`Id_Agencia` AS `id`,`a`.`Agencia` AS `name`,`a`.`description` AS `description`,`a`.`Vista` AS `agencyTypeFk`,`a`.`m3` AS `m3`,`a`.`agency_id` AS `agencyFk`,`a`.`inflacion` AS `inflation`,`a`.`send_mail` AS `sendMailTo`,`a`.`tpv` AS `isForTicket` from `vn2008`.`Agencias` `a` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Bank`
--

/*!50001 DROP VIEW IF EXISTS `Bank`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Bank` AS select `b`.`Id_Banco` AS `id`,`b`.`Banco` AS `bank`,`b`.`Cuenta` AS `account`,`b`.`cash` AS `cash`,`b`.`entity_id` AS `entityFk`,`b`.`activo` AS `isActive` from `vn2008`.`Bancos` `b` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `City`
--

/*!50001 DROP VIEW IF EXISTS `City`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `City` AS select `c`.`city_id` AS `id`,`c`.`name` AS `name`,`c`.`province_id` AS `provinceFk` from `vn2008`.`city` `c` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Client`
--

/*!50001 DROP VIEW IF EXISTS `Client`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Client` AS select `c`.`id_cliente` AS `id`,`c`.`cliente` AS `name`,`c`.`if` AS `fi`,`c`.`razonSocial` AS `socialName`,`c`.`contacto` AS `contact`,`c`.`domicilio` AS `street`,`c`.`poblacion` AS `city`,`c`.`codPostal` AS `postcode`,`c`.`province_id` AS `provinceFk`,`c`.`Id_Pais` AS `countryFk`,`c`.`e-mail` AS `email`,`c`.`telefono` AS `phone`,`c`.`movil` AS `mobile`,`c`.`fax` AS `fax`,`c`.`activo` AS `active`,`c`.`descuento` AS `discount`,`c`.`credito` AS `credit`,`c`.`creditInsurance` AS `creditInsurance`,`c`.`iban` AS `iban`,`c`.`vencimiento` AS `dueDay`,`c`.`RE` AS `equalizationTax`,`c`.`invoice` AS `hasToInvoice`,`c`.`mail` AS `invoiceByEmail`,`c`.`pay_met_id` AS `payMethodFk`,`c`.`Id_Trabajador` AS `salesPersonFk`,`c`.`chanel_id` AS `contactChannelFk`,`c`.`sepaVnl` AS `sepaVnl`,`c`.`coreVnl` AS `coreVnl`,`c`.`coreVnh` AS `coreVnh`,`c`.`EYPBC` AS `eypbc`,`c`.`calidad` AS `quality`,`c`.`vies` AS `vies`,`c`.`real` AS `isRelevant`,`c`.`clientes_tipo_id` AS `typeFk`,`c`.`Cuenta` AS `accountingAccount`,`c`.`created` AS `created`,`c`.`invoiceByAddress` AS `hasToInvoiceByAddress` from `vn2008`.`Clientes` `c` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `ClientCredit`
--

/*!50001 DROP VIEW IF EXISTS `ClientCredit`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `ClientCredit` AS select `c`.`id` AS `id`,`c`.`Id_Cliente` AS `clientFk`,`c`.`Id_Trabajador` AS `employeeFk`,`c`.`amount` AS `amount`,`c`.`odbc_date` AS `created` from `vn2008`.`credit` `c` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `ClientCreditLimit`
--

/*!50001 DROP VIEW IF EXISTS `ClientCreditLimit`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `ClientCreditLimit` AS select `l`.`id` AS `id`,`l`.`maxAmount` AS `maxAmount`,`l`.`roleFk` AS `roleFk` from `vn`.`clientCreditLimit` `l` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `ClientObservation`
--

/*!50001 DROP VIEW IF EXISTS `ClientObservation`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `ClientObservation` AS select `o`.`client_observation_id` AS `id`,`o`.`Id_Cliente` AS `clientFk`,`o`.`Id_Trabajador` AS `employeeFk`,`o`.`text` AS `text`,`o`.`odbc_date` AS `created` from `vn2008`.`client_observation` `o` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `ClientType`
--

/*!50001 DROP VIEW IF EXISTS `ClientType`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `ClientType` AS select `ct`.`clientes_tipo_id` AS `id`,`ct`.`code` AS `code`,`ct`.`tipo` AS `type` from `vn2008`.`clientes_tipo` `ct` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `ContactChannel`
--

/*!50001 DROP VIEW IF EXISTS `ContactChannel`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `ContactChannel` AS select `c`.`chanel_id` AS `id`,`c`.`name` AS `name` from `vn2008`.`chanel` `c` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Country`
--

/*!50001 DROP VIEW IF EXISTS `Country`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Country` AS select `c`.`Id` AS `id`,`c`.`Pais` AS `name`,`c`.`CEE` AS `inCee`,`c`.`Codigo` AS `code`,`c`.`Id_Moneda` AS `currencyFk`,`c`.`Id_Paisreal` AS `realCountryFk` from `vn2008`.`Paises` `c` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `CreditClassification`
--

/*!50001 DROP VIEW IF EXISTS `CreditClassification`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `CreditClassification` AS select `vn`.`creditClassification`.`id` AS `id`,`vn`.`creditClassification`.`client` AS `clientFk`,`vn`.`creditClassification`.`dateStart` AS `started`,`vn`.`creditClassification`.`dateEnd` AS `ended` from `vn`.`creditClassification` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Delivery`
--

/*!50001 DROP VIEW IF EXISTS `Delivery`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Delivery` AS select `r`.`Id_Ruta` AS `id`,`r`.`Fecha` AS `date`,`r`.`m3` AS `m3`,`t`.`warehouse_id` AS `warehouseFk` from (`vn2008`.`Rutas` `r` join `vn2008`.`Tickets` `t` on((`r`.`Id_Ruta` = `t`.`Id_Ruta`))) where (`r`.`Fecha` = curdate()) group by `r`.`Id_Ruta` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Employee`
--

/*!50001 DROP VIEW IF EXISTS `Employee`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Employee` AS select `e`.`Id_Trabajador` AS `id`,`e`.`Nombre` AS `name`,`e`.`Apellidos` AS `surname`,`e`.`user_id` AS `userFk` from `vn2008`.`Trabajadores` `e` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `PayMethod`
--

/*!50001 DROP VIEW IF EXISTS `PayMethod`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `PayMethod` AS select `m`.`id` AS `id`,`m`.`name` AS `name`,`m`.`graceDays` AS `graceDays`,`m`.`deudaviva` AS `outstandingDebt`,`m`.`ibanRequired` AS `ibanRequired` from `vn2008`.`pay_met` `m` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Province`
--

/*!50001 DROP VIEW IF EXISTS `Province`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Province` AS select `p`.`province_id` AS `id`,`p`.`name` AS `name`,`p`.`Paises_Id` AS `countryFk`,`p`.`warehouse_id` AS `warehouseFk`,`p`.`zone` AS `zoneFk` from `vn2008`.`province` `p` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Role`
--

/*!50001 DROP VIEW IF EXISTS `Role`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Role` AS select `r`.`id` AS `id`,`r`.`name` AS `name`,`r`.`description` AS `description`,`r`.`created` AS `created`,`r`.`modified` AS `modified` from `account`.`role` `r` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `RoleMapping`
--

/*!50001 DROP VIEW IF EXISTS `RoleMapping`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `RoleMapping` AS select ((`u`.`id` * 1000) + `r`.`inheritsFrom`) AS `id`,'USER' AS `principalType`,`u`.`id` AS `principalId`,`r`.`inheritsFrom` AS `roleId` from (`account`.`user` `u` join `account`.`roleRole` `r` on((`r`.`role` = `u`.`role`))) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Route`
--

/*!50001 DROP VIEW IF EXISTS `Route`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Route` AS select `r`.`Id_Ruta` AS `id`,`r`.`Fecha` AS `date` from `vn2008`.`Rutas` `r` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `State`
--

/*!50001 DROP VIEW IF EXISTS `State`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `State` AS select `s`.`id` AS `id`,`s`.`name` AS `name`,`s`.`order` AS `order`,`s`.`alert_level` AS `alertLevel`,`s`.`code` AS `code` from `vn2008`.`state` `s` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Ticket`
--

/*!50001 DROP VIEW IF EXISTS `Ticket`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Ticket` AS select `t`.`Id_Ticket` AS `id`,`t`.`Id_Agencia` AS `agencyFk`,`t`.`Id_Trabajador` AS `employeeFk`,`t`.`Fecha` AS `date`,`t`.`Hora` AS `hour`,`t`.`Id_Cliente` AS `clientFk` from `vn2008`.`Tickets` `t` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `TicketState`
--

/*!50001 DROP VIEW IF EXISTS `TicketState`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `TicketState` AS select `i`.`inter_id` AS `id`,`i`.`Id_Ticket` AS `ticketFk`,`i`.`state_id` AS `stateFk`,`i`.`Id_Trabajador` AS `employeeFk`,`i`.`odbc_date` AS `updated` from `vncontrol`.`inter` `i` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Vehicle`
--

/*!50001 DROP VIEW IF EXISTS `Vehicle`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Vehicle` AS select `v`.`Id_Vehiculo` AS `id`,`v`.`Matricula` AS `numberPlate`,`v`.`Marca` AS `tradeMark`,`v`.`Modelo` AS `model`,`v`.`empresa_id` AS `companyFk`,`v`.`warehouseFk` AS `warehouseFk`,`v`.`description` AS `description`,`v`.`m3` AS `m3`,`v`.`active` AS `isActive` from `vn2008`.`Vehiculos` `v` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Warehouse`
--

/*!50001 DROP VIEW IF EXISTS `Warehouse`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Warehouse` AS select `w`.`id` AS `id`,`w`.`name` AS `name`,`w`.`tpv` AS `tpv`,`w`.`inventario` AS `inventory`,`w`.`isManaged` AS `isManaged` from `vn2008`.`warehouse` `w` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `WarehouseAlias`
--

/*!50001 DROP VIEW IF EXISTS `WarehouseAlias`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `WarehouseAlias` AS select `wa`.`warehouse_alias_id` AS `id`,`wa`.`alias` AS `name` from `vn2008`.`warehouse_alias` `wa` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Worker`
--

/*!50001 DROP VIEW IF EXISTS `Worker`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Worker` AS select `e`.`Id_Trabajador` AS `id`,`e`.`Nombre` AS `name`,`e`.`Apellidos` AS `surname`,`e`.`user_id` AS `userFk` from `vn2008`.`Trabajadores` `e` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `Zone`
--

/*!50001 DROP VIEW IF EXISTS `Zone`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `Zone` AS select `z`.`zone_id` AS `id`,`z`.`name` AS `name`,`z`.`printingOrder` AS `printingOrder` from `vn2008`.`zones` `z` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Current Database: `hedera`
--

USE `hedera`;

--
-- Final view structure for view `address_view`
--

/*!50001 DROP VIEW IF EXISTS `address_view`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `address_view` AS select `a`.`id_consigna` AS `id`,`a`.`Id_cliente` AS `customer_id`,`a`.`warehouse_id` AS `warehouse_id`,`a`.`domicilio` AS `name`,`a`.`poblacion` AS `city`,`a`.`province_id` AS `province_id`,`a`.`codPostal` AS `zip_code`,`a`.`consignatario` AS `consignee`,`a`.`predeterminada` AS `default`,`a`.`Id_Agencia` AS `type_id`,`a`.`especificaciones` AS `specs`,`a`.`seguro` AS `insurance`,`a`.`porte` AS `postage`,`a`.`active` AS `active` from `vn2008`.`Consignatarios` `a` where (`a`.`Id_cliente` = `account`.`userGetId`()) */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `basket`
--

/*!50001 DROP VIEW IF EXISTS `basket`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `basket` AS select `o`.`id` AS `id`,`o`.`date_make` AS `date_make`,`o`.`date_send` AS `date_send`,`o`.`customer_id` AS `customer_id`,`o`.`delivery_method_id` AS `delivery_method_id`,`o`.`agency_id` AS `agency_id`,`o`.`address_id` AS `address_id`,`o`.`company_id` AS `company_id`,`o`.`note` AS `note` from `hedera`.`order` `o` where (`o`.`id` = `basketGetId`()) */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `basket_defaults`
--

/*!50001 DROP VIEW IF EXISTS `basket_defaults`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `basket_defaults` AS select `ad`.`id_consigna` AS `address_id`,`ad`.`Id_Agencia` AS `agency_id`,`v`.`code` AS `delivery_method` from (((`vn2008`.`Clientes` `c` left join `vn2008`.`Consignatarios` `ad` on((`ad`.`id_consigna` = `c`.`default_address`))) join `vn2008`.`Agencias` `a` on((`a`.`Id_Agencia` = `ad`.`Id_Agencia`))) join `vn2008`.`Vistas` `v` on((`v`.`vista_id` = `a`.`Vista`))) where (`c`.`id_cliente` = `account`.`userGetId`()) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;



--
-- Final view structure for view `customer_view`
--

/*!50001 DROP VIEW IF EXISTS `customer_view`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `customer_view` AS select `c`.`id_cliente` AS `user_id`,`c`.`cliente` AS `name`,`c`.`e-mail` AS `email`,`c`.`mail` AS `mail`,`c`.`default_address` AS `default_address`,`c`.`credito` AS `credit` from `vn2008`.`Clientes` `c` where (`c`.`id_cliente` = `account`.`userGetId`()) */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `invoice_view`
--

/*!50001 DROP VIEW IF EXISTS `invoice_view`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `invoice_view` AS select `i`.`factura_id` AS `invoice_id`,`i`.`Id_Factura` AS `serial_num`,`i`.`Fecha` AS `issued`,`i`.`Importe` AS `amount` from `vn2008`.`Facturas` `i` where ((`i`.`Id_Cliente` = `account`.`userGetId`()) and `i`.`pdf`) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `myAddress`
--

/*!50001 DROP VIEW IF EXISTS `myAddress`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `myAddress` AS select `t`.`id` AS `id`,`t`.`clientFk` AS `clientFk`,`t`.`street` AS `street`,`t`.`city` AS `city`,`t`.`postalCode` AS `postalCode`,`t`.`provinceFk` AS `provinceFk`,`t`.`nickname` AS `nickname`,`t`.`isDefaultAddress` AS `isDefaultAddress`,`t`.`isActive` AS `isActive`,`t`.`longitude` AS `longitude`,`t`.`latitude` AS `latitude`,`t`.`warehouseFk` AS `warehouseFk`,`t`.`agencyFk` AS `agencyFk` from `vn`.`address` `t` where (`t`.`clientFk` = `account`.`userGetId`()) */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `myClient`
--

/*!50001 DROP VIEW IF EXISTS `myClient`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `myClient` AS select `c`.`id` AS `id`,`c`.`isToBeMailed` AS `isToBeMailed`,`c`.`defaultAddressFk` AS `defaultAddressFk`,`c`.`credit` AS `credit` from `vn`.`client` `c` where (`c`.`id` = `account`.`userGetId`()) */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `myInvoice`
--

/*!50001 DROP VIEW IF EXISTS `myInvoice`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `myInvoice` AS select `i`.`id` AS `id`,`i`.`ref` AS `ref`,`i`.`issued` AS `issued`,`i`.`amount` AS `amount` from `vn`.`invoiceOut` `i` where ((`i`.`clientFk` = `account`.`userGetId`()) and `i`.`pdf`) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `myMenu`
--

/*!50001 DROP VIEW IF EXISTS `myMenu`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `myMenu` AS select `t`.`id` AS `id`,`t`.`path` AS `path`,`t`.`description` AS `description`,`t`.`parentFk` AS `parentFk` from (`hedera`.`menu` `t` join `account`.`userRole` `r` on((`r`.`id` = `t`.`roleFk`))) order by `t`.`parentFk`,`t`.`displayOrder`,`t`.`id` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `myTpvTransaction`
--

/*!50001 DROP VIEW IF EXISTS `myTpvTransaction`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `myTpvTransaction` AS select `t`.`id` AS `id`,`t`.`merchantFk` AS `merchantFk`,`t`.`clientFk` AS `clientFk`,`t`.`receiptFk` AS `receiptFk`,`t`.`amount` AS `amount`,`t`.`response` AS `response`,`t`.`status` AS `status`,`t`.`created` AS `created` from `hedera`.`tpvTransaction` `t` where (`t`.`clientFk` = `account`.`userGetId`()) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `order_basket`
--

/*!50001 DROP VIEW IF EXISTS `order_basket`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `order_basket` AS select `t`.`clientFk` AS `customer_id`,`t`.`orderFk` AS `order_id` from `basketOrder` `t` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `order_component`
--

/*!50001 DROP VIEW IF EXISTS `order_component`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `order_component` AS select `t`.`rowFk` AS `order_row_id`,`t`.`componentFk` AS `component_id`,`t`.`price` AS `price` from `orderRowComponent` `t` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `order_confirm_time`
--

/*!50001 DROP VIEW IF EXISTS `order_confirm_time`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `order_confirm_time` AS select `o`.`date_make` AS `date_make`,`o`.`source_app` AS `source_app`,`o`.`customer_id` AS `customer_id`,`o`.`confirm_date` AS `confirm_date`,`o`.`first_row_stamp` AS `first_row_stamp`,(ceiling((((unix_timestamp(`o`.`confirm_date`) - unix_timestamp(`o`.`first_row_stamp`)) / 60) / 5)) * 5) AS `minutos` from `order` `o` where ((`o`.`confirm_date` is not null) and (`o`.`first_row_stamp` is not null)) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `order_row`
--

/*!50001 DROP VIEW IF EXISTS `order_row`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `order_row` AS select `t`.`id` AS `id`,`t`.`orderFk` AS `order_id`,`t`.`itemFk` AS `item_id`,`t`.`warehouseFk` AS `warehouse_id`,`t`.`shipment` AS `shipment`,`t`.`amount` AS `amount`,`t`.`price` AS `price`,`t`.`rate` AS `rate`,`t`.`created` AS `created`,`t`.`saleFk` AS `Id_Movimiento` from `orderRow` `t` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `order_row_view`
--

/*!50001 DROP VIEW IF EXISTS `order_row_view`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `order_row_view` AS select `r`.`id` AS `id`,`r`.`order_id` AS `order_id`,`r`.`warehouse_id` AS `warehouse_id`,`r`.`item_id` AS `item_id`,`r`.`amount` AS `amount`,`r`.`price` AS `price2` from `hedera`.`order_row` `r` where `r`.`order_id` in (select `order_view`.`id` AS `id` from `hedera`.`order_view`) */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `order_view`
--

/*!50001 DROP VIEW IF EXISTS `order_view`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `order_view` AS select `o`.`id` AS `id`,`o`.`date_make` AS `date_make`,`o`.`date_send` AS `date_send`,`o`.`customer_id` AS `customer_id`,`o`.`delivery_method_id` AS `delivery_method_id`,`o`.`agency_id` AS `agency_id`,`o`.`note` AS `note`,`o`.`address_id` AS `address_id`,`o`.`company_id` AS `company_id` from `hedera`.`order` `o` where ((`o`.`customer_id` = `account`.`userGetId`()) and (`o`.`is_bionic` = 0)) */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `basket_item`
--

/*!50001 DROP VIEW IF EXISTS `basket_item`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `basket_item` AS select `r`.`id` AS `id`,`r`.`order_id` AS `order_id`,`r`.`warehouse_id` AS `warehouse_id`,`r`.`item_id` AS `item_id`,`r`.`amount` AS `amount`,`r`.`price` AS `price` from `hedera`.`order_row` `r` where (`r`.`order_id` = `basketGetId`()) */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;


--
-- Final view structure for view `user_android`
--

/*!50001 DROP VIEW IF EXISTS `user_android`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `user_android` AS select `t`.`androidId` AS `android_id`,`t`.`userFk` AS `user_id` from `androidUser` `t` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Current Database: `bs`
--

USE `bs`;

--
-- Final view structure for view `VentasPorCliente`
--

/*!50001 DROP VIEW IF EXISTS `VentasPorCliente`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `VentasPorCliente` AS select `v`.`Id_Cliente` AS `Id_Cliente`,round(sum(`v`.`importe`),0) AS `VentaBasica`,`t`.`year` AS `year`,`t`.`month` AS `month` from (`vn2008`.`time` `t` join `bs`.`ventas` `v` on((`v`.`fecha` = `t`.`date`))) group by `v`.`Id_Cliente`,`t`.`year`,`t`.`month` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;

--
-- Final view structure for view `v_ventas`
--

/*!50001 DROP VIEW IF EXISTS `v_ventas`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = utf8 */;
/*!50001 SET character_set_results     = utf8 */;
/*!50001 SET collation_connection      = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_ventas` AS select (`bs`.`ventas`.`importe` * `vn2008`.`Movimientos`.`Cantidad`) AS `importe`,`bs`.`ventas`.`recargo` AS `recargo`,`vn2008`.`time`.`year` AS `year`,`vn2008`.`time`.`month` AS `month`,`vn2008`.`time`.`week` AS `week`,`vn2008`.`time`.`day` AS `day` from ((`bs`.`ventas` join `vn2008`.`time` on((`vn2008`.`time`.`date` = `bs`.`ventas`.`fecha`))) join `vn2008`.`Movimientos` on((`bs`.`ventas`.`Id_Movimiento` = `vn2008`.`Movimientos`.`Id_Movimiento`))) group by `vn2008`.`time`.`date` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2018-01-23 13:27:49
