CREATE DATABASE  IF NOT EXISTS `rizanovych` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `rizanovych`;
--
-- Host: 127.0.0.1    Database: rizanovych
-- ------------------------------------------------------


--
-- Table structure for table `agro_params`
--

CREATE TABLE `agro_params` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Number` int(11) NOT NULL COMMENT 'Номер параметра',
  `Value` varchar(100) DEFAULT NULL COMMENT 'Значение',
  `Description` varchar(50) DEFAULT NULL COMMENT 'Описание',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Таблица параметров';

--
-- Dumping data for table `agro_params`
--


--
-- Table structure for table `commands`
--

CREATE TABLE `commands` (
  `ID` int(11) DEFAULT '0',
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `commands`
--

INSERT INTO `commands` VALUES (10,'DRIVER_MESSAGE_SET_D',NULL),(11,'CONFIG_SMS_SET_D',NULL),(12,'CONFIG_TEL_SET_D',NULL),(13,'CONFIG_EVENT_SET_D',NULL),(14,'CONFIG_UNIQUE_SET_D',NULL),(15,'CONFIG_ZONE_SET_D',NULL),(17,'CONFIG_ID_SET_D',NULL),(18,'CONFIG_OTHER_SET_D',NULL),(20,'DRIVER_MESSAGE_SET_M',NULL),(21,'CONFIG_SMS_SET_M',NULL),(22,'CONFIG_TEL_SET_M',NULL),(23,'CONFIG_EVENT_SET_M',NULL),(24,'CONFIG_UNIQUE_SET_M',NULL),(25,'CONFIG_ZONE_SET_M',NULL),(27,'CONFIG_ID_SET_M',NULL),(28,'CONFIG_OTHER_SET_M',NULL),(31,'CONFIG_SMS_GET_D',NULL),(32,'CONFIG_TEL_GET_D',NULL),(33,'CONFIG_EVENT_GET_D',NULL),(34,'CONFIG_UNIQUE_GET_D',NULL),(35,'CONFIG_ZONE_GET_D',NULL),(36,'DATA_GPS_GET_D',NULL),(37,'CONFIG_ID_GET_D',NULL),(38,'CONFIG_OTHER_GET_D',NULL),(41,'CONFIG_SMS_GET_M',NULL),(42,'CONFIG_TEL_GET_M',NULL),(43,'CONFIG_EVENT_GET_M',NULL),(44,'CONFIG_UNIQUE_GET_M',NULL),(45,'CONFIG_ZONE_GET_M',NULL),(46,'DATA_GPS_GET_M',NULL),(47,'CONFIG_ID_GET_M',NULL),(48,'CONFIG_OTHER_GET_M',NULL),(49,'AUTO_SEND_GET_M',NULL),(99,'ERROR_COMMAND','Невозможно раскодировать входящее сообщение'),(102,'MOBITEL_SERVICE_SEND',NULL),(103,'INTERNAL_1',NULL),(104,'INTERNAL_2',NULL),(105,'INTERNAL_3',NULL),(50,'CONFIG_GPRS_MAIN_SET_D',NULL),(51,'CONFIG_GPRS_EMAIL_SET_D',NULL),(52,'CONFIG_GPRS_SOCKET_SET_D',NULL),(53,'CONFIG_GPRS_FTP_SET_D',NULL),(60,'CONFIG_GPRS_MAIN_SET_M',NULL),(61,'CONFIG_GPRS_EMAIL_SET_M',NULL),(62,'CONFIG_GPRS_SOCKET_SET_M',NULL),(63,'CONFIG_GPRS_FTP_SET_M',NULL),(70,'CONFIG_GPRS_MAIN_GET_D',NULL),(71,'CONFIG_GPRS_EMAIL_GET_D',NULL),(72,'CONFIG_GPRS_SOCKET_GET_D',NULL),(73,'CONFIG_GPRS_FTP_GET_D',NULL),(80,'CONFIG_GPRS_MAIN_GET_M',NULL),(81,'CONFIG_GPRS_EMAIL_GET_M',NULL),(82,'CONFIG_GPRS_SOCKET_GET_M',NULL),(83,'CONFIG_GPRS_FTP_GET_M',NULL),(54,'CONFIG_GPRS_INIT_SET_D',NULL),(64,'CONFIG_GPRS_INIT_SET_M',NULL),(74,'CONFIG_GPRS_INIT_GET_D',NULL),(84,'CONFIG_GPRS_INIT_GET_M',NULL);

--
-- Table structure for table `configdrivermessage`
--

CREATE TABLE `configdrivermessage` (
  `ConfigDriverMessage_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `DriverMessage` char(200) DEFAULT NULL,
  PRIMARY KEY (`ConfigDriverMessage_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=217 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configdrivermessage`
--

INSERT INTO `configdrivermessage` VALUES (216,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',216,0,0,NULL);

--
-- Table structure for table `configevent`
--

CREATE TABLE `configevent` (
  `ConfigEvent_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `tmr1Log` int(11) DEFAULT '0',
  `tmr2Send` int(11) DEFAULT '0',
  `tmr3Zone` int(11) DEFAULT '0',
  `dist1Log` int(11) DEFAULT '0',
  `dist2Send` int(11) DEFAULT '0',
  `dist3Zone` int(11) DEFAULT '0',
  `deltaTimeZone` int(11) DEFAULT '0',
  `gprsEmail` int(11) NOT NULL DEFAULT '0',
  `gprsFtp` int(11) NOT NULL DEFAULT '0',
  `gprsSocket` int(11) NOT NULL DEFAULT '0',
  `maskSensor` char(50) DEFAULT NULL,
  `maskEvent1` int(11) DEFAULT '0',
  `maskEvent2` int(11) DEFAULT '0',
  `maskEvent3` int(11) DEFAULT '0',
  `maskEvent4` int(11) DEFAULT '0',
  `maskEvent5` int(11) DEFAULT '0',
  `maskEvent6` int(11) DEFAULT '0',
  `maskEvent7` int(11) DEFAULT '0',
  `maskEvent8` int(11) DEFAULT '0',
  `maskEvent9` int(11) DEFAULT '0',
  `maskEvent10` int(11) DEFAULT '0',
  `maskEvent11` int(11) DEFAULT '0',
  `maskEvent12` int(11) DEFAULT '0',
  `maskEvent13` int(11) DEFAULT '0',
  `maskEvent14` int(11) DEFAULT '0',
  `maskEvent15` int(11) DEFAULT '0',
  `maskEvent16` int(11) DEFAULT '0',
  `maskEvent17` int(11) DEFAULT '0',
  `maskEvent18` int(11) DEFAULT '0',
  `maskEvent19` int(11) DEFAULT '0',
  `maskEvent20` int(11) DEFAULT '0',
  `maskEvent21` int(11) DEFAULT '0',
  `maskEvent22` int(11) DEFAULT '0',
  `maskEvent23` int(11) DEFAULT '0',
  `maskEvent24` int(11) DEFAULT '0',
  `maskEvent25` int(11) DEFAULT '0',
  `maskEvent26` int(11) DEFAULT '0',
  `maskEvent27` int(11) DEFAULT '0',
  `maskEvent28` int(11) DEFAULT '0',
  `maskEvent29` int(11) DEFAULT '0',
  `maskEvent30` int(11) DEFAULT '0',
  `maskEvent31` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigEvent_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1837 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configevent`
--

INSERT INTO `configevent` VALUES (1785,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',1785,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1786,'Default','Настройки по умолчанию',1785,0,200799,3,120,600,100,1000,5000,2,162,104,225,'',1,1,1,1,1,1,1,1,1,1,1,1,25,25,25,25,273,273,1,1,1,1,1,1,0,0,0,0,0,0,0),(1787,'Default','Настройки по умолчанию',1785,0,200800,0,3600,300,30,5000,5000,3,1,104,225,'',1,1,1,1,1,1,0,1,1,1,1,1,25,25,25,25,273,273,1,0,0,0,1,1,0,0,0,0,0,0,0),(1788,'Default','Настройки по умолчанию',1785,0,200804,0,3600,300,30,5000,5000,3,1,104,225,'',1,5,5,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,1,0,0,0,0,0,0,0),(1789,'Default','Настройки по умолчанию',1785,0,200805,0,3600,300,30,5000,5000,3,1,104,225,'',1,5,5,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,1,0,0,0,0,0,0,0),(1790,'','',1785,0,200806,0,3600,300,30,5000,5000,3,1,10,10,'----',1,5,5,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,0,0,0,0,0,0,0,0),(1791,'Default','Настройки по умолчанию',1785,0,200968,0,3600,300,30,5000,5000,3,1,104,225,'',1,5,0,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,1,0,0,0,0,0,0,0),(1792,'','',1785,0,200969,0,3600,300,30,5000,5000,3,1,10,10,'----',1,5,0,1,5,1,0,1,1,1,1,0,25,25,25,25,273,273,0,0,0,0,5,0,0,0,0,0,0,0,0),(1793,'8564','Desctiption for Teletrack registered at 03.09.2016 16:52:47',1793,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1794,'6832','Desctiption for Teletrack registered at 03.09.2016 22:11:43',1794,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1795,'5235','Desctiption for Teletrack registered at 14.09.2016 13:12:00',1795,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1796,'7105','Desctiption for Teletrack registered at 22.09.2016 14:05:00',1796,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1797,'4651','Desctiption for Teletrack registered at 25.09.2016 17:43:35',1797,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1798,'0789','Desctiption for Teletrack registered at 25.09.2016 17:44:14',1798,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1799,'5088','+37282618049',1799,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1800,'7673','+37282618050',1800,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1801,'3110','Desctiption for Teletrack registered at 24.02.2017 15:05:44',1801,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1802,'8412','Desctiption for Teletrack registered at 04.07.2017 9:33:44',1802,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1803,'2684','Desctiption for Teletrack registered at 04.07.2017 9:37:24',1803,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1804,'2881','Desctiption for Teletrack registered at 27.09.2017 14:09:51',1804,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1805,'2575','Desctiption for Teletrack registered at 27.09.2017 14:10:50',1805,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1806,'','',1806,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1807,'','',1807,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1808,'','',1808,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1809,'','',1809,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1810,'','',1810,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1811,'','',1811,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1812,'','',1812,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1813,'','',1813,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1814,'','',1814,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1815,'','',1815,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1816,'','',1816,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1817,'','',1817,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1818,'','',1818,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1819,'','',1819,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1820,'','',1820,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1821,'','',1821,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1822,'','',1822,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1823,'','',1823,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1824,'','',1824,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1825,'','',1825,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1826,'','',1826,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1827,'','',1827,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1828,'','',1828,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1829,'','',1829,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1830,'','',1830,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1831,'','',1831,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1832,'','',1832,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1833,'','',1833,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1834,'','',1834,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1835,'','',1835,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(1836,'','',1836,0,0,0,0,0,0,0,0,0,0,0,0,NULL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

--
-- Table structure for table `configgprsemail`
--

CREATE TABLE `configgprsemail` (
  `ConfigGprsEmail_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Smtpserv` varchar(50) NOT NULL DEFAULT '',
  `Smtpun` varchar(50) NOT NULL DEFAULT '',
  `Smtppw` varchar(50) NOT NULL DEFAULT '',
  `Pop3serv` varchar(50) NOT NULL DEFAULT '',
  `Pop3un` varchar(50) NOT NULL DEFAULT '',
  `Pop3pw` varchar(50) NOT NULL DEFAULT '',
  PRIMARY KEY (`ConfigGprsEmail_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=397 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configgprsemail`
--

INSERT INTO `configgprsemail` VALUES (341,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',341,0,0,'','','','','',''),(342,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',341,0,200887,'smtp.p314.net','','','pop.p314.net','3051@','1%NDzZnt'),(343,'','',341,0,200888,'smtp.p314.net','','','pop.p314.net','3051@','1%NDzZnt'),(352,'','',341,0,218876,'','','','','',''),(353,'8564','Desctiption for Teletrack registered at 03.09.2016 16:52:47',353,0,0,'','','','','',''),(354,'6832','Desctiption for Teletrack registered at 03.09.2016 22:11:43',354,0,0,'','','','','',''),(355,'5235','Desctiption for Teletrack registered at 14.09.2016 13:12:00',355,0,0,'','','','','',''),(356,'7105','Desctiption for Teletrack registered at 22.09.2016 14:05:00',356,0,0,'','','','','',''),(357,'4651','Desctiption for Teletrack registered at 25.09.2016 17:43:35',357,0,0,'','','','','',''),(358,'0789','Desctiption for Teletrack registered at 25.09.2016 17:44:14',358,0,0,'','','','','',''),(359,'5088','+37282618049',359,0,0,'','','','','',''),(360,'7673','+37282618050',360,0,0,'','','','','',''),(361,'3110','Desctiption for Teletrack registered at 24.02.2017 15:05:44',361,0,0,'','','','','',''),(362,'8412','Desctiption for Teletrack registered at 04.07.2017 9:33:44',362,0,0,'','','','','',''),(363,'2684','Desctiption for Teletrack registered at 04.07.2017 9:37:24',363,0,0,'','','','','',''),(364,'2881','Desctiption for Teletrack registered at 27.09.2017 14:09:51',364,0,0,'','','','','',''),(365,'2575','Desctiption for Teletrack registered at 27.09.2017 14:10:50',365,0,0,'','','','','',''),(366,'','',366,0,0,'','','','','',''),(367,'','',367,0,0,'','','','','',''),(368,'','',368,0,0,'','','','','',''),(369,'','',369,0,0,'','','','','',''),(370,'','',370,0,0,'','','','','',''),(371,'','',371,0,0,'','','','','',''),(372,'','',372,0,0,'','','','','',''),(373,'','',373,0,0,'','','','','',''),(374,'','',374,0,0,'','','','','',''),(375,'','',375,0,0,'','','','','',''),(376,'','',376,0,0,'','','','','',''),(377,'','',377,0,0,'','','','','',''),(378,'','',378,0,0,'','','','','',''),(379,'','',379,0,0,'','','','','',''),(380,'','',380,0,0,'','','','','',''),(381,'','',381,0,0,'','','','','',''),(382,'','',382,0,0,'','','','','',''),(383,'','',383,0,0,'','','','','',''),(384,'','',384,0,0,'','','','','',''),(385,'','',385,0,0,'','','','','',''),(386,'','',386,0,0,'','','','','',''),(387,'','',387,0,0,'','','','','',''),(388,'','',388,0,0,'','','','','',''),(389,'','',389,0,0,'','','','','',''),(390,'','',390,0,0,'','','','','',''),(391,'','',391,0,0,'','','','','',''),(392,'','',392,0,0,'','','','','',''),(393,'','',393,0,0,'','','','','',''),(394,'','',394,0,0,'','','','','',''),(395,'','',395,0,0,'','','','','',''),(396,'','',396,0,0,'','','','','','');

--
-- Table structure for table `configgprsinit`
--

CREATE TABLE `configgprsinit` (
  `ConfigGprsInit_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Domain` varchar(50) NOT NULL DEFAULT '0',
  `InitString` varchar(200) NOT NULL DEFAULT '',
  PRIMARY KEY (`ConfigGprsInit_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=311 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configgprsinit`
--

INSERT INTO `configgprsinit` VALUES (299,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',299,0,0,'0',''),(300,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',299,0,200889,'smtp.p314.net',''),(301,'','',299,0,200890,'smtp.p314.net',''),(310,'','',299,0,218877,'','');

--
-- Table structure for table `configgprsmain`
--

CREATE TABLE `configgprsmain` (
  `ConfigGprsMain_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Mode` int(11) NOT NULL DEFAULT '0',
  `Apnserv` varchar(50) NOT NULL DEFAULT '',
  `Apnun` varchar(50) NOT NULL DEFAULT '',
  `Apnpw` varchar(50) NOT NULL DEFAULT '',
  `Dnsserv1` varchar(50) NOT NULL DEFAULT '',
  `Dialn1` varchar(50) NOT NULL DEFAULT '',
  `Ispun` varchar(50) NOT NULL DEFAULT '',
  `Isppw` varchar(50) NOT NULL DEFAULT '',
  PRIMARY KEY (`ConfigGprsMain_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=441 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configgprsmain`
--

INSERT INTO `configgprsmain` VALUES (382,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',382,0,0,0,'','','','','','',''),(383,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',382,0,200882,1,'www.kyivstar.net','igprs','internet','193.41.60.55','80672222901','internet','kyivstar'),(384,'','',382,0,200883,1,'www.kyivstar.net','igprs','internet','193.41.60.55','Ђg\"\"ђ000?0','internet','kyivstar'),(396,'','',382,0,218875,1,'www.kyivstar.net','igprs','internet','193.41.60.55','','internet','kyivstar'),(397,'8564','Desctiption for Teletrack registered at 03.09.2016 16:52:47',397,0,0,0,'','','','','','',''),(398,'6832','Desctiption for Teletrack registered at 03.09.2016 22:11:43',398,0,0,0,'','','','','','',''),(399,'5235','Desctiption for Teletrack registered at 14.09.2016 13:12:00',399,0,0,0,'','','','','','',''),(400,'7105','Desctiption for Teletrack registered at 22.09.2016 14:05:00',400,0,0,0,'','','','','','',''),(401,'4651','Desctiption for Teletrack registered at 25.09.2016 17:43:35',401,0,0,0,'','','','','','',''),(402,'0789','Desctiption for Teletrack registered at 25.09.2016 17:44:14',402,0,0,0,'','','','','','',''),(403,'5088','+37282618049',403,0,0,0,'','','','','','',''),(404,'7673','+37282618050',404,0,0,0,'','','','','','',''),(405,'3110','Desctiption for Teletrack registered at 24.02.2017 15:05:44',405,0,0,0,'','','','','','',''),(406,'8412','Desctiption for Teletrack registered at 04.07.2017 9:33:44',406,0,0,0,'','','','','','',''),(407,'2684','Desctiption for Teletrack registered at 04.07.2017 9:37:24',407,0,0,0,'','','','','','',''),(408,'2881','Desctiption for Teletrack registered at 27.09.2017 14:09:51',408,0,0,0,'','','','','','',''),(409,'2575','Desctiption for Teletrack registered at 27.09.2017 14:10:50',409,0,0,0,'','','','','','',''),(410,'','',410,0,0,0,'','','','','','',''),(411,'','',411,0,0,0,'','','','','','',''),(412,'','',412,0,0,0,'','','','','','',''),(413,'','',413,0,0,0,'','','','','','',''),(414,'','',414,0,0,0,'','','','','','',''),(415,'','',415,0,0,0,'','','','','','',''),(416,'','',416,0,0,0,'','','','','','',''),(417,'','',417,0,0,0,'','','','','','',''),(418,'','',418,0,0,0,'','','','','','',''),(419,'','',419,0,0,0,'','','','','','',''),(420,'','',420,0,0,0,'','','','','','',''),(421,'','',421,0,0,0,'','','','','','',''),(422,'','',422,0,0,0,'','','','','','',''),(423,'','',423,0,0,0,'','','','','','',''),(424,'','',424,0,0,0,'','','','','','',''),(425,'','',425,0,0,0,'','','','','','',''),(426,'','',426,0,0,0,'','','','','','',''),(427,'','',427,0,0,0,'','','','','','',''),(428,'','',428,0,0,0,'','','','','','',''),(429,'','',429,0,0,0,'','','','','','',''),(430,'','',430,0,0,0,'','','','','','',''),(431,'','',431,0,0,0,'','','','','','',''),(432,'','',432,0,0,0,'','','','','','',''),(433,'','',433,0,0,0,'','','','','','',''),(434,'','',434,0,0,0,'','','','','','',''),(435,'','',435,0,0,0,'','','','','','',''),(436,'','',436,0,0,0,'','','','','','',''),(437,'','',437,0,0,0,'','','','','','',''),(438,'','',438,0,0,0,'','','','','','',''),(439,'','',439,0,0,0,'','','','','','',''),(440,'','',440,0,0,0,'','','','','','','');

--
-- Table structure for table `configmain`
--

CREATE TABLE `configmain` (
  `ConfigMain_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `ConfigOther_ID` int(11) DEFAULT '0',
  `ConfigDriverMessage_ID` int(11) DEFAULT '0',
  `ConfigEvent_ID` int(11) DEFAULT '0',
  `ConfigUnique_ID` int(11) DEFAULT '0',
  `ConfigZoneSet_ID` int(11) DEFAULT '0',
  `ConfigSensorSet_ID` int(11) DEFAULT '0',
  `ConfigTel_ID` int(11) DEFAULT '0',
  `ConfigSms_ID` int(11) DEFAULT '0',
  `Mobitel_ID` int(11) DEFAULT '0',
  `ConfigGprsMain_ID` int(11) NOT NULL DEFAULT '0',
  `ConfigGprsEmail_ID` int(11) NOT NULL DEFAULT '0',
  `ConfigGprsInit_ID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ConfigMain_ID`),
  KEY `Index_2` (`Mobitel_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=139 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configmain`
--

INSERT INTO `configmain` VALUES (94,'Mobitel1','Descr',0,0,115,216,1785,128,247,103,514,708,97,382,341,299),(95,'mobitel','mca4',0,0,50,50,1793,50,50,50,528,721,98,397,353,50),(96,'mobitel','mca4',0,0,50,50,1794,50,50,50,529,722,99,398,354,50),(97,'mobitel','mca4',0,0,50,50,1795,50,50,50,530,723,100,399,355,50),(98,'mobitel','mca4',0,0,50,50,1796,50,50,50,531,724,101,400,356,50),(99,'mobitel','mca4',0,0,50,50,1797,50,50,50,532,725,102,401,357,50),(100,'mobitel','mca4',0,0,50,50,1798,50,50,50,533,726,103,402,358,50),(101,'mobitel','mca4',0,0,50,50,1799,50,50,50,534,727,104,403,359,50),(102,'mobitel','mca4',0,0,50,50,1800,50,50,50,535,728,105,404,360,50),(103,'mobitel','mca4',0,0,50,50,1801,50,50,50,536,729,106,405,361,50),(104,'mobitel','mca4',0,0,50,50,1802,50,50,50,537,730,107,406,362,50),(105,'mobitel','mca4',0,0,50,50,1803,50,50,50,538,731,108,407,363,50),(106,'mobitel','mca4',0,0,50,50,1804,50,50,50,539,732,109,408,364,50),(107,'mobitel','mca4',0,0,50,50,1805,50,50,50,540,733,110,409,365,50),(108,'','',0,0,50,50,1806,50,50,50,541,734,859386421,410,366,50),(109,'','',0,0,50,50,1807,50,50,50,542,735,808924983,411,367,50),(110,'','',0,0,50,50,1808,50,50,50,543,736,909520946,412,368,50),(111,'','',0,0,50,50,1809,50,50,50,544,737,808466742,413,369,50),(112,'','',0,0,50,50,1810,50,50,50,545,738,892418353,414,370,50),(113,'','',0,0,50,50,1811,50,50,50,546,739,876032567,415,371,50),(114,'','',0,0,50,50,1812,50,50,50,547,740,825635890,416,372,50),(115,'','',0,0,50,50,1813,50,50,50,548,741,808596790,417,373,50),(116,'','',0,0,50,50,1814,50,50,50,549,742,942814777,418,374,50),(117,'','',0,0,50,50,1815,50,50,50,550,743,876165171,419,375,50),(118,'','',0,0,50,50,1816,50,50,50,551,744,959788080,420,376,50),(119,'','',0,0,50,50,1817,50,50,50,552,745,926366004,421,377,50),(120,'','',0,0,50,50,1818,50,50,50,553,746,926364217,422,378,50),(121,'','',0,0,50,50,1819,50,50,50,554,747,909259058,423,379,50),(122,'','',0,0,50,50,1820,50,50,50,555,748,842348336,424,380,50),(123,'','',0,0,50,50,1821,50,50,50,556,749,876032307,425,381,50),(124,'','',0,0,50,50,1822,50,50,50,557,750,926365494,426,382,50),(125,'','',0,0,50,50,1823,50,50,50,558,751,875639862,427,383,50),(126,'','',0,0,50,50,1824,50,50,50,559,752,959723824,428,384,50),(127,'','',0,0,50,50,1825,50,50,50,560,753,892941624,429,385,50),(128,'','',0,0,50,50,1826,50,50,50,561,754,809054258,430,386,50),(129,'','',0,0,50,50,1827,50,50,50,562,755,926298936,431,387,50),(130,'','',0,0,50,50,1828,50,50,50,563,756,859321909,432,388,50),(131,'','',0,0,50,50,1829,50,50,50,564,757,942813752,433,389,50),(132,'','',0,0,50,50,1830,50,50,50,565,758,926103344,434,390,50),(133,'','',0,0,50,50,1831,50,50,50,566,759,926497080,435,391,50),(134,'','',0,0,50,50,1832,50,50,50,567,760,926429748,436,392,50),(135,'','',0,0,50,50,1833,50,50,50,568,761,875770931,437,393,50),(136,'','',0,0,50,50,1834,50,50,50,569,762,859191344,438,394,50),(137,'','',0,0,50,50,1835,50,50,50,570,763,808793648,439,395,50),(138,'','',0,0,50,50,1836,50,50,50,571,764,859386416,440,396,50);

--
-- Table structure for table `configother`
--

CREATE TABLE `configother` (
  `ConfigOther_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Pin` int(11) DEFAULT '0',
  `Lang` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigOther_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=116 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configother`
--

INSERT INTO `configother` VALUES (115,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',115,0,0,0,0);

--
-- Table structure for table `configsensorset`
--

CREATE TABLE `configsensorset` (
  `ConfigSensorSet_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigSensorSet_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configsensorset`
--

INSERT INTO `configsensorset` VALUES (103,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',103,0,0);

--
-- Table structure for table `configsms`
--

CREATE TABLE `configsms` (
  `ConfigSms_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `smsCenter_ID` int(11) DEFAULT '0',
  `smsDspt_ID` int(11) DEFAULT '0',
  `smsEmailGate_ID` int(11) DEFAULT '0',
  `dsptEmail` char(14) DEFAULT NULL,
  `dsptGprsEmail` char(50) DEFAULT NULL,
  PRIMARY KEY (`ConfigSms_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=765 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configsms`
--

INSERT INTO `configsms` VALUES (708,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',708,0,0,0,0,0,NULL,NULL),(709,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',708,0,200809,9,62,74,'d000@p314.net','d000@p314.net'),(710,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',708,0,200810,9,62,74,'d000@p314.net','d000@p314.net'),(711,'','',708,0,200811,-1,62,74,'d000@p314.net','d000@p314.net'),(720,'','',708,0,218874,0,0,0,'',''),(721,'8564','Desctiption for Teletrack registered at 03.09.2016 16:52:47',721,0,0,0,0,0,NULL,NULL),(722,'6832','Desctiption for Teletrack registered at 03.09.2016 22:11:43',722,0,0,0,0,0,NULL,NULL),(723,'5235','Desctiption for Teletrack registered at 14.09.2016 13:12:00',723,0,0,0,0,0,NULL,NULL),(724,'7105','Desctiption for Teletrack registered at 22.09.2016 14:05:00',724,0,0,0,0,0,NULL,NULL),(725,'4651','Desctiption for Teletrack registered at 25.09.2016 17:43:35',725,0,0,0,0,0,NULL,NULL),(726,'0789','Desctiption for Teletrack registered at 25.09.2016 17:44:14',726,0,0,0,0,0,NULL,NULL),(727,'5088','+37282618049',727,0,0,0,0,0,NULL,NULL),(728,'7673','+37282618050',728,0,0,0,0,0,NULL,NULL),(729,'3110','Desctiption for Teletrack registered at 24.02.2017 15:05:44',729,0,0,0,0,0,NULL,NULL),(730,'8412','Desctiption for Teletrack registered at 04.07.2017 9:33:44',730,0,0,0,0,0,NULL,NULL),(731,'2684','Desctiption for Teletrack registered at 04.07.2017 9:37:24',731,0,0,0,0,0,NULL,NULL),(732,'2881','Desctiption for Teletrack registered at 27.09.2017 14:09:51',732,0,0,0,0,0,NULL,NULL),(733,'2575','Desctiption for Teletrack registered at 27.09.2017 14:10:50',733,0,0,0,0,0,NULL,NULL),(734,'','',734,0,0,0,0,0,NULL,NULL),(735,'','',735,0,0,0,0,0,NULL,NULL),(736,'','',736,0,0,0,0,0,NULL,NULL),(737,'','',737,0,0,0,0,0,NULL,NULL),(738,'','',738,0,0,0,0,0,NULL,NULL),(739,'','',739,0,0,0,0,0,NULL,NULL),(740,'','',740,0,0,0,0,0,NULL,NULL),(741,'','',741,0,0,0,0,0,NULL,NULL),(742,'','',742,0,0,0,0,0,NULL,NULL),(743,'','',743,0,0,0,0,0,NULL,NULL),(744,'','',744,0,0,0,0,0,NULL,NULL),(745,'','',745,0,0,0,0,0,NULL,NULL),(746,'','',746,0,0,0,0,0,NULL,NULL),(747,'','',747,0,0,0,0,0,NULL,NULL),(748,'','',748,0,0,0,0,0,NULL,NULL),(749,'','',749,0,0,0,0,0,NULL,NULL),(750,'','',750,0,0,0,0,0,NULL,NULL),(751,'','',751,0,0,0,0,0,NULL,NULL),(752,'','',752,0,0,0,0,0,NULL,NULL),(753,'','',753,0,0,0,0,0,NULL,NULL),(754,'','',754,0,0,0,0,0,NULL,NULL),(755,'','',755,0,0,0,0,0,NULL,NULL),(756,'','',756,0,0,0,0,0,NULL,NULL),(757,'','',757,0,0,0,0,0,NULL,NULL),(758,'','',758,0,0,0,0,0,NULL,NULL),(759,'','',759,0,0,0,0,0,NULL,NULL),(760,'','',760,0,0,0,0,0,NULL,NULL),(761,'','',761,0,0,0,0,0,NULL,NULL),(762,'','',762,0,0,0,0,0,NULL,NULL),(763,'','',763,0,0,0,0,0,NULL,NULL),(764,'','',764,0,0,0,0,0,NULL,NULL);

--
-- Table structure for table `configtel`
--

CREATE TABLE `configtel` (
  `ConfigTel_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `telSOS` int(11) DEFAULT '0',
  `telDspt` int(11) DEFAULT '0',
  `telAccept1` int(11) DEFAULT '0',
  `telAccept2` int(11) DEFAULT '0',
  `telAccept3` int(11) DEFAULT '0',
  `telAnswer` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigTel_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=572 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configtel`
--

INSERT INTO `configtel` VALUES (514,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',514,0,0,0,0,0,0,0,0),(515,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',514,0,200807,57,57,71,89,75,0),(516,'','',514,0,200808,57,57,71,89,75,0),(527,'','',514,0,218873,58,58,58,58,58,0),(528,'8564','Desctiption for Teletrack registered at 03.09.2016 16:52:47',528,0,0,0,0,0,0,0,0),(529,'6832','Desctiption for Teletrack registered at 03.09.2016 22:11:43',529,0,0,0,0,0,0,0,0),(530,'5235','Desctiption for Teletrack registered at 14.09.2016 13:12:00',530,0,0,0,0,0,0,0,0),(531,'7105','Desctiption for Teletrack registered at 22.09.2016 14:05:00',531,0,0,0,0,0,0,0,0),(532,'4651','Desctiption for Teletrack registered at 25.09.2016 17:43:35',532,0,0,0,0,0,0,0,0),(533,'0789','Desctiption for Teletrack registered at 25.09.2016 17:44:14',533,0,0,0,0,0,0,0,0),(534,'5088','+37282618049',534,0,0,0,0,0,0,0,0),(535,'7673','+37282618050',535,0,0,0,0,0,0,0,0),(536,'3110','Desctiption for Teletrack registered at 24.02.2017 15:05:44',536,0,0,0,0,0,0,0,0),(537,'8412','Desctiption for Teletrack registered at 04.07.2017 9:33:44',537,0,0,0,0,0,0,0,0),(538,'2684','Desctiption for Teletrack registered at 04.07.2017 9:37:24',538,0,0,0,0,0,0,0,0),(539,'2881','Desctiption for Teletrack registered at 27.09.2017 14:09:51',539,0,0,0,0,0,0,0,0),(540,'2575','Desctiption for Teletrack registered at 27.09.2017 14:10:50',540,0,0,0,0,0,0,0,0),(541,'','',541,0,0,0,0,0,0,0,0),(542,'','',542,0,0,0,0,0,0,0,0),(543,'','',543,0,0,0,0,0,0,0,0),(544,'','',544,0,0,0,0,0,0,0,0),(545,'','',545,0,0,0,0,0,0,0,0),(546,'','',546,0,0,0,0,0,0,0,0),(547,'','',547,0,0,0,0,0,0,0,0),(548,'','',548,0,0,0,0,0,0,0,0),(549,'','',549,0,0,0,0,0,0,0,0),(550,'','',550,0,0,0,0,0,0,0,0),(551,'','',551,0,0,0,0,0,0,0,0),(552,'','',552,0,0,0,0,0,0,0,0),(553,'','',553,0,0,0,0,0,0,0,0),(554,'','',554,0,0,0,0,0,0,0,0),(555,'','',555,0,0,0,0,0,0,0,0),(556,'','',556,0,0,0,0,0,0,0,0),(557,'','',557,0,0,0,0,0,0,0,0),(558,'','',558,0,0,0,0,0,0,0,0),(559,'','',559,0,0,0,0,0,0,0,0),(560,'','',560,0,0,0,0,0,0,0,0),(561,'','',561,0,0,0,0,0,0,0,0),(562,'','',562,0,0,0,0,0,0,0,0),(563,'','',563,0,0,0,0,0,0,0,0),(564,'','',564,0,0,0,0,0,0,0,0),(565,'','',565,0,0,0,0,0,0,0,0),(566,'','',566,0,0,0,0,0,0,0,0),(567,'','',567,0,0,0,0,0,0,0,0),(568,'','',568,0,0,0,0,0,0,0,0),(569,'','',569,0,0,0,0,0,0,0,0),(570,'','',570,0,0,0,0,0,0,0,0),(571,'','',571,0,0,0,0,0,0,0,0);

--
-- Table structure for table `configunique`
--

CREATE TABLE `configunique` (
  `ConfigUnique_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `pswd` char(8) DEFAULT NULL,
  `tmpPswd` char(8) DEFAULT NULL,
  `dsptId` char(4) DEFAULT NULL,
  PRIMARY KEY (`ConfigUnique_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=129 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configunique`
--

INSERT INTO `configunique` VALUES (128,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',128,0,0,NULL,NULL,NULL);

--
-- Table structure for table `configzoneset`
--

CREATE TABLE `configzoneset` (
  `ConfigZoneSet_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`ConfigZoneSet_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=250 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `configzoneset`
--

INSERT INTO `configzoneset` VALUES (247,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',247,0,0),(248,'','',247,0,200812),(249,'','',247,0,200847);

--
-- Table structure for table `data_zones`
--

CREATE TABLE `data_zones` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `DataGps_ID` int(11) DEFAULT NULL,
  `Zone_ID` int(11) DEFAULT NULL,
  `Zone_IO` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `data_zones`
--


--
-- Table structure for table `datagpsbuffer`
--

CREATE TABLE `datagpsbuffer` (
  `DataGps_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) DEFAULT '0',
  `Longitude` int(11) DEFAULT '0',
  `Altitude` int(11) DEFAULT NULL,
  `UnixTime` int(11) DEFAULT '0',
  `Speed` smallint(6) DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) DEFAULT '1',
  `InMobitelID` int(11) DEFAULT NULL,
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  PRIMARY KEY (`DataGps_ID`),
  KEY `IDX_MobitelIDLogID` (`Mobitel_ID`,`LogID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpsbuffer`
--


--
-- Table structure for table `datagpsbuffer_dr`
--

CREATE TABLE `datagpsbuffer_dr` (
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) NOT NULL DEFAULT '0',
  `Longitude` int(11) NOT NULL DEFAULT '0',
  `Altitude` int(11) DEFAULT '0',
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) NOT NULL DEFAULT '1',
  `InMobitelID` int(11) DEFAULT '0',
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) unsigned NOT NULL DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  KEY `IDX_MobitelIDLogID` (`Mobitel_ID`,`LogID`) USING BTREE,
  KEY `IDX_MobitelidUnixtime` (`Mobitel_ID`,`UnixTime`) USING BTREE,
  KEY `IDX_MobitelidUnixtimeValid` (`Mobitel_ID`,`UnixTime`,`Valid`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Буфер приема данных поступающих по socket-ам от телетреков';

--
-- Dumping data for table `datagpsbuffer_dr`
--


--
-- Table structure for table `datagpsbuffer_on`
--

CREATE TABLE `datagpsbuffer_on` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) NOT NULL DEFAULT '0',
  `Longitude` int(11) NOT NULL DEFAULT '0',
  `Altitude` int(11) DEFAULT NULL,
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) NOT NULL DEFAULT '1',
  `InMobitelID` int(11) DEFAULT NULL,
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) NOT NULL DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) NOT NULL DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  `SrvPacketID` bigint(20) NOT NULL DEFAULT '0',
  KEY `IDX_MobitelidLogid` (`Mobitel_ID`,`LogID`) USING BTREE,
  KEY `IDX_MobitelidUnixtime` (`Mobitel_ID`,`UnixTime`) USING BTREE,
  KEY `IDX_MobitelidUnixtimeValid` (`Mobitel_ID`,`UnixTime`,`Valid`) USING BTREE,
  KEY `IDX_SrvPacketID` (`SrvPacketID`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Буфер онлайн данных';

--
-- Dumping data for table `datagpsbuffer_on`
--


--
-- Table structure for table `datagpsbuffer_on64`
--

CREATE TABLE `datagpsbuffer_on64` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0' COMMENT 'РљРѕРґ РўРµР»РµС‚СЂРµРєР°',
  `Latitude` int(11) NOT NULL DEFAULT '0' COMMENT 'РЁРёСЂРѕС‚Р°',
  `Longitude` int(11) NOT NULL DEFAULT '0' COMMENT 'Р”РѕР»РіРѕС‚Р°',
  `Direction` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РіСЂР°РґСѓСЃС‹/1.5',
  `Acceleration` int(11) NOT NULL DEFAULT '0' COMMENT 'РР·РјРµРЅРµРЅРёРµ СЃРєРѕСЂРѕСЃС‚Рё РїРѕ GPS Р·Р° РїРѕСЃР»РµРґРЅСЋСЋ СЃРµРєСѓРЅРґСѓ',
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0' COMMENT 'РЎРѕС‚РµРЅ РјРµС‚СЂРѕРІ РІ С‡Р°СЃ (0,1 РєРј/С‡)',
  `Valid` tinyint(1) NOT NULL DEFAULT '1',
  `Satellites` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РљРѕР»РёС‡РµСЃС‚РІРѕ СЃРїСѓС‚РЅРёРєРѕРІ ',
  `RssiGsm` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РЈСЂРѕРІРµРЅСЊ GSM СЃРёРіРЅР°Р»Р°',
  `Events` int(11) NOT NULL DEFAULT '0' COMMENT 'Р¤Р»Р°РіРё СЃРѕР±С‹С‚РёР№',
  `SensorsSet` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'РљРѕРґ РЅР°Р±РѕСЂР° РґР°С‚С‡РёРєРѕРІ',
  `Sensors` varbinary(50) NOT NULL DEFAULT '0' COMMENT 'Р—РЅР°С‡РµРЅРёСЏ РґР°С‚С‡РёРєРѕРІ',
  `Voltage` tinyint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'РќР°РїСЂСЏР¶РµРЅРёРµ РїРёС‚Р°РЅРёСЏ С‚РµРєСѓС‰РµРіРѕ РёСЃС‚РѕС‡РЅРёРєР°/1.5 РѕС‚ 0 РґРѕ 38,2',
  `DGPS` varchar(32) NOT NULL DEFAULT '0' COMMENT 'Р”Р°РЅРЅС‹Рµ РґРёС„С„РµСЂРµРЅС†РёР°Р»СЊРЅРѕР№ СЃРёСЃС‚РµРјС‹ GPS - РІС‹СЃРѕС‚Р°,С€РёСЂРѕС‚Р°,РґРѕР»РіРѕС‚Р°',
  `LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'РРґРµРЅС‚РёС„РёРєР°С‚РѕСЂ Р·Р°РїРёСЃРё РІ Р¶СѓСЂРЅР°Р»Рµ РўРµР»РµС‚СЂРµРєР°',
  `SrvPacketID` bigint(20) NOT NULL DEFAULT '0' COMMENT 'ID СЃРµСЂРІРµСЂРЅРѕРіРѕ РїР°РєРµС‚Р° РІ СЃРѕСЃС‚Р°РІ РєРѕС‚РѕСЂРѕРіРѕ РІС…РѕРґРёС‚ СЌС‚Р° Р·Р°РїРёСЃСЊ',
  KEY `IDX_MobitelidLogid_64` (`Mobitel_ID`,`LogID`) USING BTREE,
  KEY `IDX_MobitelidUnixtime_64` (`Mobitel_ID`,`UnixTime`) USING BTREE,
  KEY `IDX_MobitelidUnixtimeValid_64` (`Mobitel_ID`,`UnixTime`,`Valid`) USING BTREE,
  KEY `IDX_SrvPacketID_64` (`SrvPacketID`) USING BTREE,
  CONSTRAINT `FK_datagps64_mobitels_Mobitel_ID_1` FOREIGN KEY (`Mobitel_ID`) REFERENCES `mobitels` (`Mobitel_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpsbuffer_on64`
--


--
-- Table structure for table `datagpsbuffer_ontmp`
--

CREATE TABLE `datagpsbuffer_ontmp` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `LogID` int(11) NOT NULL DEFAULT '0',
  `SrvPacketID` bigint(20) NOT NULL DEFAULT '0',
  KEY `IDX_MobitelidSrvpacketid` (`Mobitel_ID`,`SrvPacketID`) USING BTREE,
  KEY `IDX_Mobitelid` (`Mobitel_ID`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Временный вспомогательный буфер онлайн данных';

--
-- Dumping data for table `datagpsbuffer_ontmp`
--


--
-- Table structure for table `datagpsbuffer_ontmp64`
--

CREATE TABLE `datagpsbuffer_ontmp64` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0' COMMENT 'РљРѕРґ РўРµР»РµС‚СЂРµРєР°',
  `LogID` int(11) unsigned DEFAULT '0' COMMENT 'РРґРµРЅС‚РёС„РёРєР°С‚РѕСЂ Р·Р°РїРёСЃРё РІ Р¶СѓСЂРЅР°Р»Рµ РўРµР»РµС‚СЂРµРєР°',
  `SrvPacketID` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'ID СЃРµСЂРІРµСЂРЅРѕРіРѕ РїР°РєРµС‚Р° РІ СЃРѕСЃС‚Р°РІ РєРѕС‚РѕСЂРѕРіРѕ РІС…РѕРґРёС‚ СЌС‚Р° Р·Р°РїРёСЃСЊ',
  KEY `IDX_Mobitelid64` (`Mobitel_ID`),
  KEY `IDX_MobitelidSrvpacketid64` (`Mobitel_ID`,`SrvPacketID`),
  CONSTRAINT `FK_datagps64_mobitels_Mobitel_ID_2` FOREIGN KEY (`Mobitel_ID`) REFERENCES `mobitels` (`Mobitel_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpsbuffer_ontmp64`
--


--
-- Table structure for table `datagpsbuffer_pop`
--

CREATE TABLE `datagpsbuffer_pop` (
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) NOT NULL DEFAULT '0',
  `Longitude` int(11) NOT NULL DEFAULT '0',
  `Altitude` int(11) DEFAULT '0',
  `UnixTime` int(11) NOT NULL DEFAULT '0',
  `Speed` smallint(6) NOT NULL DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) NOT NULL DEFAULT '1',
  `InMobitelID` int(11) DEFAULT '0',
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) unsigned NOT NULL DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  KEY `IDX_MobitelIDLogID` (`Mobitel_ID`,`LogID`) USING BTREE,
  KEY `IDX_MobitelidUnixtime` (`Mobitel_ID`,`UnixTime`) USING BTREE,
  KEY `IDX_MobitelidUnixtimeValid` (`Mobitel_ID`,`UnixTime`,`Valid`) USING BTREE
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Буфер приема данных поступающих по POP3 протоколу';

--
-- Dumping data for table `datagpsbuffer_pop`
--


--
-- Table structure for table `datagpsbufferlite`
--

CREATE TABLE `datagpsbufferlite` (
  `DataGps_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) DEFAULT '0',
  `Longitude` int(11) DEFAULT '0',
  `Altitude` int(11) DEFAULT NULL,
  `UnixTime` int(11) DEFAULT '0',
  `Speed` smallint(6) DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) DEFAULT '1',
  `InMobitelID` int(11) DEFAULT NULL,
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1',
  PRIMARY KEY (`DataGps_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpsbufferlite`
--


--
-- Table structure for table `datagpslost`
--

CREATE TABLE `datagpslost` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Begin_LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'Значение LogID после которого начинается разрыв',
  `End_LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'Значение LogID перед которым завершается разрыв',
  PRIMARY KEY (`Mobitel_ID`,`Begin_LogID`),
  KEY `IDX_MobitelID` (`Mobitel_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Список пропусков в данных DataGPS пришодящих от RF-модемов';

--
-- Dumping data for table `datagpslost`
--


--
-- Table structure for table `datagpslost_on`
--

CREATE TABLE `datagpslost_on` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Begin_LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'Значение LogID после которого начинается разрыв',
  `End_LogID` int(11) NOT NULL DEFAULT '0' COMMENT 'Значение LogID перед которым завершается разрыв',
  `Begin_SrvPacketID` bigint(20) NOT NULL DEFAULT '0',
  `End_SrvPacketID` bigint(20) NOT NULL DEFAULT '0',
  `Id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`Mobitel_ID`,`Begin_LogID`),
  UNIQUE KEY `IDX_MobitelID_BeginSrvPacketID` (`Mobitel_ID`,`Begin_SrvPacketID`),
  UNIQUE KEY `Id` (`Id`),
  KEY `IDX_MobitelID` (`Mobitel_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=cp1251 COMMENT='Пропуски в данных DataGPS, приходящих от Online сервера';

--
-- Dumping data for table `datagpslost_on`
--

INSERT INTO `datagpslost_on` VALUES (104,0,654,0,446676599438,1);

--
-- Table structure for table `datagpslost_ontmp`
--

CREATE TABLE `datagpslost_ontmp` (
  `LogID` int(11) NOT NULL DEFAULT '0',
  `SrvPacketID` bigint(20) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Используется исключительно процедурой OnLostDataGPS';

--
-- Dumping data for table `datagpslost_ontmp`
--


--
-- Table structure for table `datagpslost_rftmp`
--

CREATE TABLE `datagpslost_rftmp` (
  `LogID` int(11) DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=cp1251 COMMENT='Используется исключительно процедурой LostDataGPS';

--
-- Dumping data for table `datagpslost_rftmp`
--


--
-- Table structure for table `datagpslosted`
--

CREATE TABLE `datagpslosted` (
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Begin_LogID` int(11) NOT NULL DEFAULT '0',
  `End_LogID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Mobitel_ID`,`Begin_LogID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `datagpslosted`
--


--
-- Temporary table structure for view `datavalue1`
--

/*!50001 DROP VIEW IF EXISTS `datavalue1`*/;
/*!50001 CREATE VIEW `datavalue1` AS SELECT 
 1 AS `lon`,
 1 AS `lat`,
 1 AS `Mobitel_ID`,
 1 AS `Value`,
 1 AS `speed`,
 1 AS `time`,
 1 AS `sensor_id`,
 1 AS `datavalue_id`*/;

--
-- Temporary table structure for view `dataview`
--

/*!50001 DROP VIEW IF EXISTS `dataview`*/;
/*!50001 CREATE VIEW `dataview` AS SELECT 
 1 AS `DataGps_ID`,
 1 AS `Mobitel_ID`,
 1 AS `Lat`,
 1 AS `Lon`,
 1 AS `Altitude`,
 1 AS `time`,
 1 AS `speed`,
 1 AS `direction`,
 1 AS `Valid`,
 1 AS `sensor`,
 1 AS `Events`,
 1 AS `LogID`*/;

--
-- Temporary table structure for view `deviceview`
--

/*!50001 DROP VIEW IF EXISTS `deviceview`*/;
/*!50001 CREATE VIEW `deviceview` AS SELECT 
 1 AS `Mobitel_ID`,
 1 AS `Name`,
 1 AS `Descr`,
 1 AS `devIdShort`,
 1 AS `DeviceType`,
 1 AS `ConfirmedID`,
 1 AS `moduleIdRf`*/;

--
-- Table structure for table `driver`
--

CREATE TABLE `driver` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Family` char(40) DEFAULT NULL COMMENT 'Фамилия',
  `Name` char(40) DEFAULT NULL COMMENT 'Имя',
  `ByrdDay` date DEFAULT NULL COMMENT 'Дата рождения',
  `Category` char(5) DEFAULT NULL COMMENT 'Категория',
  `Permis` char(20) DEFAULT NULL COMMENT 'Права',
  `foto` blob COMMENT 'фото',
  `Identifier` smallint(5) unsigned DEFAULT NULL COMMENT '10 битный идентификатор водителя',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  `idType` int(11) DEFAULT '0' COMMENT 'Код специализации водителя',
  `numTelephone` varchar(32) DEFAULT '' COMMENT 'Телефон водителя для связи',
  `Department` varchar(40) DEFAULT NULL COMMENT 'Организация водителя',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`) USING BTREE,
  UNIQUE KEY `UQ_Identifier` (`Identifier`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `driver`
--

INSERT INTO `driver` VALUES (1,'','','2009-01-01','с','1111',NULL,NULL,NULL,0,'',NULL),(2,'Водитель','','2009-01-22','с','1111',NULL,NULL,NULL,0,'',NULL);

--
-- Table structure for table `driver_types`
--

CREATE TABLE `driver_types` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `TypeName` varchar(50) DEFAULT NULL COMMENT 'Специализация водителя',
  PRIMARY KEY (`Id`),
  UNIQUE KEY `id` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `driver_types`
--


--
-- Table structure for table `gpsmasks`
--

CREATE TABLE `gpsmasks` (
  `GpsMask_ID` int(11) NOT NULL AUTO_INCREMENT,
  `ID` int(11) DEFAULT '0',
  `Name` char(200) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `LastRecords` int(11) DEFAULT '0',
  `LastTimes` int(11) DEFAULT '0',
  `LastTimesIndex` int(11) DEFAULT '0',
  `LastMeters` int(11) DEFAULT '0',
  `LastMetersIndex` int(11) DEFAULT '0',
  `MaxSmsNum` int(11) DEFAULT '0',
  `MaxSmsNumIndex` int(11) DEFAULT '0',
  `LatitudeStart` int(11) DEFAULT '0',
  `LatitudeEnd` int(11) DEFAULT '0',
  `LongitudeStart` int(11) DEFAULT '0',
  `LongitudeEnd` int(11) DEFAULT '0',
  `AltitudeStart` int(11) DEFAULT '0',
  `AltitudeEnd` int(11) DEFAULT '0',
  `UnixTimeStart` int(11) DEFAULT '0',
  `UnixTimeEnd` int(11) DEFAULT '0',
  `SpeedStart` int(11) DEFAULT '0',
  `SpeedEnd` int(11) DEFAULT '0',
  `DirectionStart` int(11) DEFAULT '0',
  `DirectionEnd` int(11) DEFAULT '0',
  `NumbersStart` int(11) DEFAULT '0',
  `NumbersEnd` int(11) DEFAULT '0',
  `WhatSend` int(1) DEFAULT '0',
  `CheckMask` int(11) DEFAULT '0',
  `InMobitelID` int(11) DEFAULT '0',
  `Events` int(11) DEFAULT '0',
  `Number1` int(11) DEFAULT '0',
  `Number2` int(11) DEFAULT '0',
  `Number3` int(11) DEFAULT '0',
  `Number4` int(11) DEFAULT '0',
  `Number5` int(11) DEFAULT '0',
  PRIMARY KEY (`GpsMask_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1134 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `gpsmasks`
--

INSERT INTO `gpsmasks` VALUES (1132,0,'','',97,200893,8,-10800,0,0,0,0,0,0,0,0,0,0,0,-10800,-10800,0,0,0,0,0,0,1023,1,0,0,0,0,0,0,0),(1133,0,'','',97,201039,100,-10800,0,0,0,0,0,0,0,0,0,0,0,-10800,-10800,0,0,0,0,0,0,1023,1,0,0,0,0,0,0,0);

--
-- Table structure for table `internalmobitelconfig`
--

CREATE TABLE `internalmobitelconfig` (
  `InternalMobitelConfig_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `devIdLong` char(16) DEFAULT NULL,
  `devIdShort` char(4) DEFAULT NULL,
  `verProtocolLong` char(16) DEFAULT NULL,
  `verProtocolShort` char(2) DEFAULT NULL,
  `moduleIdGps` char(50) DEFAULT NULL,
  `moduleIdGsm` char(50) DEFAULT NULL,
  `moduleIdRf` char(50) DEFAULT NULL,
  `RfType` smallint(6) NOT NULL DEFAULT '0',
  `ActiveRf` tinyint(1) NOT NULL DEFAULT '0',
  `moduleIdSs` char(50) DEFAULT NULL,
  `moduleIdMm` char(50) NOT NULL DEFAULT 'moduleIdMm',
  PRIMARY KEY (`InternalMobitelConfig_ID`),
  KEY `Index_3` (`Message_ID`),
  KEY `Index_4` (`devIdShort`),
  KEY `IDX_InternalmobitelconfigID` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=847 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `internalmobitelconfig`
--

INSERT INTO `internalmobitelconfig` VALUES (789,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',789,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,NULL,'moduleIdMm'),(790,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',789,200801,'','3051','','','','','',0,0,'','moduleIdMm'),(791,'','',789,200803,'5040003TT201','3051','1.18','яя','яяяя','яяяя','яяяя',0,0,'яяяя','яяяя'),(801,'','',789,218878,'','','1.18','яя','яяяя','яяяя','яяяя',0,0,'яяяя','moduleIdMm'),(802,'','',789,1,'','3029','','','','','',0,0,'','moduleIdMm'),(803,'','',803,0,'0','8564','0','0','0','0','0',0,0,'0','0'),(806,'','',806,0,'0','7105','0','0','0','0','0',0,0,'0','0'),(807,'','',807,0,'0','4651','0','0','0','0','0',0,0,'0','0'),(808,'','',808,0,'0','0789','0','0','0','0','0',0,0,'0','0'),(809,'','',809,0,'0','5088','0','0','0','0','0',0,0,'0','0'),(811,'','',811,0,'0','3110','0','0','0','0','0',0,0,'0','0'),(812,'','',812,0,'0','8412','0','0','0','0','0',0,0,'0','0'),(813,'','',813,0,'0','2684','0','0','0','0','0',0,0,'0','0'),(814,'','',814,0,'0','2881','0','0','0','0','0',0,0,'0','0'),(815,'','',815,0,'0','2575','0','0','0','0','0',0,0,'0','0'),(816,'','',816,0,'0','3925','0','0','0','0','0',0,0,'0','0'),(817,'','',817,0,'0','0777','0','0','0','0','0',0,0,'0','0'),(818,'','',818,0,'0','6602','0','0','0','0','0',0,0,'0','0'),(819,'','',819,0,'0','0096','0','0','0','0','0',0,0,'0','0'),(820,'','',820,0,'0','5191','0','0','0','0','0',0,0,'0','0'),(821,'','',821,0,'0','4727','0','0','0','0','0',0,0,'0','0'),(822,'','',822,0,'0','1642','0','0','0','0','0',0,0,'0','0'),(823,'','',823,0,'0','0256','0','0','0','0','0',0,0,'0','0'),(824,'','',824,0,'0','8269','0','0','0','0','0',0,0,'0','0'),(825,'','',825,0,'0','4983','0','0','0','0','0',0,0,'0','0'),(826,'','',826,0,'0','9540','0','0','0','0','0',0,0,'0','0'),(827,'','',827,0,'0','7794','0','0','0','0','0',0,0,'0','0'),(828,'','',828,0,'0','7729','0','0','0','0','0',0,0,'0','0'),(829,'','',829,0,'0','6212','0','0','0','0','0',0,0,'0','0'),(830,'','',830,0,'0','2570','0','0','0','0','0',0,0,'0','0'),(831,'','',831,0,'0','4713','0','0','0','0','0',0,0,'0','0'),(832,'','',832,0,'0','7776','0','0','0','0','0',0,0,'0','0'),(833,'','',833,0,'0','4146','0','0','0','0','0',0,0,'0','0'),(834,'','',834,0,'0','9490','0','0','0','0','0',0,0,'0','0'),(835,'','',835,0,'0','5958','0','0','0','0','0',0,0,'0','0'),(836,'','',836,0,'0','0902','0','0','0','0','0',0,0,'0','0'),(837,'','',837,0,'0','7638','0','0','0','0','0',0,0,'0','0'),(838,'','',838,0,'0','3865','0','0','0','0','0',0,0,'0','0'),(839,'','',839,0,'0','8228','0','0','0','0','0',0,0,'0','0'),(840,'','',840,0,'0','7370','0','0','0','0','0',0,0,'0','0'),(841,'','',841,0,'0','7998','0','0','0','0','0',0,0,'0','0'),(842,'','',842,0,'0','7824','0','0','0','0','0',0,0,'0','0'),(843,'','',843,0,'0','4343','0','0','0','0','0',0,0,'0','0'),(844,'','',844,0,'0','3680','0','0','0','0','0',0,0,'0','0'),(845,'','',845,0,'0','0560','0','0','0','0','0',0,0,'0','0'),(846,'','',846,0,'0','3920','0','0','0','0','0',0,0,'0','0');

--
-- Temporary table structure for view `internalmobitelconfigview`
--

/*!50001 DROP VIEW IF EXISTS `internalmobitelconfigview`*/;
/*!50001 CREATE VIEW `internalmobitelconfigview` AS SELECT 
 1 AS `ID`,
 1 AS `LastRecord`*/;

--
-- Table structure for table `lastmeters`
--

CREATE TABLE `lastmeters` (
  `LastMeter_ID` int(11) DEFAULT '0',
  `ID` int(11) DEFAULT '0',
  `Name` char(200) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `lastmeters`
--

INSERT INTO `lastmeters` VALUES (200,2,'200 метров',NULL),(1000,3,'1 километр',NULL),(5000,4,'5 километров',NULL),(25000,5,'25 километров',NULL),(100000,6,'100 километров',NULL);

--
-- Table structure for table `lastrecords`
--

CREATE TABLE `lastrecords` (
  `LastRecord_ID` int(11) DEFAULT '0',
  `ID` int(11) DEFAULT '0',
  `Name` char(200) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `lastrecords`
--

INSERT INTO `lastrecords` VALUES (5,1,'5 записей',NULL),(20,2,'20 записей',NULL),(50,3,'50 записей',NULL),(200,4,'200 записей',NULL),(1000,6,'1000 записей',NULL),(500,5,'500 записей',NULL),(3000,7,'3000 записей','3000 записей');

--
-- Table structure for table `lasttimes`
--

CREATE TABLE `lasttimes` (
  `LastTime_ID` int(11) DEFAULT '0',
  `ID` int(11) DEFAULT '0',
  `Name` char(200) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `lasttimes`
--

INSERT INTO `lasttimes` VALUES (5,1,'5 минут',NULL),(20,2,'20 минут',NULL),(120,3,'2 часа',NULL),(360,4,'6 часов',NULL),(1440,5,'сутки',NULL);

--
-- Table structure for table `lines`
--

CREATE TABLE `lines` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Color` int(11) DEFAULT '0' COMMENT 'Цвет',
  `Width` int(11) DEFAULT '3' COMMENT 'Толщина линии',
  `Mobitel_ID` int(11) DEFAULT NULL,
  `Icon` blob,
  PRIMARY KEY (`id`),
  KEY `lines_FK1` (`Mobitel_ID`) USING BTREE,
  CONSTRAINT `lines_FK1` FOREIGN KEY (`Mobitel_ID`) REFERENCES `mobitels` (`Mobitel_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=34 DEFAULT CHARSET=cp1251 COMMENT='Описание линии';

--
-- Dumping data for table `lines`
--

INSERT INTO `lines` VALUES (1,-16777077,3,808924983,NULL),(2,-16777077,3,808466742,NULL),(3,-16777077,3,808596790,NULL),(4,-16777077,3,825635890,NULL),(5,-16777077,3,102,NULL),(6,-16777077,3,107,NULL),(7,-16777077,3,859386421,NULL),(8,-16777077,3,876032567,NULL),(9,-16777077,3,876165171,NULL),(10,-16777077,3,892418353,NULL),(11,-16777077,3,909520946,NULL),(12,-16777077,3,942814777,NULL),(13,-16777077,3,875639862,NULL),(14,-16777077,3,842348336,NULL),(15,-16777077,3,959723824,NULL),(16,-16777077,3,892941624,NULL),(17,-16777077,3,959788080,NULL),(18,-16777077,3,926364217,NULL),(19,-16777077,3,909259058,NULL),(20,-16777077,3,926366004,NULL),(21,-16777077,3,876032307,NULL),(22,-16777077,3,926365494,NULL),(23,-16777077,3,809054258,NULL),(24,-16777077,3,859321909,NULL),(25,-16777077,3,926298936,NULL),(26,-16777077,3,926103344,NULL),(27,-16777077,3,942813752,NULL),(28,-16777077,3,926497080,NULL),(29,-16777077,3,926429748,NULL),(30,-16777077,3,875770931,NULL),(31,-16777077,3,859386416,NULL),(32,-16777077,3,859191344,NULL),(33,-16777077,3,808793648,NULL);

--
-- Table structure for table `mapstyleglobal`
--

CREATE TABLE `mapstyleglobal` (
  `MapStyleGlobal_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `DefaultLineStyle_ID` int(11) DEFAULT '0',
  `DefaulPointStyle_ID` int(11) DEFAULT '0',
  `EventPointStyle1_ID` int(11) DEFAULT '0',
  `EventPointStyle2_ID` int(11) DEFAULT '0',
  `EventPointStyle3_ID` int(11) DEFAULT '0',
  `EventPointStyle4_ID` int(11) DEFAULT '0',
  `EventPointStyle5_ID` int(11) DEFAULT '0',
  `EventPointStyle6_ID` int(11) DEFAULT '0',
  `EventPointStyle7_ID` int(11) DEFAULT '0',
  `EventPointStyle8_ID` int(11) DEFAULT '0',
  `EventPointStyle9_ID` int(11) DEFAULT '0',
  `EventPointStyle10_ID` int(11) DEFAULT '0',
  `EventPointStyle11_ID` int(11) DEFAULT '0',
  `EventPointStyle12_ID` int(11) DEFAULT '0',
  `EventPointStyle13_ID` int(11) DEFAULT '0',
  `EventPointStyle14_ID` int(11) DEFAULT '0',
  `EventPointStyle15_ID` int(11) DEFAULT '0',
  `EventPointStyle16_ID` int(11) DEFAULT '0',
  `EventPointStyle17_ID` int(11) DEFAULT '0',
  `EventPointStyle18_ID` int(11) DEFAULT '0',
  `EventPointStyle19_ID` int(11) DEFAULT '0',
  `EventPointStyle20_ID` int(11) DEFAULT '0',
  `EventPointStyle21_ID` int(11) DEFAULT '0',
  `EventPointStyle22_ID` int(11) DEFAULT '0',
  `EventPointStyle23_ID` int(11) DEFAULT '0',
  `EventPointStyle24_ID` int(11) DEFAULT '0',
  `EventPointStyle25_ID` int(11) DEFAULT '0',
  `EventPointStyle26_ID` int(11) DEFAULT '0',
  `EventPointStyle27_ID` int(11) DEFAULT '0',
  `EventPointStyle28_ID` int(11) DEFAULT '0',
  `EventPointStyle29_ID` int(11) DEFAULT '0',
  `EventPointStyle30_ID` int(11) DEFAULT '0',
  `EventPointStyle31_ID` int(11) DEFAULT '0',
  `EventPointStyle32_ID` int(11) DEFAULT '0',
  `SensorPointStyle1_ID` int(11) DEFAULT '0',
  `SensorPointStyle2_ID` int(11) DEFAULT '0',
  `SensorPointStyle3_ID` int(11) DEFAULT '0',
  `SensorPointStyle4_ID` int(11) DEFAULT '0',
  `SensorPointStyle5_ID` int(11) DEFAULT '0',
  `SensorPointStyle6_ID` int(11) DEFAULT '0',
  `SensorPointStyle7_ID` int(11) DEFAULT '0',
  `SensorPointStyle8_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`MapStyleGlobal_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mapstyleglobal`
--

INSERT INTO `mapstyleglobal` VALUES (1,'Настройка 1','Настнойки для Мобител',0,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(2,'Настнойки 4','Настнойки mob 4',0,2,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(3,'Настнойки 3','Настнойки для Мобител 3',0,3,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(4,'Tune 2','Настнойки для Мобител 2',0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);

--
-- Table structure for table `mapstylelines`
--

CREATE TABLE `mapstylelines` (
  `MapStyleLine_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Color` int(11) DEFAULT '0',
  `Width` tinyint(4) DEFAULT '0',
  `Style` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`MapStyleLine_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mapstylelines`
--

INSERT INTO `mapstylelines` VALUES (1,'Стиль линий Black','Описание',1,0,1,0),(2,'Стиль линий Blue','Стиль линий 2',2,16711680,4,0),(3,'Стиль линий Green','Стиль линий 3',3,32768,5,0),(4,'Стиль линий Red','Стиль линий 4',4,255,1,0),(6,'DEFAULT','Стиль по умолчанию',0,8388736,2,0),(8,'Style Fuchsia','Description for linestyle created at 13.08.2004 10:39:31',0,16711935,1,0);

--
-- Table structure for table `mapstylepoints`
--

CREATE TABLE `mapstylepoints` (
  `MapStylePoint_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `isBitmap` tinyint(1) DEFAULT NULL,
  `SymbolCode` tinyint(4) DEFAULT '0',
  `Color` int(11) DEFAULT '0',
  `Font` char(200) DEFAULT NULL,
  `Size` int(11) DEFAULT '0',
  `Rotation` int(11) DEFAULT '0',
  `BitmapName` char(200) DEFAULT NULL,
  `BitmapStyle` tinyint(4) DEFAULT '0',
  `Style` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`MapStylePoint_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mapstylepoints`
--

INSERT INTO `mapstylepoints` VALUES (2,'Blue Style','Стиль точек 1',2,0,0,16711680,NULL,3,0,NULL,0,0),(3,'Red Style','Стиль точек 2',3,0,0,255,NULL,4,0,NULL,0,0),(5,'DEFAULT','Стиль по умолчанию',0,0,0,128,NULL,5,0,NULL,0,0),(6,'Yellow Style','Стиль точек 3',4,0,0,65535,NULL,4,0,NULL,0,0),(8,'Fuchisia Style','Description for pointstyle created at 13.08.2004 10:39:45',0,0,0,16711935,NULL,3,0,NULL,0,0),(9,'Lime Style','Description for pointstyle created at 13.08.2004 10:41:19',0,0,0,65280,NULL,2,0,NULL,0,0),(10,'test','Description for pointstyle created at 06.12.2004 17:36:40',0,NULL,0,8421376,NULL,3,0,NULL,0,0);

--
-- Table structure for table `messages`
--

CREATE TABLE `messages` (
  `Message_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Time1` int(11) DEFAULT '0',
  `Time2` int(11) DEFAULT '0',
  `Time3` int(11) DEFAULT '0',
  `Time4` int(11) DEFAULT '0',
  `isSend` tinyint(1) DEFAULT NULL,
  `isDelivered` tinyint(1) DEFAULT NULL,
  `isNew` tinyint(1) DEFAULT NULL,
  `Direction` tinyint(1) DEFAULT NULL,
  `Mobitel_ID` int(11) DEFAULT '0',
  `ServiceInit_ID` int(11) DEFAULT '0',
  `Command_ID` tinyint(4) DEFAULT '0',
  `CommandMask_ID` int(11) DEFAULT '0',
  `MessageCounter` int(11) DEFAULT '0',
  `DataFromService` char(32) DEFAULT NULL,
  `Address` char(20) DEFAULT NULL,
  `Source_ID` int(11) DEFAULT '0',
  `Crc` tinyint(4) DEFAULT '1',
  `SmsId` int(11) DEFAULT '0',
  `AdvCounter` int(11) NOT NULL DEFAULT '0',
  `isNewFromMob` tinyint(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`Message_ID`),
  KEY `Index_2` (`isNewFromMob`,`Message_ID`,`Time1`) USING BTREE,
  KEY `Index_6` (`isNew`,`Direction`,`ServiceInit_ID`),
  KEY `Index_4` (`Mobitel_ID`,`Command_ID`),
  KEY `Index_5` (`Mobitel_ID`,`MessageCounter`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `messages`
--

INSERT INTO `messages` VALUES (1,1472921539,0,0,0,0,0,1,1,97,1,17,0,1,'',NULL,0,1,0,0,0);

--
-- Table structure for table `mobitels`
--

CREATE TABLE `mobitels` (
  `Mobitel_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` bigint(20) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `ServiceInit_ID` int(11) DEFAULT '0',
  `ServiceSend_ID` int(11) DEFAULT '0',
  `InternalMobitelConfig_ID` int(11) DEFAULT '0',
  `MapStyleLine_ID` int(11) DEFAULT '0',
  `MapStyleLastPoint_ID` int(11) DEFAULT '0',
  `MapStylePoint_ID` int(11) DEFAULT '0',
  `Route_ID` int(11) DEFAULT '0',
  `DeviceType` int(11) DEFAULT '0',
  `DeviceEngine` int(11) DEFAULT '0',
  `ConfirmedID` int(11) NOT NULL DEFAULT '0' COMMENT 'MIN значение LogID менее которого считается нет пропусков или уже невозможно загрузить',
  `LastInsertTime` int(11) NOT NULL DEFAULT '0' COMMENT 'UNIX_TIMESTAMP Время последней вставки данных в DataGPS',
  `Is64bitPackets` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'передача данных идет 64 байтными пакетами',
  `IsNotDrawDgps` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'РѕС‚РѕР±СЂР°Р¶Р°С‚СЊ РёР»Рё РЅРµС‚ РґР°РЅРЅС‹Рµ DGPS РЅР° РєР°СЂС‚Рµ',
  PRIMARY KEY (`Mobitel_ID`),
  KEY `IDX_InternalmobitelconfigID` (`InternalMobitelConfig_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=959788081 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mobitels`
--

INSERT INTO `mobitels` VALUES (97,'3029','',0,0,0,250,789,6,8,3,0,0,0,0,1553592112,0,0),(98,'8564','Desctiption for Teletrack registered at 03.09.2016 16:52:47',0,0,0,257,803,6,5,5,0,0,0,652820,1554990263,1,0),(101,'7105','Desctiption for Teletrack registered at 22.09.2016 14:05:00',0,0,0,263,806,6,5,5,0,0,0,0,1527063492,0,0),(102,'4651','Desctiption for Teletrack registered at 25.09.2016 17:43:35',0,0,0,265,807,6,5,5,0,0,0,730116,1686141310,1,0),(103,'0789','Desctiption for Teletrack registered at 25.09.2016 17:44:14',0,0,0,267,808,6,5,5,0,0,0,728669,1554990266,1,0),(104,'5088','+37282618049',0,0,0,270,809,6,5,5,0,0,0,0,1553591692,1,0),(106,'3110','Desctiption for Teletrack registered at 24.02.2017 15:05:44',0,0,0,274,811,6,5,5,0,0,0,0,1531921762,0,1),(107,'8412','Desctiption for Teletrack registered at 04.07.2017 9:33:44',0,0,0,276,812,6,5,5,0,0,0,0,1667028930,0,1),(108,'2684','Desctiption for Teletrack registered at 04.07.2017 9:37:24',0,0,0,278,813,6,5,5,0,0,0,0,1554990280,0,1),(109,'2881','+37282216351',0,0,0,280,814,6,5,5,0,0,0,0,1531921793,0,0),(110,'2575','+37282216349',0,0,0,281,815,6,5,5,0,0,0,0,1554990298,0,0),(808466742,'','',0,0,0,287,819,6,5,5,0,0,0,0,1686141265,1,1),(808596790,'','',0,0,0,291,823,6,5,5,0,0,0,0,1686141139,0,1),(808793648,'0560','',0,0,0,313,845,6,5,5,0,0,0,0,1686141303,1,1),(808924983,'','',0,0,0,285,817,6,5,5,0,0,0,0,1686141302,1,1),(809054258,'','',0,0,0,304,836,6,5,5,0,0,0,0,1686141256,1,1),(825635890,'','',0,0,0,290,822,6,5,5,0,0,0,0,1686141308,1,1),(842348336,'','',0,0,0,298,830,6,5,5,0,0,0,0,1683711536,0,1),(859191344,'3680','',0,0,0,312,844,6,5,5,0,0,0,0,1686037022,1,1),(859321909,'','',0,0,0,306,838,6,5,5,0,0,0,0,1686141308,1,1),(859386416,'3920','',0,0,0,314,846,6,5,5,0,0,0,0,1686141235,1,1),(859386421,'','',0,0,0,284,816,6,5,5,0,0,0,0,1652256367,0,1),(875639862,'','',0,0,0,301,833,6,5,5,0,0,0,0,1676712676,0,1),(875770931,'','',0,0,0,311,843,6,5,5,0,0,0,0,1686089839,1,1),(876032307,'','',0,0,0,299,831,6,5,5,0,0,0,0,1686141268,1,1),(876032567,'','',0,0,0,289,821,6,5,5,0,0,0,0,1668190837,1,1),(876165171,'','',0,0,0,293,825,6,5,5,0,0,0,0,1644301112,1,1),(892418353,'','',0,0,0,288,820,6,5,5,0,0,0,0,1686141192,1,1),(892941624,'','',0,0,0,303,835,6,5,5,0,0,0,0,1643731757,0,1),(909259058,'','',0,0,0,297,829,6,5,5,0,0,0,0,1686141283,1,1),(909520946,'','',0,0,0,286,818,6,5,5,0,0,0,0,1686141272,0,1),(926103344,'','',0,0,0,308,840,6,5,5,0,0,0,0,1685897916,0,1),(926298936,'','',0,0,0,305,837,6,5,5,0,0,0,0,1686141285,1,1),(926364217,'','',0,0,0,296,828,6,5,5,0,0,0,0,1676712437,1,1),(926365494,'','',0,0,0,300,832,6,5,5,0,0,0,0,1648807954,0,1),(926366004,'','',0,0,0,295,827,6,5,5,0,0,0,0,1664343169,1,1),(926429748,'','',0,0,0,310,842,6,5,5,0,0,0,0,1686095796,1,1),(926497080,'','',0,0,0,309,841,6,5,5,0,0,0,0,1686141167,1,1),(942813752,'','',0,0,0,307,839,6,5,5,0,0,0,0,1686141264,1,1),(942814777,'','',0,0,0,292,824,6,5,5,0,0,0,0,1645211379,0,1),(959723824,'','',0,0,0,302,834,6,5,5,0,0,0,0,1686141274,1,1),(959788080,'','',0,0,0,294,826,6,5,5,0,0,0,0,1686141231,0,1);

--
-- Table structure for table `mobitels_info`
--

CREATE TABLE `mobitels_info` (
  `Mobitel_ID` int(10) unsigned NOT NULL,
  `Map_Style_Car` text,
  `Track_Color` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`Mobitel_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `mobitels_info`
--

INSERT INTO `mobitels_info` VALUES (79,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(97,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(98,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(99,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(100,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(101,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(102,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(103,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(104,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(105,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(106,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(107,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(108,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(109,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL),(110,'object TDrawersGroup\r\n  DrawMode = gdmDrawAll\r\n  object TPointIconDrawer\r\n    AdjustSize = False\r\n    Image_Data = {\r\n      0000010001001313000000000000E80400001600000028000000130000002600\r\n      00000100180000000000C0040000000000000000000000000000000000000000\r\n      00FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284000000000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000FFA28400000000000000\r\n      0000000000000000000000800000800000800000800000800000000000000000\r\n      000000000000000000000000FFA284000000FFA2840000000000000000000000\r\n      00800000800000800000FFFFFFFFFFFFFFFFFF80000080000080000000000000\r\n      0000000000000000FFA284000000FFA284000000000000000000800000800000\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8000008000000000000000\r\n      00000000FFA284000000FFA284000000000000800000800000800000FFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000000000000000\r\n      FFA284000000FFA284000000000000800000FFFFFF800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFFFFFFF800000800000FFFFFF800000000000000000FFA28400\r\n      0000FFA284000000800000800000FFFFFFFFFFFF800000800000800000FFFFFF\r\n      800000800000800000FFFFFFFFFFFF800000800000000000FFA284000000FFA2\r\n      84000000800000FFFFFFFFFFFFFFFFFFFFFFFF80000080000080000080000080\r\n      0000FFFFFFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA284000000\r\n      800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFF\r\n      FFFFFFFFFFFFFFF0FBFF800000000000FFA284000000FFA28400000080000080\r\n      0000FFFFFFFFFFFFFFFFFFFFFFFF800000800000800000FFFFFFFFFFFFFFFFFF\r\n      FFFFFF800000800000000000FFA284000000FFA284000000000000800000FFFF\r\n      FFFFFFFFFFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF80\r\n      0000000000000000FFA284000000FFA284000000000000800000800000FFFFFF\r\n      FFFFFFFFFFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF8000008000000000\r\n      00000000FFA284000000FFA284000000000000000000800000FFFFFFFFFFFFFF\r\n      FFFFFFFFFF800000FFFFFFFFFFFFFFFFFFFFFFFF800000000000000000000000\r\n      FFA284000000FFA284000000000000000000000000800000800000FFFFFFFFFF\r\n      FF800000FFFFFFFFFFFF800000800000000000000000000000000000FFA28400\r\n      0000FFA284000000000000000000000000000000800000800000800000800000\r\n      800000800000800000000000000000000000000000000000FFA284000000FFA2\r\n      8400000000000000000000000000000000000000000000000000000000000000\r\n      0000000000000000000000000000000000000000FFA284000000FFA284FFA284\r\n      0000000000000000000000000000000000000000000000000000000000000000\r\n      00000000000000000000000000FFA284FFA284000000000000FFA284FFA284FF\r\n      A284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284FFA284\r\n      FFA284FFA284FFA284FFA28400000000000080003FFF3FFF9FFF7E0FDFFF7803\r\n      DFFF7001DFFF6000DFFF6000DFFF40005FFF40005FFF40005FFF40005FFF6000\r\n      DFFF6000DFFF7001DFFF7803DFFF7C07DFFF7FFFDFFF3FFF9FFF80003FFF}\r\n  end\r\n  object TPointTextDrawer\r\n    Font.Charset = RUSSIAN_CHARSET\r\n    Font.Color = clBlack\r\n    Font.Height = -11\r\n    Font.Name = \'Arial\'\r\n    Font.Style = []\r\n    OutlineColor = clWhite\r\n    VAlignment = vaTop\r\n    HAlignment = haLeft\r\n  end\r\nend',NULL);

--
-- Table structure for table `mobitels_rotate_bands`
--

CREATE TABLE `mobitels_rotate_bands` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) NOT NULL DEFAULT '0',
  `Bound` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Id`),
  KEY `FK_mobitels_rotate_bands_mobitels_Mobitel_ID` (`Mobitel_ID`),
  CONSTRAINT `FK_mobitels_rotate_bands_mobitels_Mobitel_ID` FOREIGN KEY (`Mobitel_ID`) REFERENCES `mobitels` (`Mobitel_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `mobitels_rotate_bands`
--


--
-- Table structure for table `ntf_emails`
--

CREATE TABLE `ntf_emails` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `IsActive` tinyint(1) NOT NULL DEFAULT '0',
  `Email` varchar(127) NOT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_email_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_email_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_emails`
--


--
-- Table structure for table `ntf_events`
--

CREATE TABLE `ntf_events` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `TypeEvent` tinyint(4) NOT NULL,
  `EventId` int(11) NOT NULL DEFAULT '0',
  `ParInt1` int(11) NOT NULL DEFAULT '0' COMMENT 'INT параметр любого события',
  `ParDbl1` double NOT NULL DEFAULT '0' COMMENT 'DOUBLE параметр №1 любого события',
  `ParDbl2` double NOT NULL DEFAULT '0' COMMENT 'DOUBLE параметр №2 любого события',
  `ParBool` bit(1) NOT NULL DEFAULT b'0' COMMENT 'BOOL параметр любого события',
  `ParInt2` int(11) NOT NULL DEFAULT '0' COMMENT 'INT параметр №2 любого события',
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_events_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_events_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_events`
--


--
-- Table structure for table `ntf_log`
--

CREATE TABLE `ntf_log` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `DateEvent` datetime NOT NULL,
  `DateWrite` datetime NOT NULL,
  `TypeEvent` tinyint(4) NOT NULL,
  `Mobitel_id` int(11) NOT NULL DEFAULT '0',
  `Zone_id` int(11) NOT NULL DEFAULT '0',
  `Location` varchar(255) DEFAULT NULL,
  `Lat` double DEFAULT '0',
  `Lng` double DEFAULT '0',
  `Infor` varchar(255) DEFAULT NULL,
  `IsRead` bit(1) DEFAULT b'0' COMMENT 'Уведомление прочитано ',
  `DataGps_ID` bigint(20) DEFAULT '0',
  `Speed` double DEFAULT '0',
  `Value` double DEFAULT '0' COMMENT 'Цифровое значение события (датчики)',
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_log_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_log_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_log`
--


--
-- Table structure for table `ntf_main`
--

CREATE TABLE `ntf_main` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `IsActive` tinyint(1) NOT NULL DEFAULT '0',
  `IsPopup` tinyint(1) NOT NULL DEFAULT '0',
  `Title` varchar(255) NOT NULL,
  `IconSmall` blob,
  `IconLarge` blob,
  `SoundName` varchar(50) DEFAULT NULL,
  `TimeForControl` double DEFAULT NULL,
  `IsEmailActive` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Активна E-mail рассылка уведомления',
  `Period` int(11) NOT NULL DEFAULT '0' COMMENT 'Периодичность появления уведомления(не чаще)',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_main`
--


--
-- Table structure for table `ntf_mobitels`
--

CREATE TABLE `ntf_mobitels` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `MobitelId` int(11) NOT NULL,
  `SensorLogicId` int(11) DEFAULT '0',
  `SensorId` int(11) DEFAULT '0',
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_mobitels_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_mobitels_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_mobitels`
--


--
-- Table structure for table `ntf_popupusers`
--

CREATE TABLE `ntf_popupusers` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Id_user` int(11) NOT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_ntf_popupUsers_ntf_main_Id` (`Id_main`),
  CONSTRAINT `FK_ntf_popupUsers_ntf_main_Id` FOREIGN KEY (`Id_main`) REFERENCES `ntf_main` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ntf_popupusers`
--


--
-- Table structure for table `parameters`
--

CREATE TABLE `parameters` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Number` int(11) NOT NULL COMMENT 'Номер параметра',
  `Value` varchar(255) DEFAULT NULL COMMENT 'Значение',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `parameters`
--

INSERT INTO `parameters` VALUES (1,24,'False'),(2,18,'True'),(3,13,'False'),(4,22,'0'),(5,12,'False'),(6,21,'uk'),(7,19,'osm.lwco.biz'),(8,23,'c93368dc5108666fb7ca8c3af76f9589'),(9,25,'False'),(10,20,'----'),(11,26,'ABQIAAAAWaQgWiEBF3lW97ifKnAczhRAzBk5Igf8Z5n2W3hNnMT0j2TikxTLtVIGU7hCLLHMAuAMt-BO5UrEWA'),(12,11,'0'),(13,6,'False'),(14,8,'False'),(15,9,'False'),(16,7,'0'),(17,1,'24'),(18,3,'5'),(19,10,'0'),(20,5,'False'),(21,2,'12'),(22,29,'875'),(23,27,'False'),(24,28,'gisfile.com');

--
-- Table structure for table `pcbdata`
--

CREATE TABLE `pcbdata` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Индекс',
  `Typedata` varchar(255) NOT NULL DEFAULT ' ' COMMENT 'Тип данных',
  `koeffK` double NOT NULL DEFAULT '0' COMMENT 'Коеффициент К',
  `Startbit` int(11) NOT NULL DEFAULT '0' COMMENT 'Стартовый бит поля',
  `Lengthbit` int(11) NOT NULL DEFAULT '0' COMMENT 'Длина поля',
  `Comment` varchar(255) DEFAULT ' ' COMMENT 'Коментарий',
  `Idpcb` int(11) NOT NULL DEFAULT '0' COMMENT 'Индекс платы датчика',
  `NameVal` varchar(12) DEFAULT ' ' COMMENT 'Name meassurement value',
  `NumAlg` int(11) DEFAULT '0' COMMENT 'Number of algorithm',
  `Shifter` double DEFAULT '0' COMMENT 'Shift coefficient',
  `S` tinyint(1) DEFAULT '0' COMMENT 'Sign arifmetic',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=cp1251 AVG_ROW_LENGTH=2340 COMMENT='Описание платы датчиков';

--
-- Dumping data for table `pcbdata`
--

INSERT INTO `pcbdata` VALUES (11,'уровень топлива',1,20,12,'',1,' ',0,0,0),(12,'уровень топлива (штатный ДУТ)',0.4,48,12,'',1,' ',0,0,0),(13,'обороты двигателя',4,0,10,'',1,' ',0,0,0),(14,'расход',0.5,10,10,'',1,' ',0,0,0),(15,'бортсеть',0.1181,32,8,'',1,' ',0,0,0),(16,'правий бак',1,20,16,'',2,' л',7,0,0),(17,'бортмережа',0.1181,36,8,'',2,' В',6,0,0),(18,'запалювання',1,60,1,'',2,' ',5,0,0),(19,'лівий бак',1,44,16,'',2,'л',7,0,0),(20,'бортмережа',0.1181,36,8,'',3,'В',4,0,0),(21,'запалювання',1,60,1,'',3,'#',5,0,0),(22,'бак',1,20,16,'',3,'л',7,0,0),(23,'бак',1,80,16,'',4,' л',7,0,0),(24,'штатний ДРП',0.4,128,8,'',4,' %',9,0,0),(25,'оберти двигуна',0.125,0,16,'',4,' rpm',5,0,0),(26,'витрата',0.5,16,64,'',4,' л',27,0,0),(27,'бортмережа',1,112,16,'',4,' В',4,0,0),(28,'пробіг за тахографом',0.005,152,32,'',4,' км',6,0,0),(29,'запалювання',1,196,1,'',4,' ',2,0,0),(30,'бак',0.3922,0,8,'',5,'%',7,0,0),(31,'бортмережа',0.1181,8,8,'',5,'В',6,0,0),(32,'витрата за бортовим компом',0.1,16,32,'',5,'л',27,0,0),(33,'одометр за штатним датчику швидкості',1,48,32,'',5,'км',6,0,0),(34,'оберти двигуна',0.25,80,16,'',5,'rpm',5,0,0),(35,'розрахункове значення навантаження на двигун',0.3922,96,8,'',5,'%',6,0,0),(36,'температура охолоджуючої рідини',0,104,8,'',5,'°C',6,0,0),(37,'температура повітря, що всмоктується',0,112,8,'',5,'°C',6,0,0),(38,'запалювання',1,199,1,'',5,'#',2,0,0);

--
-- Table structure for table `pcbversion`
--

CREATE TABLE `pcbversion` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Индекс',
  `Name` varchar(50) NOT NULL DEFAULT '*' COMMENT 'Имя платы датчика',
  `Comment` varchar(255) DEFAULT ' ' COMMENT 'Комментарий',
  `MobitelId` int(11) DEFAULT '-1' COMMENT 'ID машины на которую назначена эта плата датчиков',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=cp1251 AVG_ROW_LENGTH=5461 COMMENT='Распределение данных для версии исполнения платы датчиков';

--
-- Dumping data for table `pcbversion`
--

INSERT INTO `pcbversion` VALUES (1,'SCAD_CAN','для версии исполнения ПД SCAD',-1),(2,'SCAD_37f_16 bit','для версии исполнения ПД SCAD',-1),(3,'SCAD_37','для версии исполнения ПД SCAD',-1),(4,'SCAD_CAN64','для версии исполнения ПД SCAD',-1),(5,'SCAD_OBD II 64','для версии исполнения ПД SCAD',-1);

--
-- Table structure for table `points`
--

CREATE TABLE `points` (
  `Point_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Latitude` int(11) DEFAULT '0',
  `Longitude` int(11) DEFAULT '0',
  `Zone_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`Point_ID`),
  KEY `FK_points_zones` (`Zone_ID`),
  CONSTRAINT `FK_points_zones` FOREIGN KEY (`Zone_ID`) REFERENCES `zones` (`Zone_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `points`
--


--
-- Table structure for table `relationalgorithms`
--

CREATE TABLE `relationalgorithms` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `AlgorithmID` int(11) NOT NULL DEFAULT '0',
  `SensorID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=305 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `relationalgorithms`
--

INSERT INTO `relationalgorithms` VALUES (11,6,11),(12,5,12),(13,7,13),(14,9,14),(15,3,15),(16,8,16),(17,6,17),(18,7,18),(19,7,19),(20,7,20),(21,7,21),(22,7,22),(23,5,23),(24,8,24),(25,4,25),(27,10,27),(28,2,28),(29,2,29),(30,7,30),(31,11,31),(32,5,32),(33,8,33),(34,6,34),(35,2,35),(36,7,36),(40,6,40),(41,5,41),(49,7,49),(50,7,50),(53,6,53),(54,5,54),(55,6,55),(56,6,56),(61,6,61),(62,5,62),(70,5,70),(72,4,72),(73,6,73),(74,2,74),(75,7,75),(79,6,79),(81,5,81),(82,7,82),(84,6,84),(85,5,85),(88,6,88),(89,5,89),(91,6,91),(92,5,92),(95,6,95),(96,5,96),(97,7,97),(98,7,98),(103,4,103),(105,5,105),(106,4,106),(107,5,107),(113,4,113),(115,2,115),(120,4,120),(122,2,122),(127,4,127),(129,2,129),(138,31,138),(139,5,139),(140,27,140),(141,4,141),(142,6,142),(143,2,143),(145,6,145),(146,5,146),(148,4,148),(149,5,149),(151,4,151),(152,5,152),(155,31,155),(156,5,156),(157,27,157),(158,4,158),(159,6,159),(160,2,160),(164,4,164),(166,7,166),(167,4,167),(168,5,168),(169,7,169),(170,4,170),(171,5,171),(172,7,172),(173,4,173),(174,5,174),(175,7,175),(177,7,177),(178,5,178),(179,8,179),(180,4,180),(181,6,181),(182,2,182),(183,7,183),(184,6,184),(185,5,185),(187,7,187),(188,31,188),(189,5,189),(190,8,190),(191,4,191),(192,6,192),(193,2,193),(194,7,194),(195,7,195),(197,5,197),(199,4,199),(200,6,200),(201,2,201),(202,7,202),(204,5,204),(206,4,206),(207,6,207),(208,2,208),(209,7,209),(211,5,211),(213,4,213),(214,6,214),(215,2,215),(217,31,217),(218,5,218),(219,8,219),(220,4,220),(221,6,221),(222,2,222),(223,7,223),(224,31,224),(225,5,225),(226,8,226),(227,4,227),(228,6,228),(229,2,229),(231,31,231),(232,5,232),(233,8,233),(234,4,234),(235,6,235),(236,2,236),(237,4,237),(238,5,238),(239,7,239),(255,9,255),(256,5,256),(257,27,257),(258,4,258),(259,6,259),(260,2,260),(263,5,263),(265,4,265),(266,6,266),(267,2,267),(268,7,268),(270,5,270),(272,4,272),(273,6,273),(274,2,274),(275,7,275),(276,7,276),(278,5,278),(279,27,279),(280,4,280),(281,6,281),(282,2,282),(283,7,283),(285,9,285),(286,5,286),(287,27,287),(288,4,288),(289,6,289),(290,2,290),(293,5,293),(294,27,294),(295,4,295),(296,6,296),(297,2,297),(298,7,298),(300,5,300),(302,4,302),(303,6,303),(304,2,304);

--
-- Table structure for table `report_pass_zones`
--

CREATE TABLE `report_pass_zones` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `ZoneID` int(11) NOT NULL COMMENT 'Идентификатор КЗ',
  PRIMARY KEY (`ID`),
  KEY `IDX_ZoneID` (`ZoneID`) USING BTREE,
  CONSTRAINT `FK_RPZ_Zones` FOREIGN KEY (`ZoneID`) REFERENCES `zones` (`Zone_ID`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Список зон, используемый в отчетах по пассажиропотоку.';

--
-- Dumping data for table `report_pass_zones`
--


--
-- Table structure for table `route_items`
--

CREATE TABLE `route_items` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Seq` int(11) DEFAULT NULL,
  `Route_ID` int(11) DEFAULT NULL,
  `Zone_ID` int(11) DEFAULT NULL,
  `Zone_IO` int(11) DEFAULT NULL,
  `GoNext_Min` int(11) DEFAULT NULL,
  `GoNext_Max` int(11) DEFAULT NULL,
  `Link_Item` int(11) DEFAULT NULL,
  `Link_Info` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_items`
--


--
-- Table structure for table `route_list`
--

CREATE TABLE `route_list` (
  `Route_ID` int(11) NOT NULL AUTO_INCREMENT,
  `GIS` blob,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `Modified` int(11) DEFAULT NULL,
  PRIMARY KEY (`Route_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_list`
--


--
-- Table structure for table `route_lists`
--

CREATE TABLE `route_lists` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Parent` int(11) DEFAULT NULL,
  `Title` varchar(70) DEFAULT NULL,
  `Data` text,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_lists`
--


--
-- Table structure for table `route_mobitel_links`
--

CREATE TABLE `route_mobitel_links` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `List_ID` int(11) DEFAULT NULL,
  `Route_ID` int(11) DEFAULT NULL,
  `Mobitel_ID` int(11) DEFAULT NULL,
  `Time1` int(11) DEFAULT NULL,
  `Time2` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_mobitel_links`
--


--
-- Table structure for table `route_mobitel_plans`
--

CREATE TABLE `route_mobitel_plans` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Title` varchar(70) DEFAULT NULL,
  `Time1` int(11) DEFAULT NULL,
  `Time2` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_mobitel_plans`
--


--
-- Table structure for table `route_points`
--

CREATE TABLE `route_points` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Route_ID` int(11) DEFAULT NULL,
  `Zone_ID` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `route_points`
--


--
-- Table structure for table `rt_events`
--

CREATE TABLE `rt_events` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_events`
--

INSERT INTO `rt_events` VALUES (1,'Въезд'),(2,'Выезд');

--
-- Table structure for table `rt_route`
--

CREATE TABLE `rt_route` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_sample` int(11) NOT NULL COMMENT 'Ссылка на шаблон маршрута ',
  `Id_mobitel` int(11) NOT NULL DEFAULT '0' COMMENT 'Транспортное средство ',
  `Id_driver` int(11) NOT NULL DEFAULT '0' COMMENT 'Водитель',
  `TimeStartPlan` datetime DEFAULT NULL COMMENT 'План время начала маршрута',
  `Distance` double NOT NULL DEFAULT '0' COMMENT 'Общий путь, км',
  `TimePlanTotal` varchar(20) DEFAULT NULL COMMENT 'Общее время на маршруте (план)',
  `TimeFactTotal` varchar(20) DEFAULT NULL COMMENT 'Общее время на маршруте (факт)',
  `Deviation` varchar(20) DEFAULT NULL COMMENT 'Отклонение от графика',
  `DeviationAr` varchar(20) DEFAULT NULL COMMENT 'Отклонение по времени прибытия',
  `Remark` text COMMENT 'Примечание',
  `FuelStart` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Топливо в начале',
  `FuelAdd` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Заправлено',
  `FuelSub` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Слито',
  `FuelEnd` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Топливо в конце',
  `FuelExpens` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Общий расход топлива',
  `FuelExpensAvg` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДУТ Средний расход,  л/100 км',
  `Fuel_ExpensMove` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДРТ/CAN Расход топлива в движении, л',
  `Fuel_ExpensStop` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДРТ/CAN Расход топлива на стоянках, л',
  `Fuel_ExpensTotal` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДРТ/CAN Общий расход, л',
  `Fuel_ExpensAvg` double(10,2) NOT NULL DEFAULT '0.00' COMMENT 'ДРТ/CAN Средний расход, л/100 км',
  `TimeMove` varchar(20) DEFAULT NULL COMMENT 'Время движения',
  `TimeStop` varchar(20) DEFAULT NULL COMMENT 'Время остановок',
  `SpeedAvg` double(10,2) DEFAULT '0.00' COMMENT 'Средняя скорость',
  `FuelAddQty` int(11) DEFAULT '0' COMMENT 'ДУТ Заправлено - кол-во',
  `FuelSubQty` int(11) DEFAULT '0' COMMENT 'ДУТ Слито - кол-во',
  `PointsValidity` int(11) DEFAULT '0' COMMENT 'Валидность данных',
  `PointsCalc` int(11) DEFAULT '0' COMMENT 'Количество точек (по Log_ID) расчетное',
  `PointsFact` int(11) DEFAULT '0' COMMENT 'Количество точек (по Log_ID) фактическое',
  `PointsIntervalMax` varchar(20) DEFAULT NULL COMMENT 'Максимальный интервал между точками',
  `Type` tinyint(4) NOT NULL DEFAULT '1' COMMENT 'Тип маршрутного листа - КЗ или населенные пункты',
  `TimeEndFact` datetime DEFAULT NULL COMMENT 'Фактическое время окончания маршрута',
  `DistLogicSensor` double(10,2) DEFAULT '0.00' COMMENT 'Путь с включенным логическим датчиком, км',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route`
--


--
-- Table structure for table `rt_route_fuel`
--

CREATE TABLE `rt_route_fuel` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Location` varchar(255) NOT NULL,
  `time_` datetime NOT NULL,
  `dValueCalc` double NOT NULL DEFAULT '0' COMMENT 'Расчетная величина',
  `dValueHandle` double DEFAULT '0' COMMENT 'Ручная правка',
  PRIMARY KEY (`Id`),
  UNIQUE KEY `Id` (`Id`) USING BTREE,
  KEY `rt_route_fuel_FK1` (`Id_main`),
  CONSTRAINT `rt_route_fuel_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_route` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route_fuel`
--


--
-- Table structure for table `rt_route_sensors`
--

CREATE TABLE `rt_route_sensors` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `SensorName` varchar(127) NOT NULL,
  `Location` varchar(255) NOT NULL,
  `EventTime` datetime NOT NULL,
  `Duration` time NOT NULL,
  `Description` varchar(255) DEFAULT NULL,
  `Speed` double DEFAULT '0',
  `Distance` double(10,2) DEFAULT '0.00' COMMENT 'Путь, км',
  PRIMARY KEY (`Id`),
  KEY `rt_route_sensors_FK1` (`Id_main`) USING BTREE,
  CONSTRAINT `rt_route_sensors_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_route` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route_sensors`
--


--
-- Table structure for table `rt_route_stops`
--

CREATE TABLE `rt_route_stops` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Location` varchar(255) DEFAULT NULL,
  `InitialTime` datetime DEFAULT NULL,
  `FinalTime` datetime DEFAULT NULL,
  `Interval` time DEFAULT NULL,
  `CheckZone` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Остановка в контрольной зоне',
  PRIMARY KEY (`Id`),
  KEY `rt_route_stops_FK1` (`Id_main`) USING BTREE,
  CONSTRAINT `rt_route_stops_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_route` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route_stops`
--


--
-- Table structure for table `rt_route_type`
--

CREATE TABLE `rt_route_type` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) NOT NULL COMMENT 'Тип маршрута',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_route_type`
--

INSERT INTO `rt_route_type` VALUES (1,'Контрольные зоны'),(2,'Населенные пункты');

--
-- Table structure for table `rt_routet`
--

CREATE TABLE `rt_routet` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Id_zone` int(11) NOT NULL DEFAULT '0' COMMENT 'Контрольная зона',
  `Id_event` int(11) NOT NULL DEFAULT '1' COMMENT 'Событие - въезд / выезд ',
  `DatePlan` datetime DEFAULT NULL COMMENT 'План время события ',
  `DateFact` datetime DEFAULT NULL COMMENT 'Факт время события ',
  `Deviation` varchar(10) DEFAULT NULL COMMENT 'Отклонение от графика',
  `Remark` text COMMENT 'Примечание',
  `Distance` double DEFAULT '0' COMMENT 'Путь между точками маршрута',
  `Location` varchar(255) DEFAULT NULL COMMENT 'Населенный пункт',
  PRIMARY KEY (`Id`),
  KEY `rt_routet_FK1` (`Id_main`) USING BTREE,
  CONSTRAINT `rt_routet_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_route` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_routet`
--


--
-- Table structure for table `rt_sample`
--

CREATE TABLE `rt_sample` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(100) NOT NULL,
  `Id_mobitel` int(11) DEFAULT '0' COMMENT 'Транспортное средство (опц)',
  `TimeStart` time DEFAULT NULL COMMENT 'Время начала маршрута (опц)',
  `Distance` double DEFAULT '0' COMMENT 'Общий путь, км',
  `Remark` text COMMENT 'Примечание',
  `Id_main` int(11) NOT NULL DEFAULT '0' COMMENT 'Ссылка на элемент верхнего уровня в иерархии',
  `IsGroupe` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Запись - группа',
  `AutoCreate` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Маршрут может автосоздаваться ',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_sample`
--


--
-- Table structure for table `rt_samplet`
--

CREATE TABLE `rt_samplet` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL,
  `Position` tinyint(4) NOT NULL COMMENT 'Порядковый номер записи шаблона маршрута',
  `Id_event` int(11) NOT NULL COMMENT 'Событие - въезд / выезд ',
  `Id_zone` int(11) DEFAULT NULL COMMENT 'Контрольная зона',
  `TimeRel` char(5) DEFAULT '00:00' COMMENT 'Относительное время от начала маршрута',
  `TimeRelP` char(5) DEFAULT '00:00' COMMENT 'Допустимое отклонение (+)',
  `TimeRelM` char(5) DEFAULT '00:00' COMMENT 'Допустимое отклонение (-)',
  `TimeAbs` char(8) DEFAULT '00:00:00' COMMENT 'Абсолютное время маршрута',
  PRIMARY KEY (`Id`),
  KEY `rt_samplet_FK1` (`Id_main`) USING BTREE,
  CONSTRAINT `rt_samplet_FK1` FOREIGN KEY (`Id_main`) REFERENCES `rt_sample` (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rt_samplet`
--


--
-- Table structure for table `rt_shedule`
--

CREATE TABLE `rt_shedule` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_shedule_dc` int(11) DEFAULT NULL COMMENT 'Ссылка на справочник графиков',
  `Id_zone_main` int(11) DEFAULT NULL COMMENT 'Зона старта транспортных средств',
  `DateShedule` datetime NOT NULL COMMENT 'Дата графика',
  `Remark` varchar(127) DEFAULT NULL COMMENT 'Примечание',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Ссылка на внешний документ учетной системы',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Шапка документа ГРАФИК ДВИЖЕНИЯ';

--
-- Dumping data for table `rt_shedule`
--


--
-- Table structure for table `rt_shedule_dc`
--

CREATE TABLE `rt_shedule_dc` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(127) NOT NULL COMMENT 'Название шаблона графика движения',
  `Id_zone_main` int(11) DEFAULT NULL COMMENT 'Зона старта транспортных средств',
  `Remark` varchar(127) DEFAULT NULL COMMENT 'Примечание',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Шаблон шапки документа ГРАФИК ДВИЖЕНИЯ';

--
-- Dumping data for table `rt_shedule_dc`
--


--
-- Table structure for table `rt_shedulet`
--

CREATE TABLE `rt_shedulet` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL COMMENT 'Ссылка на шапку документа',
  `Id_zone_to` int(11) DEFAULT NULL COMMENT 'Зона прибытия транспортного средства',
  `Id_vehicle` int(11) DEFAULT NULL COMMENT 'Транспортное средство',
  `TimePlanStart` datetime NOT NULL COMMENT 'Плановая дата начала движения',
  `TimePlanEnd` datetime DEFAULT NULL COMMENT 'Плановая дата окончания движения',
  `TimeFactStart` datetime DEFAULT NULL COMMENT 'Фактическая дата начала движения',
  `TimeFactEnd` datetime DEFAULT NULL COMMENT 'Фактическая дата окончания движения',
  `Distance` float NOT NULL DEFAULT '0' COMMENT 'Плановое расстояние',
  `State` varchar(127) DEFAULT NULL COMMENT 'Статус слежения за транспортным средством',
  `IsClose` bit(1) NOT NULL DEFAULT b'0' COMMENT 'Слежение за транспортным средством прекращено',
  PRIMARY KEY (`Id`),
  KEY `FK_rt_shedulet_rt_shedule` (`Id_main`) USING BTREE,
  CONSTRAINT `FK_rt_shedulet_rt_shedule` FOREIGN KEY (`Id_main`) REFERENCES `rt_shedule` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Содержимое документа ГРАФИК ДВИЖЕНИЯ';

--
-- Dumping data for table `rt_shedulet`
--


--
-- Table structure for table `rt_shedulet_dc`
--

CREATE TABLE `rt_shedulet_dc` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_main` int(11) NOT NULL COMMENT 'Ссылка на шапку документа',
  `Id_zone_to` int(11) DEFAULT NULL COMMENT 'Зона прибытия транспортного средства',
  `TimePlanStart` char(5) NOT NULL COMMENT 'Плановая дата начала движения',
  `TimePlanEnd` char(5) DEFAULT NULL COMMENT 'Плановая дата окончания движения',
  `Distance` float NOT NULL DEFAULT '0' COMMENT 'Плановое расстояние',
  PRIMARY KEY (`Id`),
  KEY `FK_rt_shedulet_rt_shedule` (`Id_main`) USING BTREE,
  CONSTRAINT `FK_rt_shedulet_dc_rt_shedule_dc` FOREIGN KEY (`Id_main`) REFERENCES `rt_shedule_dc` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Шаблон содержимого документа ГРАФИК ДВИЖЕНИЯ';

--
-- Dumping data for table `rt_shedulet_dc`
--


--
-- Table structure for table `rules`
--

CREATE TABLE `rules` (
  `Rule_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Password` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) NOT NULL DEFAULT '0',
  `Rule1` tinyint(4) NOT NULL DEFAULT '0',
  `Rule2` tinyint(4) NOT NULL DEFAULT '0',
  `Rule3` tinyint(4) NOT NULL DEFAULT '0',
  `Rule4` tinyint(4) NOT NULL DEFAULT '0',
  `Rule5` tinyint(4) NOT NULL DEFAULT '0',
  `Rule6` tinyint(4) NOT NULL DEFAULT '0',
  `Rule7` tinyint(4) NOT NULL DEFAULT '0',
  `Rule8` tinyint(4) NOT NULL DEFAULT '0',
  `Rule9` tinyint(4) NOT NULL DEFAULT '0',
  `Rule10` tinyint(4) NOT NULL DEFAULT '0',
  `Rule11` tinyint(4) NOT NULL DEFAULT '0',
  `Rule12` tinyint(4) NOT NULL DEFAULT '0',
  `Rule13` tinyint(4) NOT NULL DEFAULT '0',
  `Rule14` tinyint(4) NOT NULL DEFAULT '0',
  `Rule15` tinyint(4) NOT NULL DEFAULT '0',
  `Rule16` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Rule_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `rules`
--

INSERT INTO `rules` VALUES (1,'guest','guest','guest account',0,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0),(8,'power','power','Description for Power User Profile',0,1,1,1,1,1,0,0,1,1,0,0,0,0,0,0,0),(9,'root','root','Description for root  Profile',0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0);

--
-- Table structure for table `sensor_hookups`
--

CREATE TABLE `sensor_hookups` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Mobitel_ID` int(11) DEFAULT NULL,
  `Sensor_ID` int(11) DEFAULT NULL,
  `FirstBit` int(11) DEFAULT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensor_hookups`
--


--
-- Table structure for table `sensor_list`
--

CREATE TABLE `sensor_list` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Title` varchar(70) DEFAULT NULL,
  `Kind` varchar(20) DEFAULT NULL,
  `BitsCount` int(11) DEFAULT NULL,
  `FirstBit` int(11) DEFAULT NULL,
  `Data` text,
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensor_list`
--


--
-- Table structure for table `sensoralgorithms`
--

CREATE TABLE `sensoralgorithms` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(45) NOT NULL,
  `Description` char(45) DEFAULT NULL,
  `AlgorithmID` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID` (`ID`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensoralgorithms`
--

INSERT INTO `sensoralgorithms` VALUES (1,'Логический датчик','Для анализа используется критерий вкл. выкл.',1),(2,'Работа основного двигателя','Обычно используется при подключении к заж.',2),(3,'Обороты оборудования','Для анализа используются к-во оборотов',3),(4,'Напряжение','Контролируется борт сеть',4),(5,'Обороты основного двигателя','Для анализа используются к-во оборотов',5),(6,'Температура','Датчик температуры',6),(7,'Уровень топлива','Уровень топлива в баке1',7),(8,'Расход топлива','Уровень топлива в баке2',8),(9,'Пассажиры1','Для подсчета количества пассажиров1',9),(10,'Пассажиры2','Для подсчета количества пассажиров2',10),(11,'Дверь1','Для пассажиров1',11),(12,'Дверь2','Для пассажиров2',12),(13,'Идентификация водителя','Для идентификации водителей',13),(14,'Идентификация прицепного устройства','Для идентификации прицепных устройств',14),(15,'Топливозаправщик','Для контроля запровок с бензовоза',15),(16,'Слежение - логический датчик','Для отображения в режиме слежения',16),(17,'Прицепное оборудование - логический датчик','Для контроля состояний работа/переезд',17),(18,'Инклинометр - продольная ось X,','Для контроля угла наклона по оси Х',18),(19,'Инклинометр - продольная ось Y,','Для контроля угла наклона по оси Y',19),(20,'Идентификация оператора','Для идентификации водителя принявшего топливо',20),(21,'Идентификация транспортного средства','Для идентификации топливозаправщика',21),(22,'Угломерный датчик рабочего положения','Для идентификации агрегата в агро',22),(23,'Датчик разгрузки транспортного средства','Выгрузка бункера комбайна в агро',23),(24,'Расход топлива прямой','Расход топлива в баке прямой',24),(25,'Расход топлива обратный','Расход топлива в баке обратный',25),(26,'Дальномер','Дальномер',26),(27,'Расходомер топлива накопительный','Расходомер типа ДРТ, только накопительный',27),(28,'Определение уровня зерна в бункере','Алгоритм определения уровня зерна в бункере',28),(29,'Расход топлива дифференциальный','Дифференциальный проточник',29),(30,'Топливозаправщик (дифференциальный)','Топливозаправщик на дифф ДРТ',30),(31,'Уровень топлива в агрегате','Уровень топлива в баке агрегата',31);

--
-- Table structure for table `sensorcoefficient`
--

CREATE TABLE `sensorcoefficient` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Sensor_id` int(10) unsigned NOT NULL,
  `UserValue` double(10,5) NOT NULL,
  `SensorValue` double(10,5) NOT NULL,
  `K` double(10,5) NOT NULL DEFAULT '1.00000',
  `b` double NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `Index_2` (`Sensor_id`,`UserValue`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=805 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensorcoefficient`
--

INSERT INTO `sensorcoefficient` VALUES (1,20,0.00000,514.00000,0.07968,-40.9561752988048),(2,20,20.00000,765.00000,0.03630,-7.76769509981851),(3,20,40.00000,1316.00000,0.03650,-8.02919708029197),(4,20,60.00000,1864.00000,0.03697,-8.90942698706101),(5,20,80.00000,2405.00000,0.03891,-13.579766536965),(6,20,100.00000,2919.00000,0.03731,-8.91791044776119),(7,20,120.00000,3455.00000,0.03731,-8.91791044776119),(8,20,140.00000,3991.00000,0.03738,-9.19626168224298),(9,20,160.00000,4526.00000,0.03683,-6.7034990791897),(10,20,180.00000,5069.00000,0.03914,-18.3953033268102),(11,20,200.00000,5580.00000,0.03724,-7.82122905027936),(12,20,220.00000,6117.00000,0.03676,-4.88970588235296),(13,20,240.00000,6661.00000,0.03670,-4.44036697247708),(14,20,260.00000,7206.00000,0.04167,-40.25),(15,20,266.00000,7350.00000,0.04167,-40.25),(99,13,0.00000,621.00000,0.06042,-37.5226586102719),(100,13,20.00000,952.00000,0.07634,-52.6717557251908),(101,13,40.00000,1214.00000,0.08734,-66.0262008733624),(102,13,60.00000,1443.00000,0.08696,-65.4782608695652),(103,13,80.00000,1673.00000,0.08969,-70.0448430493273),(104,13,100.00000,1896.00000,0.08811,-67.0484581497797),(105,13,120.00000,2123.00000,0.11364,-121.25),(106,13,140.00000,2299.00000,0.09662,-82.1256038647343),(107,13,160.00000,2506.00000,0.09804,-85.6862745098039),(108,13,180.00000,2710.00000,0.10000,-91),(109,13,200.00000,2910.00000,0.10050,-92.462311557789),(110,13,220.00000,3109.00000,0.10152,-95.6345177664975),(111,13,240.00000,3306.00000,0.10152,-95.6345177664975),(112,13,260.00000,3503.00000,0.10204,-97.4489795918367),(113,13,280.00000,3699.00000,0.10256,-99.3846153846154),(114,13,300.00000,3894.00000,0.10204,-97.3469387755103),(115,13,320.00000,4090.00000,0.10152,-95.2284263959391),(116,13,340.00000,4287.00000,0.10101,-93.030303030303),(117,13,360.00000,4485.00000,0.11050,-135.580110497238),(118,13,380.00000,4666.00000,0.09852,-79.704433497537),(119,13,400.00000,4869.00000,0.09709,-72.7184466019418),(120,13,420.00000,5075.00000,0.09524,-63.3333333333333),(121,13,440.00000,5285.00000,0.09302,-51.6279069767442),(122,13,460.00000,5500.00000,0.08969,-33.2735426008969),(123,13,480.00000,5723.00000,0.08696,-17.6521739130434),(124,13,500.00000,5953.00000,0.08264,8.01652892561981),(125,13,520.00000,6195.00000,0.08264,8.01652892561981),(126,18,0.00000,588.00000,0.07937,-46.6666666666667),(127,18,20.00000,840.00000,0.11765,-78.8235294117647),(128,18,40.00000,1010.00000,0.12903,-90.3225806451613),(129,18,60.00000,1165.00000,0.12903,-90.3225806451613),(130,18,80.00000,1320.00000,0.12658,-87.0886075949367),(131,18,100.00000,1478.00000,0.12903,-90.7096774193548),(132,18,120.00000,1633.00000,0.13158,-94.8684210526315),(133,18,140.00000,1785.00000,0.13245,-96.4238410596027),(134,18,160.00000,1936.00000,0.15625,-142.5),(135,18,180.00000,2064.00000,0.13699,-102.739726027397),(136,18,200.00000,2210.00000,0.13986,-109.090909090909),(137,18,220.00000,2353.00000,0.14085,-111.408450704225),(138,18,240.00000,2495.00000,0.14184,-113.900709219858),(139,18,260.00000,2636.00000,0.14085,-111.267605633803),(140,18,280.00000,2778.00000,0.13793,-103.172413793103),(141,18,300.00000,2923.00000,0.13986,-108.811188811189),(142,18,320.00000,3066.00000,0.14085,-111.830985915493),(143,18,340.00000,3208.00000,0.13986,-108.671328671329),(144,18,360.00000,3351.00000,0.14085,-111.971830985916),(145,18,380.00000,3493.00000,0.14085,-111.971830985916),(146,18,400.00000,3635.00000,0.13986,-108.391608391608),(147,18,420.00000,3778.00000,0.13986,-108.391608391608),(148,18,440.00000,3921.00000,0.13986,-108.391608391608),(149,18,460.00000,4064.00000,0.13986,-108.391608391608),(150,18,480.00000,4207.00000,0.16393,-209.672131147541),(151,18,500.00000,4329.00000,0.14286,-118.428571428571),(152,18,520.00000,4469.00000,0.13889,-100.694444444444),(153,18,540.00000,4613.00000,0.13889,-100.694444444444),(154,18,560.00000,4757.00000,0.13699,-91.6438356164383),(155,18,580.00000,4903.00000,0.13514,-82.5675675675676),(156,18,600.00000,5051.00000,0.13158,-64.6052631578947),(157,18,620.00000,5203.00000,0.13072,-60.1307189542484),(158,18,640.00000,5356.00000,0.12579,-33.7106918238994),(159,18,660.00000,5515.00000,0.12346,-20.8641975308642),(160,18,680.00000,5677.00000,0.11905,4.16666666666674),(161,18,700.00000,5845.00000,0.11628,20.3488372093024),(162,18,720.00000,6017.00000,0.10363,96.4766839378239),(163,18,740.00000,6210.00000,0.10363,96.4766839378239),(164,19,0.00000,826.00000,0.05141,-42.4678663239075),(165,19,20.00000,1215.00000,0.05495,-46.7582417582418),(166,19,40.00000,1579.00000,0.05464,-46.2841530054645),(167,19,60.00000,1945.00000,0.05666,-50.1983002832861),(168,19,80.00000,2298.00000,0.05714,-51.3142857142857),(169,19,100.00000,2648.00000,0.05698,-50.8831908831909),(170,19,120.00000,2999.00000,0.06231,-66.8535825545171),(171,19,140.00000,3320.00000,0.05618,-46.5168539325843),(172,19,160.00000,3676.00000,0.05747,-51.2643678160919),(173,19,180.00000,4024.00000,0.05618,-46.0674157303371),(174,19,200.00000,4380.00000,0.05556,-43.3333333333333),(175,19,220.00000,4740.00000,0.05305,-31.4588859416446),(176,19,240.00000,5117.00000,0.04743,-2.70355731225294),(177,19,252.00000,5370.00000,0.04743,-2.70355731225294),(178,30,0.00000,591.00000,0.17391,-102.782608695652),(179,30,20.00000,706.00000,0.14184,-80.1418439716312),(180,30,40.00000,847.00000,0.14925,-86.4179104477612),(181,30,60.00000,981.00000,0.15385,-90.9230769230769),(182,30,80.00000,1111.00000,0.15748,-94.9606299212599),(183,30,100.00000,1238.00000,0.15974,-97.7635782747604),(184,30,150.00000,1551.00000,0.16077,-99.3569131832797),(185,30,200.00000,1862.00000,0.17857,-132.5),(186,30,250.00000,2142.00000,0.16447,-102.302631578947),(187,30,300.00000,2446.00000,0.16667,-107.666666666667),(188,30,350.00000,2746.00000,0.16722,-109.197324414716),(189,30,400.00000,3045.00000,0.16835,-112.626262626263),(190,30,450.00000,3342.00000,0.16892,-114.527027027027),(191,30,500.00000,3638.00000,0.16835,-112.457912457912),(192,30,550.00000,3935.00000,0.16835,-112.457912457912),(193,30,600.00000,4232.00000,0.17986,-161.151079136691),(194,30,650.00000,4510.00000,0.16667,-101.666666666667),(195,30,700.00000,4810.00000,0.16556,-96.3576158940398),(196,30,750.00000,5112.00000,0.16340,-85.2941176470588),(197,30,800.00000,5418.00000,0.16181,-76.6990291262135),(198,30,850.00000,5727.00000,0.15924,-61.9426751592356),(199,30,900.00000,6041.00000,0.15432,-32.253086419753),(200,30,950.00000,6365.00000,0.14706,13.970588235294),(201,30,970.00000,6501.00000,0.14815,6.88888888888891),(202,30,990.00000,6636.00000,0.14815,6.88888888888891),(203,49,0.00000,586.00000,0.05782,-33.8843537414966),(204,49,17.00000,880.00000,0.07194,-46.3093525179856),(205,49,37.00000,1158.00000,0.08403,-60.3109243697479),(206,49,57.00000,1396.00000,0.08197,-57.4262295081967),(207,49,77.00000,1640.00000,0.09479,-78.4502369668246),(208,49,97.00000,1851.00000,0.08850,-66.8053097345133),(209,49,117.00000,2077.00000,0.10417,-99.3541666666667),(210,49,137.00000,2269.00000,0.09302,-74.0697674418605),(211,49,157.00000,2484.00000,0.09390,-76.2394366197183),(212,49,177.00000,2697.00000,0.09615,-82.3269230769231),(213,49,197.00000,2905.00000,0.09662,-83.6763285024155),(214,49,217.00000,3112.00000,0.09709,-85.1359223300971),(215,49,237.00000,3318.00000,0.09804,-88.2941176470588),(216,49,257.00000,3522.00000,0.09804,-88.2941176470588),(217,49,277.00000,3726.00000,0.09804,-88.2941176470588),(218,49,297.00000,3930.00000,0.09852,-90.192118226601),(219,49,317.00000,4133.00000,0.09756,-86.219512195122),(220,49,337.00000,4338.00000,0.09709,-84.1650485436893),(221,49,357.00000,4544.00000,0.10989,-142.340659340659),(222,49,377.00000,4726.00000,0.09479,-70.9620853080568),(223,49,397.00000,4937.00000,0.09346,-64.4018691588785),(224,49,417.00000,5151.00000,0.09217,-57.7465437788019),(225,49,437.00000,5368.00000,0.08969,-44.4349775784753),(226,49,457.00000,5591.00000,0.08734,-31.296943231441),(227,49,477.00000,5820.00000,0.08368,-10.0292887029289),(228,49,497.00000,6059.00000,0.08032,10.3333333333333),(229,49,517.00000,6308.00000,0.07380,51.4649446494465),(230,49,537.00000,6579.00000,0.08097,4.28744939271257),(231,49,557.00000,6826.00000,0.08097,4.28744939271257),(232,50,0.00000,592.00000,0.06601,-39.0759075907591),(233,50,20.00000,895.00000,0.06993,-42.5874125874126),(234,50,40.00000,1181.00000,0.07576,-49.469696969697),(235,50,60.00000,1445.00000,0.07937,-54.6825396825397),(236,50,80.00000,1697.00000,0.08299,-60.8298755186722),(237,50,100.00000,1938.00000,0.09524,-84.5714285714286),(238,50,120.00000,2148.00000,0.08696,-66.7826086956522),(239,50,140.00000,2378.00000,0.08850,-70.4424778761062),(240,50,160.00000,2604.00000,0.08929,-72.5),(241,50,180.00000,2828.00000,0.09132,-78.2648401826484),(242,50,200.00000,3047.00000,0.09091,-77),(243,50,220.00000,3267.00000,0.09217,-81.1059907834102),(244,50,240.00000,3484.00000,0.09174,-79.6330275229358),(245,50,260.00000,3702.00000,0.09217,-81.1981566820277),(246,50,280.00000,3919.00000,0.09174,-79.5412844036697),(247,50,300.00000,4137.00000,0.09091,-76.0909090909091),(248,50,320.00000,4357.00000,0.09390,-89.1079812206573),(249,50,340.00000,4570.00000,0.09709,-103.68932038835),(250,50,360.00000,4776.00000,0.08772,-58.9473684210526),(251,50,380.00000,5004.00000,0.08621,-51.3793103448276),(252,50,400.00000,5236.00000,0.08439,-41.8565400843881),(253,50,420.00000,5473.00000,0.08130,-24.9593495934959),(254,50,440.00000,5719.00000,0.07874,-10.3149606299212),(255,50,460.00000,5973.00000,0.07435,15.910780669145),(256,50,480.00000,6242.00000,0.06873,50.9965635738831),(257,50,500.00000,6533.00000,0.06647,65.7254335260116),(258,50,523.00000,6879.00000,0.06647,65.7254335260116),(259,75,0.00000,885.00000,0.06757,-59.7972972972973),(260,75,20.00000,1181.00000,0.08032,-74.859437751004),(261,75,40.00000,1430.00000,0.08584,-82.7467811158798),(262,75,60.00000,1663.00000,0.08969,-89.1479820627803),(263,75,80.00000,1886.00000,0.08889,-87.6444444444444),(264,75,100.00000,2111.00000,0.10554,-122.796833773087),(265,75,140.00000,2490.00000,0.09926,-107.146401985112),(266,75,180.00000,2893.00000,0.10127,-112.962025316456),(267,75,220.00000,3288.00000,0.10230,-116.368286445013),(268,75,260.00000,3679.00000,0.10283,-118.303341902314),(269,75,300.00000,4068.00000,0.10256,-117.230769230769),(270,75,320.00000,4263.00000,0.10152,-112.791878172589),(271,75,340.00000,4460.00000,0.10582,-131.957671957672),(272,75,360.00000,4649.00000,0.11050,-153.701657458564),(273,75,380.00000,4830.00000,0.09852,-95.8620689655173),(274,75,400.00000,5033.00000,0.09501,-78.1947743467934),(275,75,440.00000,5454.00000,0.09050,-53.5746606334841),(276,75,480.00000,5896.00000,0.08247,-6.26804123711338),(277,75,520.00000,6381.00000,0.07576,36.5909090909091),(278,75,525.00000,6447.00000,0.07937,13.3333333333334),(279,75,530.00000,6510.00000,0.07353,51.3235294117647),(280,75,535.00000,6578.00000,0.06494,107.857142857143),(281,75,540.00000,6655.00000,0.06494,107.857142857143),(282,82,0.00000,659.00000,0.06734,-44.3771043771044),(283,82,40.00000,1253.00000,0.08097,-61.4574898785425),(284,82,80.00000,1747.00000,0.09346,-83.2710280373832),(285,82,120.00000,2175.00000,0.09238,-80.9237875288683),(286,82,160.00000,2608.00000,0.09524,-88.3809523809524),(287,82,200.00000,3028.00000,0.09662,-92.56038647343),(288,82,220.00000,3235.00000,0.09756,-95.609756097561),(289,82,240.00000,3440.00000,0.09709,-93.9805825242718),(290,82,260.00000,3646.00000,0.09804,-97.4509803921568),(291,82,280.00000,3850.00000,0.09615,-90.1923076923077),(292,82,300.00000,4058.00000,0.09804,-97.8431372549019),(293,82,340.00000,4466.00000,0.09804,-97.8431372549019),(294,82,380.00000,4874.00000,0.08949,-56.1521252796421),(295,82,420.00000,5321.00000,0.08439,-29.0295358649789),(296,82,460.00000,5795.00000,0.09398,-84.6428571428571),(297,82,485.00000,6061.00000,0.06024,119.879518072289),(298,82,495.00000,6227.00000,0.06024,119.879518072289),(313,98,0.00000,500.00000,0.07317,-36.5853658536585),(314,98,60.00000,1320.00000,0.07968,-45.1792828685259),(315,98,80.00000,1571.00000,0.08333,-50.9166666666667),(316,98,100.00000,1811.00000,0.08547,-54.7863247863248),(317,98,120.00000,2045.00000,0.08584,-55.5364806866953),(318,98,140.00000,2278.00000,0.09009,-65.2252252252252),(319,98,160.00000,2500.00000,0.09058,-66.4492753623188),(320,98,210.00000,3052.00000,0.09560,-81.7782026768642),(321,98,260.00000,3575.00000,0.08865,-56.9326241134752),(322,98,310.00000,4139.00000,0.08475,-40.7627118644068),(323,98,360.00000,4729.00000,0.07782,-8.01556420233464),(324,98,380.00000,4986.00000,0.07407,10.6666666666667),(325,98,400.00000,5256.00000,0.06608,52.6872246696036),(326,98,415.00000,5483.00000,0.06608,52.6872246696036),(327,21,0.00000,500.00000,0.07519,-37.593984962406),(328,21,20.00000,766.00000,0.07500,-37.45),(329,21,40.10000,1034.00000,0.09352,-56.5981481481481),(330,21,60.30000,1250.00000,0.09095,-53.3877828054299),(331,21,80.40000,1471.00000,0.09302,-56.4372093023256),(332,21,100.40000,1686.00000,0.11167,-87.8699999999999),(333,21,120.50000,1866.00000,0.09756,-61.5487804878049),(334,21,140.50000,2071.00000,0.10000,-66.6),(335,21,160.60000,2272.00000,0.10256,-72.425641025641),(336,21,180.60000,2467.00000,0.10204,-71.134693877551),(337,21,200.60000,2663.00000,0.10361,-75.3087628865979),(338,21,220.70000,2857.00000,0.13581,-167.311486486487),(339,21,240.80000,3005.00000,0.10582,-77.189417989418),(340,21,260.80000,3194.00000,0.10469,-73.5718749999994),(341,21,280.90000,3386.00000,0.10582,-77.4068783068783),(342,21,300.90000,3575.00000,0.10417,-71.4958333333334),(343,21,320.90000,3767.00000,0.10471,-73.5502617801047),(344,21,340.90000,3958.00000,0.09853,-49.0794117647063),(345,21,361.00000,4162.00000,0.12579,-162.522012578616),(346,21,381.00000,4321.00000,0.10050,-53.2713567839196),(347,21,401.00000,4520.00000,0.09804,-42.1372549019608),(348,21,421.00000,4724.00000,0.09571,-31.1542857142862),(349,21,441.10000,4934.00000,0.09217,-13.6465437788019),(350,21,461.10000,5151.00000,0.09009,-2.95405405405398),(351,21,481.10000,5373.00000,0.08590,19.5730769230778),(352,21,501.20000,5607.00000,0.08112,46.3349397590364),(353,21,521.40000,5856.00000,0.08112,46.3349397590364),(354,22,0.00000,500.00000,0.07317,-36.5853658536585),(355,22,60.00000,1320.00000,0.07968,-45.1792828685259),(356,22,80.00000,1571.00000,0.08333,-50.9166666666667),(357,22,100.00000,1811.00000,0.08547,-54.7863247863248),(358,22,120.00000,2045.00000,0.08584,-55.5364806866953),(359,22,140.00000,2278.00000,0.09009,-65.2252252252252),(360,22,160.00000,2500.00000,0.09058,-66.4492753623188),(361,22,210.00000,3052.00000,0.09560,-81.7782026768642),(362,22,260.00000,3575.00000,0.08865,-56.9326241134752),(363,22,310.00000,4139.00000,0.08475,-40.7627118644068),(364,22,360.00000,4729.00000,0.07782,-8.01556420233464),(365,22,380.00000,4986.00000,0.07407,10.6666666666667),(366,22,400.00000,5256.00000,0.06608,52.6872246696036),(367,22,415.00000,5483.00000,0.06608,52.6872246696036),(368,97,0.00000,500.00000,0.09901,-49.5049504950495),(369,97,50.00000,1005.00000,0.08889,-39.3333333333333),(370,97,70.00000,1230.00000,0.08811,-38.3700440528634),(371,97,90.00000,1457.00000,0.09709,-51.4563106796116),(372,97,110.00000,1663.00000,0.09823,-53.3595284872299),(373,97,160.00000,2172.00000,0.11521,-90.2304147465438),(374,97,210.00000,2606.00000,0.10823,-72.034632034632),(375,97,260.00000,3068.00000,0.10142,-51.1561866125761),(376,97,310.00000,3561.00000,0.09862,-41.1834319526627),(377,97,360.00000,4068.00000,0.10438,-64.6346555323591),(378,97,410.00000,4547.00000,0.08811,9.38325991189424),(379,97,430.00000,4774.00000,0.09950,-45.0248756218906),(380,97,450.00000,4975.00000,0.08696,17.3913043478261),(381,97,460.00000,5090.00000,0.08696,17.3913043478261),(423,166,0.00000,0.00000,0.47619,0),(424,166,1.00000,5147.00000,-0.04691,242.4641975308642),(425,166,20.00000,4742.00000,-0.04691,242.4641975308642),(426,166,40.00000,4264.00000,-0.04184,218.4100418410042),(427,166,60.00000,3789.00000,-0.04211,219.53684210526316),(428,166,80.00000,3330.00000,-0.04357,225.09803921568627),(429,166,100.00000,2866.00000,-0.04310,223.5344827586207),(430,166,120.00000,2390.00000,-0.04202,220.42016806722688),(431,166,140.00000,1926.00000,-0.04310,223.01724137931035),(432,166,160.00000,1428.00000,-0.04016,217.34939759036143),(433,166,180.00000,923.00000,-0.03960,216.55445544554456),(434,166,200.00000,420.00000,-0.03976,216.69980119284295),(435,195,0.00000,0.00000,1.14155,0),(436,195,1.00000,7091.00000,-0.05307,377.33798882681566),(437,195,20.00000,6733.00000,-0.05307,377.33798882681566),(438,195,40.00000,6431.00000,-0.06623,465.8940397350994),(439,195,60.00000,6134.00000,-0.06734,473.06397306397304),(440,195,80.00000,5863.00000,-0.07380,512.6937269372694),(441,195,100.00000,5605.00000,-0.07752,534.4961240310078),(442,195,120.00000,5386.00000,-0.09132,611.8721461187215),(443,195,140.00000,5144.00000,-0.08264,565.1239669421489),(444,195,160.00000,4897.00000,-0.08097,556.5182186234817),(445,195,180.00000,4652.00000,-0.08163,559.7551020408163),(446,195,200.00000,4416.00000,-0.08475,574.2372881355932),(447,195,220.00000,4179.00000,-0.08439,572.6582278481012),(448,195,240.00000,3937.00000,-0.08264,565.3719008264463),(449,195,260.00000,3697.00000,-0.08333,568.0833333333333),(450,195,280.00000,3454.00000,-0.08230,564.2798353909466),(451,195,300.00000,3213.00000,-0.08299,566.6390041493776),(452,195,320.00000,2974.00000,-0.08368,568.8702928870293),(453,195,340.00000,2723.00000,-0.07968,556.9721115537849),(454,195,360.00000,2467.00000,-0.07812,552.734375),(455,195,380.00000,2212.00000,-0.07843,553.4901960784314),(456,195,400.00000,1948.00000,-0.07576,547.5757575757576),(457,195,420.00000,1671.00000,-0.07220,540.6498194945848),(458,195,440.00000,1375.00000,-0.06757,532.9054054054054),(459,195,460.00000,1057.00000,-0.06289,526.4779874213837),(460,195,470.00000,888.00000,-0.05917,522.5443786982248),(461,195,500.00000,438.00000,-0.06667,529.2),(462,202,0.00000,0.00000,1.14155,0),(463,202,1.00000,7091.00000,-0.05307,377.33798882681566),(464,202,20.00000,6733.00000,-0.05307,377.33798882681566),(465,202,40.00000,6431.00000,-0.06623,465.8940397350994),(466,202,60.00000,6134.00000,-0.06734,473.06397306397304),(467,202,80.00000,5863.00000,-0.07380,512.6937269372694),(468,202,100.00000,5605.00000,-0.07752,534.4961240310078),(469,202,120.00000,5386.00000,-0.09132,611.8721461187215),(470,202,140.00000,5144.00000,-0.08264,565.1239669421489),(471,202,160.00000,4897.00000,-0.08097,556.5182186234817),(472,202,180.00000,4652.00000,-0.08163,559.7551020408163),(473,202,200.00000,4416.00000,-0.08475,574.2372881355932),(474,202,220.00000,4179.00000,-0.08439,572.6582278481012),(475,202,240.00000,3937.00000,-0.08264,565.3719008264463),(476,202,260.00000,3697.00000,-0.08333,568.0833333333333),(477,202,280.00000,3454.00000,-0.08230,564.2798353909466),(478,202,300.00000,3213.00000,-0.08299,566.6390041493776),(479,202,320.00000,2974.00000,-0.08368,568.8702928870293),(480,202,340.00000,2723.00000,-0.07968,556.9721115537849),(481,202,360.00000,2467.00000,-0.07812,552.734375),(482,202,380.00000,2212.00000,-0.07843,553.4901960784314),(483,202,400.00000,1948.00000,-0.07576,547.5757575757576),(484,202,420.00000,1671.00000,-0.07220,540.6498194945848),(485,202,440.00000,1375.00000,-0.06757,532.9054054054054),(486,202,460.00000,1057.00000,-0.06289,526.4779874213837),(487,202,470.00000,888.00000,-0.05917,522.5443786982248),(488,202,500.00000,438.00000,-0.06667,529.2),(489,209,0.00000,0.00000,1.14155,0),(490,209,1.00000,7091.00000,-0.05307,377.33798882681566),(491,209,20.00000,6733.00000,-0.05307,377.33798882681566),(492,209,40.00000,6431.00000,-0.06623,465.8940397350994),(493,209,60.00000,6134.00000,-0.06734,473.06397306397304),(494,209,80.00000,5863.00000,-0.07380,512.6937269372694),(495,209,100.00000,5605.00000,-0.07752,534.4961240310078),(496,209,120.00000,5386.00000,-0.09132,611.8721461187215),(497,209,140.00000,5144.00000,-0.08264,565.1239669421489),(498,209,160.00000,4897.00000,-0.08097,556.5182186234817),(499,209,180.00000,4652.00000,-0.08163,559.7551020408163),(500,209,200.00000,4416.00000,-0.08475,574.2372881355932),(501,209,220.00000,4179.00000,-0.08439,572.6582278481012),(502,209,240.00000,3937.00000,-0.08264,565.3719008264463),(503,209,260.00000,3697.00000,-0.08333,568.0833333333333),(504,209,280.00000,3454.00000,-0.08230,564.2798353909466),(505,209,300.00000,3213.00000,-0.08299,566.6390041493776),(506,209,320.00000,2974.00000,-0.08368,568.8702928870293),(507,209,340.00000,2723.00000,-0.07968,556.9721115537849),(508,209,360.00000,2467.00000,-0.07812,552.734375),(509,209,380.00000,2212.00000,-0.07843,553.4901960784314),(510,209,400.00000,1948.00000,-0.07576,547.5757575757576),(511,209,420.00000,1671.00000,-0.07220,540.6498194945848),(512,209,440.00000,1375.00000,-0.06757,532.9054054054054),(513,209,460.00000,1057.00000,-0.06289,526.4779874213837),(514,209,470.00000,888.00000,-0.05917,522.5443786982248),(515,209,500.00000,438.00000,-0.06667,529.2),(516,187,0.00000,0.00000,0.90000,0),(517,187,10.00000,6912.00000,-0.06369,450.2547770700637),(518,187,30.00000,6598.00000,-0.06369,450.2547770700637),(519,187,50.00000,6288.00000,-0.06452,455.6774193548387),(520,187,70.00000,5984.00000,-0.06579,463.6842105263158),(521,187,90.00000,5690.00000,-0.06803,477.07482993197283),(522,187,110.00000,5405.00000,-0.07018,489.29824561403507),(523,187,160.00000,4699.00000,-0.07082,492.79036827195466),(524,187,210.00000,4000.00000,-0.07153,496.12303290414883),(525,187,260.00000,3309.00000,-0.07236,499.43560057887123),(526,187,310.00000,2609.00000,-0.07143,496.35714285714283),(527,187,330.00000,2324.00000,-0.07018,493.0877192982456),(528,187,350.00000,2013.00000,-0.06431,479.4533762057878),(529,187,370.00000,1727.00000,-0.06993,490.7692307692308),(530,187,390.00000,1429.00000,-0.06711,485.90604026845637),(531,187,410.00000,1108.00000,-0.06231,479.0342679127726),(532,187,427.00000,830.00000,-0.06115,477.75539568345323),(533,187,450.00000,500.00000,-0.06970,484.8484848484849),(534,194,0.00000,0.00000,1.14493,0),(535,194,30.00000,6782.00000,-0.13605,952.7210884353742),(536,194,50.00000,6635.00000,-0.13605,952.7210884353742),(537,194,70.00000,6447.00000,-0.10638,755.8510638297872),(538,194,90.00000,6277.00000,-0.11765,828.4705882352941),(539,194,110.00000,6108.00000,-0.11834,832.8402366863905),(540,194,130.00000,5954.00000,-0.12987,903.2467532467532),(541,194,180.00000,5554.00000,-0.12500,874.25),(542,194,230.00000,5148.00000,-0.12315,863.9901477832512),(543,194,280.00000,4754.00000,-0.12690,883.2994923857867),(544,194,330.00000,4363.00000,-0.12788,887.9283887468031),(545,194,380.00000,3970.00000,-0.12723,885.089058524173),(546,194,430.00000,3576.00000,-0.12690,883.8071065989848),(547,194,480.00000,3193.00000,-0.13055,896.8407310704961),(548,194,530.00000,2801.00000,-0.12755,887.2704081632653),(549,194,580.00000,2405.00000,-0.12626,883.6616161616162),(550,194,630.00000,2006.00000,-0.12531,881.3784461152882),(551,194,650.00000,1850.00000,-0.12821,887.1794871794872),(552,194,670.00000,1688.00000,-0.12346,878.395061728395),(553,194,690.00000,1522.00000,-0.12048,873.3734939759036),(554,194,710.00000,1352.00000,-0.11765,869.0588235294117),(555,194,730.00000,1186.00000,-0.12048,872.8915662650602),(556,194,756.00000,993.00000,-0.13472,889.7720207253886),(557,194,770.00000,866.00000,-0.11024,865.4645669291339),(558,194,790.00000,690.00000,-0.11364,868.4090909090909),(606,223,0.00000,0.00000,1.06667,0),(607,223,1.00000,6664.00000,-0.09845,657.041450777202),(608,223,20.00000,6471.00000,-0.09845,657.041450777202),(609,223,40.00000,6303.00000,-0.11905,790.3571428571428),(610,223,60.00000,6139.00000,-0.12195,808.6585365853658),(611,223,80.00000,5987.00000,-0.13158,867.7631578947368),(612,223,100.00000,5837.00000,-0.13333,878.2666666666667),(613,223,150.00000,5470.00000,-0.13624,895.2316076294279),(614,223,250.00000,4731.00000,-0.13532,890.1894451962111),(615,223,350.00000,4019.00000,-0.14045,914.4662921348315),(616,223,450.00000,3295.00000,-0.13812,905.110497237569),(617,223,550.00000,2587.00000,-0.14124,915.3954802259886),(618,223,650.00000,1852.00000,-0.13605,901.9727891156463),(619,223,700.00000,1487.00000,-0.13699,903.6986301369863),(620,223,750.00000,1103.00000,-0.13021,893.6197916666667),(621,223,770.00000,944.00000,-0.12579,888.7421383647799),(622,223,800.00000,750.00000,-0.15464,915.979381443299),(623,239,0.00000,0.00000,1.24309,0),(624,239,1.00000,7308.00000,-0.05398,395.4659090909091),(625,239,20.00000,6956.00000,-0.05398,395.4659090909091),(626,239,40.00000,6781.00000,-0.11429,814.9714285714285),(627,239,60.00000,6612.00000,-0.11834,842.4852071005917),(628,239,80.00000,6450.00000,-0.12346,876.2962962962963),(629,239,100.00000,6300.00000,-0.13333,940),(630,239,120.00000,6154.00000,-0.13699,963.0136986301369),(631,239,140.00000,6012.00000,-0.14085,986.7605633802817),(632,239,160.00000,5865.00000,-0.13605,957.9591836734695),(633,239,180.00000,5735.00000,-0.15385,1062.3076923076924),(634,239,200.00000,5602.00000,-0.15038,1042.406015037594),(635,239,250.00000,5262.00000,-0.14706,1023.8235294117648),(636,239,300.00000,4925.00000,-0.14837,1030.7121661721067),(637,239,350.00000,4591.00000,-0.14970,1037.2754491017963),(638,239,400.00000,4274.00000,-0.15773,1074.1324921135647),(639,239,450.00000,3941.00000,-0.15015,1041.7417417417419),(640,239,500.00000,3612.00000,-0.15198,1048.9361702127658),(641,239,550.00000,3286.00000,-0.15337,1053.9877300613498),(642,239,600.00000,2970.00000,-0.15823,1069.9367088607596),(643,239,620.00000,2839.00000,-0.15267,1053.4351145038167),(644,239,640.00000,2708.00000,-0.15267,1053.4351145038167),(645,239,660.00000,2574.00000,-0.14925,1044.1791044776119),(646,239,680.00000,2438.00000,-0.14706,1038.5294117647059),(647,239,700.00000,2300.00000,-0.14493,1033.3333333333335),(648,239,720.00000,2161.00000,-0.14388,1030.9352517985612),(649,239,740.00000,2026.00000,-0.14815,1040.1481481481483),(650,239,760.00000,1887.00000,-0.14388,1031.5107913669065),(651,239,780.00000,1744.00000,-0.13986,1023.916083916084),(652,239,800.00000,1597.00000,-0.13605,1017.2789115646259),(653,239,820.00000,1444.00000,-0.13072,1008.7581699346406),(654,239,840.00000,1294.00000,-0.13333,1012.5333333333333),(655,239,860.00000,1141.00000,-0.13072,1009.1503267973856),(656,239,880.00000,924.00000,-0.09217,965.1612903225806),(657,239,900.00000,724.00000,-0.10000,972.4),(658,183,0.00000,0.00000,1.24309,0),(659,183,1.00000,7308.00000,-0.05398,395.4659090909091),(660,183,20.00000,6956.00000,-0.05398,395.4659090909091),(661,183,40.00000,6781.00000,-0.11429,814.9714285714285),(662,183,60.00000,6612.00000,-0.11834,842.4852071005917),(663,183,80.00000,6450.00000,-0.12346,876.2962962962963),(664,183,100.00000,6300.00000,-0.13333,940),(665,183,120.00000,6154.00000,-0.13699,963.0136986301369),(666,183,140.00000,6012.00000,-0.14085,986.7605633802817),(667,183,160.00000,5865.00000,-0.13605,957.9591836734695),(668,183,180.00000,5735.00000,-0.15385,1062.3076923076924),(669,183,200.00000,5602.00000,-0.15038,1042.406015037594),(670,183,250.00000,5262.00000,-0.14706,1023.8235294117648),(671,183,300.00000,4925.00000,-0.14837,1030.7121661721067),(672,183,350.00000,4591.00000,-0.14970,1037.2754491017963),(673,183,400.00000,4274.00000,-0.15773,1074.1324921135647),(674,183,450.00000,3941.00000,-0.15015,1041.7417417417419),(675,183,500.00000,3612.00000,-0.15198,1048.9361702127658),(676,183,550.00000,3286.00000,-0.15337,1053.9877300613498),(677,183,600.00000,2970.00000,-0.15823,1069.9367088607596),(678,183,620.00000,2839.00000,-0.15267,1053.4351145038167),(679,183,640.00000,2708.00000,-0.15267,1053.4351145038167),(680,183,660.00000,2574.00000,-0.14925,1044.1791044776119),(681,183,680.00000,2438.00000,-0.14706,1038.5294117647059),(682,183,700.00000,2300.00000,-0.14493,1033.3333333333335),(683,183,720.00000,2161.00000,-0.14388,1030.9352517985612),(684,183,740.00000,2026.00000,-0.14815,1040.1481481481483),(685,183,760.00000,1887.00000,-0.14388,1031.5107913669065),(686,183,780.00000,1744.00000,-0.13986,1023.916083916084),(687,183,800.00000,1597.00000,-0.13605,1017.2789115646259),(688,183,820.00000,1444.00000,-0.13072,1008.7581699346406),(689,183,840.00000,1294.00000,-0.13333,1012.5333333333333),(690,183,860.00000,1141.00000,-0.13072,1009.1503267973856),(691,183,880.00000,924.00000,-0.09217,965.1612903225806),(692,183,900.00000,724.00000,-0.10000,972.4),(693,268,0.00000,0.00000,0.55285,0),(694,268,1.00000,7163.00000,-0.04034,289.95329087048833),(695,268,20.00000,6692.00000,-0.04034,289.95329087048833),(696,268,40.00000,6261.00000,-0.04640,330.5336426914153),(697,268,60.00000,5864.00000,-0.05038,355.4156171284635),(698,268,80.00000,5500.00000,-0.05495,382.1978021978022),(699,268,100.00000,5135.00000,-0.05479,381.3698630136986),(700,268,150.00000,4268.00000,-0.05767,396.13610149942326),(701,268,200.00000,3407.00000,-0.05807,397.8513356562137),(702,268,250.00000,2533.00000,-0.05721,394.908466819222),(703,268,270.00000,2152.00000,-0.05249,382.96587926509187),(704,268,290.00000,1765.00000,-0.05168,381.21447028423773),(705,268,310.00000,1331.00000,-0.04608,371.33640552995394),(706,268,320.00000,1065.00000,-0.03759,360.0375939849624),(707,268,340.00000,615.00000,-0.04444,367.3333333333333),(708,275,0.00000,0.00000,0.73638,0),(709,275,1.00000,7451.00000,-0.05507,411.34492753623186),(710,275,20.00000,7106.00000,-0.05507,411.34492753623186),(711,275,40.00000,6782.00000,-0.06173,458.641975308642),(712,275,60.00000,6479.00000,-0.06601,487.6567656765676),(713,275,80.00000,6193.00000,-0.06993,513.0769230769231),(714,275,100.00000,5927.00000,-0.07519,545.6390977443609),(715,275,120.00000,5665.00000,-0.07634,552.4427480916031),(716,275,140.00000,5407.00000,-0.07752,559.1472868217054),(717,275,160.00000,5151.00000,-0.07812,562.421875),(718,275,210.00000,4539.00000,-0.08170,580.8333333333333),(719,275,260.00000,3924.00000,-0.08130,579.0243902439024),(720,275,310.00000,3315.00000,-0.08210,582.167487684729),(721,275,330.00000,3069.00000,-0.08130,579.5121951219512),(722,275,350.00000,2816.00000,-0.07905,572.6086956521739),(723,275,370.00000,2557.00000,-0.07722,567.4517374517375),(724,275,390.00000,2293.00000,-0.07576,563.7121212121212),(725,275,410.00000,2033.00000,-0.07692,566.3846153846154),(726,275,430.00000,1757.00000,-0.07246,557.3188405797101),(727,275,450.00000,1461.00000,-0.06757,548.7162162162163),(728,275,470.00000,1144.00000,-0.06309,542.1766561514196),(729,275,500.00000,679.00000,-0.06452,543.8064516129032),(730,276,0.00000,0.00000,0.90811,0),(731,276,1.00000,7656.00000,-0.02687,206.68358208955223),(732,276,10.00000,7321.00000,-0.02687,206.68358208955223),(733,276,20.00000,7062.00000,-0.03861,292.66409266409266),(734,276,40.00000,6591.00000,-0.04246,319.87261146496814),(735,276,60.00000,6160.00000,-0.04640,345.8468677494199),(736,276,80.00000,5746.00000,-0.04831,357.5845410628019),(737,276,100.00000,5352.00000,-0.05076,371.6751269035533),(738,276,120.00000,4960.00000,-0.05102,373.0612244897959),(739,276,140.00000,4579.00000,-0.05249,380.3674540682415),(740,276,160.00000,4205.00000,-0.05348,384.8663101604278),(741,276,180.00000,3822.00000,-0.05222,379.5822454308094),(742,276,200.00000,3445.00000,-0.05305,382.7586206896552),(743,276,220.00000,3057.00000,-0.05155,377.57731958762884),(744,276,240.00000,2660.00000,-0.05038,374.0050377833753),(745,276,260.00000,2247.00000,-0.04843,368.8135593220339),(746,276,280.00000,1817.00000,-0.04651,364.51162790697674),(747,276,300.00000,1345.00000,-0.04237,356.99152542372883),(748,276,310.00000,1077.00000,-0.03731,350.1865671641791),(749,276,316.00000,879.00000,-0.03030,342.6363636363636),(750,276,336.00000,370.00000,-0.03929,350.53831041257365),(751,283,0.00000,0.00000,0.90811,0),(752,283,1.00000,7326.00000,-0.02671,196.64985163204747),(753,283,10.00000,6989.00000,-0.02671,196.64985163204747),(754,283,20.00000,6745.00000,-0.04098,296.4344262295082),(755,283,40.00000,6304.00000,-0.04535,325.89569160997735),(756,283,60.00000,5899.00000,-0.04938,351.3086419753086),(757,283,80.00000,5509.00000,-0.05128,362.5128205128205),(758,283,100.00000,5137.00000,-0.05376,376.18279569892474),(759,283,120.00000,4771.00000,-0.05464,380.7103825136612),(760,283,140.00000,4407.00000,-0.05495,382.1428571428571),(761,283,160.00000,4043.00000,-0.05495,382.1428571428571),(762,283,180.00000,3676.00000,-0.05450,380.32697547683927),(763,283,200.00000,3306.00000,-0.05405,378.7027027027027),(764,283,220.00000,2932.00000,-0.05348,376.79144385026734),(765,283,240.00000,2545.00000,-0.05168,371.52454780361757),(766,283,260.00000,2151.00000,-0.05076,369.18781725888323),(767,283,280.00000,1733.00000,-0.04785,362.91866028708137),(768,283,300.00000,1282.00000,-0.04435,356.85144124168517),(769,283,310.00000,1022.00000,-0.03846,349.3076923076923),(770,283,316.00000,837.00000,-0.03243,343.1459459459459),(771,283,336.00000,370.00000,-0.04283,351.8458244111349),(772,298,0.00000,0.00000,1.14600,0),(773,298,1.00000,7739.00000,-0.05455,423.1272727272727),(774,298,10.00000,7574.00000,-0.05455,423.1272727272727),(775,298,20.00000,7409.00000,-0.06061,469.03030303030306),(776,298,40.00000,7109.00000,-0.06667,513.9333333333334),(777,298,60.00000,6831.00000,-0.07194,551.4388489208633),(778,298,80.00000,6571.00000,-0.07692,585.4615384615386),(779,298,100.00000,6318.00000,-0.07905,599.4466403162055),(780,298,120.00000,6073.00000,-0.08163,615.7551020408163),(781,298,140.00000,5842.00000,-0.08658,645.8008658008657),(782,298,160.00000,5610.00000,-0.08621,643.6206896551724),(783,298,180.00000,5386.00000,-0.08929,660.8928571428571),(784,298,200.00000,5160.00000,-0.08850,656.6371681415928),(785,298,220.00000,4940.00000,-0.09091,669.0909090909091),(786,298,240.00000,4720.00000,-0.09091,669.0909090909091),(787,298,260.00000,4499.00000,-0.09050,667.1493212669684),(788,298,280.00000,4283.00000,-0.09259,676.5740740740741),(789,298,300.00000,4062.00000,-0.09050,667.6018099547512),(790,298,320.00000,3845.00000,-0.09217,674.3778801843318),(791,298,340.00000,3622.00000,-0.08969,664.8430493273543),(792,298,360.00000,3398.00000,-0.08929,663.3928571428571),(793,298,380.00000,3177.00000,-0.09050,667.5113122171946),(794,298,400.00000,2949.00000,-0.08772,658.6842105263158),(795,298,420.00000,2719.00000,-0.08696,656.4347826086956),(796,298,440.00000,2487.00000,-0.08621,654.3965517241379),(797,298,460.00000,2245.00000,-0.08264,645.5371900826447),(798,298,480.00000,2002.00000,-0.08230,644.7736625514403),(799,298,500.00000,1744.00000,-0.07752,635.1937984496124),(800,298,520.00000,1478.00000,-0.07519,631.1278195488721),(801,298,540.00000,1183.00000,-0.06780,620.2033898305085),(802,298,550.00000,984.00000,-0.05025,599.4472361809045),(803,298,553.00000,830.00000,-0.01948,569.1688311688312),(804,298,573.00000,500.00000,-0.06061,603.3030303030303);

--
-- Table structure for table `sensordata`
--

CREATE TABLE `sensordata` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `datagps_id` int(10) unsigned NOT NULL,
  `sensor_id` int(10) unsigned NOT NULL,
  `Value` double(10,2) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `Index_2` (`datagps_id`,`sensor_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensordata`
--


--
-- Table structure for table `sensors`
--

CREATE TABLE `sensors` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mobitel_id` int(11) NOT NULL,
  `Name` varchar(45) NOT NULL,
  `Description` varchar(200) NOT NULL,
  `StartBit` int(10) unsigned NOT NULL,
  `Length` int(10) unsigned NOT NULL,
  `NameUnit` varchar(45) NOT NULL,
  `K` double(10,5) NOT NULL DEFAULT '0.00000',
  `B` double DEFAULT '0' COMMENT 'Shift coefficient',
  `S` tinyint(1) DEFAULT '0' COMMENT 'Sign arifmetic',
  PRIMARY KEY (`id`),
  KEY `Index_2` (`mobitel_id`)
) ENGINE=InnoDB AUTO_INCREMENT=305 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sensors`
--

INSERT INTO `sensors` VALUES (11,97,'бортмережа','',36,8,'В',0.11810,0,0),(12,97,'запалювання','Default',60,1,'--',1.00000,0,0),(13,99,'правий бак','',80,16,'л',0.00000,0,0),(14,99,'штатний ДРП','',128,8,'%',0.40000,0,0),(15,99,'оберти','',0,16,'rpm',0.12500,0,0),(16,99,'розхід','',16,64,'л',0.50000,0,0),(17,99,'бортмережа','',112,16,'В',0.00100,0,0),(18,99,'лівий бак','',96,16,'л',0.00000,0,0),(19,99,'бак рефа','',136,16,'л',0.00000,0,0),(20,97,'бак','',20,16,'л',0.00000,0,0),(21,98,'правий бак','',80,16,'л',0.00000,0,0),(22,98,'лівий бак','',96,16,'л',0.00000,0,0),(23,98,'оберти','',0,16,'rpm',0.12500,0,0),(24,98,'розхід','',16,64,'л',0.50000,0,0),(25,98,'бортмережа','',112,16,'В',0.00100,0,0),(27,98,'штатний ДРП','',128,8,'%',0.40000,0,0),(28,99,'запалювання','Default',196,1,'--',1.00000,0,0),(29,98,'запалювання','Default',196,1,'--',1.00000,0,0),(30,100,'бак','',80,16,'л',0.00000,0,0),(31,100,'штатний ДРП','',128,8,'%',0.40000,0,0),(32,100,'оберти','',0,16,'rpm',0.12500,0,0),(33,100,'розхід','',16,64,'л',0.50000,0,0),(34,100,'бортмережа','',112,16,'В',0.00100,0,0),(35,100,'запалювання','Default',196,1,'--',1.00000,0,0),(36,101,'бак','',20,16,'л',1.00000,0,0),(40,101,'бортмережа','',36,8,'В',0.11810,0,0),(41,101,'запалювання','Default',60,1,'--',1.00000,0,0),(49,103,'правий бак','',80,16,'л',0.00000,0,0),(50,103,'лівий бак','',96,16,'л',0.00000,0,0),(53,103,'бортмережа','',112,16,'В',0.00100,0,0),(54,103,'запалювання','Default',196,1,'--',1.00000,0,0),(55,98,'пробіг по тахографк','',152,32,'км',0.00500,0,0),(56,100,'пробіг по тахографу','',152,32,'км',0.00500,0,0),(61,104,'бортмережа','',112,16,'В',0.00100,0,0),(62,104,'запалювання','Default',196,1,'--',1.00000,0,0),(70,105,'оберти','',0,16,'rpm',0.12500,0,0),(72,105,'бортмережа','',112,16,'В',0.00100,0,0),(73,105,'одометр','',152,32,'км',0.00500,0,0),(74,105,'запалювання','Default',196,1,'--',1.00000,0,0),(75,106,'правый бак','',20,16,'л',0.00000,0,0),(79,106,'бортсеть','',36,8,'В',0.11810,0,0),(81,106,'зажигание','Default',60,1,'--',1.00000,0,0),(82,106,'левый бак','',44,16,'л',0.00000,0,0),(84,107,'бортмережа','',36,8,' В',0.11810,0,0),(85,107,'запалювання','',60,1,' ',1.00000,0,0),(88,108,'бортмережа','',36,8,' В',0.11810,0,0),(89,108,'запалювання','',60,1,' ',1.00000,0,0),(91,109,'бортмережа','',36,8,' В',0.11810,0,0),(92,109,'запалювання','',60,1,' ',1.00000,0,0),(95,110,'бортмережа','',36,8,' В',0.11810,0,0),(96,110,'запалювання','',60,1,' ',1.00000,0,0),(97,107,'правий бак','',20,16,'л',0.00000,0,0),(98,107,'лівий бак','',44,16,'л',0.00000,0,0),(103,808924983,'бортмережа','',112,16,' В',0.00100,0,0),(105,808924983,'запалювання','',196,1,' ',1.00000,0,0),(106,942814777,'бортмережа','',32,8,'В',0.11810,0,0),(107,942814777,'запалювання','',61,1,'#',1.00000,0,0),(113,876165171,'бортмережа','',112,16,' В',0.00100,0,0),(115,876165171,'запалювання','',196,1,' ',1.00000,0,0),(120,892418353,'бортмережа','',112,16,' В',0.00100,0,0),(122,892418353,'запалювання','',196,1,' ',1.00000,0,0),(127,825635890,'бортмережа','',112,16,' В',0.00100,0,0),(129,825635890,'запалювання','',196,1,' ',1.00000,0,0),(138,808466742,'штатний ДРП','',128,8,' %',0.40000,0,0),(139,808466742,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(140,808466742,'витрата','',16,64,' л',0.50000,0,0),(141,808466742,'бортмережа','',112,16,' В',0.00100,0,0),(142,808466742,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(143,808466742,'запалювання','',196,1,' ',1.00000,0,0),(145,859386421,'бортмережа','',36,8,' В',0.11810,0,0),(146,859386421,'запалювання','',60,1,' ',1.00000,0,0),(148,909520946,'бортмережа','',36,8,'В',0.11810,0,0),(149,909520946,'запалювання','',60,1,'#',1.00000,0,0),(151,808596790,'бортмережа','',36,8,'В',0.11810,0,0),(152,808596790,'запалювання','',60,1,'#',1.00000,0,0),(155,876032567,'штатний ДРП','',128,8,' %',0.40000,0,0),(156,876032567,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(157,876032567,'витрата','',16,64,' л',0.50000,0,0),(158,876032567,'бортмережа','',112,16,' В',0.00100,0,0),(159,876032567,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(160,876032567,'запалювання','',196,1,' ',1.00000,0,0),(164,926365494,'бортмережа','',36,8,'В',0.11810,0,0),(166,926365494,'бак','',20,16,'л',1.00000,0,0),(167,875639862,'бортмережа','',36,8,'В',0.11810,0,0),(168,875639862,'запалювання','',60,1,'#',1.00000,0,0),(169,875639862,'бак','',20,16,'л',1.00000,0,0),(170,892941624,'бортмережа','',32,8,'В',0.11810,0,0),(171,892941624,'запалювання','',61,1,'#',1.00000,0,0),(172,892941624,'вірт. бак','',0,8,'л',1.00000,0,0),(173,842348336,'бортмережа','',32,8,'В',0.11810,0,0),(174,842348336,'запалювання','',61,1,'#',1.00000,0,0),(175,842348336,'вірт. бак','',0,8,'л',1.00000,0,0),(177,959723824,'штатний ДРП','',128,8,' %',0.40000,0,0),(178,959723824,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(179,959723824,'витрата','',16,64,' л',0.50000,0,0),(180,959723824,'бортмережа','',112,16,' В',0.00100,0,0),(181,959723824,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(182,959723824,'запалювання','',196,1,' ',1.00000,0,0),(183,959788080,'правий бак','',20,16,' л',1.00000,0,0),(184,959788080,'бортмережа','',36,8,' В',0.11810,0,0),(185,959788080,'запалювання','',60,1,' ',1.00000,0,0),(187,926366004,'правий бак','',80,16,' л',1.00000,0,0),(188,926366004,'штатний ДРП','',128,8,' %',0.40000,0,0),(189,926366004,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(190,926366004,'витрата','',16,64,' л',0.50000,0,0),(191,926366004,'бортмережа','',112,16,' В',0.00100,0,0),(192,926366004,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(193,926366004,'запалювання','',196,1,' ',1.00000,0,0),(194,926366004,'лівий бак','Новая',96,16,'л',1.00000,0,0),(195,926364217,'бак','',80,16,' л',1.00000,0,0),(197,926364217,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(199,926364217,'бортмережа','',112,16,' В',0.00100,0,0),(200,926364217,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(201,926364217,'запалювання','',196,1,' ',1.00000,0,0),(202,909259058,'бак','',80,16,' л',1.00000,0,0),(204,909259058,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(206,909259058,'бортмережа','',112,16,' В',0.00100,0,0),(207,909259058,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(208,909259058,'запалювання','',196,1,' ',1.00000,0,0),(209,876032307,'бак','',80,16,' л',1.00000,0,0),(211,876032307,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(213,876032307,'бортмережа','',112,16,' В',0.00100,0,0),(214,876032307,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(215,876032307,'запалювання','',196,1,' ',1.00000,0,0),(217,809054258,'штатний ДРП','',128,8,' %',0.40000,0,0),(218,809054258,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(219,809054258,'витрата','',16,64,' л',0.50000,0,0),(220,809054258,'бортмережа','',112,16,' В',0.00100,0,0),(221,809054258,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(222,809054258,'запалювання','',196,1,' ',1.00000,0,0),(223,926298936,'бак','',80,16,' л',1.00000,0,0),(224,926298936,'штатний ДРП','',128,8,' %',0.40000,0,0),(225,926298936,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(226,926298936,'витрата','',16,64,' л',0.50000,0,0),(227,926298936,'бортмережа','',112,16,' В',0.00100,0,0),(228,926298936,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(229,926298936,'запалювання','',196,1,' ',1.00000,0,0),(231,859321909,'штатний ДРП','',128,8,' %',0.40000,0,0),(232,859321909,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(233,859321909,'витрата','',16,64,' л',0.50000,0,0),(234,859321909,'бортмережа','',112,16,' В',0.00100,0,0),(235,859321909,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(236,859321909,'запалювання','',196,1,' ',1.00000,0,0),(237,926103344,'бортмережа','',36,8,'В',0.11810,0,0),(238,926103344,'запалювання','',60,1,'#',1.00000,0,0),(239,926103344,'бак','',20,16,'л',1.00000,0,0),(255,942813752,'штатний ДРП','',128,8,' %',0.40000,0,0),(256,942813752,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(257,942813752,'витрата','',16,64,' л',0.50000,0,0),(258,942813752,'бортмережа','',112,16,' В',1.00000,0,0),(259,942813752,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(260,942813752,'запалювання','',196,1,' ',1.00000,0,0),(263,926497080,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(265,926497080,'бортмережа','',112,16,' В',1.00000,0,0),(266,926497080,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(267,926497080,'запалювання','',196,1,' ',1.00000,0,0),(268,926429748,'правий бак','',80,16,' л',1.00000,0,0),(270,926429748,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(272,926429748,'бортмережа','',112,16,' В',1.00000,0,0),(273,926429748,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(274,926429748,'запалювання','',196,1,' ',1.00000,0,0),(275,926429748,'лівий бак','Новая',96,16,'л',1.00000,0,0),(276,808793648,'правий бак','',80,16,' л',1.00000,0,0),(278,808793648,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(279,808793648,'витрата','',16,64,' л',1.00000,0,0),(280,808793648,'бортмережа','',112,16,' В',1.00000,0,0),(281,808793648,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(282,808793648,'запалювання','',196,1,' ',1.00000,0,0),(283,808793648,'лівий бак','Новая',96,16,'л',1.00000,0,0),(285,859191344,'штатний ДРП','',128,8,' %',0.40000,0,0),(286,859191344,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(287,859191344,'витрата','',16,64,' л',0.50000,0,0),(288,859191344,'бортмережа','',112,16,' В',1.00000,0,0),(289,859191344,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(290,859191344,'запалювання','',196,1,' ',1.00000,0,0),(293,859386416,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(294,859386416,'витрата','',16,64,' л',1.00000,0,0),(295,859386416,'бортмережа','',112,16,' В',1.00000,0,0),(296,859386416,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(297,859386416,'запалювання','',196,1,' ',1.00000,0,0),(298,102,'бак','',80,16,' л',1.00000,0,0),(300,102,'оберти двигуна','',0,16,' rpm',0.12500,0,0),(302,102,'бортмережа','',112,16,' В',0.00100,0,0),(303,102,'пробіг за тахографом','',152,32,' км',0.00500,0,0),(304,102,'запалювання','',196,1,' ',1.00000,0,0);

--
-- Table structure for table `serviceinit`
--

CREATE TABLE `serviceinit` (
  `ServiceInit_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `ServiceType_ID` int(11) DEFAULT '0',
  `A1` char(50) DEFAULT NULL,
  `A2` char(50) DEFAULT NULL,
  `A3` char(50) DEFAULT NULL,
  `A4` char(50) DEFAULT NULL,
  `A5` char(50) DEFAULT NULL,
  `A6` char(50) DEFAULT NULL,
  `A7` char(50) DEFAULT NULL,
  `A8` char(50) DEFAULT NULL,
  `A9` char(50) DEFAULT NULL,
  `A10` char(200) DEFAULT NULL,
  `CAtoSAint` int(11) DEFAULT '0',
  `CAtoSAtime` int(11) DEFAULT '0',
  `SAtoCAint` int(11) DEFAULT '0',
  `SAtoCAtime` int(11) DEFAULT '0',
  `SAtoCAtext` char(50) DEFAULT 'STOPPED',
  `CAtoSAtext` char(50) DEFAULT 'STOPPED',
  `MobitelActive_ID` int(11) NOT NULL DEFAULT '0',
  `Active` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`ServiceInit_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `serviceinit`
--

INSERT INTO `serviceinit` VALUES (1,'Direct Cable','Сервис для прямого кабельного соединения',0,0,5,'COM1','115200','','','','','','','','',0,0,1,1222352358,'Running',NULL,83,0),(7,'GSM модем','Отправка SMS по  GSM каналу',0,0,2,'COM2','115200','','','','','','','','XXX',0,0,1,1127307060,'Running',NULL,75,0),(29,'EMail','Сервис отправки данных через E-mail',29,1125886839,6,'','','','smtp.p314.net','pop.p314.net','25','110','60','','XXX',0,0,1,1128962351,'Running',NULL,68,0),(30,'Online','Онлайн через телематический сервер',30,0,3,'','9010','','','','','','','','',0,0,0,0,'STOPPED','STOPPED',0,0);

--
-- Table structure for table `servicesend`
--

CREATE TABLE `servicesend` (
  `ServiceSend_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` varchar(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `telMobitel` varchar(64) DEFAULT NULL,
  `smsMobitel` varchar(64) DEFAULT NULL,
  `emailMobitel` varchar(64) DEFAULT NULL,
  `IPMobitel` varchar(64) DEFAULT NULL,
  `URLMobitel` varchar(64) DEFAULT NULL,
  `PortMobitel` int(11) DEFAULT '0',
  `RfMobitel` varchar(50) DEFAULT NULL,
  `Message_ID` int(11) DEFAULT '0',
  PRIMARY KEY (`ServiceSend_ID`),
  KEY `Index_2` (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=315 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `servicesend`
--

INSERT INTO `servicesend` VALUES (250,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',250,0,'107',NULL,NULL,NULL,NULL,0,NULL,0),(252,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',250,0,'98','106','3051@p314.net','',NULL,0,'',200892),(255,'Record 22.09.2005 12:14:57','Description for record created at 22.09.2005 12:14:57',250,0,'96','80','','',NULL,0,'',218879),(256,'set','phone',250,0,'102',NULL,NULL,NULL,NULL,0,NULL,0),(257,'8564','Desctiption for Teletrack registered at 03.09.2016 16:52:47',257,0,'105',NULL,NULL,NULL,NULL,0,NULL,0),(258,'set','phone',257,0,'103',NULL,NULL,NULL,NULL,0,NULL,0),(259,'6832','Desctiption for Teletrack registered at 03.09.2016 22:11:43',259,0,'106',NULL,NULL,NULL,NULL,0,NULL,0),(260,'set','phone',259,0,'104',NULL,NULL,NULL,NULL,0,NULL,0),(261,'5235','Desctiption for Teletrack registered at 14.09.2016 13:12:00',261,0,'109',NULL,NULL,NULL,NULL,0,NULL,0),(262,'set','phone',261,0,'108',NULL,NULL,NULL,NULL,0,NULL,0),(263,'7105','Desctiption for Teletrack registered at 22.09.2016 14:05:00',263,0,'114',NULL,NULL,NULL,NULL,0,NULL,0),(264,'set','phone',263,0,'110',NULL,NULL,NULL,NULL,0,NULL,0),(265,'4651','Desctiption for Teletrack registered at 25.09.2016 17:43:35',265,0,'115',NULL,NULL,NULL,NULL,0,NULL,0),(266,'set','phone',265,0,'111',NULL,NULL,NULL,NULL,0,NULL,0),(267,'0789','Desctiption for Teletrack registered at 25.09.2016 17:44:14',267,0,'116',NULL,NULL,NULL,NULL,0,NULL,0),(268,'set','phone',267,0,'112',NULL,NULL,NULL,NULL,0,NULL,0),(269,'set','phone',267,0,'113',NULL,NULL,NULL,NULL,0,NULL,0),(270,'5088','+37282618049',270,0,'118',NULL,NULL,NULL,NULL,0,NULL,0),(271,'set','phone',270,0,'117',NULL,NULL,NULL,NULL,0,NULL,0),(272,'7673','+37282618050',272,0,'120',NULL,NULL,NULL,NULL,0,NULL,0),(273,'set','phone',272,0,'119',NULL,NULL,NULL,NULL,0,NULL,0),(274,'3110','Desctiption for Teletrack registered at 24.02.2017 15:05:44',274,0,'122',NULL,NULL,NULL,NULL,0,NULL,0),(275,'set','phone',274,0,'121',NULL,NULL,NULL,NULL,0,NULL,0),(276,'8412','Desctiption for Teletrack registered at 04.07.2017 9:33:44',276,0,'126',NULL,NULL,NULL,NULL,0,NULL,0),(277,'set','phone',276,0,'123',NULL,NULL,NULL,NULL,0,NULL,0),(278,'2684','Desctiption for Teletrack registered at 04.07.2017 9:37:24',278,0,'125',NULL,NULL,NULL,NULL,0,NULL,0),(279,'set','phone',278,0,'124',NULL,NULL,NULL,NULL,0,NULL,0),(280,'2881','Desctiption for Teletrack registered at 27.09.2017 14:09:51',280,0,'129',NULL,NULL,NULL,NULL,0,NULL,0),(281,'2575','Desctiption for Teletrack registered at 27.09.2017 14:10:50',281,0,'130',NULL,NULL,NULL,NULL,0,NULL,0),(282,'set','phone',281,0,'127',NULL,NULL,NULL,NULL,0,NULL,0),(283,'set','phone',280,0,'128',NULL,NULL,NULL,NULL,0,NULL,0),(284,'','',284,0,'135',NULL,NULL,NULL,NULL,0,NULL,0),(285,'','',285,0,'131',NULL,NULL,NULL,NULL,0,NULL,0),(286,'','',286,0,'139',NULL,NULL,NULL,NULL,0,NULL,0),(287,'','',287,0,'132',NULL,NULL,NULL,NULL,0,NULL,0),(288,'','',288,0,'138',NULL,NULL,NULL,NULL,0,NULL,0),(289,'','',289,0,'136',NULL,NULL,NULL,NULL,0,NULL,0),(290,'','',290,0,'134',NULL,NULL,NULL,NULL,0,NULL,0),(291,'','',291,0,'133',NULL,NULL,NULL,NULL,0,NULL,0),(292,'','',292,0,'140',NULL,NULL,NULL,NULL,0,NULL,0),(293,'','',293,0,'137',NULL,NULL,NULL,NULL,0,NULL,0),(294,'','',294,0,'145',NULL,NULL,NULL,NULL,0,NULL,0),(295,'','',295,0,'148',NULL,NULL,NULL,NULL,0,NULL,0),(296,'','',296,0,'146',NULL,NULL,NULL,NULL,0,NULL,0),(297,'','',297,0,'147',NULL,NULL,NULL,NULL,0,NULL,0),(298,'','',298,0,'142',NULL,NULL,NULL,NULL,0,NULL,0),(299,'','',299,0,'149',NULL,NULL,NULL,NULL,0,NULL,0),(300,'','',300,0,'150',NULL,NULL,NULL,NULL,0,NULL,0),(301,'','',301,0,'141',NULL,NULL,NULL,NULL,0,NULL,0),(302,'','',302,0,'143',NULL,NULL,NULL,NULL,0,NULL,0),(303,'','',303,0,'144',NULL,NULL,NULL,NULL,0,NULL,0),(304,'','',304,0,'151',NULL,NULL,NULL,NULL,0,NULL,0),(305,'','',305,0,'153',NULL,NULL,NULL,NULL,0,NULL,0),(306,'','',306,0,'152',NULL,NULL,NULL,NULL,0,NULL,0),(307,'','',307,0,'155',NULL,NULL,NULL,NULL,0,NULL,0),(308,'','',308,0,'154',NULL,NULL,NULL,NULL,0,NULL,0),(309,'','',309,0,'156',NULL,NULL,NULL,NULL,0,NULL,0),(310,'','',310,0,'157',NULL,NULL,NULL,NULL,0,NULL,0),(311,'','',311,0,'158',NULL,NULL,NULL,NULL,0,NULL,0),(312,'','',312,0,'160',NULL,NULL,NULL,NULL,0,NULL,0),(313,'','',313,0,'161',NULL,NULL,NULL,NULL,0,NULL,0),(314,'','',314,0,'159',NULL,NULL,NULL,NULL,0,NULL,0);

--
-- Table structure for table `servicetypes`
--

CREATE TABLE `servicetypes` (
  `ServiceType_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `Flags` int(11) DEFAULT '0',
  `D1` char(200) DEFAULT NULL,
  `D2` char(200) DEFAULT NULL,
  `D3` char(200) DEFAULT NULL,
  `D4` char(200) DEFAULT NULL,
  `D5` char(200) DEFAULT NULL,
  `D6` char(200) DEFAULT NULL,
  `D7` char(200) DEFAULT NULL,
  `D8` char(200) DEFAULT NULL,
  `D9` char(200) DEFAULT NULL,
  `D10` char(200) DEFAULT NULL,
  PRIMARY KEY (`ServiceType_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `servicetypes`
--

INSERT INTO `servicetypes` VALUES (1,'reserved','Зарезервировано',0,'Parameter 1','Parameter 2','Parameter 3','','','','','','',''),(2,'GSM','Тип сервиса для отправки SMS через GSM соединение',0,'Номер порта','Скорость порта','','','','','','','',''),(3,'Online','Online',0,'IP','Port','Login','Password','','','','','',''),(4,'RF modem','Радиомодем (не реализовано)',0,'Номер порта','Скорость порта','','','','','','','',''),(5,'DC','Тип сервиса \"прямое кабельное соединения\"',0,'Номер порта','Скорость порта',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(6,'E-Mail','Тип сервиса \" E-Mail \" для отправки SMS через электронную почту',0,'EMAIL','Login','Password','Smtp Server','Pop3 Server','Smtp Port','Pop3 Port','Check Out time',NULL,NULL);

--
-- Table structure for table `setting`
--

CREATE TABLE `setting` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `TimeBreak` time DEFAULT '00:01:00' COMMENT 'Минимальное время остановки',
  `RotationMain` int(11) DEFAULT '100' COMMENT 'Обороты основного двигателя',
  `RotationAdd` int(11) DEFAULT '100' COMMENT 'Обороты доп. двигателя',
  `FuelingEdge` int(11) DEFAULT '0' COMMENT 'Минимальная заправка',
  `band` int(11) DEFAULT '25' COMMENT 'Полоса осреднения',
  `FuelingDischarge` int(11) DEFAULT '0' COMMENT 'Минимальный слив топлива',
  `accelMax` double DEFAULT '1' COMMENT 'Максимальное ускорение',
  `breakMax` double DEFAULT '1' COMMENT 'Максимальное торможение',
  `speedMax` double DEFAULT '70' COMMENT 'Максимальная скорость',
  `idleRunningMain` int(11) DEFAULT '0' COMMENT 'Холостой ход основного двигателя',
  `idleRunningAdd` int(11) DEFAULT '0' COMMENT 'Холосой ход доп. двигателя',
  `Name` char(20) DEFAULT 'Установки' COMMENT 'Название',
  `Desc` char(80) DEFAULT 'Описание установки' COMMENT 'Описание ',
  `AvgFuelRatePerHour` double(10,5) NOT NULL DEFAULT '15.00000' COMMENT 'Средний расход топлива в час',
  `FuelApproximationTime` time NOT NULL DEFAULT '00:02:00' COMMENT 'Временной интервал перед стоянкой, по точка которого уточняется уровень топлива в начале стоянки',
  `TimeGetFuelAfterStop` time NOT NULL DEFAULT '00:00:00' COMMENT 'Временной интервал между началом стоянки и замером уровня топлива',
  `TimeGetFuelBeforeMotion` time NOT NULL DEFAULT '00:00:00' COMMENT 'Временной интервал между замером уровня топлива и началом движения',
  `CzMinCrossingPairTime` time NOT NULL DEFAULT '00:01:00' COMMENT 'Min временной интервал между двумя пересечениями КЗ',
  `FuelerRadiusFinds` int(11) NOT NULL DEFAULT '10' COMMENT 'Радиус поиска заправляемых ТС вокруг топливозаправщика',
  `FuelerMaxTimeStop` time NOT NULL DEFAULT '00:02:00' COMMENT 'Минимальное время до заправки следующего ТС',
  `FuelerMinFuelrate` int(11) NOT NULL DEFAULT '1' COMMENT 'Минимальная величина заправки, что будет попадать в отчет',
  `FuelerCountInMotion` int(11) NOT NULL DEFAULT '0' COMMENT 'Считать ли заправки, при не нулевой скорости',
  `FuelrateWithDischarge` int(11) NOT NULL DEFAULT '0' COMMENT 'Считать ли в расходе сливы',
  `FuelingMinMaxAlgorithm` int(11) NOT NULL DEFAULT '0' COMMENT 'Считать заправки по MAX-MIN',
  `TimeBreakMaxPermitted` time NOT NULL DEFAULT '03:00:00' COMMENT 'Макс. время разрешенной стоянки',
  `InclinometerMaxAngleAxisX` double NOT NULL DEFAULT '5' COMMENT 'Предельный угол наклона относительно продольной оси Х ',
  `InclinometerMaxAngleAxisY` double NOT NULL DEFAULT '5' COMMENT 'Предельный угол наклона относительно продольной оси Y ',
  `MinTimeSwitch` int(11) NOT NULL DEFAULT '0' COMMENT 'Минимальное время между двумя событиями датчика',
  `TimeMinimMovingSize` time NOT NULL DEFAULT '00:00:00' COMMENT 'Минимальное время движения в начале смены',
  `speedMin` float NOT NULL DEFAULT '0' COMMENT 'Минимальная скорость в км/ч',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `setting`
--

INSERT INTO `setting` VALUES (1,'00:01:00',100,100,15,0,7,1,1,85,0,0,'Настройка 1','Настройка по умолчанию',18.00000,'00:01:30','00:00:00','00:00:00','00:01:00',10,'00:02:00',1,0,1,0,'03:00:00',5,5,0,'00:00:00',0),(2,'00:01:00',100,100,20,3,10,1,1,70,0,0,'Еско','Еско',30.00000,'00:01:30','00:00:00','00:00:00','00:01:00',10,'00:02:00',1,0,0,3,'03:00:00',5,5,0,'00:00:00',0);

--
-- Table structure for table `smsnumbers`
--

CREATE TABLE `smsnumbers` (
  `SmsNumber_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `smsNumber` char(14) DEFAULT NULL,
  PRIMARY KEY (`SmsNumber_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `smsnumbers`
--

INSERT INTO `smsnumbers` VALUES (9,'UMC SMS Center','UMC SMS Center descr',0,0,'+380500005010'),(42,'Golden SMS Center','Golden SMS Center descr',0,0,'+380390001008'),(53,'GOLDEN SMS Шлюз','Номер телефона, на который отправляются данные с ТТ через E_MAIL',0,0,'025'),(80,'SMS',' (SMS)',0,0,'+38067'),(81,'RCSB (SMS)','Телефон (SMS)',0,0,'+380672452724'),(82,'RCSB2 (SMS)',' (SMS)',0,0,'+380672452734'),(83,'RCS1 (SMS)',' (SMS)',0,0,'+380637562677'),(84,'RCS2 (SMS)',' (SMS)',0,0,'+380933222277'),(85,'RCS3 (SMS)',' (SMS)',0,0,'+380637562678');

--
-- Table structure for table `sources`
--

CREATE TABLE `sources` (
  `Source_ID` int(11) NOT NULL AUTO_INCREMENT,
  `SourceText` char(200) DEFAULT NULL,
  `SourceError` char(200) DEFAULT NULL,
  PRIMARY KEY (`Source_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `sources`
--


--
-- Table structure for table `specialmessages`
--

CREATE TABLE `specialmessages` (
  `SpecMessage_ID` int(11) NOT NULL AUTO_INCREMENT,
  `DataString` char(50) DEFAULT NULL,
  `DataInteger` int(11) DEFAULT '0',
  `unixtime` char(50) DEFAULT NULL,
  `isNew` int(11) DEFAULT '0',
  PRIMARY KEY (`SpecMessage_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `specialmessages`
--


--
-- Table structure for table `state`
--

CREATE TABLE `state` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `MinValue` double NOT NULL,
  `MaxValue` double NOT NULL,
  `Title` varchar(50) NOT NULL,
  `SensorId` int(11) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `State_FK` (`SensorId`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=cp1251 COMMENT='Состояния автомобиля';

--
-- Dumping data for table `state`
--

INSERT INTO `state` VALUES (3,0,0.1,'0',12),(4,1,1.1,'1',12),(5,0,0.1,'0',28),(6,1,1.1,'1',28),(7,0,0.1,'0',29),(8,1,1.1,'1',29),(9,0,0.1,'0',35),(10,1,1.1,'1',35),(11,0,0.1,'0',41),(12,1,1.1,'1',41),(15,0,0.1,'0',54),(16,1,1.1,'1',54),(17,0,0.1,'0',62),(18,1,1.1,'1',62),(19,0,0.1,'0',74),(20,1,1.1,'1',74),(21,0,0.1,'0',81),(22,1,1.1,'1',81),(23,0,0.1,'0',85),(24,1,1.1,'1',85),(25,0,0.1,'0',89),(26,1,1.1,'1',89),(27,0,0.1,'0',92),(28,1,1.1,'1',92),(29,0,0.1,'0',96),(30,1,1.1,'1',96),(31,0,0.1,'0',105),(32,1,1.1,'1',105),(33,0,0.1,'0',107),(34,1,1.1,'1',107),(35,0,0.1,'0',115),(36,1,1.1,'1',115),(37,0,0.1,'0',122),(38,1,1.1,'1',122),(39,0,0.1,'0',129),(40,1,1.1,'1',129),(43,0,0.1,'0',143),(44,1,1.1,'1',143),(45,0,0.1,'0',146),(46,1,1.1,'1',146),(47,0,0.1,'0',149),(48,1,1.1,'1',149),(49,0,0.1,'0',152),(50,1,1.1,'1',152),(51,0,0.1,'0',160),(52,1,1.1,'1',160),(57,0,0.1,'0',168),(58,1,1.1,'1',168),(59,0,0.1,'0',171),(60,1,1.1,'1',171),(61,0,0.1,'0',174),(62,1,1.1,'1',174),(63,0,0.1,'0',182),(64,1,1.1,'1',182),(65,0,0.1,'0',185),(66,1,1.1,'1',185),(67,0,0.1,'0',193),(68,1,1.1,'1',193),(69,0,0.1,'0',201),(70,1,1.1,'1',201),(71,0,0.1,'0',208),(72,1,1.1,'1',208),(73,0,0.1,'0',215),(74,1,1.1,'1',215),(75,0,0.1,'0',222),(76,1,1.1,'1',222),(77,0,0.1,'0',229),(78,1,1.1,'1',229),(79,0,0.1,'0',236),(80,1,1.1,'1',236),(81,0,0.1,'0',238),(82,1,1.1,'1',238),(87,0,0.1,'0',260),(88,1,1.1,'1',260),(89,0,0.1,'0',267),(90,1,1.1,'1',267),(91,0,0.1,'0',274),(92,1,1.1,'1',274),(93,0,0.1,'0',282),(94,1,1.1,'1',282),(95,0,0.1,'0',290),(96,1,1.1,'1',290),(97,0,0.1,'0',297),(98,1,1.1,'1',297),(99,0,0.1,'0',304),(100,1,1.1,'1',304);

--
-- Table structure for table `swupdate`
--

CREATE TABLE `swupdate` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `ShortID` char(4) NOT NULL COMMENT 'Идентификатор телетрека(логин)',
  `Soft` mediumtext NOT NULL COMMENT 'Прошивка',
  `InsertTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Дата и время вставки в таблицу',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Обновление прошивки телетрека';

--
-- Dumping data for table `swupdate`
--


--
-- Table structure for table `team`
--

CREATE TABLE `team` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) DEFAULT NULL,
  `Descr` text COMMENT 'Описание',
  `Setting_id` int(11) DEFAULT NULL,
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  `FuelWayKmGrp` double DEFAULT '0' COMMENT 'Норма расхода топлива л/100 км',
  `FuelMotoHrGrp` double DEFAULT '0' COMMENT 'Норма расхода топлива на холостом ходу л/моточас',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`) USING BTREE,
  KEY `Setting_id` (`Setting_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `team`
--

INSERT INTO `team` VALUES (1,'Архів','null',1,NULL,0,0),(2,'Оригінал Транс','',1,'',0,0),(3,'Різанович Україна','',1,'',0,0),(5,'Оригінал Транс 2','',1,'',0,0);

--
-- Table structure for table `telnumbers`
--

CREATE TABLE `telnumbers` (
  `TelNumber_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` char(200) DEFAULT NULL,
  `ID` int(11) DEFAULT '0',
  `Flags` int(11) DEFAULT '0',
  `TelNumber` char(50) DEFAULT NULL,
  PRIMARY KEY (`TelNumber_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=162 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `telnumbers`
--

INSERT INTO `telnumbers` VALUES (56,'RCSB','Телефон',0,0,'80672452724'),(57,'Телефон','Телефон',0,0,'22222222222'),(58,'Телефон','Телефон',0,0,'33333333333'),(59,'Телефон','Телефон',0,0,'44444444444'),(68,'Телефон','Телефон',0,0,'55555555555'),(71,'Телефон','',0,0,'66666666666'),(73,'Телефон','Телефон',0,0,'77777777777'),(74,'Телефон','Телефон',0,0,'88888888888'),(75,'Телефон','',0,0,'99999999999'),(81,'RCS3','',0,0,'80637562678'),(89,'RCS2','',0,0,'80933222277'),(90,'RCS1','',0,0,'80637562677'),(97,'RCSB2','',0,0,'80672452734'),(101,'Телефон','',0,0,'1'),(102,'3029',NULL,0,0,'0673645331'),(103,'8564',NULL,0,0,'0673645332'),(104,'6832',NULL,0,0,'0673644268'),(105,'rcs','mtel',0,0,'0673645332'),(106,'rcs','mtel',0,0,'0673644268'),(107,'rcs','mtel',0,0,'0673645331'),(108,'5235',NULL,0,0,'0673643919'),(109,'rcs','mtel',0,0,'0673643919'),(110,'7105',NULL,0,0,'0673643187'),(111,'4651',NULL,0,0,'0673641664'),(112,'0789',NULL,0,0,'067364392'),(113,'0789',NULL,0,0,'0673643923'),(114,'rcs','mtel',0,0,'0673643187'),(115,'rcs','mtel',0,0,'0673641664'),(116,'rcs','mtel',0,0,'0673643923'),(117,'5088',NULL,0,0,'0979594541'),(118,'rcs','mtel',0,0,'0979594541'),(119,'7673',NULL,0,0,'0979594542'),(120,'rcs','mtel',0,0,'0979594542'),(121,'3110',NULL,0,0,'0979594509'),(122,'rcs','mtel',0,0,'0979594509'),(123,'8412',NULL,0,0,'0673636629'),(124,'2684',NULL,0,0,'0981638392'),(125,'rcs','mtel',0,0,'0981638392'),(126,'rcs','mtel',0,0,'0673636629'),(127,'2575',NULL,0,0,'0981896850'),(128,'2881',NULL,0,0,'0981896849'),(129,'rcs','mtel',0,0,'0981896849'),(130,'rcs','mtel',0,0,'0981896850'),(131,'rcs','mtel',0,0,'+380981617730'),(132,'rcs','mtel',0,0,'+380674006534'),(133,'rcs','mtel',0,0,'+380981880585'),(134,'rcs','mtel',0,0,'+380674003718'),(135,'rcs','mtel',0,0,'+380981819875'),(136,'rcs','mtel',0,0,'+380981617345'),(137,'rcs','mtel',0,0,'+380679677961'),(138,'rcs','mtel',0,0,'+380679571713'),(139,'rcs','mtel',0,0,'+380981847394'),(140,'rcs','mtel',0,0,'+37257912453'),(141,'rcs','mtel',0,0,'+380671712467'),(142,'rcs','mtel',0,0,'+37257952592'),(143,'rcs','mtel',0,0,'+37257952586'),(144,'rcs','mtel',0,0,'+37257952579'),(145,'rcs','mtel',0,0,'+37257952579'),(146,'rcs','mtel',0,0,'+380671759643'),(147,'rcs','mtel',0,0,'+380671759614'),(148,'rcs','mtel',0,0,'+37257952588'),(149,'rcs','mtel',0,0,'+380671759665'),(150,'rcs','mtel',0,0,'+380671759611'),(151,'rcs','mtel',0,0,'+37257931729'),(152,'rcs','mtel',0,0,'+37257931752'),(153,'rcs','mtel',0,0,'No Data'),(154,'rcs','mtel',0,0,'+37257914248'),(155,'rcs','mtel',0,0,'+37257952584'),(156,'rcs','mtel',0,0,'travelsim'),(157,'rcs','mtel',0,0,'travelsim'),(158,'rcs','mtel',0,0,'travelsim'),(159,'rcs','mtel',0,0,'+37281478423 SIM MNK'),(160,'rcs','mtel',0,0,'+37281478402 MNK'),(161,'rcs','mtel',0,0,'+37281478394 MNK');

--
-- Table structure for table `temp`
--

CREATE TABLE `temp` (
  `datagps_id` int(10) unsigned NOT NULL DEFAULT '0',
  `sensor_id` int(10) unsigned NOT NULL DEFAULT '0',
  `Value` double(10,2) NOT NULL DEFAULT '0.00'
) ENGINE=MEMORY DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `temp`
--


--
-- Table structure for table `tmpdatagps`
--

CREATE TABLE `tmpdatagps` (
  `DataGps_ID` int(11) NOT NULL DEFAULT '0',
  `Mobitel_ID` int(11) DEFAULT '0',
  `Message_ID` int(11) DEFAULT '0',
  `Latitude` int(11) DEFAULT '0',
  `Longitude` int(11) DEFAULT '0',
  `Altitude` int(11) DEFAULT NULL,
  `UnixTime` int(11) DEFAULT '0',
  `Speed` smallint(6) DEFAULT '0',
  `Direction` int(11) NOT NULL DEFAULT '0',
  `Valid` tinyint(4) DEFAULT '1',
  `InMobitelID` int(11) DEFAULT NULL,
  `Events` int(10) unsigned DEFAULT '0',
  `Sensor1` tinyint(4) unsigned DEFAULT '0',
  `Sensor2` tinyint(4) unsigned DEFAULT '0',
  `Sensor3` tinyint(4) unsigned DEFAULT '0',
  `Sensor4` tinyint(4) unsigned DEFAULT '0',
  `Sensor5` tinyint(4) unsigned DEFAULT '0',
  `Sensor6` tinyint(4) unsigned DEFAULT '0',
  `Sensor7` tinyint(4) unsigned DEFAULT '0',
  `Sensor8` tinyint(4) unsigned DEFAULT '0',
  `LogID` int(11) DEFAULT '0',
  `isShow` tinyint(4) DEFAULT '0',
  `whatIs` smallint(6) unsigned DEFAULT '0',
  `Counter1` int(11) NOT NULL DEFAULT '-1',
  `Counter2` int(11) NOT NULL DEFAULT '-1',
  `Counter3` int(11) NOT NULL DEFAULT '-1',
  `Counter4` int(11) NOT NULL DEFAULT '-1'
) ENGINE=MEMORY DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `tmpdatagps`
--


--
-- Table structure for table `transition`
--

CREATE TABLE `transition` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `InitialStateId` int(11) DEFAULT NULL,
  `FinalStateId` int(11) DEFAULT NULL,
  `Title` varchar(50) NOT NULL,
  `SensorId` int(11) DEFAULT NULL,
  `IconName` varchar(50) NOT NULL,
  `SoundName` varchar(50) NOT NULL,
  `Enabled` tinyint(1) NOT NULL,
  `ViewInReport` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`Id`),
  KEY `Sensors_FK` (`SensorId`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=91 DEFAULT CHARSET=cp1251 COMMENT='Переходы между состояниями';

--
-- Dumping data for table `transition`
--

INSERT INTO `transition` VALUES (1,1,2,'вмк.',6,'Default','Default',0,1),(2,2,1,'вимк.',6,'Default','Default',0,1),(3,3,4,'вмк.',12,'Default','Default',0,1),(4,4,3,'вимк.',12,'Default','Default',0,1),(5,5,6,'вмк.',28,'Default','Default',0,1),(6,6,5,'вимк.',28,'Default','Default',0,1),(7,7,8,'вмк.',29,'Default','Default',0,1),(8,8,7,'вимк.',29,'Default','Default',0,1),(9,9,10,'вмк.',35,'Default','Default',0,1),(10,10,9,'вимк.',35,'Default','Default',0,1),(11,11,12,'вмк.',41,'Default','Default',0,1),(12,12,11,'вимк.',41,'Default','Default',0,1),(13,13,14,'вмк.',47,'Default','Default',0,1),(14,14,13,'вимк.',47,'Default','Default',0,1),(15,15,16,'вмк.',54,'Default','Default',0,1),(16,16,15,'вимк.',54,'Default','Default',0,1),(17,17,18,'вмк.',62,'Default','Default',0,1),(18,18,17,'вимк.',62,'Default','Default',0,1),(19,19,20,'вмк.',74,'Default','Default',0,1),(20,20,19,'вимк.',74,'Default','Default',0,1),(21,21,22,'вкл.',81,'Default','Default',0,1),(22,22,21,'выкл.',81,'Default','Default',0,1),(23,23,24,'увімк.',85,'Default','Default',0,1),(24,24,23,'вимк.',85,'Default','Default',0,1),(25,25,26,'вмк.',89,'Default','Default',0,1),(26,26,25,'вимк.',89,'Default','Default',0,1),(27,27,28,'увімк.',92,'Default','Default',0,1),(28,28,27,'вимк.',92,'Default','Default',0,1),(29,29,30,'увімк.',96,'Default','Default',0,1),(30,30,29,'вимк.',96,'Default','Default',0,1),(31,31,32,'увімк.',105,'Default','Default',0,1),(32,32,31,'вимк.',105,'Default','Default',0,1),(33,33,34,'увімк.',107,'Default','Default',0,1),(34,34,33,'вимк.',107,'Default','Default',0,1),(35,35,36,'увімк.',115,'Default','Default',0,1),(36,36,35,'вимк.',115,'Default','Default',0,1),(37,37,38,'увімк.',122,'Default','Default',0,1),(38,38,37,'вимк.',122,'Default','Default',0,1),(39,39,40,'увімк.',129,'Default','Default',0,1),(40,40,39,'вимк.',129,'Default','Default',0,1),(41,43,44,'увімк.',143,'Default','Default',0,1),(42,44,43,'вимк.',143,'Default','Default',0,1),(43,45,46,'увімк.',146,'Default','Default',0,1),(44,46,45,'вимк.',146,'Default','Default',0,1),(45,47,48,'увімк.',149,'Default','Default',0,1),(46,48,47,'вимк.',149,'Default','Default',0,1),(47,49,50,'увімк.',152,'Default','Default',0,1),(48,50,49,'вимк.',152,'Default','Default',0,1),(49,51,52,'увімк.',160,'Default','Default',0,1),(50,52,51,'вимк.',160,'Default','Default',0,1),(51,53,54,'1',162,'Default','Default',0,1),(52,54,53,'0',162,'Default','Default',0,1),(53,59,60,'1',171,'Default','Default',0,1),(54,60,59,'0',171,'Default','Default',0,1),(55,61,62,'1',174,'Default','Default',0,1),(56,62,61,'0',174,'Default','Default',0,1),(57,63,64,'1',182,'Default','Default',0,1),(58,64,63,'0',182,'Default','Default',0,1),(59,65,66,'1',185,'Default','Default',0,1),(60,66,65,'0',185,'Default','Default',0,1),(61,67,68,'1',193,'Default','Default',0,1),(62,68,67,'0',193,'Default','Default',0,1),(63,69,70,'1',201,'Default','Default',0,1),(64,70,69,'0',201,'Default','Default',0,1),(65,71,72,'1',208,'Default','Default',0,1),(66,72,71,'0',208,'Default','Default',0,1),(67,73,74,'1',215,'Default','Default',0,1),(68,74,73,'0',215,'Default','Default',0,1),(69,75,76,'1',222,'Default','Default',0,1),(70,76,75,'0',222,'Default','Default',0,1),(71,77,78,'1',229,'Default','Default',0,1),(72,78,77,'0',229,'Default','Default',0,1),(73,79,80,'1',236,'Default','Default',0,1),(74,80,79,'0',236,'Default','Default',0,1),(75,81,82,'1',238,'Default','Default',0,1),(76,82,81,'0',238,'Default','Default',0,1),(77,87,88,'1',260,'Default','Default',0,1),(78,88,87,'0',260,'Default','Default',0,1),(79,89,90,'1',267,'Default','Default',0,1),(80,90,89,'0',267,'Default','Default',0,1),(81,91,92,'1',274,'Default','Default',0,1),(82,92,91,'0',274,'Default','Default',0,1),(83,93,94,'1',282,'Default','Default',0,1),(84,94,93,'0',282,'Default','Default',0,1),(85,95,96,'1',290,'Default','Default',0,1),(86,96,95,'0',290,'Default','Default',0,1),(87,97,98,'1',297,'Default','Default',0,1),(88,98,97,'0',297,'Default','Default',0,1),(89,99,100,'1',304,'Default','Default',0,1),(90,100,99,'0',304,'Default','Default',0,1);

--
-- Table structure for table `users_acs_objects`
--

CREATE TABLE `users_acs_objects` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Id_role` int(11) NOT NULL,
  `Id_type` int(11) NOT NULL,
  `Id_object` int(11) NOT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_users_acs_objects_users_acs_roles_Id` (`Id_role`),
  CONSTRAINT `FK_users_acs_objects_users_acs_roles_Id` FOREIGN KEY (`Id_role`) REFERENCES `users_acs_roles` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_acs_objects`
--


--
-- Table structure for table `users_acs_roles`
--

CREATE TABLE `users_acs_roles` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_acs_roles`
--

INSERT INTO `users_acs_roles` VALUES (1,'Администратор');

--
-- Table structure for table `users_actions_log`
--

CREATE TABLE `users_actions_log` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `TypeLog` int(11) NOT NULL DEFAULT '0',
  `DateAction` datetime NOT NULL,
  `Id_document` int(11) NOT NULL DEFAULT '0',
  `TextLog` varchar(255) NOT NULL,
  `User` varchar(127) NOT NULL,
  `Computer` varchar(63) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=262 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_actions_log`
--

INSERT INTO `users_actions_log` VALUES (1,8,'2016-09-07 13:57:14',0,'25->3 Полоса сглаживания','admin','MNK'),(2,8,'2016-09-07 13:57:14',0,'50->20 Порог заправки','admin','MNK'),(3,9,'2016-09-13 15:35:00',20,'Вход','admin','MNK'),(4,9,'2016-09-13 15:35:01',20,'Загрузить','admin','MNK'),(5,8,'2016-09-13 15:35:29',0,'00:02:00->00:01:30 Время определения уровня топлива','admin','MNK'),(6,9,'2016-09-13 16:32:59',21,'Вход','admin','MNK'),(7,9,'2016-09-13 16:33:00',21,'Загрузить','admin','MNK'),(8,9,'2016-09-13 16:33:10',22,'Вход','admin','MNK'),(9,9,'2016-09-13 16:33:12',22,'Загрузить','admin','MNK'),(10,9,'2016-09-13 16:33:23',21,'Вход','admin','MNK'),(11,9,'2016-09-13 16:33:32',22,'Вход','admin','MNK'),(12,9,'2016-09-13 16:33:38',21,'Вход','admin','MNK'),(13,9,'2016-09-13 16:39:01',26,'Вход','admin','MNK'),(14,9,'2016-09-13 16:39:03',26,'Загрузить','admin','MNK'),(15,8,'2016-09-13 16:41:41',0,'0->1 Не учитывать сливы в расходе','admin','MNK'),(16,9,'2016-09-13 17:21:59',13,'Вход','admin','MNK'),(17,9,'2016-09-13 17:22:01',13,'Загрузить','admin','MNK'),(18,9,'2016-09-13 17:22:11',18,'Вход','admin','MNK'),(19,9,'2016-09-13 17:22:13',18,'Загрузить','admin','MNK'),(20,9,'2016-09-13 17:26:56',19,'Вход','admin','MNK'),(21,9,'2016-09-13 17:26:57',19,'Загрузить','admin','MNK'),(22,8,'2016-09-13 17:29:25',1,'5->3 Полоса сглаживания','admin','MNK'),(23,8,'2016-09-13 17:29:25',1,'Новая настройка 1->Еско Название настройки','admin','MNK'),(24,8,'2016-09-13 17:29:25',1,'Новая настройка 1->Еско Описание настройки','admin','MNK'),(25,8,'2016-09-13 17:29:25',1,'00:02:00->00:01:30 Время определения уровня топлива','admin','MNK'),(26,8,'2016-09-13 17:29:25',1,'0->3 Заправки считать по Min/Max','admin','MNK'),(27,9,'2016-09-15 15:31:40',30,'Вход','admin','MNK'),(28,9,'2016-09-15 15:31:42',30,'Загрузить','admin','MNK'),(29,9,'2016-10-26 19:46:48',49,'Вход','admin','MNK'),(30,9,'2016-10-26 19:46:50',49,'Загрузить','admin','MNK'),(31,9,'2016-10-26 19:47:00',50,'Вход','admin','MNK'),(32,9,'2016-10-26 19:47:01',50,'Загрузить','admin','MNK'),(33,8,'2017-08-04 12:46:41',0,'15->22 Средний расход топлива, л/ч','admin','MNK'),(34,8,'2017-09-29 13:51:37',0,'22->18 Средний расход топлива, л/ч','admin','MNK'),(35,9,'2017-09-29 13:51:54',75,'Вход','admin','MNK'),(36,9,'2017-09-29 13:51:55',75,'Загрузить','admin','MNK'),(37,9,'2017-09-29 13:52:05',82,'Вход','admin','MNK'),(38,9,'2017-09-29 13:52:07',82,'Загрузить','admin','MNK'),(39,9,'2018-07-16 18:45:09',84,'Вход','admin','MNK'),(40,9,'2018-07-16 18:45:11',84,'Загрузить','admin','MNK'),(41,9,'2018-07-16 18:45:21',98,'Вход','admin','MNK'),(42,9,'2018-07-16 18:45:23',98,'Загрузить','admin','MNK'),(43,9,'2018-07-16 18:45:34',84,'Вход','admin','MNK'),(44,9,'2018-07-16 18:45:38',98,'Вход','admin','MNK'),(45,9,'2018-07-16 18:48:54',21,'Вход','admin','MNK'),(46,9,'2018-07-16 18:49:03',22,'Вход','admin','MNK'),(47,9,'2018-07-16 18:49:16',21,'Вход','admin','MNK'),(48,9,'2018-07-16 18:49:22',22,'Вход','admin','MNK'),(49,9,'2018-07-17 14:06:44',21,'Вход','admin','MNK'),(50,9,'2018-07-17 14:06:47',21,'Удаление строки 0','admin','MNK'),(51,9,'2018-07-17 14:06:47',21,'Удаление строки 0','admin','MNK'),(52,9,'2018-07-17 14:06:48',21,'Удаление строки 0','admin','MNK'),(53,9,'2018-07-17 14:06:48',21,'Удаление строки 0','admin','MNK'),(54,9,'2018-07-17 14:06:48',21,'Удаление строки 0','admin','MNK'),(55,9,'2018-07-17 14:06:48',21,'Удаление строки 0','admin','MNK'),(56,9,'2018-07-17 14:06:49',21,'Удаление строки 0','admin','MNK'),(57,9,'2018-07-17 14:06:49',21,'Удаление строки 0','admin','MNK'),(58,9,'2018-07-17 14:06:49',21,'Удаление строки 0','admin','MNK'),(59,9,'2018-07-17 14:06:49',21,'Удаление строки 0','admin','MNK'),(60,9,'2018-07-17 14:06:49',21,'Удаление строки 0','admin','MNK'),(61,9,'2018-07-17 14:06:50',21,'Удаление строки 0','admin','MNK'),(62,9,'2018-07-17 14:06:50',21,'Удаление строки 0','admin','MNK'),(63,9,'2018-07-17 14:06:50',21,'Удаление строки 0','admin','MNK'),(64,9,'2018-07-17 14:06:50',21,'Удаление строки 0','admin','MNK'),(65,9,'2018-07-17 14:06:50',21,'Удаление строки 0','admin','MNK'),(66,9,'2018-07-17 14:06:51',21,'Удаление строки 0','admin','MNK'),(67,9,'2018-07-17 14:06:51',21,'Удаление строки 0','admin','MNK'),(68,9,'2018-07-17 14:06:51',21,'Удаление строки 0','admin','MNK'),(69,9,'2018-07-17 14:06:51',21,'Удаление строки 0','admin','MNK'),(70,9,'2018-07-17 14:06:51',21,'Удаление строки 0','admin','MNK'),(71,9,'2018-07-17 14:06:52',21,'Удаление строки 0','admin','MNK'),(72,9,'2018-07-17 14:06:52',21,'Удаление строки 0','admin','MNK'),(73,9,'2018-07-17 14:06:52',21,'Удаление строки 0','admin','MNK'),(74,9,'2018-07-17 14:06:52',21,'Удаление строки 0','admin','MNK'),(75,9,'2018-07-17 14:06:52',21,'Удаление строки 0','admin','MNK'),(76,9,'2018-07-17 14:06:53',21,'Удаление строки 0','admin','MNK'),(77,9,'2018-07-17 14:06:53',21,'Удаление строки 0','admin','MNK'),(78,9,'2018-07-17 14:06:53',21,'Удаление строки 0','admin','MNK'),(79,9,'2018-07-17 14:06:53',21,'Удаление строки 0','admin','MNK'),(80,9,'2018-07-17 14:06:53',21,'Удаление строки 0','admin','MNK'),(81,9,'2018-07-17 14:06:54',21,'Удаление строки 0','admin','MNK'),(82,9,'2018-07-17 14:06:54',21,'Удаление строки 0','admin','MNK'),(83,9,'2018-07-17 14:06:54',21,'Удаление строки 0','admin','MNK'),(84,9,'2018-07-17 14:06:54',21,'Удаление строки 0','admin','MNK'),(85,9,'2018-07-17 14:06:59',22,'Вход','admin','MNK'),(86,9,'2018-07-17 14:07:02',22,'Удаление строки 0','admin','MNK'),(87,9,'2018-07-17 14:07:02',22,'Удаление строки 0','admin','MNK'),(88,9,'2018-07-17 14:07:02',22,'Удаление строки 0','admin','MNK'),(89,9,'2018-07-17 14:07:03',22,'Удаление строки 0','admin','MNK'),(90,9,'2018-07-17 14:07:03',22,'Удаление строки 0','admin','MNK'),(91,9,'2018-07-17 14:07:03',22,'Удаление строки 0','admin','MNK'),(92,9,'2018-07-17 14:07:03',22,'Удаление строки 0','admin','MNK'),(93,9,'2018-07-17 14:07:04',22,'Удаление строки 0','admin','MNK'),(94,9,'2018-07-17 14:07:04',22,'Удаление строки 0','admin','MNK'),(95,9,'2018-07-17 14:07:04',22,'Удаление строки 0','admin','MNK'),(96,9,'2018-07-17 14:07:04',22,'Удаление строки 0','admin','MNK'),(97,9,'2018-07-17 14:07:04',22,'Удаление строки 0','admin','MNK'),(98,9,'2018-07-17 14:07:05',22,'Удаление строки 0','admin','MNK'),(99,9,'2018-07-17 14:07:05',22,'Удаление строки 0','admin','MNK'),(100,9,'2018-07-17 14:07:05',22,'Удаление строки 0','admin','MNK'),(101,9,'2018-07-17 14:07:05',22,'Удаление строки 0','admin','MNK'),(102,9,'2018-07-17 14:07:05',22,'Удаление строки 0','admin','MNK'),(103,9,'2018-07-17 14:07:06',22,'Удаление строки 0','admin','MNK'),(104,9,'2018-07-17 14:07:06',22,'Удаление строки 0','admin','MNK'),(105,9,'2018-07-17 14:07:06',22,'Удаление строки 0','admin','MNK'),(106,9,'2018-07-17 14:07:06',22,'Удаление строки 0','admin','MNK'),(107,9,'2018-07-17 14:07:06',22,'Удаление строки 0','admin','MNK'),(108,9,'2018-07-17 14:07:07',22,'Удаление строки 0','admin','MNK'),(109,9,'2018-07-17 14:07:07',22,'Удаление строки 0','admin','MNK'),(110,9,'2018-07-17 14:07:07',22,'Удаление строки 0','admin','MNK'),(111,9,'2018-07-17 14:07:07',22,'Удаление строки 0','admin','MNK'),(112,9,'2018-07-17 14:07:08',22,'Удаление строки 0','admin','MNK'),(113,9,'2018-07-17 14:07:08',22,'Удаление строки 0','admin','MNK'),(114,9,'2018-07-17 14:07:08',22,'Удаление строки 0','admin','MNK'),(115,9,'2018-07-17 14:07:08',22,'Удаление строки 0','admin','MNK'),(116,9,'2018-07-17 14:07:09',22,'Удаление строки 0','admin','MNK'),(117,9,'2018-07-17 14:07:09',22,'Удаление строки 0','admin','MNK'),(118,9,'2018-07-17 14:07:09',22,'Удаление строки 0','admin','MNK'),(119,9,'2018-07-17 14:07:10',22,'Удаление строки 0','admin','MNK'),(120,9,'2018-07-17 14:07:10',22,'Удаление строки 0','admin','MNK'),(121,9,'2018-07-17 18:00:04',26,'Вход','admin','MNK'),(122,9,'2018-07-17 18:00:07',26,'Удаление строки 0','admin','MNK'),(123,9,'2018-07-17 18:00:07',26,'Удаление строки 0','admin','MNK'),(124,9,'2018-07-17 18:00:07',26,'Удаление строки 0','admin','MNK'),(125,9,'2018-07-17 18:00:07',26,'Удаление строки 0','admin','MNK'),(126,9,'2018-07-17 18:00:10',26,'Удаление строки 0','admin','MNK'),(127,9,'2018-07-17 18:00:10',26,'Удаление строки 0','admin','MNK'),(128,9,'2018-07-17 18:00:11',26,'Удаление строки 0','admin','MNK'),(129,9,'2018-07-17 18:00:11',26,'Удаление строки 0','admin','MNK'),(130,9,'2018-07-17 18:00:11',26,'Удаление строки 0','admin','MNK'),(131,9,'2018-07-17 18:00:11',26,'Удаление строки 0','admin','MNK'),(132,9,'2018-07-17 18:00:11',26,'Удаление строки 0','admin','MNK'),(133,9,'2018-07-17 18:00:11',26,'Удаление строки 0','admin','MNK'),(134,9,'2018-07-17 18:00:12',26,'Удаление строки 0','admin','MNK'),(135,9,'2018-07-18 16:44:12',21,'Вход','admin','MNK'),(136,9,'2018-07-18 16:44:13',21,'Загрузить','admin','MNK'),(137,9,'2018-07-18 16:44:24',22,'Вход','admin','MNK'),(138,9,'2018-07-18 16:44:25',22,'Загрузить','admin','MNK'),(139,8,'2018-07-18 16:46:57',0,'70->85 Максимальная скорость движения, км/ч','admin','MNK'),(140,8,'2018-07-18 16:47:17',0,'10->8 Порог слива','admin','MNK'),(141,9,'2018-07-20 11:50:33',97,'Вход','admin','MNK'),(142,9,'2018-07-20 11:50:41',97,'Вход','admin','MNK'),(143,9,'2018-07-20 11:50:42',97,'Загрузить','admin','MNK'),(144,9,'2018-07-20 11:51:11',84,'Вход','admin','MNK'),(145,9,'2018-07-20 11:51:15',84,'Удаление строки 0','admin','MNK'),(146,9,'2018-07-20 11:51:15',84,'Удаление строки 0','admin','MNK'),(147,9,'2018-07-20 11:51:15',84,'Удаление строки 0','admin','MNK'),(148,9,'2018-07-20 11:51:16',84,'Удаление строки 0','admin','MNK'),(149,9,'2018-07-20 11:51:16',84,'Удаление строки 0','admin','MNK'),(150,9,'2018-07-20 11:51:19',84,'Удаление строки 0','admin','MNK'),(151,9,'2018-07-20 11:51:19',84,'Удаление строки 0','admin','MNK'),(152,9,'2018-07-20 11:51:19',84,'Удаление строки 0','admin','MNK'),(153,9,'2018-07-20 11:51:19',84,'Удаление строки 0','admin','MNK'),(154,9,'2018-07-20 11:51:20',84,'Удаление строки 0','admin','MNK'),(155,9,'2018-07-20 11:51:20',84,'Удаление строки 0','admin','MNK'),(156,9,'2018-07-20 11:51:20',84,'Удаление строки 0','admin','MNK'),(157,9,'2018-07-20 11:51:20',84,'Удаление строки 0','admin','MNK'),(158,9,'2018-07-20 11:51:20',84,'Удаление строки 0','admin','MNK'),(159,9,'2018-07-20 13:07:57',97,'Вход','admin','MNK'),(160,9,'2018-07-20 13:08:01',98,'Вход','admin','MNK'),(161,9,'2018-07-20 13:08:06',97,'Вход','admin','MNK'),(162,8,'2019-03-29 10:16:14',0,'3->0 Період згладжування','admin','MNK'),(163,8,'2019-03-29 10:16:14',0,'8->7 Поріг зливу','admin','MNK'),(164,8,'2019-03-29 10:16:14',0,'20->15 Поріг заправки','admin','MNK'),(165,9,'2022-02-08 15:12:11',183,'Вхід','admin','MNK'),(166,9,'2022-02-08 15:12:13',183,'Завантижити','admin','MNK'),(167,9,'2022-02-08 15:12:21',186,'Вхід','admin','MNK'),(168,9,'2022-02-08 15:12:24',186,'Завантижити','admin','MNK'),(169,9,'2022-02-08 15:23:58',166,'Вхід','admin','MNK'),(170,9,'2022-02-08 15:23:59',166,'Завантижити','admin','MNK'),(171,9,'2022-02-08 16:13:56',195,'Вхід','admin','MNK'),(172,9,'2022-02-08 16:13:57',195,'Завантижити','admin','MNK'),(173,9,'2022-02-08 16:14:14',202,'Вхід','admin','MNK'),(174,9,'2022-02-08 16:14:16',202,'Завантижити','admin','MNK'),(175,9,'2022-02-08 16:14:26',209,'Вхід','admin','MNK'),(176,9,'2022-02-08 16:14:27',209,'Завантижити','admin','MNK'),(177,9,'2022-02-14 20:35:07',187,'Вхід','admin','MNK'),(178,9,'2022-02-14 20:35:09',187,'Завантижити','admin','MNK'),(179,9,'2022-02-14 20:35:20',194,'Вхід','admin','MNK'),(180,9,'2022-02-14 20:35:21',194,'Завантижити','admin','MNK'),(181,9,'2022-07-11 15:09:18',223,'Вхід','admin','MNK'),(182,9,'2022-07-11 15:09:19',223,'Завантижити','admin','MNK'),(183,9,'2022-08-20 10:04:43',223,'Вхід','admin','MNK'),(184,9,'2022-08-20 10:04:48',223,'Delete record 0','admin','MNK'),(185,9,'2022-08-20 10:04:48',223,'Delete record 0','admin','MNK'),(186,9,'2022-08-20 10:04:49',223,'Delete record 0','admin','MNK'),(187,9,'2022-08-20 10:04:49',223,'Delete record 0','admin','MNK'),(188,9,'2022-08-20 10:04:49',223,'Delete record 0','admin','MNK'),(189,9,'2022-08-20 10:04:49',223,'Delete record 0','admin','MNK'),(190,9,'2022-08-20 10:04:49',223,'Delete record 0','admin','MNK'),(191,9,'2022-08-20 10:04:50',223,'Delete record 0','admin','MNK'),(192,9,'2022-08-20 10:04:50',223,'Delete record 0','admin','MNK'),(193,9,'2022-08-20 10:04:50',223,'Delete record 0','admin','MNK'),(194,9,'2022-08-20 10:04:50',223,'Delete record 0','admin','MNK'),(195,9,'2022-08-20 10:04:50',223,'Delete record 0','admin','MNK'),(196,9,'2022-08-20 10:04:51',223,'Delete record 0','admin','MNK'),(197,9,'2022-08-20 10:04:51',223,'Delete record 0','admin','MNK'),(198,9,'2022-08-20 10:04:51',223,'Delete record 0','admin','MNK'),(199,9,'2022-08-20 10:04:51',223,'Delete record 0','admin','MNK'),(200,9,'2022-08-20 10:04:51',223,'Delete record 0','admin','MNK'),(201,9,'2022-08-20 10:04:52',223,'Delete record 0','admin','MNK'),(202,9,'2022-08-20 10:04:52',223,'Delete record 0','admin','MNK'),(203,9,'2022-08-20 10:04:52',223,'Delete record 0','admin','MNK'),(204,9,'2022-08-20 10:04:52',223,'Delete record 0','admin','MNK'),(205,9,'2022-08-20 10:04:52',223,'Delete record 0','admin','MNK'),(206,9,'2022-08-20 10:04:53',223,'Delete record 0','admin','MNK'),(207,9,'2022-08-20 10:04:53',223,'Delete record 0','admin','MNK'),(208,9,'2022-08-20 10:04:53',223,'Delete record 0','admin','MNK'),(209,9,'2022-08-20 10:04:53',223,'Delete record 0','admin','MNK'),(210,9,'2022-08-20 10:04:53',223,'Delete record 0','admin','MNK'),(211,9,'2022-08-20 10:04:54',223,'Delete record 0','admin','MNK'),(212,9,'2022-08-20 10:04:54',223,'Delete record 0','admin','MNK'),(213,9,'2022-08-20 10:04:54',223,'Delete record 0','admin','MNK'),(214,9,'2022-08-20 10:04:54',223,'Delete record 0','admin','MNK'),(215,9,'2022-08-20 10:04:55',223,'Delete record 0','admin','MNK'),(216,9,'2022-08-20 10:04:55',223,'Delete record 0','admin','MNK'),(217,9,'2022-08-20 10:04:55',223,'Delete record 0','admin','MNK'),(218,9,'2022-08-20 10:04:55',223,'Delete record 0','admin','MNK'),(219,9,'2022-08-20 10:04:55',223,'Delete record 0','admin','MNK'),(220,9,'2022-08-20 10:04:56',223,'Delete record 0','admin','MNK'),(221,9,'2022-08-20 10:04:56',223,'Delete record 0','admin','MNK'),(222,9,'2022-08-20 10:04:58',223,'Delete record 0','admin','MNK'),(223,9,'2022-08-20 10:04:59',223,'Delete record 0','admin','MNK'),(224,9,'2022-08-20 10:04:59',223,'Delete record 0','admin','MNK'),(225,9,'2022-08-20 10:04:59',223,'Delete record 0','admin','MNK'),(226,9,'2022-08-20 10:04:59',223,'Delete record 0','admin','MNK'),(227,9,'2022-08-20 10:05:00',223,'Delete record 0','admin','MNK'),(228,9,'2022-08-20 10:05:00',223,'Delete record 0','admin','MNK'),(229,9,'2022-08-20 10:05:00',223,'Delete record 0','admin','MNK'),(230,9,'2022-08-20 10:05:00',223,'Delete record 0','admin','MNK'),(231,9,'2022-08-20 10:16:38',223,'Вхід','admin','MNK'),(232,9,'2022-08-20 10:16:39',223,'Завантижити','admin','MNK'),(233,9,'2023-04-08 19:57:36',239,'Вхід','admin','MNK'),(234,9,'2023-04-08 19:57:38',239,'Завантижити','admin','MNK'),(235,9,'2023-04-08 19:58:06',183,'Вхід','admin','MNK'),(236,9,'2023-04-08 19:58:12',183,'Delete record 0','admin','MNK'),(237,9,'2023-04-08 19:58:12',183,'Delete record 0','admin','MNK'),(238,9,'2023-04-08 19:58:12',183,'Delete record 0','admin','MNK'),(239,9,'2023-04-08 19:58:13',183,'Delete record 0','admin','MNK'),(240,9,'2023-04-08 19:58:13',183,'Delete record 0','admin','MNK'),(241,9,'2023-04-08 19:58:15',183,'Delete record 0','admin','MNK'),(242,9,'2023-04-08 19:58:15',183,'Delete record 0','admin','MNK'),(243,9,'2023-04-08 19:58:16',183,'Delete record 0','admin','MNK'),(244,9,'2023-04-08 19:58:16',183,'Delete record 0','admin','MNK'),(245,9,'2023-04-08 19:58:16',183,'Delete record 0','admin','MNK'),(246,9,'2023-04-08 19:58:16',183,'Delete record 0','admin','MNK'),(247,9,'2023-04-08 19:58:16',183,'Delete record 0','admin','MNK'),(248,9,'2023-04-08 19:58:17',183,'Delete record 0','admin','MNK'),(249,9,'2023-04-08 19:58:17',183,'Delete record 0','admin','MNK'),(250,9,'2023-04-08 19:58:20',183,'Завантижити','admin','MNK'),(251,9,'2023-04-08 22:45:31',268,'Вхід','admin','MNK'),(252,9,'2023-04-08 22:45:32',268,'Завантижити','admin','MNK'),(253,9,'2023-04-08 22:45:51',275,'Вхід','admin','MNK'),(254,9,'2023-04-08 22:45:52',275,'Завантижити','admin','MNK'),(255,9,'2023-06-07 15:20:34',276,'Вхід','admin','MNK'),(256,9,'2023-06-07 15:20:35',276,'Завантижити','admin','MNK'),(257,9,'2023-06-07 15:20:50',283,'Вхід','admin','MNK'),(258,9,'2023-06-07 15:20:51',283,'Завантижити','admin','MNK'),(259,9,'2023-06-07 15:30:26',298,'Вхід','admin','MNK'),(260,9,'2023-06-07 15:30:27',298,'Завантижити','admin','MNK'),(261,9,'2023-06-07 15:32:55',298,'Вхід','admin','MNK');

--
-- Table structure for table `users_list`
--

CREATE TABLE `users_list` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL,
  `WinLogin` varchar(50) DEFAULT NULL,
  `Password` blob NOT NULL,
  `Admin` tinyint(1) NOT NULL DEFAULT '0',
  `Id_role` int(11) DEFAULT '0' COMMENT 'Код роли пользователя',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_list`
--


--
-- Table structure for table `users_reports_list`
--

CREATE TABLE `users_reports_list` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `ReportType` varchar(127) NOT NULL,
  `ReportCaption` varchar(127) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `users_reports_list`
--

INSERT INTO `users_reports_list` VALUES (1,'KilometrageControl','Пробег'),(2,'KilometrageDayControl','Пробег суточный'),(3,'KilometrageTotal','Пробег общий'),(4,'FuelControl','Заправки'),(5,'FuelExpensesControlDutDay','Топливо суточный ДУТ'),(6,'FuelExpensesControlDut','Общий расход ДУТ'),(7,'FlowmeterControl','Расход'),(8,'FuelExpensesControlDrt','Общий расход ДРТ'),(9,'RoadSafetyControl','Безопасность'),(10,'ParamOfMovingControl','Параметры движения'),(11,'CzDetailed','КЗ Детальный'),(12,'CZ_Detailed_General','КЗ Групповой'),(13,'FuelCZ_Inkom_DRT','ДРТ - КЗ'),(14,'FuelCZ_Inkom_DUT','ДУТ - КЗ'),(15,'SensorEventsControl','События датчиков'),(16,'RotationControl','Обороты'),(17,'PassTrafficDaily','Пассажиры суточный'),(18,'FuelerControlDrt','Заправщик'),(19,'ReportDrivers','Водители (RFID)'),(20,'GrainLevel','Уровень зерна'),(21,'KilometrageControlDut','Пробег+ДУТ'),(22,'ReportVehicles','Идентификация ТС');

--
-- Table structure for table `vehicle`
--

CREATE TABLE `vehicle` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `MakeCar` text COMMENT 'Марка автомобиля',
  `NumberPlate` text COMMENT 'Номерной знак',
  `Team_id` int(11) DEFAULT NULL,
  `Mobitel_id` int(11) DEFAULT NULL,
  `Odometr` int(11) DEFAULT '0' COMMENT 'Показания одометра',
  `CarModel` text COMMENT 'Модель',
  `setting_id` int(11) DEFAULT '1',
  `odoTime` datetime DEFAULT NULL COMMENT 'Дата и время сверки одометра',
  `driver_id` int(11) DEFAULT '-1',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  `Category_id` int(11) DEFAULT NULL COMMENT 'Категория транспортая',
  `Category_id2` int(11) DEFAULT NULL COMMENT 'Категория2 транспорта',
  `PcbVersionId` int(11) DEFAULT '-1' COMMENT 'Версия плат датчика назначенная на машину',
  `Category_id3` int(11) DEFAULT NULL COMMENT 'Категория3 транспорта',
  `Category_id4` int(11) DEFAULT NULL COMMENT 'Категория4 транспорта',
  `FuelWayLiter` double DEFAULT '0' COMMENT 'Расход топлива л/100 км',
  `FuelMotorLiter` double DEFAULT '0' COMMENT 'Расход топлива л/моточас',
  `Identifier` int(11) DEFAULT '0' COMMENT 'Идентификатор машины',
  PRIMARY KEY (`id`),
  UNIQUE KEY `id` (`id`) USING BTREE,
  KEY `Mobitel_id` (`Mobitel_id`) USING BTREE,
  KEY `Team_id` (`Team_id`) USING BTREE,
  KEY `setting_id` (`setting_id`) USING BTREE,
  KEY `FK_vehicle_vehicle_category_Id` (`Category_id`),
  KEY `FK_vehicle_vehicle_category_Id2` (`Category_id2`),
  KEY `FK_vehicle_vehicle_category_Id3` (`Category_id3`),
  KEY `FK_vehicle_vehicle_category_Id4` (`Category_id4`),
  CONSTRAINT `FK_vehicle_vehicle_category_Id` FOREIGN KEY (`Category_id`) REFERENCES `vehicle_category` (`Id`),
  CONSTRAINT `FK_vehicle_vehicle_category_Id2` FOREIGN KEY (`Category_id2`) REFERENCES `vehicle_category2` (`Id`),
  CONSTRAINT `FK_vehicle_vehicle_category_Id3` FOREIGN KEY (`Category_id3`) REFERENCES `vehicle_category3` (`Id`),
  CONSTRAINT `FK_vehicle_vehicle_category_Id4` FOREIGN KEY (`Category_id4`) REFERENCES `vehicle_category4` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle`
--

INSERT INTO `vehicle` VALUES (1,'Volvo','BK 5082 BX',1,98,0,'FH420',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(2,'Volvo','BK 7374 AI',1,99,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(3,'Atlas','97',1,97,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(4,'DAF','BK 2618 BH',1,100,0,'105',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(5,'Volvo','101',1,101,0,'',1,NULL,1,'',NULL,NULL,1,NULL,NULL,0,0,0),(6,'Volvo','BK 8963 HO',3,102,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(7,'Volvo','BK 8780 BO',1,103,0,'',1,NULL,1,'',NULL,NULL,1,NULL,NULL,0,0,0),(8,'Volvo','BK 7212 BO',1,104,0,'',1,NULL,1,'',NULL,NULL,1,NULL,NULL,0,0,0),(9,'Renault','BK 1296 BK',1,105,0,'Magnum',1,NULL,1,'',NULL,NULL,1,NULL,NULL,0,0,0),(10,'Volvo','BK 0863 BC',1,106,0,'',1,NULL,1,'',NULL,NULL,1,NULL,NULL,0,0,0),(11,'Volvo','BK 0978 BX',3,107,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(12,'Volvo','BK 1789 BT',1,108,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(13,'Volvo','BK 3081 BT',1,109,0,'',1,NULL,1,'',NULL,NULL,2,NULL,NULL,0,0,0),(14,'Volvo','BK 8652 AT',1,110,0,'',1,NULL,1,'',NULL,NULL,2,NULL,NULL,0,0,0),(15,'Volvo','LC 78135',2,859386421,0,'',1,NULL,1,'',NULL,NULL,2,NULL,NULL,0,0,0),(16,'Mercedes-Benz',' LC 84996',1,808924983,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(17,'Volvo','BK 0603 BO',3,909520946,0,'',1,NULL,1,'',NULL,NULL,3,NULL,NULL,0,0,0),(18,'DAF','LC 82206',5,808466742,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(19,'Mercedes-Benz','LC 84684',2,892418353,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(20,'DAF','LC 78134',2,876032567,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(21,'Mercedes-Benz','LC 80179',2,825635890,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(22,'Volvo','BK 8316 HX',1,808596790,0,'',1,NULL,1,'',NULL,NULL,3,NULL,NULL,0,0,0),(23,'Mercedes-Benz','LC 85585',2,942814777,0,'',1,NULL,1,'',NULL,NULL,3,NULL,NULL,0,0,0),(24,'Volvo','BK 1918 CM',3,876165171,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(25,'Volvo','BK 7510 HX',3,959788080,0,'',1,NULL,1,'',NULL,NULL,2,NULL,NULL,0,0,0),(26,'DAF','LC 89196',2,926366004,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(27,'Renault','BK 7312 HP',1,926364217,0,'Premium',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(28,'Renault','BK 7380 HP',3,909259058,0,'Premium',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(29,'Mercedes-Benz','LC 88268',2,842348336,0,'',1,NULL,1,'',NULL,NULL,3,NULL,NULL,0,0,0),(30,'Renault','CV 321 DV',3,876032307,0,'Premium',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(31,'Урал','AB 5197 CE',3,926365494,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(32,'Volvo','BK 5359 HH',3,875639862,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(33,'DAF','LC 88574',5,959723824,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(34,'ex Mercedes-Benz','5958',3,892941624,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(35,'Volvo','BK4273IA',2,809054258,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(36,'DAF','BK 9419 HM',NULL,926298936,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(37,'DAF','LC 90483',2,859321909,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(38,'DAF','LC 92542',2,942813752,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(39,'Volvo','BK 7511 HX',NULL,926103344,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(40,'Renault','LC 92563',2,926497080,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(41,'Volvo','BK 1545 IA',NULL,926429748,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(42,'Volvo','BK 5119 HH',NULL,875770931,0,'',1,NULL,1,'',NULL,NULL,-1,NULL,NULL,0,0,0),(43,'DAF','LC 93513',5,859191344,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(44,'Renault','BK 5299 IA',NULL,808793648,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0),(45,'Volvo','BK 9530 IE',2,859386416,0,'',1,NULL,1,'',NULL,NULL,4,NULL,NULL,0,0,0);

--
-- Table structure for table `vehicle_category`
--

CREATE TABLE `vehicle_category` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) NOT NULL COMMENT 'Категория транспортного средства',
  `Tonnage` decimal(10,3) NOT NULL DEFAULT '0.000' COMMENT 'Грузоподъемность,  тонн',
  `FuelNormMoving` double NOT NULL DEFAULT '0' COMMENT 'норма расхода топлива в движении л/100 км',
  `FuelNormParking` double NOT NULL DEFAULT '0' COMMENT 'норма расхода топлива на холостых оборотах л/час',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle_category`
--


--
-- Table structure for table `vehicle_category2`
--

CREATE TABLE `vehicle_category2` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL COMMENT 'Категория2 транспортного средства',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle_category2`
--


--
-- Table structure for table `vehicle_category3`
--

CREATE TABLE `vehicle_category3` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL COMMENT 'Категория3 транспортного средства',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle_category3`
--


--
-- Table structure for table `vehicle_category4`
--

CREATE TABLE `vehicle_category4` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) NOT NULL COMMENT 'Категория4 транспортного средства',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `vehicle_category4`
--


--
-- Table structure for table `vehicle_commentary`
--

CREATE TABLE `vehicle_commentary` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Comment` varchar(255) DEFAULT NULL,
  `Mobitel_id` int(11) NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=cp1251 COMMENT='Комментарий для машины';

--
-- Dumping data for table `vehicle_commentary`
--

INSERT INTO `vehicle_commentary` VALUES (1,'+37282618051',98),(2,'+37282618044',100),(3,'+37282618048',102),(4,'+37282618047',103),(5,'+37282618049',104),(6,'+37282618050',105),(7,'+37282216352',108),(8,'+37282216350',107),(9,'+37282216351',109),(10,'+37282216349',110),(11,'+37259208750',808924983),(12,'+37259704263',808466742),(13,'+37259208756',808596790),(14,'+37259704754',825635890),(15,'+37281300232',876032567),(16,'+37281300238',859386421),(17,'+37257906724',892418353),(18,'+37259208752',909520946);

--
-- Table structure for table `ver`
--

CREATE TABLE `ver` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Номер текущей сборки БД',
  `Desc` text NOT NULL COMMENT 'Описание текущей сборки БД',
  `time` datetime DEFAULT NULL COMMENT 'Время обновления',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `ver`
--

INSERT INTO `ver` VALUES (1,1,'Сборка от 9.12.2008','2008-12-09 00:00:00'),(2,2,'Сборка от 10.02.2009','2009-02-10 00:00:00');

--
-- Table structure for table `zone_category`
--

CREATE TABLE `zone_category` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) DEFAULT NULL COMMENT 'Категория зоны',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Категории для зон';

--
-- Dumping data for table `zone_category`
--


--
-- Table structure for table `zone_category2`
--

CREATE TABLE `zone_category2` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(255) DEFAULT NULL COMMENT 'Категория2 зоны',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB DEFAULT CHARSET=cp1251 COMMENT='Категории2 для зон';

--
-- Dumping data for table `zone_category2`
--


--
-- Table structure for table `zonerelations`
--

CREATE TABLE `zonerelations` (
  `ZoneRelation_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Zone_ID` int(11) DEFAULT '0',
  `ConfigZoneSet_ID` int(11) DEFAULT '0',
  `In_flag` tinyint(4) NOT NULL DEFAULT '0',
  `Out_flag` tinyint(4) NOT NULL DEFAULT '0',
  `In_flag2` tinyint(4) NOT NULL DEFAULT '0',
  `Out_flag2` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`ZoneRelation_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=222 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `zonerelations`
--

INSERT INTO `zonerelations` VALUES (220,78,248,1,0,0,0),(221,78,249,1,0,0,0);

--
-- Table structure for table `zones`
--

CREATE TABLE `zones` (
  `Zone_ID` int(11) NOT NULL AUTO_INCREMENT,
  `Name` char(50) DEFAULT NULL,
  `Descr` text,
  `ID` int(11) DEFAULT '0',
  `Status` tinyint(4) DEFAULT '0',
  `Square` double(14,5) DEFAULT '0.00000' COMMENT 'Площадь контрольной зоны',
  `ZoneColor` int(11) DEFAULT '0' COMMENT 'Цвет контрольной зоны',
  `TextColor` int(11) DEFAULT '0' COMMENT 'Цвет подписи контрольной зоны',
  `TextFontName` char(50) DEFAULT 'Microsoft Sans Serif' COMMENT 'Шрирфт подписи контрольной зоны',
  `TextFontSize` double(5,2) DEFAULT '25.00' COMMENT 'Размер шрирфта подписи контрольной зоны',
  `TextFontParams` char(8) DEFAULT '0;0;0;0;' COMMENT 'Параметры шрирфта подписи контрольной зоны',
  `Icon` blob COMMENT 'Иконка контрольной зоны',
  `HatchStyle` int(11) DEFAULT '0' COMMENT 'Текстура контрольной зоны',
  `DateCreate` datetime DEFAULT NULL COMMENT 'Дата создания',
  `Id_main` int(11) DEFAULT '0' COMMENT 'Ссылка на элемент верхнего уровня в иерархии',
  `Level` tinyint(4) DEFAULT '1' COMMENT 'Уровень в иерархии',
  `StyleId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'ID стиля зоны',
  `ZonesGroupId` int(10) unsigned NOT NULL DEFAULT '1' COMMENT 'ID Группы зон',
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  `Category_id` int(11) DEFAULT NULL COMMENT 'Категория для зоны',
  `Category_id2` int(11) DEFAULT NULL COMMENT 'Категория2 для зоны',
  PRIMARY KEY (`Zone_ID`),
  KEY `FK_zones_zonesgroup` (`ZonesGroupId`),
  CONSTRAINT `FK_zones_zonesgroup` FOREIGN KEY (`ZonesGroupId`) REFERENCES `zonesgroup` (`Id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `zones`
--


--
-- Table structure for table `zonesgroup`
--

CREATE TABLE `zonesgroup` (
  `Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `Title` varchar(50) NOT NULL,
  `Description` varchar(200) NOT NULL,
  `OutLinkId` varchar(20) DEFAULT NULL COMMENT 'Код внешней базы',
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=cp1251;

--
-- Dumping data for table `zonesgroup`
--

INSERT INTO `zonesgroup` VALUES (1,'Все зоны','НЕ УДАЛЯТЬ! Корневой элемент дерева контрольных зон',NULL);

--
-- Dumping events for database 'rizanovych'
--

--
-- Dumping routines for database 'rizanovych'
--
/*!50003 DROP FUNCTION IF EXISTS `CheckVersion` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `CheckVersion`(maskVersion TINYTEXT) RETURNS tinyint(4)
    SQL SECURITY INVOKER
    COMMENT 'Проверка версии СУБД. Должна быть maskVersion или выше. Результа'
BEGIN

  DECLARE currentVersion TINYTEXT;

  SELECT Left(VERSION(), Length(maskVersion)) INTO currentVersion;

  RETURN currentVersion >= maskVersion;

END ;;
DELIMITER ;
/*!50003 DROP FUNCTION IF EXISTS `HaveSuperPrivileges` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` FUNCTION `HaveSuperPrivileges`() RETURNS tinyint(4)
    SQL SECURITY INVOKER
    COMMENT 'Проверка, имеет ли пользователь привилегию SUPER. Результат: 1 -'
BEGIN

  DECLARE usrstr TINYTEXT DEFAULT '';



  DECLARE usr TINYTEXT DEFAULT '';

  DECLARE hst TINYTEXT DEFAULT '';

  DECLARE pos TINYINT;



  SELECT USER() INTO usrstr;



  SELECT INSTR(usrstr, '@') INTO pos;





  SELECT Left(usrstr, pos - 1), Right(usrstr, Length(usrstr) - pos) INTO usr, hst;



  RETURN (

    SELECT COUNT(*) > 0

    FROM mysql.`user` u

    WHERE u.`User` = usr AND u.Host = hst AND Super_priv = 'Y'

  );

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `BMCTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `BMCTransferBuffer`(IN DatagpsIsUpdated INT, IN Datagps64IsUpdated INT)
    COMMENT 'Обновление online* для BMC'
BEGIN
	DECLARE MobitelID INT;
	DECLARE done INT DEFAULT FALSE;
	DECLARE CursorMobitels CURSOR FOR SELECT Mobitel_ID FROM datagpsbuffer_bmc WHERE `Online`=1;
	DECLARE CursorMobitels64 CURSOR FOR SELECT Mobitel_ID FROM datagpsbuffer_bmc64 WHERE `Online`=1;
	DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
    
	/* datagps */
	IF DatagpsIsUpdated THEN
		OPEN CursorMobitels;
		read_loop: LOOP
			FETCH CursorMobitels INTO MobitelID;
			IF done THEN
				LEAVE read_loop;
			END IF;
			DELETE FROM `online` WHERE Mobitel_ID=MobitelID AND UnixTime <= (SELECT COALESCE(UnixTime, 0) FROM (SELECT UnixTime FROM `online` WHERE Mobitel_ID=MobitelID ORDER BY UnixTime DESC LIMIT 100, 1) o);
		END LOOP;
		CLOSE CursorMobitels;
		UPDATE mobitels m,datagpsbuffer_bmc b SET m.LastInsertTime=b.UnixTime WHERE m.Mobitel_ID=b.Mobitel_ID AND m.LastInsertTime<b.UnixTime;
	END IF;
	/* datagps64 */
	IF Datagps64IsUpdated THEN
		OPEN CursorMobitels64;
		read_loop: LOOP
			FETCH CursorMobitels64 INTO MobitelID;
			IF done THEN
				LEAVE read_loop;
			END IF;
			DELETE FROM `online64` WHERE Mobitel_ID=MobitelID AND UnixTime <= (SELECT COALESCE(UnixTime, 0) FROM (SELECT UnixTime FROM `online64` WHERE Mobitel_ID=MobitelID ORDER BY UnixTime DESC LIMIT 100, 1) o);
		END LOOP;
		CLOSE CursorMobitels64;
		UPDATE mobitels m,datagpsbuffer_bmc64 b SET m.LastInsertTime=b.UnixTime WHERE m.Mobitel_ID=b.Mobitel_ID AND m.LastInsertTime<b.UnixTime;
	END IF;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckDB` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckDB`()
    SQL SECURITY INVOKER
    COMMENT 'Проверка БД при подключении.'
BEGIN



  SELECT 'OK';


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CheckOdo` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CheckOdo`(IN m_id INTEGER(11), IN end_time DATETIME)
    SQL SECURITY INVOKER
BEGIN

  SELECT 

   FROM_UNIXTIME(datagps.UnixTime) AS `time` ,

   (datagps.Latitude / 600000.00000) AS Lat,

   (datagps.Longitude / 600000.00000) AS Lon

  FROM

    datagps

  WHERE

    datagps.Mobitel_ID = m_id AND 

    datagps.UnixTime BETWEEN (SELECT UNIX_TIMESTAMP(odoTime)  FROM vehicle WHERE Mobitel_id = m_id) AND 

    UNIX_TIMESTAMP(end_time) AND 

    Valid = 1;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `CleaningDataGpsLostOn` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `CleaningDataGpsLostOn`()
    SQL SECURITY INVOKER
    COMMENT 'Сия процедура удаляет не корректно оформленные диапазоны пропусков из таблицы datagpslost_on'
BEGIN

  /* удаляем записи у которых BeginSrvPacketId >= EndSrvPacketId */

  DELETE d FROM datagpslost_on d WHERE d.Begin_SrvPacketID >= d.End_SrvPacketID;

  /* удаляем записи у которых EndLogId - BeginLogId <= 1 */

  DELETE d FROM datagpslost_on d WHERE d.End_LogID - d.Begin_LogID <= 1;

  /* удаляем записи которые с заданным LogId и SrvPackId отсутвут в таблице datagps или datagps64 (фантомные записи) */



  CREATE TEMPORARY TABLE MobiTemp (Id bigint(20) UNSIGNED DEFAULT 0)ENGINE = INNODB

    CHARACTER SET cp1251

    COLLATE cp1251_general_ci

    COMMENT = 'Промежуточная временная таблица';



  INSERT INTO MobiTemp SELECT d.Id FROM datagpslost_on d WHERE 

  NOT EXISTS(SELECT NULL FROM datagps d1 WHERE (d.Mobitel_ID = d1.Mobitel_ID) AND ((d.Begin_LogID = d1.LogID) AND (d.Begin_SrvPacketID = d1.SrvPacketID))) AND 

  NOT EXISTS(SELECT NULL FROM datagps64 d2 WHERE (d.Mobitel_ID = d2.Mobitel_ID) AND ((d.Begin_LogID = d2.LogID) AND (d.Begin_SrvPacketID = d2.SrvPacketID))); 

  DELETE d FROM datagpslost_on d, MobiTemp m WHERE m.Id = d.Id;



  TRUNCATE MobiTemp;



  INSERT INTO MobiTemp SELECT d.Id FROM datagpslost_on d WHERE 

  NOT EXISTS(SELECT NULL FROM datagps d1 WHERE (d.Mobitel_ID = d1.Mobitel_ID) AND ((d.End_LogID = d1.LogID) AND (d.End_SrvPacketID = d1.SrvPacketID))) AND 

  NOT EXISTS(SELECT NULL FROM datagps64 d2 WHERE (d.Mobitel_ID = d2.Mobitel_ID) AND ((d.End_LogID = d2.LogID) AND (d.End_SrvPacketID = d2.SrvPacketID))); 

  DELETE d FROM datagpslost_on d, MobiTemp m WHERE m.Id = d.Id;



  DROP TEMPORARY TABLE MobiTemp;



  SELECT 1;

  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `dataview` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `dataview`(

  IN m_id INTEGER(11), 

  IN val BOOL, 

  IN begin_time DATETIME, 

  IN end_time DATETIME)
    SQL SECURITY INVOKER
BEGIN

  SELECT DataGps_ID AS DataGps_ID,

    Mobitel_ID AS Mobitel_ID,

    ((Latitude * 1.0000) / 600000) AS Lat,

    ((Longitude * 1.0000) / 600000) AS Lon,

    Altitude AS Altitude,

    FROM_UNIXTIME(UnixTime) AS `time`,

    (Speed * 1.852) AS speed,

    ((Direction * 360) / 255) AS direction,

    Valid AS Valid,

    (Sensor8 + (Sensor7 << 8) + (Sensor6 << 16) + 

      (Sensor5 << 24) + (Sensor4 << 32) + (Sensor3 << 40) + 

      (Sensor2 << 48) + (Sensor1 << 56)) AS sensor,

    Events AS Events,

    LogID AS LogID 

  FROM datagps 

  WHERE Mobitel_ID = m_id AND  

    (UnixTime BETWEEN UNIX_TIMESTAMP(begin_time) AND UNIX_TIMESTAMP(end_time)) AND                                                                                                                                

    (Valid = val) AND NOT (Latitude = 0 AND Longitude =0)

  ORDER BY UnixTime;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `delDupSrvPacket` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `delDupSrvPacket`()
    SQL SECURITY INVOKER
    COMMENT 'Удаляет дубликаты SrvPacketID из таблицы datagpsbuffer_on64'
BEGIN

DROP TEMPORARY TABLE IF EXISTS tmp64;




CREATE TEMPORARY TABLE tmp64 SELECT Mobitel_ID,

  Latitude,

  Longitude,

  Direction,

  Acceleration,

  UnixTime,

  Speed,

  Valid,

  Satellites,

  RssiGsm,

  `Events`,

  SensorsSet,

  Sensors,

  Voltage,

  DGPS,

  LogID,

  SrvPacketID

FROM datagpsbuffer_on64 d

GROUP BY d.SrvPacketID;



  TRUNCATE TABLE datagpsbuffer_on64;



  INSERT INTO datagpsbuffer_on64 SELECT Mobitel_ID,

  Latitude,

  Longitude,

  Direction,

  Acceleration,

  UnixTime,

  Speed,

  Valid,

  Satellites,

  RssiGsm,

  `Events`,

  SensorsSet,

  Sensors,

  Voltage,

  DGPS,

  LogID,

  SrvPacketID

FROM tmp64 d;



DROP TEMPORARY TABLE IF EXISTS tmp64;


END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DrListMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DrListMobitelConfig`()
    SQL SECURITY INVOKER
    COMMENT 'Выборка настроек телетреков в режиме DirectOnline'
BEGIN

  SELECT m.Mobitel_id AS MobitelID, 

    imc.DevIdShort AS DevIdShort,

    cge.Pop3un AS Login, 

    cge.Pop3pw AS Password

  FROM Mobitels m JOIN ConfigMain cm ON m.Mobitel_id = cm.Mobitel_ID

    JOIN ConfigGprsEmail cge ON cm.ConfigGprsEmail_ID = cge.ID

    JOIN internalmobitelconfig imc ON m.InternalMobitelConfig_ID = imc.ID 

  WHERE (cge.ConfigGprsEmail_ID = (

      SELECT MAX(intCge.ConfigGprsEmail_ID)

      FROM ConfigGprsEmail intCge

      WHERE intCge.ID = cge.ID)) AND

    (imc.InternalMobitelConfig_ID = (

      SELECT MAX(intConf.InternalMobitelConfig_ID)

      FROM internalmobitelconfig intConf

      WHERE intConf.ID = imc.ID)) AND 

    (imc.devIdShort IS NOT NULL) AND (imc.devIdShort <> _cp1251 '')	AND 

    (cge.Pop3un IS NOT NULL) AND (cge.Pop3un <> _cp1251 '') 

  ORDER BY m.Mobitel_ID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `DrTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `DrTransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные DirectOnline из буферной таблицы в datagps'
BEGIN

  DECLARE MobitelIDInCursor INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  

  DECLARE TmpMaxUnixTime INT; 



  DECLARE CursorMobitels CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer_dr;



  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;





    

  

  

  DELETE o

  FROM online o, datagpsbuffer_dr dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);

  

  SET DataExists = 1;

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    

    SELECT COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online FORCE INDEX (IDX_Mobitelid)

    WHERE Mobitel_ID = MobitelIDInCursor;



    

    INSERT INTO online (

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs)

    SELECT

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs

    FROM (

      SELECT *

      FROM datagpsbuffer_dr

      WHERE (Mobitel_ID = MobitelIDInCursor)  AND 

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

      GROUP BY Mobitel_ID, LogID

      ORDER BY UnixTime DESC

      LIMIT 100) AS T

    ORDER BY UnixTime ASC;



    

    DELETE FROM online

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < 

      (SELECT COALESCE(MIN(UnixTime), 0) 

       FROM (

         SELECT UnixTime

         FROM online

         WHERE Mobitel_ID = MobitelIDInCursor 

         ORDER BY UnixTime DESC

         LIMIT 100) T1)); 

  

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;

   





  

  UPDATE datagps d, datagpsbuffer_dr b SET

    d.Latitude = b.Latitude,

    d.Longitude = b.Longitude,

    d.Altitude = b.Altitude,

    d.UnixTime = b.UnixTime,

    d.Speed = b.Speed,

    d.Direction = b.Direction,

    d.Valid = b.Valid,

    d.InMobitelID = b.LogID,

    d.`Events` = b.`Events`,

    d.Sensor1 = b.Sensor1,

    d.Sensor2 = b.Sensor2,

    d.Sensor3 = b.Sensor3,

    d.Sensor4 = b.Sensor4,

    d.Sensor5 = b.Sensor5,

    d.Sensor6 = b.Sensor6,

    d.Sensor7 = b.Sensor7,

    d.Sensor8 = b.Sensor8,

    d.whatIs = b.whatIs,

    d.Counter1 = b.Counter1,

    d.Counter2 = b.Counter2,

    d.Counter3 = b.Counter3,

    d.Counter4 = b.Counter4

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  DELETE b

  FROM datagps d, datagpsbuffer_dr b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  INSERT INTO datagps (

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, InMobitelID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs)

  SELECT

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, LogID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs

  FROM datagpsbuffer_dr

  GROUP BY Mobitel_ID, LogID;



  

  TRUNCATE TABLE datagpsbuffer_dr;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `ExecuteQuery` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `ExecuteQuery`(IN sqlQuery TINYTEXT)
    SQL SECURITY INVOKER
BEGIN

  SET @s = sqlQuery;

  PREPARE stmt FROM @s;

  EXECUTE stmt;

  DEALLOCATE PREPARE stmt;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `getDiapasone` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `getDiapasone`(

  IN mobile INTEGER(11),  

  IN prevLogId int, 

  IN currLogId int)
    SQL SECURITY INVOKER
BEGIN

  SELECT DataGps_ID AS DataGps_ID,

    Mobitel_ID AS Mobitel_ID,

    ((Latitude * 1.0000) / 600000) AS Lat,

    ((Longitude * 1.0000) / 600000) AS Lon,

    Altitude AS Altitude,

    FROM_UNIXTIME(UnixTime) AS `time`,

    (Speed * 1.852) AS speed,

    ((Direction * 360) / 255) AS direction,

    Valid AS Valid,

    (Sensor8 + (Sensor7 << 8) + (Sensor6 << 16) + 

      (Sensor5 << 24) + (Sensor4 << 32) + (Sensor3 << 40) + 

      (Sensor2 << 48) + (Sensor1 << 56)) AS sensor,

    Events AS Events,

    LogID AS LogID, 

    SrvPacketID AS srvPack

  FROM datagps 

  WHERE Mobitel_ID = mobile AND  Valid = 1 AND  

    (LogID BETWEEN prevLogId AND currLogId) ORDER BY UnixTime;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `getDiapasone64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `getDiapasone64`(

  IN mobile INTEGER(11),  

  IN prevLogId int, 

  IN currLogId int)
    SQL SECURITY INVOKER
BEGIN

  SELECT  DataGps_ID, Mobitel_ID,

    ((Latitude * 1.000) / 10000000) AS Lat,

    ((Longitude * 1.000) / 10000000) AS Lng,

    Acceleration , 

    FROM_UNIXTIME(UnixTime) AS `time` , 

    Speed /10 AS Speed, 

    Valid,

    Sensors AS sensor, 

  `Events`, 

  LogID ,

  Voltage,

  DGPS,

  Direction,

  Satellites,

  SensorsSet,

  RssiGsm,

  SrvPacketID AS srvPack FROM datagps64 d WHERE Mobitel_ID = mobile AND d.Valid = 1 AND  

    (LogID BETWEEN prevLogId AND currLogId) ORDER BY UnixTime;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `hystoryOnline` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `hystoryOnline`(IN id INTEGER(11))
    SQL SECURITY INVOKER
BEGIN

  SELECT LogID, Mobitel_Id, 

    FROM_UNIXTIME(unixtime)  AS `time`,

    ROUND((Latitude / 600000.00000), 6) AS Lat,

    ROUND((Longitude / 600000.00000), 6)  AS Lon,

    Altitude  AS Altitude,

    (Speed * 1.852) AS speed,

    ((Direction * 360) / 255) AS direction,

    Valid AS Valid,

    (Sensor8 + (Sensor7 << 8) + (Sensor6 << 16) + 

      (Sensor5 << 24) + (Sensor4 << 32) + (Sensor3 << 40) + 

      (Sensor2 << 48) + (Sensor1 << 56)) AS sensor,

    Events AS Events,

    DataGPS_ID  AS 'DataGPS_ID'

  FROM online

  WHERE  datagps_id > id

  ORDER BY datagps_id DESC;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `IsTeletrackDatabase` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `IsTeletrackDatabase`()
    SQL SECURITY INVOKER
    COMMENT 'Проверка базы данных на соответствие структуре системы Teletrack'
BEGIN

  DECLARE i TINYINT;



END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `new_proc` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `new_proc`(IN sensor INTEGER(11), IN m_id INTEGER(11), IN s_id INTEGER(11), IN begin_time DATETIME, IN end_time DATETIME)
    READS SQL DATA
    SQL SECURITY INVOKER
BEGIN                                                                                                                                      
select                                                                                                                                     
    round((`datagps`.`Longitude` / 600000),6) AS `lon`,                                                                                    
    round((`datagps`.`Latitude` / 600000),6) AS `lat`,                                                                                     
    `datagps`.`Mobitel_ID` AS `Mobitel_ID`,                                                                                                
    `sensordata`.`Value` AS `Value`,                                                                                                       
    (`datagps`.`Speed` * 1.852) AS `speed`,                                                                                                
    from_unixtime(`datagps`.`UnixTime`) AS `time`,                                                                                         
    `sensordata`.`sensor_id` AS `sensor_id`,                                                                                               
    `datagps`.`DataGps_ID` AS `datagps_id`,                                                                                                
    `datagps`.`Sensor1`&`sensor` AS `sensor`                                                                                              
  from                                                                                                                                     
    (`sensordata` join `datagps` on((`sensordata`.`datagps_id` = `datagps`.`DataGps_ID`)))                                                 
  where                                                                                                                                    
    (`datagps`.`Valid` = 1) and                                                                                                            
    ( datagps.UnixTime BETWEEN UNIX_TIMESTAMP(begin_time) and UNIX_TIMESTAMP(end_time))                                                    
    and datagps.Mobitel_ID = m_id AND sensordata.sensor_id = s_id                                                                          
  order by                                                                                                                                 
    `datagps`.`UnixTime`,`datagps`.`Mobitel_ID`,`sensordata`.`sensor_id`;                                                                  
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnCorrectInfotrackLogId` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnCorrectInfotrackLogId`()
    SQL SECURITY INVOKER
    COMMENT 'Корректировка значений LogId и InMobitelID в данных инфотреков'
BEGIN

  DECLARE MobitelIDInCursor INT; /* Текущее значение MobitelID */

  DECLARE DataExists TINYINT DEFAULT 1; /* Флаг наличия данных после фетча */

  DECLARE MaxLogId INT DEFAULT 0; /* Максимальный LogId для данного дивайса */

  DECLARE SrvPacketIDInCursor BIGINT DEFAULT 0; /* Текущее значение серверного пакета */

    

  /* Курсор по инфотрекам в множестве новых данных. 

     Все инфотреки начинаются с буквы I */

  DECLARE CursorInfoTrack CURSOR FOR

    SELECT DISTINCT buf.Mobitel_ID

    FROM datagpsbuffer_on buf 

      JOIN mobitels m ON (buf.mobitel_id = m.mobitel_id)

      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)

    WHERE (c.InternalMobitelConfig_ID = (

      SELECT intConf.InternalMobitelConfig_ID

      FROM internalmobitelconfig intConf

      WHERE (intConf.ID = c.ID) 

      ORDER BY intConf.InternalMobitelConfig_ID DESC

      LIMIT 1)) AND 

      (c.devIdShort LIKE "I%") AND (buf.LogId = 0)

    ORDER BY 1;

    

  /* Курсор по данным телетрека */

  DECLARE CursorInfoTrackUpdateSet CURSOR FOR

    SELECT SrvPacketID 

    FROM datagpsbuffer_on

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (LogId = 0)

    ORDER BY UnixTime;  



  /* Обработчик отсутствующей записи при FETCH следующей записи */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

  OPEN CursorInfoTrack;

  FETCH CursorInfoTrack INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* Находим максимальный LogId для данного инфотрека */

    SELECT COALESCE(MAX(LogID), 0) INTO	MaxLogId

    FROM DataGps

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* Обновляем LogId и InMobitelID в наборе новых данных текущего инфотрека */

    OPEN CursorInfoTrackUpdateSet;

    FETCH CursorInfoTrackUpdateSet INTO SrvPacketIDInCursor;

    WHILE DataExists = 1 DO

      SET MaxLogId = MaxLogId + 1;



      UPDATE datagpsbuffer_on

      SET LogId = MaxLogId, InMobitelID = MaxLogId

      WHERE SrvPacketID = SrvPacketIDInCursor;



      FETCH CursorInfoTrackUpdateSet INTO SrvPacketIDInCursor;

    END WHILE;

    CLOSE CursorInfoTrackUpdateSet;

 

    SET DataExists = 1;

    FETCH CursorInfoTrack INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorInfoTrack;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnCorrectInfotrackLogId64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnCorrectInfotrackLogId64`()
    SQL SECURITY INVOKER
    COMMENT 'РљРѕСЂСЂРµРєС‚РёСЂРѕРІРєР° Р·РЅР°С‡РµРЅРёР№ LogId Рё InMobitelID РІ РґР°РЅРЅС‹С… РёРЅС„РѕС‚СЂРµРєРѕРІ'
BEGIN

  DECLARE MobitelIDInCursor int; /* РўРµРєСѓС‰РµРµ Р·РЅР°С‡РµРЅРёРµ MobitelID */

  DECLARE DataExists tinyint DEFAULT 1; /* Р¤Р»Р°Рі РЅР°Р»РёС‡РёСЏ РґР°РЅРЅС‹С… РїРѕСЃР»Рµ С„РµС‚С‡Р° */

  DECLARE MaxLogId int DEFAULT 0; /* РњР°РєСЃРёРјР°Р»СЊРЅС‹Р№ LogId РґР»СЏ РґР°РЅРЅРѕРіРѕ РґРёРІР°Р№СЃР° */

  DECLARE SrvPacketIDInCursor bigint DEFAULT 0; /* РўРµРєСѓС‰РµРµ Р·РЅР°С‡РµРЅРёРµ СЃРµСЂРІРµСЂРЅРѕРіРѕ РїР°РєРµС‚Р° */



  /* РљСѓСЂСЃРѕСЂ РїРѕ РёРЅС„РѕС‚СЂРµРєР°Рј РІ РјРЅРѕР¶РµСЃС‚РІРµ РЅРѕРІС‹С… РґР°РЅРЅС‹С…. 

     Р’СЃРµ РёРЅС„РѕС‚СЂРµРєРё РЅР°С‡РёРЅР°СЋС‚СЃСЏ СЃ Р±СѓРєРІС‹ I */

  DECLARE CursorInfoTrack CURSOR FOR

  SELECT DISTINCT

    buf.Mobitel_ID

  FROM datagpsbuffer_on64 buf

    JOIN mobitels m

      ON (buf.mobitel_id = m.mobitel_id)

    JOIN internalmobitelconfig c

      ON (c.ID = m.InternalMobitelConfig_ID)

  WHERE (c.InternalMobitelConfig_ID = (SELECT

      intConf.InternalMobitelConfig_ID

    FROM internalmobitelconfig intConf

    WHERE (intConf.ID = c.ID)

    ORDER BY intConf.InternalMobitelConfig_ID DESC

    LIMIT 1)) AND

  (c.devIdShort LIKE "I%") AND (buf.LogId = 0)

  ORDER BY 1;



  /* РљСѓСЂСЃРѕСЂ РїРѕ РґР°РЅРЅС‹Рј С‚РµР»РµС‚СЂРµРєР° */

  DECLARE CursorInfoTrackUpdateSet CURSOR FOR

  SELECT

    SrvPacketID

  FROM datagpsbuffer_on64

  WHERE (Mobitel_ID = MobitelIDInCursor) AND (LogId = 0)

  ORDER BY UnixTime;



  /* РћР±СЂР°Р±РѕС‚С‡РёРє РѕС‚СЃСѓС‚СЃС‚РІСѓСЋС‰РµР№ Р·Р°РїРёСЃРё РїСЂРё FETCH СЃР»РµРґСѓСЋС‰РµР№ Р·Р°РїРёСЃРё */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  OPEN CursorInfoTrack;

  FETCH CursorInfoTrack INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* РќР°С…РѕРґРёРј РјР°РєСЃРёРјР°Р»СЊРЅС‹Р№ LogId РґР»СЏ РґР°РЅРЅРѕРіРѕ РёРЅС„РѕС‚СЂРµРєР° */

    SELECT

      COALESCE(MAX(LogID), 0) INTO MaxLogId

    FROM DataGps

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* РћР±РЅРѕРІР»СЏРµРј LogId Рё InMobitelID РІ РЅР°Р±РѕСЂРµ РЅРѕРІС‹С… РґР°РЅРЅС‹С… С‚РµРєСѓС‰РµРіРѕ РёРЅС„РѕС‚СЂРµРєР° */

    OPEN CursorInfoTrackUpdateSet;

    FETCH CursorInfoTrackUpdateSet INTO SrvPacketIDInCursor;

    WHILE DataExists = 1 DO

      SET MaxLogId = MaxLogId + 1;



      UPDATE datagpsbuffer_on64

      SET LogId = MaxLogId,

          InMobitelID = MaxLogId

      WHERE SrvPacketID = SrvPacketIDInCursor;



      FETCH CursorInfoTrackUpdateSet INTO SrvPacketIDInCursor;

    END WHILE;

    CLOSE CursorInfoTrackUpdateSet;



    SET DataExists = 1;

    FETCH CursorInfoTrack INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorInfoTrack;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnDeleteDuplicates` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnDeleteDuplicates`()
    SQL SECURITY INVOKER
    COMMENT 'Удаление повторяющихся строк из datagpsbuffer_on'
BEGIN

  /* Удаляет дубликаты строк из таблицы datagpsbuffer_on. Критерием поиска

   являются одинаковые значения в полях Mobitel_Id + LogID. Из множества

   повторяющихся записей в таблице datagpsbuffer_on останется только одна - 

   последняя принятая телематическим сервером, т.е. с максимальным SrvPacketID. */

   

  /* Текущий MobitelId в курсоре CursorDuplicateGroups */

  DECLARE MobitelIdInCursor INT DEFAULT 0; 

  /* Текущий LogID в курсоре CursorDuplicateGroups */

  DECLARE LogIdInCursor INT DEFAULT 0; 

  /* Max SrvPacketId в множестве строк текущей группы дубликатов */

  DECLARE MaxSrvPacketId BIGINT DEFAULT 0; 

  DECLARE DataExists TINYINT DEFAULT 1;



  /* Курсор для прохода по всем группам дубликатов */  

  DECLARE CursorDuplicateGroups CURSOR FOR

    SELECT Mobitel_Id, LogId 

    FROM datagpsbuffer_on

    GROUP BY Mobitel_Id, LogId 

    HAVING COUNT(LogId) > 1;

    

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  SET DataExists = 1;

  OPEN CursorDuplicateGroups;

  FETCH CursorDuplicateGroups INTO MobitelIdInCursor, LogIdInCursor;

  WHILE DataExists = 1 DO

    SELECT MAX(SrvPacketID) INTO MaxSrvPacketId

    FROM datagpsbuffer_on 

    WHERE (Mobitel_ID = MobitelIdInCursor) AND (LogId = LogIdInCursor);

         

    DELETE FROM datagpsbuffer_on  

    WHERE (Mobitel_ID = MobitelIdInCursor) AND (LogId = LogIdInCursor) 

      AND (SrvPacketID < MaxSrvPacketId);

        

    FETCH CursorDuplicateGroups INTO MobitelIdInCursor, LogIdInCursor;

  END WHILE;

  CLOSE CursorDuplicateGroups; 

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnDeleteDuplicates64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnDeleteDuplicates64`()
    SQL SECURITY INVOKER
    COMMENT 'РЈРґР°Р»РµРЅРёРµ РїРѕРІС‚РѕСЂСЏСЋС‰РёС…СЃСЏ СЃС‚СЂРѕРє РёР· datagpsbuffer_on64'
BEGIN

  /* РЈРґР°Р»СЏРµС‚ РґСѓР±Р»РёРєР°С‚С‹ СЃС‚СЂРѕРє РёР· С‚Р°Р±Р»РёС†С‹ datagpsbuffer_on64. РљСЂРёС‚РµСЂРёРµРј РїРѕРёСЃРєР°

   СЏРІР»СЏСЋС‚СЃСЏ РѕРґРёРЅР°РєРѕРІС‹Рµ Р·РЅР°С‡РµРЅРёСЏ РІ РїРѕР»СЏС… Mobitel_Id + LogID. РР· РјРЅРѕР¶РµСЃС‚РІР°

   РїРѕРІС‚РѕСЂСЏСЋС‰РёС…СЃСЏ Р·Р°РїРёСЃРµР№ РІ С‚Р°Р±Р»РёС†Рµ datagpsbuffer_on64 РѕСЃС‚Р°РЅРµС‚СЃСЏ С‚РѕР»СЊРєРѕ РѕРґРЅР° - 

   РїРѕСЃР»РµРґРЅСЏСЏ РїСЂРёРЅСЏС‚Р°СЏ С‚РµР»РµРјР°С‚РёС‡РµСЃРєРёРј СЃРµСЂРІРµСЂРѕРј, С‚.Рµ. СЃ РјР°РєСЃРёРјР°Р»СЊРЅС‹Рј SrvPacketID. */



  /* РўРµРєСѓС‰РёР№ MobitelId РІ РєСѓСЂСЃРѕСЂРµ CursorDuplicateGroups */

  DECLARE MobitelIdInCursor int DEFAULT 0;

  /* РўРµРєСѓС‰РёР№ LogID РІ РєСѓСЂСЃРѕСЂРµ CursorDuplicateGroups */

  DECLARE LogIdInCursor int DEFAULT 0;

  /* Max SrvPacketId РІ РјРЅРѕР¶РµСЃС‚РІРµ СЃС‚СЂРѕРє С‚РµРєСѓС‰РµР№ РіСЂСѓРїРїС‹ РґСѓР±Р»РёРєР°С‚РѕРІ */

  DECLARE MaxSrvPacketId bigint DEFAULT 0;

  DECLARE DataExists tinyint DEFAULT 1;



  /* РљСѓСЂСЃРѕСЂ РґР»СЏ РїСЂРѕС…РѕРґР° РїРѕ РІСЃРµРј РіСЂСѓРїРїР°Рј РґСѓР±Р»РёРєР°С‚РѕРІ */

  DECLARE CursorDuplicateGroups CURSOR FOR

  SELECT

    Mobitel_Id,

    LogId

  FROM datagpsbuffer_on64

  GROUP BY Mobitel_Id,

           LogId

  HAVING COUNT(LogId) > 1;



  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  SET DataExists = 1;

  OPEN CursorDuplicateGroups;

  FETCH CursorDuplicateGroups INTO MobitelIdInCursor, LogIdInCursor;

  WHILE DataExists = 1 DO

    SELECT

      MAX(SrvPacketID) INTO MaxSrvPacketId

    FROM datagpsbuffer_on64

    WHERE (Mobitel_ID = MobitelIdInCursor) AND (LogId = LogIdInCursor);



    DELETE

      FROM datagpsbuffer_on64

    WHERE (Mobitel_ID = MobitelIdInCursor) AND (LogId = LogIdInCursor)

      AND (SrvPacketID < MaxSrvPacketId);



    FETCH CursorDuplicateGroups INTO MobitelIdInCursor, LogIdInCursor;

  END WHILE;

  CLOSE CursorDuplicateGroups;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnDeleteLostRange` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnDeleteLostRange`(IN MobitelID INTEGER(11), IN BeginSrvPacketID BIGINT)
    SQL SECURITY INVOKER
    COMMENT 'Удаление указанного диапазона пропусков из datagpslost_on.'
BEGIN

  /* Определяем является ли запись, предназначенная для удаления,

     первой в списке заданного телетрека. Если является - тогда

     внесем поправку в значение ConfirmedID */  

     

  DECLARE MinBeginSrvPacketID BIGINT; -- Минимальное значение Begin_SrvPacketID для данного телетрека

  DECLARE NewConfirmedID INT; -- Новое значение ConfirmedID  



  /* Нахождение минимального значения Begin_SrvPacketID */  

  SELECT MIN(Begin_SrvPacketID) INTO MinBeginSrvPacketID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;

  

  /* Если есть данные о пропусках у телетрека - продолжим */

  IF MinBeginSrvPacketID IS NOT NULL THEN

    /* Если удаляем первую запись - запомним новое значение ConfirmedID */

    IF MinBeginSrvPacketID = BeginSrvPacketID  THEN

      SELECT End_LogID INTO NewConfirmedID

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_SrvPacketID = BeginSrvPacketID);

    END IF;

  

    /* Удаление записи */

    DELETE FROM  datagpslost_on

    WHERE (Mobitel_ID = MobitelID) AND (Begin_SrvPacketID = BeginSrvPacketID);

    

    /* Если удалили первую запись - обновим ConfirmedID */  

    IF MinBeginSrvPacketID = BeginSrvPacketID  THEN

      UPDATE mobitels

      SET ConfirmedID = NewConfirmedID

      WHERE (Mobitel_ID = MobitelID) AND (NewConfirmedID > ConfirmedID);

    END IF;

  END IF;  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnInsertDatagpsLost` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnInsertDatagpsLost`(

  IN MobitelID INT, 

  IN BeginLogID INT, 

  IN EndLogID INT,

  IN BeginSrvPacketID BIGINT, 

  IN EndSrvPacketID BIGINT)
    SQL SECURITY INVOKER
    COMMENT 'Вставка данных в таблицу datagpslost_on.'
BEGIN

  /* Флаг существования записи с заданными Mobitel_ID и Begin_LogID

     в таблице datagpslost_on */

  DECLARE MobitelId_BeginLogID_Exists TINYINT DEFAULT 0; 

  /* Флаг существования записи с заданными Mobitel_ID и Begin_SrvPacketID

     в таблице datagpslost_on  */

  DECLARE MobitelId_BeginSrvPacketID_Exists TINYINT DEFAULT 0;

  

  DECLARE RowBeginSrvPacketID BIGINT; 

  

  IF EXISTS(

    SELECT NULL

    FROM datagpslost_on

    WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID))

  THEN

    SET MobitelId_BeginLogID_Exists = 1;

  END IF;



  IF EXISTS(

    SELECT NULL

    FROM datagpslost_on

    WHERE (Mobitel_ID = MobitelID) AND (Begin_SrvPacketID = BeginSrvPacketID))

  THEN

    SET MobitelId_BeginSrvPacketID_Exists = 1;

  END IF;



  IF (MobitelId_BeginLogID_Exists = 0) AND (MobitelId_BeginSrvPacketID_Exists = 0)

  THEN

    /* Вставка новой записи */

    INSERT INTO datagpslost_on(Mobitel_ID, Begin_LogID, End_LogID, Begin_SrvPacketID, End_SrvPacketID)

    VALUES (MobitelID, BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID);

  ELSE

    IF ((MobitelId_BeginLogID_Exists = 1) AND (MobitelId_BeginSrvPacketID_Exists = 1))

    THEN

      /* Обновление существующей записи */

      UPDATE datagpslost_on

      SET End_LogID = EndLogID, End_SrvPacketID = EndSrvPacketID

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID);

    ELSE

      /* Комбинацию MobitelId_BeginLogID_Exists = 0, MobitelId_BeginSrvPacketID_Exists = 1

         игнорируем - это исключительная ситуация, которая не должна возникать. */

      SELECT Begin_SrvPacketID

      INTO RowBeginSrvPacketID

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID)

      LIMIT 1;

      

      IF ((MobitelId_BeginLogID_Exists = 1) AND (MobitelId_BeginSrvPacketID_Exists = 0) AND

        (BeginSrvPacketID < RowBeginSrvPacketID))

      THEN

        /* В эту ветвь попадаем, если телетрек отдаст одну и ту же запись несколько раз 

           (LogID у записей один и тотже, а SrvPacketID различны) */

        UPDATE datagpslost_on

        SET End_LogID = EndLogID, Begin_SrvPacketID = BeginSrvPacketID, End_SrvPacketID = EndSrvPacketID

        WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID);

      END IF;

    END IF;

  END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `online` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `online`()
    SQL SECURITY INVOKER
BEGIN

  SELECT Log_ID, MobitelId, 

    (SELECT DataGPS_ID

    FROM `online` 

    WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS 'DataGPS_ID',

      (SELECT from_unixtime(unixtime) 

      FROM `online` 

      WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS 'time',

        (SELECT ROUND((`Latitude` / 600000.00000),6)

        FROM `online` 

        WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Lat`,

          (SELECT ROUND((`Longitude` / 600000.00000),6) 

          FROM `online` 

          WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Lon`,

            (SELECT `Altitude` 

            FROM `online` 

            WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Altitude`,

              (SELECT (`Speed` * 1.852)

              FROM `online` 

              WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `speed`,

                (SELECT ((`Direction` * 360) / 255)

                FROM `online` 

                WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `direction`,

                  (SELECT `Valid`

                  FROM `online` 

                  WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Valid`,

                    (SELECT (((((((`Sensor8` + 

                    (`Sensor7` << 8)) + 

                    (`Sensor6` << 16)) + 

                    (`Sensor5` << 24)) + 

                    (`Sensor4` << 32)) + 

                    (`Sensor3` << 40)) + 

                    (`Sensor2` << 48)) + 

                    (`Sensor1` << 56)) 

                    FROM `online` 

                    WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `sensor`,

                      (SELECT `Events`

                      FROM `online` 

                      WHERE mobitel_id = MobitelId AND LogId = Log_ID Limit 1) AS `Events`

   

  FROM (SELECT MAX(`LogID`) AS `Log_ID`, mobitel_id AS MobitelId

        FROM `online` 

        GROUP BY `Mobitel_ID`) T1;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnListMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnListMobitelConfig`()
    SQL SECURITY INVOKER
    COMMENT 'Выборка настроек телетреков которые могут работать в online режиме'
BEGIN

  DECLARE MobitelIDInCursor INT;

  DECLARE DevIdShortInCursor CHAR(4);

  DECLARE DataExists TINYINT DEFAULT 1;



  /* Курсор в множестве настроенных телетреков */

  DECLARE CursorMobitels CURSOR FOR

    SELECT m.Mobitel_ID AS MobitelID, c.devIdShort AS DevIdShort

    FROM mobitels m

      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)

    WHERE (c.InternalMobitelConfig_ID = (

      SELECT intConf.InternalMobitelConfig_ID

      FROM internalmobitelconfig intConf

      WHERE (intConf.ID = c.ID)

      ORDER BY intConf.InternalMobitelConfig_ID DESC

      LIMIT 1)) AND

      (c.devIdShort IS NOT NULL) AND (c.devIdShort <> _cp1251'')

    ORDER BY m.Mobitel_ID;



  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  /* Временная таблица настроек телетрека */

  CREATE TEMPORARY TABLE tmpMobitelsConfig (

    MobitelID INT NOT NULL,

    DevIdShort CHAR(4) NOT NULL,

    LastPacketID BIGINT NOT NULL) ENGINE = MEMORY;



  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor, DevIdShortInCursor;

  WHILE DataExists = 1 DO



    INSERT INTO tmpMobitelsConfig SELECT MobitelIDInCursor, DevIdShortInCursor,

      (SELECT COALESCE(MAX(SrvPacketID), 0)

       FROM datagps

       WHERE Mobitel_ID = MobitelIDInCursor) AS LastPacketID;



    FETCH CursorMobitels INTO MobitelIDInCursor, DevIdShortInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  SELECT MobitelID, DevIdShort, LastPacketID

  FROM tmpMobitelsConfig;



  DROP TEMPORARY TABLE tmpMobitelsConfig;  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnListMobitelConfig64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnListMobitelConfig64`()
    SQL SECURITY INVOKER
    COMMENT 'Выборка настроек телетреков которые могут работать в online режиме для datagps и datagps64'
BEGIN

  DECLARE MobitelIDInCursor INT;

  DECLARE Is64Cursor tinyint;

  DECLARE DevIdShortInCursor CHAR(4);

  DECLARE DataExists TINYINT DEFAULT 1;



  /* Курсор в множестве настроенных телетреков */

  DECLARE CursorMobitels CURSOR FOR

    SELECT m.Mobitel_ID AS MobitelID, m.Is64bitPackets AS Is64, c.devIdShort AS DevIdShort

    FROM mobitels m

      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)

    WHERE (c.InternalMobitelConfig_ID = (

      SELECT intConf.InternalMobitelConfig_ID

      FROM internalmobitelconfig intConf

      WHERE (intConf.ID = c.ID)

      ORDER BY intConf.InternalMobitelConfig_ID DESC

      LIMIT 1)) AND

      (c.devIdShort IS NOT NULL) AND (c.devIdShort <> _cp1251'')

    ORDER BY m.Mobitel_ID;



  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  /* Временная таблица настроек телетрека */

  CREATE TEMPORARY TABLE tmpMobitelsConfig (

    MobitelID INT NOT NULL,

    Is64 tinyint NOT NULL,

    DevIdShort CHAR(4) NOT NULL,

    LastPacketID BIGINT NOT NULL,

    LastPacketID64 BIGINT NOT NULL) ENGINE = MEMORY;



  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor, Is64Cursor, DevIdShortInCursor;

  WHILE DataExists = 1 DO



    INSERT INTO tmpMobitelsConfig SELECT MobitelIDInCursor, Is64Cursor, DevIdShortInCursor,

      (SELECT COALESCE(MAX(d.SrvPacketID), 0)

       FROM datagps d

       WHERE d.Mobitel_ID = MobitelIDInCursor) AS LastPacketID,

      (SELECT COALESCE(MAX(t.SrvPacketID), 0)

       FROM datagps64 t

       WHERE t.Mobitel_ID = MobitelIDInCursor) AS LastPacketID64;



    FETCH CursorMobitels INTO MobitelIDInCursor, Is64Cursor, DevIdShortInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  SELECT MobitelID, Is64, DevIdShort, LastPacketID, LastPacketID64

  FROM tmpMobitelsConfig;



  DROP TEMPORARY TABLE tmpMobitelsConfig;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnLostDataGPS` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnLostDataGPS`(IN MobitelID INTEGER(11), OUT NeedOptimize TINYINT)
    SQL SECURITY INVOKER
    COMMENT 'Поиск пропусков в online данных заданного телетрека и заполнение таблиц.'
BEGIN



  /********** DECLARE **********/

  

  DECLARE CurrentConfirmedID INT DEFAULT 0; /* Текущее значение ConfirmedID */

  DECLARE NewConfirmedID INT DEFAULT 0; /* Новое значение ConfirmedID */

  DECLARE StartLogIDSelect INT DEFAULT 0; /* min LogID для выборки */

  DECLARE FinishLogIDSelect INT DEFAULT 0; /* max LogID для выборки */

  DECLARE MaxEndLogID INT DEFAULT 0; /* max End_LogID в пропущенных диапазонах данного телетрека */

  

  DECLARE MinLogID_n INT DEFAULT 0; /* Минимальный LogID после ConfirmedID в множестве новых данных */

  DECLARE MaxLogID_n INT DEFAULT 0; /* Максимальный LogID в множестве новых данных */

  

  DECLARE DataExists TINYINT DEFAULT 1; /* Флаг наличия данных после фетча */

    

  DECLARE NewLogID INT; /* Значение LogID в курсоре CursorNewLogID */

  DECLARE NewSrvPacketID BIGINT; /* Значение SrvPacketID в курсоре CursorNewLogID */

  DECLARE FirstLogID INT DEFAULT -9999999; /* Первое значение LogID для анализа */

  DECLARE SecondLogID INT; /* Второе значение LogID для анализа */

  DECLARE FirstSrvPacketID BIGINT; /* Первое значение SrvPacketID */

  DECLARE SecondSrvPacketID BIGINT; /* Второе значение SrvPacketID */

  

  DECLARE tmpSrvPacketID BIGINT DEFAULT 0; /* Значение SrvPacketID для первой искусственной записи в анализе новых данных, не пересекающихся с существующими */  

  

  /* Курсор для прохода по новым LogID */

  DECLARE CursorNewLogID CURSOR FOR

    SELECT LogID, SrvPacketID 

    FROM datagpslost_ontmp;

    

  /* Обработчик отсутствующей записи при FETCH следующей записи */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

  /********** END DECLARE **********/



  SET NeedOptimize = 0;

 

  SELECT COALESCE(ConfirmedID, 0) INTO CurrentConfirmedID

  FROM mobitels

  WHERE Mobitel_ID = MobitelID;



  /* Минимальный LogID в новом наборе данных c которым будем работать */

  SELECT MIN(LogID) INTO MinLogID_n

  FROM datagpsbuffer_on

  WHERE (Mobitel_ID = MobitelID) AND (LogID > CurrentConfirmedID);

  

  /* Максимальный LogID в новом наборе данных c которым будем работать */

  SELECT MAX(LogID) INTO MaxLogID_n

  FROM datagpsbuffer_on 

  WHERE Mobitel_ID = MobitelID;  

  

  /* Максимальный End_LogID в пропущенных диапазонах данного телетрека */

  SELECT COALESCE(MAX(End_LogID), 0) INTO MaxEndLogID

  FROM datagpslost_on 

  WHERE Mobitel_ID = MobitelID;  

  

  /* Проверим есть ли данные для анализа */

  IF MinLogID_n IS NOT NULL THEN

  

    /********** PREPARE **********/

    

    TRUNCATE TABLE datagpslost_ontmp;

  

    IF MinLogID_n < MaxEndLogID THEN

      /* Если  MinLogID_n < MaxEndLogID значит пришли данные, 

       которые возможно закроют часть пропусков. */

       

      /* Находим стартовый LogID для пересчета. */

      SELECT COALESCE(Begin_LogID, MinLogID_n) INTO StartLogIDSelect

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (MinLogID_n > Begin_LogID) 

        AND (MinLogID_n < End_LogID);

      

      /* Находим последний LogID для пересчета. */  

      SELECT COALESCE(End_LogID, MaxLogID_n) INTO FinishLogIDSelect

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (MaxLogID_n > Begin_LogID) 

        AND (MaxLogID_n < End_LogID);

       

      /* Удалим старые записи из реестра пропущенных записей 

         (стали неактуальными, надо пересчитать) */

      DELETE FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID >= StartLogIDSelect)

        AND (Begin_LogID <= FinishLogIDSelect);

      

      /* Если первая запись LogID = 0 и этой записи нет в DataGps, тогда

         надо добавить первую фиктивную запись для анализа. */

      IF (StartLogIDSelect = 0) AND (NOT EXISTS

        (Select 1 

         FROM datagps 

         WHERE (Mobitel_ID = MobitelID) AND (LogID = StartLogIDSelect))) THEN

      

        INSERT INTO datagpslost_ontmp(LogID, SrvPacketID) VALUES (0, 0);  

      END IF;       

    ELSE

      /* Пришли новые данные. Надо добавить для анализа искусственную запись - 

         нижнюю границу */

      

      /* Находим стартовый LogID для пересчета. */

      SELECT COALESCE(MAX(End_LogID), CurrentConfirmedID) INTO StartLogIDSelect

      FROM datagpslost_on

      WHERE Mobitel_ID = MobitelID;   

         

      /* Находим последний LogID для пересчета. */  

      SELECT MAX(LogID)  INTO FinishLogIDSelect

      FROM datagpsbuffer_on

      WHERE Mobitel_ID = MobitelID;

      

      /* Выбираем из datagps соответствующее значение SrvPacketID  для первой

         искусственной записи */

      SELECT COALESCE(SrvPacketID, 0) INTO tmpSrvPacketID

      FROM datagps

      WHERE (Mobitel_ID = MobitelID) AND (LogID = StartLogIDSelect);

      

      /* Помещаем в таблицу datagpslost_ontmp для анализа пропусков 

         дополнительную первую запись */

      INSERT INTO datagpslost_ontmp(LogID, SrvPacketID)

      VALUES (StartLogIDSelect, tmpSrvPacketID);

    END IF; -- IF MinLogID_n < MaxEndLogID   

    

    /********** END PREPARE **********/

    

    /**********  INSERT ROWS **********/

    

    /* Заполнение временной таблицы последними данными телетрека

       для анализа разрывов */

    INSERT INTO datagpslost_ontmp  (LogID, SrvPacketID)

      SELECT LogID, SrvPacketID

      FROM datagps

      WHERE (Mobitel_ID = MobitelID) AND (LogID >= StartLogIDSelect)

        AND (LogID <= FinishLogIDSelect)

      ORDER BY LogID;

            

    /* Формирование команды-вставки в таблицу пропущенных диапазонов */

    SET DataExists = 1;

    OPEN CursorNewLogID;

    FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

    WHILE DataExists = 1 DO

      IF FirstLogID = -9999999 THEN

        /* Первое значение в списке */

        SET FirstLogID = NewLogID;

        SET FirstSrvPacketID = NewSrvPacketID;

      ELSE

        /* Основная ветка расчета*/

        SET SecondLogID = NewLogID;

        SET SecondSrvPacketID = NewSrvPacketID;

        

        IF (SecondLogID - FirstLogID) > 1 THEN

          /* Найден разрыв */

          /* Из-за всяких комбинаций состояний LogId и SrvPacketId из-за особенностей работы телематического сервера

          и ТДМ вводим дополнительный анализ вставляемых записей, если запись не соответсвует указаным правилам, она 

          отбрасывается */

          IF (SecondSrvPacketID > FirstSrvPacketID) THEN

            IF EXISTS(SELECT NULL FROM datagps d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = FirstLogID) AND (d.SrvPacketID = FirstSrvPacketID))) THEN 

              IF EXISTS(SELECT NULL FROM datagps d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = SecondLogID) AND (d.SrvPacketID = SecondSrvPacketID))) THEN 



                CALL OnInsertDatagpsLost(MobitelID, FirstLogID, SecondLogID, FirstSrvPacketID, SecondSrvPacketID);

                IF NeedOptimize = 0 THEN SET NeedOptimize = 1; END IF;

                

              END IF;

            END IF;

          END IF;

        END IF;

        /* Переместим текущее второе значение на первую позицию

           для участия в следующей итерации в качестве начального значения */

        SET  FirstLogID = SecondLogID;

        SET FirstSrvPacketID = SecondSrvPacketID;

      END IF;  

      FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

    END WHILE;

    CLOSE CursorNewLogID;

 

    /********** END INSERT ROWS **********/

               

    /********** UPDATE MOBITELS **********/

    

    /* Если пропущенных записей у данного телетрека нет - 

       тогда ConfirmedID будет равен максимальному LogID 

       данного телетрека. Иначе - минимальный Begin_LogID

       из таблицы пропусков */

    SELECT MIN(Begin_LogID) INTO NewConfirmedID

    FROM datagpslost_on

    WHERE Mobitel_ID = MobitelID;

       

    IF NewConfirmedID IS NULL THEN

      SELECT MAX(LogID) INTO NewConfirmedID

      FROM datagps

      WHERE Mobitel_ID = MobitelID;

    END IF;  

    

    /* Обновим ConfirmedID если надо */

    UPDATE mobitels

    SET ConfirmedID = NewConfirmedID

    WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);

    

    /********** END UPDATE MOBITELS **********/

        

    TRUNCATE TABLE datagpslost_ontmp;

  END IF; -- IF MaxEndLogID IS NOT NULL  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnLostDataGPS2` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnLostDataGPS2`(IN MobitelID INTEGER(11), OUT NeedOptimize TINYINT)
    SQL SECURITY INVOKER
    COMMENT 'Модификация диапазонов пропусков. Анализ дублирующих данных заданного телетрека.'
BEGIN

    /********** DECLARE **********/

    

  DECLARE NewConfirmedID INT DEFAULT 0; /* Новое значение ConfirmedID */

  DECLARE BeginLogID INT; /* Begin_LogID в курсоре CursorLostRanges */

  DECLARE EndLogID INT; /* End_LogID в курсоре CursorLostRanges */

  DECLARE BeginSrvPacketID BIGINT; /* Begin_SrvPacketID в курсоре CursorLostRanges */

  DECLARE EndSrvPacketID BIGINT; /* End_SrvPacketID в курсоре CursorLostRanges */

  DECLARE RowCountForAnalyze INT DEFAULT 0; /* Количество записей для анализа */

  DECLARE DataExists TINYINT DEFAULT 1; /* Флаг наличия данных после фетча */

    

  /* Курсор для прохода по диапазонам пропусков телетрека */

  DECLARE CursorLostRanges CURSOR FOR

    SELECT Begin_LogID, End_LogID, Begin_SrvPacketID, End_SrvPacketID 

    FROM datagpslost_on

    WHERE Mobitel_ID = MobitelID;    



  /* Курсор для прохода по новым LogID */

  DECLARE CursorNewLogID CURSOR FOR

    SELECT LogID, SrvPacketID 

    FROM datagpslost_ontmp

    ORDER BY SrvPacketID;    

    

  /* Обработчик отсутствующей записи при FETCH следующей записи */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

  /********** END DECLARE **********/



  SET NeedOptimize = 0;

  

  TRUNCATE TABLE datagpslost_ontmp;

  

  /* Перебираем диапазоны и сокращаем разрывы если это возможно */

  SET DataExists = 1;

  OPEN CursorLostRanges;

  FETCH CursorLostRanges INTO BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID;

  WHILE DataExists = 1 DO

    /* Заполнение временной таблицы дублирующими данными телетрека

       для анализа разрывов */

    INSERT INTO datagpslost_ontmp  (LogID, SrvPacketID)

      SELECT DISTINCT LogID, SrvPacketID

      FROM datagpsbuffer_ontmp

      WHERE (Mobitel_ID = MobitelID) AND (SrvPacketID > BeginSrvPacketID)

        AND (SrvPacketID < EndSrvPacketID)

      ORDER BY SrvPacketID;

      

    /* Если есть данные модифицируем диапазон */  

    SELECT COUNT(1) INTO RowCountForAnalyze

    FROM datagpslost_ontmp;  

    

    IF RowCountForAnalyze > 0 THEN  

      /* Добавляем первую и последнюю записи для анализа */  

      INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

      VALUES (BeginLogID, BeginSrvPacketID), (EndLogID, EndSrvPacketID);

      

      /* Удаляем старый диапазон */

      DELETE FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID);

       

      /**********  INSERT ROWS **********/             

      BEGIN

        DECLARE NewLogID INT; /* Значение LogID в курсоре CursorNewLogID */

        DECLARE NewSrvPacketID BIGINT; /* Значение SrvPacketID в курсоре CursorNewLogID */

        DECLARE FirstLogID INT DEFAULT -9999999; /* Первое значение LogID для анализа */

        DECLARE SecondLogID INT; /* Второе значение LogID для анализа */

        DECLARE FirstSrvPacketID BIGINT; /* Первое значение SrvPacketID */

        DECLARE SecondSrvPacketID BIGINT; /* Второе значение SrvPacketID */

        

        /* Обработчик отсутствующей записи при FETCH следующей записи */

        DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

        

        /* Формирование команды-вставки в таблицу пропущенных диапазонов */

        SET DataExists = 1;

        OPEN CursorNewLogID;

        FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

        WHILE DataExists = 1 DO

          IF FirstLogID = -9999999 THEN

            /* Первое значение в списке */

            SET FirstLogID = NewLogID;

            SET FirstSrvPacketID = NewSrvPacketID;

          ELSE

            /* Основная ветка расчета*/

            SET SecondLogID = NewLogID;

            SET SecondSrvPacketID = NewSrvPacketID;

            

            IF (SecondLogID - FirstLogID) > 1 THEN

          /* Найден разрыв */

          /* Из-за всяких комбинаций состояний LogId и SrvPacketId из-за особенностей работы телематического сервера

          и ТДМ вводим дополнительный анализ вставляемых записей, если запись не соответсвует указаным правилам, она 

          отбрасывается */

          IF (SecondSrvPacketID > FirstSrvPacketID) THEN

            IF EXISTS(SELECT NULL FROM datagps d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = FirstLogID) AND (d.SrvPacketID = FirstSrvPacketID))) THEN 

              IF EXISTS(SELECT NULL FROM datagps d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = SecondLogID) AND (d.SrvPacketID = SecondSrvPacketID))) THEN 



                CALL OnInsertDatagpsLost(MobitelID, FirstLogID, SecondLogID, FirstSrvPacketID, SecondSrvPacketID);

                IF NeedOptimize = 0 THEN SET NeedOptimize = 1; END IF;

                

              END IF;

            END IF;

          END IF;

        END IF;

            /* Переместим текущее второе значение на первую позицию

               для участия в следующей итерации в качестве начального значения */

            SET FirstLogID = SecondLogID;

            SET FirstSrvPacketID = SecondSrvPacketID;

          END IF;  

          FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

        END WHILE;

        CLOSE CursorNewLogID;

      END;

      /********** END INSERT ROWS **********/  



      TRUNCATE TABLE datagpslost_ontmp;

    END IF;

      

    FETCH CursorLostRanges INTO BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID;

  END WHILE;

  CLOSE CursorLostRanges;

  

  /********** UPDATE MOBITELS **********/

    

  /* Если пропущенных записей у данного телетрека нет - 

     тогда ConfirmedID будет равен максимальному LogID 

     данного телетрека. Иначе - минимальный Begin_LogID

     из таблицы пропусков */

  SELECT MIN(Begin_LogID) INTO NewConfirmedID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;

       

  IF NewConfirmedID IS NULL THEN

    SELECT MAX(LogID) INTO NewConfirmedID

    FROM datagps

    WHERE Mobitel_ID = MobitelID;

  END IF;  

    

  /* Обновим ConfirmedID если надо */

  UPDATE mobitels

  SET ConfirmedID = NewConfirmedID

  WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);

    

  /********** END UPDATE MOBITELS **********/

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnLostDataGPS264` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnLostDataGPS264`(IN MobitelID integer(11), OUT NeedOptimize tinyint)
    SQL SECURITY INVOKER
    COMMENT 'РњРѕРґРёС„РёРєР°С†РёСЏ РґРёР°РїР°Р·РѕРЅРѕРІ РїСЂРѕРїСѓСЃРєРѕРІ. РђРЅР°Р»РёР· РґСѓР±Р»РёСЂСѓСЋС‰РёС… РґР°РЅРЅС‹С… Р·Р°РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР°.'
BEGIN

  /********** DECLARE **********/



  DECLARE NewConfirmedID int DEFAULT 0; /* РќРѕРІРѕРµ Р·РЅР°С‡РµРЅРёРµ ConfirmedID */

  DECLARE BeginLogID int; /* Begin_LogID РІ РєСѓСЂСЃРѕСЂРµ CursorLostRanges */

  DECLARE EndLogID int; /* End_LogID РІ РєСѓСЂСЃРѕСЂРµ CursorLostRanges */

  DECLARE BeginSrvPacketID bigint; /* Begin_SrvPacketID РІ РєСѓСЂСЃРѕСЂРµ CursorLostRanges */

  DECLARE EndSrvPacketID bigint; /* End_SrvPacketID РІ РєСѓСЂСЃРѕСЂРµ CursorLostRanges */

  DECLARE RowCountForAnalyze int DEFAULT 0; /* РљРѕР»РёС‡РµСЃС‚РІРѕ Р·Р°РїРёСЃРµР№ РґР»СЏ Р°РЅР°Р»РёР·Р° */

  DECLARE DataExists tinyint DEFAULT 1; /* Р¤Р»Р°Рі РЅР°Р»РёС‡РёСЏ РґР°РЅРЅС‹С… РїРѕСЃР»Рµ С„РµС‚С‡Р° */



  /* РљСѓСЂСЃРѕСЂ РґР»СЏ РїСЂРѕС…РѕРґР° РїРѕ РґРёР°РїР°Р·РѕРЅР°Рј РїСЂРѕРїСѓСЃРєРѕРІ С‚РµР»РµС‚СЂРµРєР° */

  DECLARE CursorLostRanges CURSOR FOR

  SELECT

    Begin_LogID,

    End_LogID,

    Begin_SrvPacketID,

    End_SrvPacketID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;



  /* РљСѓСЂСЃРѕСЂ РґР»СЏ РїСЂРѕС…РѕРґР° РїРѕ РЅРѕРІС‹Рј LogID */

  DECLARE CursorNewLogID CURSOR FOR

  SELECT

    LogID,

    SrvPacketID

  FROM datagpslost_ontmp

  ORDER BY SrvPacketID;



  /* РћР±СЂР°Р±РѕС‚С‡РёРє РѕС‚СЃСѓС‚СЃС‚РІСѓСЋС‰РµР№ Р·Р°РїРёСЃРё РїСЂРё FETCH СЃР»РµРґСѓСЋС‰РµР№ Р·Р°РїРёСЃРё */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  /********** END DECLARE **********/



  SET NeedOptimize = 0;



  TRUNCATE TABLE datagpslost_ontmp;



  /* РџРµСЂРµР±РёСЂР°РµРј РґРёР°РїР°Р·РѕРЅС‹ Рё СЃРѕРєСЂР°С‰Р°РµРј СЂР°Р·СЂС‹РІС‹ РµСЃР»Рё СЌС‚Рѕ РІРѕР·РјРѕР¶РЅРѕ */

  SET DataExists = 1;

  OPEN CursorLostRanges;

  FETCH CursorLostRanges INTO BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID;

  WHILE DataExists = 1 DO

    /* Р—Р°РїРѕР»РЅРµРЅРёРµ РІСЂРµРјРµРЅРЅРѕР№ С‚Р°Р±Р»РёС†С‹ РґСѓР±Р»РёСЂСѓСЋС‰РёРјРё РґР°РЅРЅС‹РјРё С‚РµР»РµС‚СЂРµРєР°

       РґР»СЏ Р°РЅР°Р»РёР·Р° СЂР°Р·СЂС‹РІРѕРІ */

    INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

      SELECT DISTINCT

        LogID,

        SrvPacketID

      FROM datagpsbuffer_ontmp64

      WHERE (Mobitel_ID = MobitelID) AND (SrvPacketID > BeginSrvPacketID)

      AND (SrvPacketID < EndSrvPacketID)

      ORDER BY SrvPacketID;



    /* Р•СЃР»Рё РµСЃС‚СЊ РґР°РЅРЅС‹Рµ РјРѕРґРёС„РёС†РёСЂСѓРµРј РґРёР°РїР°Р·РѕРЅ */

    SELECT

      COUNT(1) INTO RowCountForAnalyze

    FROM datagpslost_ontmp;



    IF RowCountForAnalyze > 0 THEN

      /* Р”РѕР±Р°РІР»СЏРµРј РїРµСЂРІСѓСЋ Рё РїРѕСЃР»РµРґРЅСЋСЋ Р·Р°РїРёСЃРё РґР»СЏ Р°РЅР°Р»РёР·Р° */

      INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

        VALUES (BeginLogID, BeginSrvPacketID), (EndLogID, EndSrvPacketID);



      /* РЈРґР°Р»СЏРµРј СЃС‚Р°СЂС‹Р№ РґРёР°РїР°Р·РѕРЅ */

      DELETE

        FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID = BeginLogID);



      /**********  INSERT ROWS **********/

      BEGIN

        DECLARE NewLogID int; /* Р—РЅР°С‡РµРЅРёРµ LogID РІ РєСѓСЂСЃРѕСЂРµ CursorNewLogID */

        DECLARE NewSrvPacketID bigint; /* Р—РЅР°С‡РµРЅРёРµ SrvPacketID РІ РєСѓСЂСЃРѕСЂРµ CursorNewLogID */

        DECLARE FirstLogID int DEFAULT -9999999; /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ LogID РґР»СЏ Р°РЅР°Р»РёР·Р° */

        DECLARE SecondLogID int; /* Р’С‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ LogID РґР»СЏ Р°РЅР°Р»РёР·Р° */

        DECLARE FirstSrvPacketID bigint; /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID */

        DECLARE SecondSrvPacketID bigint; /* Р’С‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID */



        /* РћР±СЂР°Р±РѕС‚С‡РёРє РѕС‚СЃСѓС‚СЃС‚РІСѓСЋС‰РµР№ Р·Р°РїРёСЃРё РїСЂРё FETCH СЃР»РµРґСѓСЋС‰РµР№ Р·Р°РїРёСЃРё */

        DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



        /* Р¤РѕСЂРјРёСЂРѕРІР°РЅРёРµ РєРѕРјР°РЅРґС‹-РІСЃС‚Р°РІРєРё РІ С‚Р°Р±Р»РёС†Сѓ РїСЂРѕРїСѓС‰РµРЅРЅС‹С… РґРёР°РїР°Р·РѕРЅРѕРІ */

        SET DataExists = 1;

        OPEN CursorNewLogID;

        FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

        WHILE DataExists = 1 DO

          IF FirstLogID = -9999999 THEN

            /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ РІ СЃРїРёСЃРєРµ */

            SET FirstLogID = NewLogID;

            SET FirstSrvPacketID = NewSrvPacketID;

          ELSE

            /* РћСЃРЅРѕРІРЅР°СЏ РІРµС‚РєР° СЂР°СЃС‡РµС‚Р°*/

            SET SecondLogID = NewLogID;

            SET SecondSrvPacketID = NewSrvPacketID;



            IF (SecondLogID - FirstLogID) > 1 THEN

          /* РќР°Р№РґРµРЅ СЂР°Р·СЂС‹РІ */

          /* РР·-Р·Р° РІСЃСЏРєРёС… РєРѕРјР±РёРЅР°С†РёР№ СЃРѕСЃС‚РѕСЏРЅРёР№ LogId Рё SrvPacketId РёР·-Р·Р° РѕСЃРѕР±РµРЅРЅРѕСЃС‚РµР№ СЂР°Р±РѕС‚С‹ С‚РµР»РµРјР°С‚РёС‡РµСЃРєРѕРіРѕ СЃРµСЂРІРµСЂР°

          Рё РўР”Рњ РІРІРѕРґРёРј РґРѕРїРѕР»РЅРёС‚РµР»СЊРЅС‹Р№ Р°РЅР°Р»РёР· РІСЃС‚Р°РІР»СЏРµРјС‹С… Р·Р°РїРёСЃРµР№, РµСЃР»Рё Р·Р°РїРёСЃСЊ РЅРµ СЃРѕРѕС‚РІРµС‚СЃРІСѓРµС‚ СѓРєР°Р·Р°РЅС‹Рј РїСЂР°РІРёР»Р°Рј, РѕРЅР° 

          РѕС‚Р±СЂР°СЃС‹РІР°РµС‚СЃСЏ */

          IF (SecondSrvPacketID > FirstSrvPacketID) THEN

            IF EXISTS(SELECT NULL FROM datagps64 d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = FirstLogID) AND (d.SrvPacketID = FirstSrvPacketID))) THEN 

              IF EXISTS(SELECT NULL FROM datagps64 d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = SecondLogID) AND (d.SrvPacketID = SecondSrvPacketID))) THEN 



                CALL OnInsertDatagpsLost(MobitelID, FirstLogID, SecondLogID, FirstSrvPacketID, SecondSrvPacketID);

                IF NeedOptimize = 0 THEN SET NeedOptimize = 1; END IF;

                

              END IF;

            END IF;

          END IF;

        END IF;

            /* РџРµСЂРµРјРµСЃС‚РёРј С‚РµРєСѓС‰РµРµ РІС‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ РЅР° РїРµСЂРІСѓСЋ РїРѕР·РёС†РёСЋ

               РґР»СЏ СѓС‡Р°СЃС‚РёСЏ РІ СЃР»РµРґСѓСЋС‰РµР№ РёС‚РµСЂР°С†РёРё РІ РєР°С‡РµСЃС‚РІРµ РЅР°С‡Р°Р»СЊРЅРѕРіРѕ Р·РЅР°С‡РµРЅРёСЏ */

            SET FirstLogID = SecondLogID;

            SET FirstSrvPacketID = SecondSrvPacketID;

          END IF;

          FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

        END WHILE;

        CLOSE CursorNewLogID;

      END;

      /********** END INSERT ROWS **********/



      TRUNCATE TABLE datagpslost_ontmp;

    END IF;



    FETCH CursorLostRanges INTO BeginLogID, EndLogID, BeginSrvPacketID, EndSrvPacketID;

  END WHILE;

  CLOSE CursorLostRanges;



  /********** UPDATE MOBITELS **********/



  /* Р•СЃР»Рё РїСЂРѕРїСѓС‰РµРЅРЅС‹С… Р·Р°РїРёСЃРµР№ Сѓ РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° РЅРµС‚ - 

     С‚РѕРіРґР° ConfirmedID Р±СѓРґРµС‚ СЂР°РІРµРЅ РјР°РєСЃРёРјР°Р»СЊРЅРѕРјСѓ LogID 

     РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР°. РРЅР°С‡Рµ - РјРёРЅРёРјР°Р»СЊРЅС‹Р№ Begin_LogID

     РёР· С‚Р°Р±Р»РёС†С‹ РїСЂРѕРїСѓСЃРєРѕРІ */

  SELECT

    MIN(Begin_LogID) INTO NewConfirmedID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;



  IF NewConfirmedID IS NULL THEN

    SELECT

      MAX(LogID) INTO NewConfirmedID

    FROM datagps64

    WHERE Mobitel_ID = MobitelID;

  END IF;



  /* РћР±РЅРѕРІРёРј ConfirmedID РµСЃР»Рё РЅР°РґРѕ */

  UPDATE mobitels

  SET ConfirmedID = NewConfirmedID

  WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);



/********** END UPDATE MOBITELS **********/

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnLostDataGPS64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnLostDataGPS64`(IN MobitelID integer(11), OUT NeedOptimize tinyint)
    SQL SECURITY INVOKER
    COMMENT 'РџРѕРёСЃРє РїСЂРѕРїСѓСЃРєРѕРІ РІ online РґР°РЅРЅС‹С… Р·Р°РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° Рё Р·Р°РїРѕР»РЅРµРЅРёРµ С‚Р°Р±Р»РёС†.'
BEGIN



  /********** DECLARE **********/



  DECLARE CurrentConfirmedID int DEFAULT 0; /* РўРµРєСѓС‰РµРµ Р·РЅР°С‡РµРЅРёРµ ConfirmedID */

  DECLARE NewConfirmedID int DEFAULT 0; /* РќРѕРІРѕРµ Р·РЅР°С‡РµРЅРёРµ ConfirmedID */

  DECLARE StartLogIDSelect int DEFAULT 0; /* min LogID РґР»СЏ РІС‹Р±РѕСЂРєРё */

  DECLARE FinishLogIDSelect int DEFAULT 0; /* max LogID РґР»СЏ РІС‹Р±РѕСЂРєРё */

  DECLARE MaxEndLogID int DEFAULT 0; /* max End_LogID РІ РїСЂРѕРїСѓС‰РµРЅРЅС‹С… РґРёР°РїР°Р·РѕРЅР°С… РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° */



  DECLARE MinLogID_n int DEFAULT 0; /* РњРёРЅРёРјР°Р»СЊРЅС‹Р№ LogID РїРѕСЃР»Рµ ConfirmedID РІ РјРЅРѕР¶РµСЃС‚РІРµ РЅРѕРІС‹С… РґР°РЅРЅС‹С… */

  DECLARE MaxLogID_n int DEFAULT 0; /* РњР°РєСЃРёРјР°Р»СЊРЅС‹Р№ LogID РІ РјРЅРѕР¶РµСЃС‚РІРµ РЅРѕРІС‹С… РґР°РЅРЅС‹С… */



  DECLARE DataExists tinyint DEFAULT 1; /* Р¤Р»Р°Рі РЅР°Р»РёС‡РёСЏ РґР°РЅРЅС‹С… РїРѕСЃР»Рµ С„РµС‚С‡Р° */



  DECLARE NewLogID int; /* Р—РЅР°С‡РµРЅРёРµ LogID РІ РєСѓСЂСЃРѕСЂРµ CursorNewLogID */

  DECLARE NewSrvPacketID bigint; /* Р—РЅР°С‡РµРЅРёРµ SrvPacketID РІ РєСѓСЂСЃРѕСЂРµ CursorNewLogID */

  DECLARE FirstLogID int DEFAULT -9999999; /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ LogID РґР»СЏ Р°РЅР°Р»РёР·Р° */

  DECLARE SecondLogID int; /* Р’С‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ LogID РґР»СЏ Р°РЅР°Р»РёР·Р° */

  DECLARE FirstSrvPacketID bigint; /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID */

  DECLARE SecondSrvPacketID bigint; /* Р’С‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID */



  DECLARE tmpSrvPacketID bigint DEFAULT 0; /* Р—РЅР°С‡РµРЅРёРµ SrvPacketID РґР»СЏ РїРµСЂРІРѕР№ РёСЃРєСѓСЃСЃС‚РІРµРЅРЅРѕР№ Р·Р°РїРёСЃРё РІ Р°РЅР°Р»РёР·Рµ РЅРѕРІС‹С… РґР°РЅРЅС‹С…, РЅРµ РїРµСЂРµСЃРµРєР°СЋС‰РёС…СЃСЏ СЃ СЃСѓС‰РµСЃС‚РІСѓСЋС‰РёРјРё */



  /* РљСѓСЂСЃРѕСЂ РґР»СЏ РїСЂРѕС…РѕРґР° РїРѕ РЅРѕРІС‹Рј LogID */

  DECLARE CursorNewLogID CURSOR FOR

  SELECT

    LogID,

    SrvPacketID

  FROM datagpslost_ontmp;



  /* РћР±СЂР°Р±РѕС‚С‡РёРє РѕС‚СЃСѓС‚СЃС‚РІСѓСЋС‰РµР№ Р·Р°РїРёСЃРё РїСЂРё FETCH СЃР»РµРґСѓСЋС‰РµР№ Р·Р°РїРёСЃРё */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  /********** END DECLARE **********/



  SET NeedOptimize = 0;



  SELECT

    COALESCE(ConfirmedID, 0) INTO CurrentConfirmedID

  FROM mobitels

  WHERE Mobitel_ID = MobitelID;



  /* РњРёРЅРёРјР°Р»СЊРЅС‹Р№ LogID РІ РЅРѕРІРѕРј РЅР°Р±РѕСЂРµ РґР°РЅРЅС‹С… c РєРѕС‚РѕСЂС‹Рј Р±СѓРґРµРј СЂР°Р±РѕС‚Р°С‚СЊ */

  SELECT

    MIN(LogID) INTO MinLogID_n

  FROM datagpsbuffer_on64

  WHERE (Mobitel_ID = MobitelID) AND (LogID > CurrentConfirmedID);



  /* РњР°РєСЃРёРјР°Р»СЊРЅС‹Р№ LogID РІ РЅРѕРІРѕРј РЅР°Р±РѕСЂРµ РґР°РЅРЅС‹С… c РєРѕС‚РѕСЂС‹Рј Р±СѓРґРµРј СЂР°Р±РѕС‚Р°С‚СЊ */

  SELECT

    MAX(LogID) INTO MaxLogID_n

  FROM datagpsbuffer_on64

  WHERE Mobitel_ID = MobitelID;



  /* РњР°РєСЃРёРјР°Р»СЊРЅС‹Р№ End_LogID РІ РїСЂРѕРїСѓС‰РµРЅРЅС‹С… РґРёР°РїР°Р·РѕРЅР°С… РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° */

  SELECT

    COALESCE(MAX(End_LogID), 0) INTO MaxEndLogID

  FROM datagpslost_on

  WHERE Mobitel_ID = MobitelID;



  /* РџСЂРѕРІРµСЂРёРј РµСЃС‚СЊ Р»Рё РґР°РЅРЅС‹Рµ РґР»СЏ Р°РЅР°Р»РёР·Р° */

  IF MinLogID_n IS NOT NULL THEN



    /********** PREPARE **********/



    TRUNCATE TABLE datagpslost_ontmp;



    IF MinLogID_n < MaxEndLogID THEN

      /* Р•СЃР»Рё  MinLogID_n < MaxEndLogID Р·РЅР°С‡РёС‚ РїСЂРёС€Р»Рё РґР°РЅРЅС‹Рµ, 

       РєРѕС‚РѕСЂС‹Рµ РІРѕР·РјРѕР¶РЅРѕ Р·Р°РєСЂРѕСЋС‚ С‡Р°СЃС‚СЊ РїСЂРѕРїСѓСЃРєРѕРІ. */



      /* РќР°С…РѕРґРёРј СЃС‚Р°СЂС‚РѕРІС‹Р№ LogID РґР»СЏ РїРµСЂРµСЃС‡РµС‚Р°. */

      SELECT

        COALESCE(Begin_LogID, MinLogID_n) INTO StartLogIDSelect

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (MinLogID_n > Begin_LogID)

      AND (MinLogID_n < End_LogID);



      /* РќР°С…РѕРґРёРј РїРѕСЃР»РµРґРЅРёР№ LogID РґР»СЏ РїРµСЂРµСЃС‡РµС‚Р°. */

      SELECT

        COALESCE(End_LogID, MaxLogID_n) INTO FinishLogIDSelect

      FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (MaxLogID_n > Begin_LogID)

      AND (MaxLogID_n < End_LogID);



      /* РЈРґР°Р»РёРј СЃС‚Р°СЂС‹Рµ Р·Р°РїРёСЃРё РёР· СЂРµРµСЃС‚СЂР° РїСЂРѕРїСѓС‰РµРЅРЅС‹С… Р·Р°РїРёСЃРµР№ 

         (СЃС‚Р°Р»Рё РЅРµР°РєС‚СѓР°Р»СЊРЅС‹РјРё, РЅР°РґРѕ РїРµСЂРµСЃС‡РёС‚Р°С‚СЊ) */

      DELETE

        FROM datagpslost_on

      WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID >= StartLogIDSelect)

        AND (Begin_LogID <= FinishLogIDSelect);



      /* Р•СЃР»Рё РїРµСЂРІР°СЏ Р·Р°РїРёСЃСЊ LogID = 0 Рё СЌС‚РѕР№ Р·Р°РїРёСЃРё РЅРµС‚ РІ DataGps, С‚РѕРіРґР°

         РЅР°РґРѕ РґРѕР±Р°РІРёС‚СЊ РїРµСЂРІСѓСЋ С„РёРєС‚РёРІРЅСѓСЋ Р·Р°РїРёСЃСЊ РґР»СЏ Р°РЅР°Р»РёР·Р°. */

      IF (StartLogIDSelect = 0) AND (NOT EXISTS (SELECT

            1

          FROM datagps64

          WHERE (Mobitel_ID = MobitelID) AND (LogID = StartLogIDSelect))) THEN



        INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

          VALUES (0, 0);

      END IF;

    ELSE

      /* РџСЂРёС€Р»Рё РЅРѕРІС‹Рµ РґР°РЅРЅС‹Рµ. РќР°РґРѕ РґРѕР±Р°РІРёС‚СЊ РґР»СЏ Р°РЅР°Р»РёР·Р° РёСЃРєСѓСЃСЃС‚РІРµРЅРЅСѓСЋ Р·Р°РїРёСЃСЊ - 

         РЅРёР¶РЅСЋСЋ РіСЂР°РЅРёС†Сѓ */



      /* РќР°С…РѕРґРёРј СЃС‚Р°СЂС‚РѕРІС‹Р№ LogID РґР»СЏ РїРµСЂРµСЃС‡РµС‚Р°. */

      SELECT

        COALESCE(MAX(End_LogID), CurrentConfirmedID) INTO StartLogIDSelect

      FROM datagpslost_on

      WHERE Mobitel_ID = MobitelID;



      /* РќР°С…РѕРґРёРј РїРѕСЃР»РµРґРЅРёР№ LogID РґР»СЏ РїРµСЂРµСЃС‡РµС‚Р°. */

      SELECT

        MAX(LogID) INTO FinishLogIDSelect

      FROM datagpsbuffer_on64

      WHERE Mobitel_ID = MobitelID;



      /* Р’С‹Р±РёСЂР°РµРј РёР· datagps СЃРѕРѕС‚РІРµС‚СЃС‚РІСѓСЋС‰РµРµ Р·РЅР°С‡РµРЅРёРµ SrvPacketID  РґР»СЏ РїРµСЂРІРѕР№

         РёСЃРєСѓСЃСЃС‚РІРµРЅРЅРѕР№ Р·Р°РїРёСЃРё */

      SELECT

        COALESCE(SrvPacketID, 0) INTO tmpSrvPacketID

      FROM datagps64

      WHERE (Mobitel_ID = MobitelID) AND (LogID = StartLogIDSelect);



      /* РџРѕРјРµС‰Р°РµРј РІ С‚Р°Р±Р»РёС†Сѓ datagpslost_ontmp64 РґР»СЏ Р°РЅР°Р»РёР·Р° РїСЂРѕРїСѓСЃРєРѕРІ 

         РґРѕРїРѕР»РЅРёС‚РµР»СЊРЅСѓСЋ РїРµСЂРІСѓСЋ Р·Р°РїРёСЃСЊ */

      INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

        VALUES (StartLogIDSelect, tmpSrvPacketID);

    END IF; -- IF MinLogID_n < MaxEndLogID   



    /********** END PREPARE **********/



    /**********  INSERT ROWS **********/



    /* Р—Р°РїРѕР»РЅРµРЅРёРµ РІСЂРµРјРµРЅРЅРѕР№ С‚Р°Р±Р»РёС†С‹ РїРѕСЃР»РµРґРЅРёРјРё РґР°РЅРЅС‹РјРё С‚РµР»РµС‚СЂРµРєР°

       РґР»СЏ Р°РЅР°Р»РёР·Р° СЂР°Р·СЂС‹РІРѕРІ */

    INSERT INTO datagpslost_ontmp (LogID, SrvPacketID)

      SELECT

        LogID,

        SrvPacketID

      FROM datagps64

      WHERE (Mobitel_ID = MobitelID) AND (LogID >= StartLogIDSelect)

      AND (LogID <= FinishLogIDSelect)

      ORDER BY LogID;



    /* Р¤РѕСЂРјРёСЂРѕРІР°РЅРёРµ РєРѕРјР°РЅРґС‹-РІСЃС‚Р°РІРєРё РІ С‚Р°Р±Р»РёС†Сѓ РїСЂРѕРїСѓС‰РµРЅРЅС‹С… РґРёР°РїР°Р·РѕРЅРѕРІ */

    SET DataExists = 1;

    OPEN CursorNewLogID;

    FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

    WHILE DataExists = 1 DO

      IF FirstLogID = -9999999 THEN

        /* РџРµСЂРІРѕРµ Р·РЅР°С‡РµРЅРёРµ РІ СЃРїРёСЃРєРµ */

        SET FirstLogID = NewLogID;

        SET FirstSrvPacketID = NewSrvPacketID;

      ELSE

        /* РћСЃРЅРѕРІРЅР°СЏ РІРµС‚РєР° СЂР°СЃС‡РµС‚Р°*/

        SET SecondLogID = NewLogID;

        SET SecondSrvPacketID = NewSrvPacketID;



        IF (SecondLogID - FirstLogID) > 1 THEN

          /* РќР°Р№РґРµРЅ СЂР°Р·СЂС‹РІ */

          /* РР·-Р·Р° РІСЃСЏРєРёС… РєРѕРјР±РёРЅР°С†РёР№ СЃРѕСЃС‚РѕСЏРЅРёР№ LogId Рё SrvPacketId РёР·-Р·Р° РѕСЃРѕР±РµРЅРЅРѕСЃС‚РµР№ СЂР°Р±РѕС‚С‹ С‚РµР»РµРјР°С‚РёС‡РµСЃРєРѕРіРѕ СЃРµСЂРІРµСЂР°

          Рё РўР”Рњ РІРІРѕРґРёРј РґРѕРїРѕР»РЅРёС‚РµР»СЊРЅС‹Р№ Р°РЅР°Р»РёР· РІСЃС‚Р°РІР»СЏРµРјС‹С… Р·Р°РїРёСЃРµР№, РµСЃР»Рё Р·Р°РїРёСЃСЊ РЅРµ СЃРѕРѕС‚РІРµС‚СЃРІСѓРµС‚ СѓРєР°Р·Р°РЅС‹Рј РїСЂР°РІРёР»Р°Рј, РѕРЅР° 

          РѕС‚Р±СЂР°СЃС‹РІР°РµС‚СЃСЏ */

          IF (SecondSrvPacketID > FirstSrvPacketID) THEN

            IF EXISTS(SELECT NULL FROM datagps64 d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = FirstLogID) AND (d.SrvPacketID = FirstSrvPacketID))) THEN 

              IF EXISTS(SELECT NULL FROM datagps64 d WHERE (d.Mobitel_ID = MobitelID) AND ((d.LogID = SecondLogID) AND (d.SrvPacketID = SecondSrvPacketID))) THEN 



                CALL OnInsertDatagpsLost(MobitelID, FirstLogID, SecondLogID, FirstSrvPacketID, SecondSrvPacketID);

                IF NeedOptimize = 0 THEN SET NeedOptimize = 1; END IF;

                

              END IF;

            END IF;

          END IF;

        END IF;

        /* РџРµСЂРµРјРµСЃС‚РёРј С‚РµРєСѓС‰РµРµ РІС‚РѕСЂРѕРµ Р·РЅР°С‡РµРЅРёРµ РЅР° РїРµСЂРІСѓСЋ РїРѕР·РёС†РёСЋ

           РґР»СЏ СѓС‡Р°СЃС‚РёСЏ РІ СЃР»РµРґСѓСЋС‰РµР№ РёС‚РµСЂР°С†РёРё РІ РєР°С‡РµСЃС‚РІРµ РЅР°С‡Р°Р»СЊРЅРѕРіРѕ Р·РЅР°С‡РµРЅРёСЏ */

        SET FirstLogID = SecondLogID;

        SET FirstSrvPacketID = SecondSrvPacketID;

      END IF;

      FETCH CursorNewLogID INTO NewLogID, NewSrvPacketID;

    END WHILE;

    CLOSE CursorNewLogID;



    /********** END INSERT ROWS **********/



    /********** UPDATE MOBITELS **********/



    /* Р•СЃР»Рё РїСЂРѕРїСѓС‰РµРЅРЅС‹С… Р·Р°РїРёСЃРµР№ Сѓ РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР° РЅРµС‚ - 

       С‚РѕРіРґР° ConfirmedID Р±СѓРґРµС‚ СЂР°РІРµРЅ РјР°РєСЃРёРјР°Р»СЊРЅРѕРјСѓ LogID 

       РґР°РЅРЅРѕРіРѕ С‚РµР»РµС‚СЂРµРєР°. РРЅР°С‡Рµ - РјРёРЅРёРјР°Р»СЊРЅС‹Р№ Begin_LogID

       РёР· С‚Р°Р±Р»РёС†С‹ РїСЂРѕРїСѓСЃРєРѕРІ */

    SELECT

      MIN(Begin_LogID) INTO NewConfirmedID

    FROM datagpslost_on

    WHERE Mobitel_ID = MobitelID;



    IF NewConfirmedID IS NULL THEN

      SELECT

        MAX(LogID) INTO NewConfirmedID

      FROM datagps64

      WHERE Mobitel_ID = MobitelID;

    END IF;



    /* РћР±РЅРѕРІРёРј ConfirmedID РµСЃР»Рё РЅР°РґРѕ */

    UPDATE mobitels

    SET ConfirmedID = NewConfirmedID

    WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);



    /********** END UPDATE MOBITELS **********/



    TRUNCATE TABLE datagpslost_ontmp;

  END IF; -- IF MaxEndLogID IS NOT NULL  

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnTransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps'
BEGIN

  DECLARE MobitelIDInCursor INT; /* Текущее значение MobitelID */

  DECLARE DataExists TINYINT DEFAULT 1; /* Флаг наличия данных после фетча */

  DECLARE NeedOptimize TINYINT DEFAULT 0; /* Нужна оптимизация или нет */

  DECLARE NeedOptimizeParam TINYINT;

  

  DECLARE TmpMaxUnixTime INT; /* Временная переменная для хранения Max UnixTime из таблицы online */



  /* Курсор по телетрекам в множестве новых данных */

  DECLARE CursorMobitelsInsertSet CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer_on;

  /* Курсор по телетрекам в множестве повторных данных */

  DECLARE CursorMobitelsUpdateSet CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer_ontmp;  



  /* Обработчик отсутствующей записи при FETCH следующей записи */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  CALL OnDeleteDuplicates();

  CALL OnCorrectInfotrackLogId();

  

  /* Сохраняем записи, которые уже есть в БД, для второго этапа анализа пропусков 

     Используется процедурой OnLostDataGPS2. */

  INSERT INTO datagpsbuffer_ontmp (Mobitel_ID, LogID, SrvPacketID)

    SELECT b.Mobitel_ID, b.LogID, b.SrvPacketID

    FROM datagpsbuffer_on b LEFT JOIN datagps d ON

      (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

    WHERE d.LogID IS NOT NULL;

       

  /* -------------------- Заполнение таблицы Online ---------------------- */  

  /* Удаление из таблицы online дублирующих строк таблицы datagpsbuffer_on */

  /* по полям Mobitel_ID и LogID */

  DELETE o

  FROM `online` o, datagpsbuffer_on dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);

  

  SET DataExists = 1;

  OPEN CursorMobitelsInsertSet;

  FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* Нахождение Max значения UnixTime в таблице online для заданного

       телетрека. p.s. UnixTime в таблице online только валидный */

    SELECT COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online FORCE INDEX (IDX_Mobitelid)

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* Вставка новых записей (максимум 100)каждого телетрека в online */

    INSERT INTO `online` (

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs)

    SELECT

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs

    FROM (

      SELECT *

      FROM datagpsbuffer_on

      WHERE (Mobitel_ID = MobitelIDInCursor)  AND 

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

      GROUP BY Mobitel_ID, LogID

      ORDER BY UnixTime DESC

      LIMIT 100) AS T

    ORDER BY UnixTime ASC;



    /* Удаление строк из таблицы оперативных данных не удовлетворяющие

       условиям хранения - не являются последними 100 строками */

    DELETE FROM `online`

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < 

      (SELECT COALESCE(MIN(UnixTime), 0) 

       FROM (

         SELECT UnixTime

         FROM `online`

         WHERE Mobitel_ID = MobitelIDInCursor 

         ORDER BY UnixTime DESC

         LIMIT 100) T1)); 

  

    FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsInsertSet;

  /* ---------------- Online ---------------- */ 

  

  /* Зачем-то нужен апдейт ... */

  UPDATE datagps d, datagpsbuffer_on b SET

    d.Latitude = b.Latitude,

    d.Longitude = b.Longitude,

    d.Altitude = b.Altitude,

    d.UnixTime = b.UnixTime,

    d.Speed = b.Speed,

    d.Direction = b.Direction,

    d.Valid = b.Valid,

    d.InMobitelID = b.LogID,

    d.Events = b.Events,

    d.Sensor1 = b.Sensor1,

    d.Sensor2 = b.Sensor2,

    d.Sensor3 = b.Sensor3,

    d.Sensor4 = b.Sensor4,

    d.Sensor5 = b.Sensor5,

    d.Sensor6 = b.Sensor6,

    d.Sensor7 = b.Sensor7,

    d.Sensor8 = b.Sensor8,

    d.whatIs = b.whatIs,

    d.Counter1 = b.Counter1,

    d.Counter2 = b.Counter2,

    d.Counter3 = b.Counter3,

    d.Counter4 = b.Counter4,

    d.SrvPacketID = b.SrvPacketID

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

    AND (d.SrvPacketID < b.SrvPacketID);



  /* Удалим записи которые участвовали в апдейте */

  DELETE b

  FROM datagps d, datagpsbuffer_on b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  /* Вставка новых записей*/

  INSERT INTO datagps (

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, InMobitelID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs, SrvPacketID)

  SELECT

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, LogID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs, SrvPacketID

  FROM datagpsbuffer_on

  GROUP BY Mobitel_ID, LogID;



  /* ------------------- FETCH Mobitels (INSERT SET) ----------------------- */

  SET DataExists = 1;

  OPEN CursorMobitelsInsertSet;

  FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* ------ Обновление времени последней вставки записей ------- */

    UPDATE mobitels SET LastInsertTime = UNIX_TIMESTAMP(NOW())

    WHERE Mobitel_ID = MobitelIDInCursor;

       

    /* ------ Обновление списка пропущенных записей -------------- */

    CALL OnLostDataGPS(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsInsertSet;



  /* Очистка буфера */

  TRUNCATE TABLE datagpsbuffer_on;

    

  /* ------------------- FETCH Mobitels (UPDATE SET) ---------------------- */

  SET DataExists = 1;

  OPEN CursorMobitelsUpdateSet;

  FETCH CursorMobitelsUpdateSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* ---- Обновление списка пропущенных записей по второму алгоритму --- */

    CALL OnLostDataGPS2(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitelsUpdateSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsUpdateSet;

  

  /* Очистка вспомогательного буфера */

  TRUNCATE TABLE datagpsbuffer_ontmp;



  /* Были изменения - сделаем оптимизацию */

  /*IF NeedOptimize = 1 THEN

    OPTIMIZE TABLE datagpslost_on;

  END IF; */           

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `OnTransferBuffer64` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `OnTransferBuffer64`()
    SQL SECURITY INVOKER
BEGIN

  DECLARE MobitelIDInCursor int; /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ MobitelID */

  DECLARE DataExists tinyint DEFAULT 1; /* пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ */

  DECLARE NeedOptimize tinyint DEFAULT 0; /* пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅ */

  DECLARE NeedOptimizeParam tinyint;



  DECLARE TmpMaxUnixTime int; /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ Max UnixTime пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ online */



  /* пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  DECLARE CursorMobitelsInsertSet CURSOR FOR

  SELECT DISTINCT

    (Mobitel_ID)

  FROM datagpsbuffer_on64;

  /* пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  DECLARE CursorMobitelsUpdateSet CURSOR FOR

  SELECT DISTINCT

    (Mobitel_ID)

  FROM datagpsbuffer_ontmp64;



  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ FETCH пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  /*DECLARE EXIT HANDLER FOR SQLEXCEPTION 

  BEGIN

    ROLLBACK;

    SELECT 'An error has occurred, operation rollbacked and the stored procedure was terminated';

  end;*/



  CALL delDupSrvPacket();

  CALL OnDeleteDuplicates64();

  /*CALL OnCorrectInfotrackLogId64();*/



  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ, пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅ пїЅ пїЅпїЅ, пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ 

     пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ OnLostDataGPS264. */

  /*INSERT INTO datagpsbuffer_ontmp64 (Mobitel_ID, LogID, SrvPacketID)

    SELECT

      b.Mobitel_ID,

      b.LogID,

      b.SrvPacketID

    FROM datagpsbuffer_on64 b

      LEFT JOIN datagps64 d

        ON (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

    WHERE d.LogID IS NOT NULL GROUP BY d.SrvPacketID;*/

 DROP TEMPORARY TABLE IF EXISTS temp1;

  DROP TABLE IF EXISTS temp1;

  CREATE TEMPORARY TABLE temp1  SELECT

      b.Mobitel_ID,

      b.LogID,

      b.SrvPacketID

    FROM datagpsbuffer_on64 b

      LEFT JOIN datagps64 d

        ON (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

    WHERE d.LogID IS NOT NULL GROUP BY d.SrvPacketID;



INSERT INTO datagpsbuffer_ontmp64 (Mobitel_ID, LogID, SrvPacketID) SELECT * FROM temp1 GROUP BY SrvPacketID;



DROP TEMPORARY TABLE IF EXISTS temp1;


  /* -------------------- пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ Online ---------------------- */

  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ online пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ datagpsbuffer_on64 */

  /* пїЅпїЅ пїЅпїЅпїЅпїЅпїЅ Mobitel_ID пїЅ LogID */

  DELETE o

    FROM online64 o, datagpsbuffer_on64 dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);



  SET DataExists = 1;

  OPEN CursorMobitelsInsertSet;

  FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ Max пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ UnixTime пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ online пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ

       пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ. p.s. UnixTime пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ online пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ */

    SELECT

      COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online64 FORCE INDEX (IDX_Mobitelid64)

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ (пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ 100)пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ online */

    INSERT INTO online64 (Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Acceleration,

    Direction, Speed, Valid, `Events`,

    Satellites, RssiGsm, SensorsSet, Sensors, Voltage, DGPS)

      SELECT

        Mobitel_ID,

        LogID,

        UnixTime,

        Latitude,

        Longitude,

        Acceleration,

        Direction,

        Speed,

        Valid,

        `Events`,

        Satellites,

        RssiGsm,

        SensorsSet,

        Sensors,

        Voltage,

        DGPS

      FROM (SELECT

          *

        FROM datagpsbuffer_on64

        WHERE (Mobitel_ID = MobitelIDInCursor) AND

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

        GROUP BY Mobitel_ID,

                 LogID

        ORDER BY UnixTime DESC

        LIMIT 100) AS T

      ORDER BY UnixTime ASC;



    /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ

       пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ - пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ 100 пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ */

    DELETE

      FROM online64

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < (SELECT

          COALESCE(MIN(UnixTime), 0)

        FROM (SELECT

            UnixTime

          FROM online64

          WHERE Mobitel_ID = MobitelIDInCursor

          ORDER BY UnixTime DESC

          LIMIT 100) T1));



    FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsInsertSet;

  /* ---------------- Online ---------------- */

  /* пїЅпїЅпїЅпїЅпїЅ-пїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ ... */

  UPDATE datagps64 d, datagpsbuffer_on64 b

  SET d.Latitude = b.Latitude,

      d.Longitude = b.Longitude,

      d.Acceleration = b.Acceleration,

      d.UnixTime = b.UnixTime,

      d.Speed = b.Speed,

      d.Direction = b.Direction,

      d.Valid = b.Valid,

      d.LogID = b.LogID,

      d.`Events` = b.`Events`,

      d.Satellites = b.Satellites,

      d.RssiGsm = b.RssiGsm,

      d.SensorsSet = b.SensorsSet,

      d.Sensors = b.Sensors,

      d.Voltage = b.Voltage,

      d.DGPS = b.DGPS,

      d.SrvPacketID = b.SrvPacketID

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID)

  AND (d.SrvPacketID < b.SrvPacketID);



  /* пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ */

  DELETE b

    FROM datagps64 d, datagpsbuffer_on64 b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



    /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ */ 

  INSERT INTO datagps64 (Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Acceleration,

  Direction, Speed, Valid, `Events`,

  Satellites, RssiGsm, SensorsSet, Sensors, Voltage, DGPS, SrvPacketID)

    SELECT

      Mobitel_ID,

      LogID,

      UnixTime,

      Latitude,

      Longitude,

      Acceleration,

      Direction,

      Speed,

      Valid,

      `Events`,

      Satellites,

      RssiGsm,

      SensorsSet,

      Sensors,

      Voltage,

      DGPS,

      SrvPacketID

    FROM datagpsbuffer_on64

    GROUP BY Mobitel_ID,

             LogID;



  /* ------------------- FETCH Mobitels (INSERT SET) ----------------------- */

  SET DataExists = 1;

  OPEN CursorMobitelsInsertSet;

  FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* ------ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ ------- */

    UPDATE mobitels

    SET LastInsertTime = UNIX_TIMESTAMP(NOW())

    WHERE Mobitel_ID = MobitelIDInCursor;



    /* ------ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ -------------- */

    CALL OnLostDataGPS64(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitelsInsertSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsInsertSet;



  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  TRUNCATE TABLE datagpsbuffer_on64;



  /* ------------------- FETCH Mobitels (UPDATE SET) ---------------------- */

  SET DataExists = 1;

  OPEN CursorMobitelsUpdateSet;

  FETCH CursorMobitelsUpdateSet INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    /* ---- пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ --- */

    CALL OnLostDataGPS264(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitelsUpdateSet INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitelsUpdateSet;



  /* пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ */

  TRUNCATE TABLE datagpsbuffer_ontmp64;



  /* пїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ - пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅпїЅ */

  /*IF NeedOptimize = 1 THEN

    OPTIMIZE TABLE datagpslost_on;

  END IF;*/

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `PopListMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PopListMobitelConfig`()
    SQL SECURITY INVOKER
    COMMENT 'Выборка настроек телетреков для работы в режиме POP3'
BEGIN

  SELECT m.Mobitel_ID AS MobitelID, c.devIdShort AS DevIdShort,

    COALESCE(

      (SELECT s.EmailMobitel 

       FROM Mobitels m2 JOIN ServiceSend s ON s.ID = m2.ServiceSend_ID 

       WHERE m2.Mobitel_ID = m.Mobitel_ID

       ORDER BY s.ServiceSend_ID DESC

       LIMIT 1), "") AS Email

  FROM mobitels m JOIN internalmobitelconfig c ON c.ID = m.InternalMobitelConfig_ID

  WHERE (c.InternalMobitelConfig_ID = (

    SELECT intConf.InternalMobitelConfig_ID

    FROM internalmobitelconfig intConf

    WHERE (intConf.ID = c.ID)

    ORDER BY intConf.InternalMobitelConfig_ID DESC

    LIMIT 1)) AND (c.devIdShort IS NOT NULL) AND (c.devIdShort <> _cp1251 '')

  ORDER BY m.Mobitel_ID;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `PopTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `PopTransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps'
BEGIN

  DECLARE MobitelIDInCursor INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  

  DECLARE TmpMaxUnixTime INT; 



  DECLARE CursorMobitels CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer_pop;



  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



    

  

  

  DELETE o

  FROM online o, datagpsbuffer_pop dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);

  

  SET DataExists = 1;

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    

    SELECT COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online FORCE INDEX (IDX_Mobitelid)

    WHERE Mobitel_ID = MobitelIDInCursor;



    

    INSERT INTO online (

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs)

    SELECT

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs

    FROM (

      SELECT *

      FROM datagpsbuffer_pop

      WHERE (Mobitel_ID = MobitelIDInCursor)  AND 

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

      GROUP BY Mobitel_ID, LogID

      ORDER BY UnixTime DESC

      LIMIT 100) AS T

    ORDER BY UnixTime ASC;



    

    DELETE FROM online

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < 

      (SELECT COALESCE(MIN(UnixTime), 0) 

       FROM (

         SELECT UnixTime

         FROM online

         WHERE Mobitel_ID = MobitelIDInCursor 

         ORDER BY UnixTime DESC

         LIMIT 100) T1)); 

  

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;

    



  

  UPDATE datagps d, datagpsbuffer_pop b SET

    d.Latitude = b.Latitude,

    d.Longitude = b.Longitude,

    d.Altitude = b.Altitude,

    d.UnixTime = b.UnixTime,

    d.Speed = b.Speed,

    d.Direction = b.Direction,

    d.Valid = b.Valid,

    d.InMobitelID = b.LogID,

    d.`Events` = b.`Events`,

    d.Sensor1 = b.Sensor1,

    d.Sensor2 = b.Sensor2,

    d.Sensor3 = b.Sensor3,

    d.Sensor4 = b.Sensor4,

    d.Sensor5 = b.Sensor5,

    d.Sensor6 = b.Sensor6,

    d.Sensor7 = b.Sensor7,

    d.Sensor8 = b.Sensor8,

    d.whatIs = b.whatIs,

    d.Counter1 = b.Counter1,

    d.Counter2 = b.Counter2,

    d.Counter3 = b.Counter3,

    d.Counter4 = b.Counter4

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  DELETE b

  FROM datagps d, datagpsbuffer_pop b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  INSERT INTO datagps (

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, InMobitelID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs)

  SELECT

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, LogID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs

  FROM datagpsbuffer_pop

  GROUP BY Mobitel_ID, LogID;



  

  TRUNCATE TABLE datagpsbuffer_pop;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfFillLostDataGPS` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfFillLostDataGPS`()
    COMMENT 'Поиск пропусков в RF данных и заполнение таблицы datagpslost'
BEGIN

  DECLARE MobitelIDInCursor INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  DECLARE NeedOptimize TINYINT DEFAULT 0; 

  DECLARE NeedOptimizeParam TINYINT;



  

  DECLARE CursorMobitels CURSOR FOR

    SELECT m.Mobitel_ID AS Mobitel_ID
    FROM mobitels m
      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)
    WHERE (c.InternalMobitelConfig_ID = (
      SELECT intConf.InternalMobitelConfig_ID
      FROM internalmobitelconfig intConf
      WHERE intConf.ID = c.ID 
      ORDER BY intConf.InternalMobitelConfig_ID DESC
      LIMIT 1)) AND
      (c.moduleIdRf IS NOT NULL) AND (c.moduleIdRf <> _cp1251'')
    ORDER BY m.Mobitel_ID;

  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

  SET DataExists = 1;

  

  

  DELETE d

  FROM datagpslost d

  WHERE NOT EXISTS(

    SELECT 1

    FROM mobitels m

    WHERE m.Mobitel_ID = d.Mobitel_ID);

  

  

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    CALL RfLostDataGPS(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  

  IF NeedOptimize = 1 THEN

    OPTIMIZE TABLE datagpslost;

  END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfListMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfListMobitelConfig`()
    COMMENT 'Выборка RF настроек телетреков'
BEGIN

  DECLARE MobitelIDInCursor INT;

  DECLARE NameInCursor CHAR(50);

  DECLARE DescrInCursor CHAR(200);

  DECLARE ConfirmedIDInCursor INT;

  DECLARE moduleIdRfInCursor CHAR(50);

  DECLARE LastInsertTimeInCursor DateTime;

  DECLARE DataExists TINYINT DEFAULT 1;



  

  DECLARE CursorMobitels CURSOR FOR

    SELECT m.Mobitel_ID AS Mobitel_ID,
      m.Name AS Name,
      m.Descr AS Descr,
      m.ConfirmedID AS ConfirmedID,
      c.moduleIdRf AS moduleIdRf,
      FROM_UNIXTIME(m.LastInsertTime) AS LastInsertTime
    FROM mobitels m
      JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)
    WHERE (c.InternalMobitelConfig_ID = (
      SELECT intConf.InternalMobitelConfig_ID
      FROM internalmobitelconfig intConf
      WHERE intConf.ID = c.ID 
      ORDER BY intConf.InternalMobitelConfig_ID DESC
      LIMIT 1)) AND
      (c.moduleIdRf IS NOT NULL) AND (c.moduleIdRf <> _cp1251'')
    ORDER BY m.Mobitel_ID;



  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  

  CREATE TEMPORARY TABLE tmpMobitelsConfig (

    Mobitel_ID INT NOT NULL,

    Name CHAR(50),

    Descr CHAR(200),

    ConfirmedID INT NOT NULL,

    moduleIdRf CHAR(50) NOT NULL,

    LastInsertTime DateTime NOT NULL,

    LastLogID INT NOT NULL) ENGINE = MEMORY;



  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor, NameInCursor, DescrInCursor, 

    ConfirmedIDInCursor, moduleIdRfInCursor, LastInsertTimeInCursor;

  WHILE DataExists = 1 DO



    INSERT INTO tmpMobitelsConfig SELECT MobitelIDInCursor, NameInCursor, DescrInCursor, 

      ConfirmedIDInCursor, moduleIdRfInCursor, LastInsertTimeInCursor,

      (SELECT COALESCE(MAX(LogID), 0)
       FROM datagps
       WHERE Mobitel_ID = MobitelIDInCursor) AS LastLogID;



    FETCH CursorMobitels INTO MobitelIDInCursor, NameInCursor, DescrInCursor, 

    ConfirmedIDInCursor, moduleIdRfInCursor, LastInsertTimeInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  SELECT Mobitel_ID, Name, Descr, ConfirmedID, moduleIdRf, LastInsertTime, LastLogID

  FROM tmpMobitelsConfig;



  DROP TEMPORARY TABLE tmpMobitelsConfig;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfLostDataGPS` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfLostDataGPS`(IN MobitelID INTEGER(11), OUT NeedOptimize TINYINT)
    COMMENT 'Поиск пропусков в RF данных заданного телетрека и заполнение таб'
BEGIN

  

  DECLARE MAX_RECORD_COUNT INT DEFAULT 33792;

  DECLARE FirstActualLogID INT; 



  DECLARE CurrentConfirmedID INT; 

  DECLARE NewConfirmedID INT DEFAULT 0; 

  DECLARE NewStartLogIDSelect INT DEFAULT 0; 

  DECLARE MaxMobitelLogID INT; 



  DECLARE BeginLogIDInCursor INT; 

  DECLARE EndLogIDInCursor INT; 

  DECLARE CountInLostRange INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  DECLARE DataChanged TINYINT DEFAULT 0; 

  DECLARE NeedAnalyze TINYINT DEFAULT 0; 

  

  DECLARE NewRowCount INT DEFAULT 0; 

  

  DECLARE NewLogID INT; 

  DECLARE FirstLogID INT DEFAULT -9999999; 

  DECLARE SecondLogID INT; 

                                                                                    

  

  

  DECLARE CursorLostData CURSOR FOR

    SELECT Begin_LogID, End_LogID

    FROM datagpslost

    WHERE Mobitel_ID = MobitelID

    ORDER BY Begin_LogID;

    

  

  DECLARE CursorNewLogID CURSOR FOR

    SELECT LogID 

    FROM datagpslost_rftmp;

    

  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;



  SET DataExists = 1;

  SET NeedOptimize = 0;

 

  SELECT COALESCE(ConfirmedID, 0) INTO CurrentConfirmedID

  FROM mobitels

  WHERE Mobitel_ID = MobitelID;



  

  SELECT COALESCE(MAX(LogID), 0) INTO MaxMobitelLogID

  FROM datagps

  WHERE (Mobitel_ID = MobitelID);



  IF CurrentConfirmedID <> MaxMobitelLogID THEN

    

    SET FirstActualLogID = MaxMobitelLogID - MAX_RECORD_COUNT;

    IF FirstActualLogID < 0 THEN

      SET FirstActualLogID = 0;

    END IF;



    

    DELETE FROM datagpslost

    WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID < FirstActualLogID);

    

    

    OPEN CursorLostData;

    FETCH CursorLostData INTO BeginLogIDInCursor, EndLogIDInCursor;

    

    

    IF DataExists = 0 THEN

      SET DataChanged = 0;

      SET NeedAnalyze = 1;

      

      SET NewStartLogIDSelect = GREATEST(CurrentConfirmedID, FirstActualLogID);

    END IF;



    

    WHILE DataExists = 1 DO

      

      SELECT COUNT(1) INTO CountInLostRange

      FROM datagps

      WHERE (Mobitel_ID = MobitelID) AND

        (LogID > BeginLogIDInCursor) AND (LogID < EndLogIDInCursor);



      

      IF (CountInLostRange > 0)  THEN

        

        DELETE FROM datagpslost

        WHERE (Mobitel_ID = MobitelID) AND (Begin_LogID >= BeginLogIDInCursor);



        SET DataChanged = 1;

        SET NeedAnalyze = 1;

        SET NewStartLogIDSelect = BeginLogIDInCursor;

        

        

        SET DataExists = 0;

      ELSE

        FETCH CursorLostData INTO BeginLogIDInCursor, EndLogIDInCursor;

      END IF;	

    END WHILE;

    CLOSE CursorLostData;

   

    

       

    IF (NeedAnalyze = 0) AND (EndLogIDInCursor < MaxMobitelLogID) THEN

      SET NewStartLogIDSelect = EndLogIDInCursor;

      SET NeedAnalyze = 1;

    END IF;

   

    



    IF NeedAnalyze = 1 THEN

      TRUNCATE TABLE datagpslost_rftmp;



      

      INSERT INTO datagpslost_rftmp	(LogID)

      SELECT DISTINCT(LogID)

      FROM datagps

      WHERE (Mobitel_ID = MobitelID) AND (LogID >= NewStartLogIDSelect)

      ORDER BY LogID;

      

      

      SET @InsertLostDataStatement = 

        "INSERT INTO datagpslost(Mobitel_ID, Begin_LogID, End_LogID) VALUES ";

      

      

      SET DataExists = 1;

      OPEN CursorNewLogID;

      FETCH CursorNewLogID INTO NewLogID;

      WHILE DataExists = 1 DO

        IF FirstLogID = -9999999 THEN

          

          SET FirstLogID = NewLogID;

        ELSE

          

          SET SecondLogID = NewLogID;

          IF (SecondLogID -	FirstLogID) > 1 THEN

            

            IF NewRowCount > 0 THEN

              SET @InsertLostDataStatement = 

                CONCAT(@InsertLostDataStatement, ",");

            END IF;

            SET @InsertLostDataStatement = 

              CONCAT(@InsertLostDataStatement, 

                " (", MobitelID, ", ", FirstLogID, ", ", SecondLogID, ")");

            

            SET NewRowCount = NewRowCount + 1;

          END IF;

          

          SET	FirstLogID = SecondLogID;

        END IF;	

        FETCH CursorNewLogID INTO NewLogID;

      END WHILE;

      CLOSE CursorNewLogID;

      

        

      IF NewRowCount > 0 THEN

        

        PREPARE stmt FROM @InsertLostDataStatement;

        EXECUTE stmt;

        DEALLOCATE PREPARE stmt;

        

        SET DataChanged = 1;

      END IF; 
             

      

      

      SELECT COALESCE(MIN(Begin_LogID), -1) INTO NewConfirmedID

      FROM datagpslost

      WHERE Mobitel_ID = MobitelID;



      

      IF NewConfirmedID = -1 THEN

        SET NewConfirmedID = MaxMobitelLogID;

      END IF;



      

      IF NewConfirmedID > CurrentConfirmedID THEN

        UPDATE mobitels

        SET ConfirmedID = NewConfirmedID

        WHERE (Mobitel_ID = MobitelID) AND (ConfirmedID < NewConfirmedID);

      END IF;

      

      TRUNCATE TABLE datagpslost_rftmp;

    END IF;	 
    

    IF DataChanged = 1 THEN

      SET NeedOptimize = 1;

    END IF;

  

  END IF;	
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfMobitelConfig` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfMobitelConfig`(IN paramMobitelID INTEGER(11))
    COMMENT 'Выборка RF настроек заданного телетрека'
BEGIN

SELECT
  m.Mobitel_ID AS Mobitel_ID,
  m.Name AS Name,
  m.Descr AS Descr,
  m.ConfirmedID AS ConfirmedID,
  c.moduleIdRf AS moduleIdRf,
  FROM_UNIXTIME(m.LastInsertTime) AS LastInsertTime,
  ( SELECT COALESCE(d.LogID, 0)
    FROM datagps d
    WHERE d.Mobitel_ID = m.Mobitel_ID
    ORDER BY d.LogID DESC
    LIMIT 1 ) AS LastLogID
FROM mobitels m
  JOIN internalmobitelconfig c ON (c.ID = m.InternalMobitelConfig_ID)
WHERE (m.Mobitel_ID = paramMobitelID) AND
  (c.InternalMobitelConfig_ID = (
    SELECT intConf.InternalMobitelConfig_ID
    FROM internalmobitelconfig intConf
    WHERE intConf.ID = c.ID
    ORDER BY intConf.InternalMobitelConfig_ID DESC
    LIMIT 1)) AND
  (c.moduleIdRf IS NOT NULL) AND (c.moduleIdRf <> _cp1251'')
ORDER BY m.Mobitel_ID;
END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `RfTransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `RfTransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps.'
BEGIN



  DECLARE MobitelIDInCursor INT; 

  DECLARE DataExists TINYINT DEFAULT 1; 

  DECLARE NeedOptimize TINYINT DEFAULT 0; 

  DECLARE NeedOptimizeParam TINYINT;

  DECLARE TmpMaxUnixTime INT; 



  DECLARE CursorMobitels CURSOR FOR

    SELECT DISTINCT(Mobitel_ID) FROM datagpsbuffer;



  

  DECLARE CONTINUE HANDLER FOR NOT FOUND SET DataExists = 0;

  

    

  

  

  DELETE o

  FROM online o, datagpsbuffer_pop dgb

  WHERE (o.Mobitel_ID = dgb.Mobitel_ID) AND (o.LogID = dgb.LogID);

  

  SET DataExists = 1;

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    

    SELECT COALESCE(MAX(UnixTime), 0) INTO TmpMaxUnixTime

    FROM online FORCE INDEX (IDX_Mobitelid)

    WHERE Mobitel_ID = MobitelIDInCursor;



    

    INSERT INTO online (

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs)

    SELECT

      Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

      Direction, Speed, Valid, `Events`,

      Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

      Counter1, Counter2, Counter3, Counter4, whatIs

    FROM (

      SELECT * 

      FROM datagpsbuffer

      WHERE (Mobitel_ID = MobitelIDInCursor)  AND 

        (UnixTime > TmpMaxUnixTime) AND (Valid = 1)

      GROUP BY Mobitel_ID, LogID

      ORDER BY UnixTime DESC

      LIMIT 100) AS T

    ORDER BY UnixTime ASC; 



    

    DELETE FROM online

    WHERE (Mobitel_ID = MobitelIDInCursor) AND (UnixTime < 

      (SELECT COALESCE(MIN(UnixTime), 0) 

       FROM (

         SELECT UnixTime

         FROM online

         WHERE Mobitel_ID = MobitelIDInCursor 

         ORDER BY UnixTime DESC

         LIMIT 100) T1)); 

  

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;

    





  

  UPDATE datagps d, datagpsbuffer b SET

    d.Message_ID = 0, d.Latitude = b.Latitude,

    d.Longitude = b.Longitude,

    d.Altitude = b.Altitude,

    d.UnixTime = b.UnixTime,

    d.Speed = b.Speed,

    d.Direction = b.Direction,

    d.Valid = b.Valid,

    d.InMobitelID = b.LogID,

    d.`Events` = b.`Events`,

    d.Sensor1 = b.Sensor1,

    d.Sensor2 = b.Sensor2,

    d.Sensor3 = b.Sensor3,

    d.Sensor4 = b.Sensor4,

    d.Sensor5 = b.Sensor5,

    d.Sensor6 = b.Sensor6,

    d.Sensor7 = b.Sensor7,

    d.Sensor8 = b.Sensor8,

    d.isShow = 0,

    d.whatIs = b.whatIs,

    d.Counter1 = b.Counter1,

    d.Counter2 = b.Counter2,

    d.Counter3 = b.Counter3,

    d.Counter4 = b.Counter4

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  DELETE b

  FROM datagps d, datagpsbuffer b

  WHERE (d.Mobitel_ID = b.Mobitel_ID) AND (d.LogID = b.LogID);



  

  INSERT INTO datagps (

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, InMobitelID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4, whatIs)

  SELECT

    Mobitel_ID, LogID, UnixTime, Latitude, Longitude, Altitude,

    Direction, Speed, Valid, `Events`, LogID,

    Sensor1, Sensor2, Sensor3, Sensor4, Sensor5, Sensor6, Sensor7, Sensor8,

    Counter1, Counter2, Counter3, Counter4,

    whatIs

  FROM datagpsbuffer

  GROUP BY Mobitel_ID, LogID;



  

  SET DataExists = 1;

  OPEN CursorMobitels;

  FETCH CursorMobitels INTO MobitelIDInCursor;

  WHILE DataExists = 1 DO

    

    UPDATE mobitels SET LastInsertTime = UNIX_TIMESTAMP(NOW())

    WHERE Mobitel_ID = MobitelIDInCursor;

        

    

    CALL RfLostDataGPS(MobitelIDInCursor, NeedOptimizeParam);

    SET NeedOptimize = GREATEST(NeedOptimize, NeedOptimizeParam);

    

    FETCH CursorMobitels INTO MobitelIDInCursor;

  END WHILE;

  CLOSE CursorMobitels;



  

  TRUNCATE TABLE datagpsbuffer;



  

  IF NeedOptimize = 1 THEN

    OPTIMIZE TABLE datagpslost;

  END IF;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `SelectDataGpsPeriodAll` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `SelectDataGpsPeriodAll`(IN mobile int, IN beginperiod datetime, IN endperiod datetime,

IN timebegin varchar(9), IN timeend varchar(9), IN weekdays varchar(15), IN daymonth varchar(90))
BEGIN

  DECLARE time0 time DEFAULT '23:59:59';

  DECLARE time1 time DEFAULT '00:00:00'; 



  DROP TEMPORARY TABLE IF EXISTS tempperiod4;



  CREATE TEMPORARY TABLE tempperiod4 -- временная таблица выборок в указанном диапазоне

  SELECT

    DataGps_ID AS DataGps_ID,

    Mobitel_ID AS Mobitel_ID,

    ((Latitude * 1.0000) / 600000) AS Lat,

    ((Longitude * 1.0000) / 600000) AS Lon,

    Altitude AS Altitude,

    FROM_UNIXTIME(UnixTime) AS `time`,

    (Speed * 1.852) AS speed,

    Valid AS Valid,

    (Sensor8 + (Sensor7 << 8) + (Sensor6 << 16) + (Sensor5 << 24) + (Sensor4 << 32) + (Sensor3 << 40) + (Sensor2 << 48) + (Sensor1 << 56)) AS sensor,

    Events AS Events,

    LogID AS LogID

  FROM datagps

  WHERE Mobitel_ID = mobile AND

  (UnixTime BETWEEN UNIX_TIMESTAMP(beginperiod) AND UNIX_TIMESTAMP(endperiod)) AND

  (Valid = 1) AND NOT (Latitude = 0 AND Longitude = 0)

  ORDER BY UnixTime;



  DROP TEMPORARY TABLE IF EXISTS tempweeks;



  IF weekdays != '' THEN



    CREATE TEMPORARY TABLE tempweeks (

      shead varchar(2)

    );



    SET @saTail = weekdays;

    WHILE @saTail != '' DO

      SET @sHead = SUBSTRING_INDEX(@saTail, ';', 1);

      SET @saTail = SUBSTRING(@saTail, LENGTH(@sHead) + 2);

      INSERT INTO tempweeks (shead)

        VALUES (@sHead);

    END WHILE;

  END IF;



  DROP TEMPORARY TABLE IF EXISTS tempday0;



  IF daymonth != '' THEN



    CREATE TEMPORARY TABLE tempday0 (

      shead varchar(2)

    );



    SET @saTail = daymonth;

    WHILE @saTail != '' DO

      SET @sHead = SUBSTRING_INDEX(@saTail, ';', 1);

      SET @saTail = SUBSTRING(@saTail, LENGTH(@sHead) + 2);

      INSERT INTO tempday0 (shead)

        VALUES (@sHead);

    END WHILE;

  END IF;



  -- getting selecting data

  IF (daymonth != '') AND (weekdays != '') THEN

    IF TIME(timebegin) < TIME(timeend) then

    SELECT

      *

    FROM tempperiod4

    WHERE ((DAY(`time`) IN (SELECT

      *

    FROM tempday0)) AND -- чтение по дням месяца

    (WEEKDAY(`time`) IN (SELECT

      *

    FROM tempweeks)) AND -- чтение по дням недели

    (TIME(`time`) BETWEEN TIME(timebegin) AND TIME(timeend))); -- чтение дат

    END IF;



    IF TIME(timebegin) > TIME(timeend) then

    SELECT

      *

    FROM tempperiod4

    WHERE ((DAY(`time`) IN (SELECT

      *

    FROM tempday0)) AND -- чтение по дням месяца

    (WEEKDAY(`time`) IN (SELECT

      *

    FROM tempweeks)) AND -- чтение по дням недели

    ((time(`time`) > time(timebegin) and time(`time`) < time(time0))

    OR (time(`time`) > time(time1) AND time(`time`) < time(timeend)))); -- чтение дат

    END IF;

    END IF;



      IF (daymonth = '') AND (weekdays != '') THEN

        IF TIME(timebegin) < TIME(timeend) then

        SELECT

          *

        FROM tempperiod4

        WHERE ((WEEKDAY(`time`) IN (SELECT

          *

        FROM tempweeks)) AND -- чтение по дням недели

        (TIME(`time`) BETWEEN TIME(timebegin) AND TIME(timeend))); -- чтение дат

          end IF;



        IF TIME(timebegin) > TIME(timeend) then

        SELECT

          *

        FROM tempperiod4

        WHERE ((WEEKDAY(`time`) IN (SELECT

          *

        FROM tempweeks)) AND -- чтение по дням недели

        ((time(`time`) > time(timebegin) and time(`time`) < time(time0))

    OR (time(`time`) > time(time1) AND time(`time`) < time(timeend)))); -- чтение дат

          end IF;

        END IF;



          IF (daymonth != '') AND (weekdays = '') THEN

            IF TIME(timebegin) < TIME(timeend) then

            SELECT

              *

            FROM tempperiod4

            WHERE ((DAY(`time`) IN (SELECT

              *

            FROM tempday0)) AND -- чтение по дням месяца

            (TIME(`time`) BETWEEN TIME(timebegin) AND TIME(timeend))); -- чтение дат

              END IF;



            IF TIME(timebegin) > TIME(timeend) then

            SELECT

              *

            FROM tempperiod4

            WHERE ((DAY(`time`) IN (SELECT

              *

            FROM tempday0)) AND -- чтение по дням месяца

            ((time(`time`) > time(timebegin) and time(`time`) < time(time0))

              OR (time(`time`) > time(time1) AND time(`time`) < time(timeend)))); -- чтение дат

              END IF;

            END IF;



              IF (daymonth = '') AND (weekdays = '') THEN

                IF TIME(timebegin) < TIME(timeend) then

                SELECT

                  *

                FROM tempperiod4

                WHERE (TIME(`time`) BETWEEN TIME(timebegin) AND TIME(timeend)); -- чтение дат

                  end IF;



                IF TIME(timebegin) > TIME(timeend) then

                SELECT

                  *

                FROM tempperiod4

                WHERE ((time(`time`) > time(timebegin) and time(`time`) < time(time0))

                  OR (time(`time`) > time(time1) AND time(`time`) < time(timeend))); -- чтение дат

                  end IF;

              END IF;

            END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `TestP` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `TestP`()
BEGIN

  SELECT VERSION();

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `TransferBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `TransferBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps.'
BEGIN









CREATE TEMPORARY TABLE IF NOT EXISTS temp1 ENGINE=HEAP(

  SELECT DataGPS_ID FROM datagpsbuffer

  );





UPDATE datagps d, datagpsbuffer b, temp1 t SET

  d.Message_ID = 0, 
  d.Latitude = b.Latitude,

  d.Longitude = b.Longitude,

  d.Altitude = b.Altitude,

  d.UnixTime = b.UnixTime,

  d.Speed = b.Speed,

  d.Direction = b.Direction,

  d.Valid = b.Valid,

  d.InMobitelID = NULL, 
  d.`Events` = b.`Events`,

  d.Sensor1 = b.Sensor1,

  d.Sensor2 = b.Sensor2,

  d.Sensor3 = b.Sensor3,

  d.Sensor4 = b.Sensor4,

  d.Sensor5 = b.Sensor5,

  d.Sensor6 = b.Sensor6,

  d.Sensor7 = b.Sensor7,

  d.Sensor8 = b.Sensor8,

  d.isShow = 0, 
  d.whatIs = b.whatIs,

  d.Counter1 = b.Counter1,

  d.Counter2 = b.Counter2,

  d.Counter3 = b.Counter3,

  d.Counter4 = b.Counter4

WHERE b.DataGps_ID = t.DataGps_ID

  AND d.Mobitel_ID = b.Mobitel_ID

  AND d.LogID = b.LogID;




DELETE b

FROM datagps d, datagpsbuffer b, temp1 t

WHERE b.DataGps_ID = t.DataGps_ID

  AND d.Mobitel_ID = b.Mobitel_ID

  AND d.LogID = b.LogID;




INSERT INTO datagps

  (

  Mobitel_ID,

  LogID,

  UnixTime,

  Latitude,

  Longitude,

  Altitude,

  Direction,

  Speed,

  Valid,

  `Events`,

  Sensor1,

  Sensor2,

  Sensor3,

  Sensor4,

  Sensor5,

  Sensor6,

  Sensor7,

  Sensor8,

  Counter1,

  Counter2,

  Counter3,

  Counter4,

  whatIs

  )

SELECT

  b.Mobitel_ID,

  b.LogID,

  b.UnixTime,

  b.Latitude,

  b.Longitude,

  b.Altitude,

  b.Direction,

  b.Speed,

  b.Valid,

  b.`Events`,

  b.Sensor1,

  b.Sensor2,

  b.Sensor3,

  b.Sensor4,

  b.Sensor5,

  b.Sensor6,

  b.Sensor7,

  b.Sensor8,

  b.Counter1,

  b.Counter2,

  b.Counter3,

  b.Counter4,

  b.whatIs

FROM datagpsbuffer b, temp1 t

WHERE b.DataGps_ID = t.DataGps_ID

GROUP BY b.Mobitel_ID, b.LogID;




DELETE b

FROM datagpsbuffer b, temp1 t

WHERE b.DataGps_ID = t.DataGps_ID;




DROP TEMPORARY TABLE temp1;

END ;;
DELIMITER ;
/*!50003 DROP PROCEDURE IF EXISTS `TransferLiteBuffer` */;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `TransferLiteBuffer`()
    SQL SECURITY INVOKER
    COMMENT 'Переносит GPS данные из буферной таблицы в datagps.'
BEGIN









CREATE TEMPORARY TABLE IF NOT EXISTS temp2 ENGINE=HEAP(

  SELECT DataGPS_ID FROM datagpsbufferlite

  );





UPDATE datagps d, datagpsbuffer b, temp2 t SET

  d.Message_ID = b.Message_ID,

  d.Latitude = b.Latitude,

  d.Longitude = b.Longitude,

  d.Altitude = b.Altitude,

  d.UnixTime = b.UnixTime,

  d.Speed = b.Speed,

  d.Direction = b.Direction,

  d.Valid = b.Valid,

  d.InMobitelID = NULL, 
  d.`Events` = b.`Events`,

  d.Sensor1 = b.Sensor1,

  d.Sensor2 = b.Sensor2,

  d.Sensor3 = b.Sensor3,

  d.Sensor4 = b.Sensor4,

  d.Sensor5 = b.Sensor5,

  d.Sensor6 = b.Sensor6,

  d.Sensor7 = b.Sensor7,

  d.Sensor8 = b.Sensor8,

  d.isShow = b.IsShow,

  d.whatIs = b.whatIs,

  d.Counter1 = b.Counter1,

  d.Counter2 = b.Counter2,

  d.Counter3 = b.Counter3,

  d.Counter4 = b.Counter4

WHERE b.DataGps_ID = t.DataGps_ID

  AND d.Mobitel_ID = b.Mobitel_ID

  AND d.Latitude = b.Latitude

  AND d.Longitude = b.Longitude

  AND d.Altitude = b.Altitude

  AND d.UnixTime = b.UnixTime;




DELETE b

FROM datagps d, datagpsbufferlite b, temp2 t

WHERE b.DataGps_ID = t.DataGps_ID

  AND d.Mobitel_ID = b.Mobitel_ID

  AND d.Latitude = b.Latitude

  AND d.Longitude = b.Longitude

  AND d.Altitude = b.Altitude

  AND d.UnixTime = b.UnixTime;




INSERT INTO datagps

  (

  Mobitel_ID,

  LogID,

  UnixTime,

  Latitude,

  Longitude,

  Altitude,

  Direction,

  Speed,

  Valid,

  `Events`,

  Sensor1,

  Sensor2,

  Sensor3,

  Sensor4,

  Sensor5,

  Sensor6,

  Sensor7,

  Sensor8,

  Counter1,

  Counter2,

  Counter3,

  Counter4,

  whatIs

  )

SELECT

  b.Mobitel_ID,

  b.LogID,

  b.UnixTime,

  b.Latitude,

  b.Longitude,

  b.Altitude,

  b.Direction,

  b.Speed,

  b.Valid,

  b.`Events`,

  b.Sensor1,

  b.Sensor2,

  b.Sensor3,

  b.Sensor4,

  b.Sensor5,

  b.Sensor6,

  b.Sensor7,

  b.Sensor8,

  b.Counter1,

  b.Counter2,

  b.Counter3,

  b.Counter4,

  b.whatIs

FROM datagpsbufferlite b, temp2 t

WHERE b.DataGps_ID = t.DataGps_ID

GROUP BY b.Mobitel_ID, b.LogID, b.Latitude, b.Longitude, b.Altitude, b.UnixTime;




DELETE b

FROM datagpsbufferlite b, temp2 t

WHERE b.DataGps_ID = t.DataGps_ID;




DROP TEMPORARY TABLE temp2;

END ;;
DELIMITER ;

--
-- Final view structure for view `datavalue1`
--

/*!50001 DROP VIEW IF EXISTS `datavalue1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `datavalue1` AS select round((`datagps`.`Longitude` / 600000),6) AS `lon`,round((`datagps`.`Latitude` / 600000),6) AS `lat`,`datagps`.`Mobitel_ID` AS `Mobitel_ID`,`sensordata`.`Value` AS `Value`,(`datagps`.`Speed` * 1.852) AS `speed`,from_unixtime(`datagps`.`UnixTime`) AS `time`,`sensordata`.`sensor_id` AS `sensor_id`,`datagps`.`DataGps_ID` AS `datavalue_id` from (`sensordata` join `datagps` on((`sensordata`.`datagps_id` = `datagps`.`DataGps_ID`))) where (`datagps`.`Valid` = 1) order by `datagps`.`UnixTime`,`datagps`.`Mobitel_ID`,`sensordata`.`sensor_id` */;

--
-- Final view structure for view `dataview`
--

/*!50001 DROP VIEW IF EXISTS `dataview`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `dataview` AS select `datagps`.`DataGps_ID` AS `DataGps_ID`,`datagps`.`Mobitel_ID` AS `Mobitel_ID`,(`datagps`.`Latitude` / 600000.00000) AS `Lat`,(`datagps`.`Longitude` / 600000.00000) AS `Lon`,`datagps`.`Altitude` AS `Altitude`,from_unixtime(`datagps`.`UnixTime`) AS `time`,(`datagps`.`Speed` * 1.852) AS `speed`,((`datagps`.`Direction` * 360) / 255) AS `direction`,`datagps`.`Valid` AS `Valid`,(((((((`datagps`.`Sensor8` + (`datagps`.`Sensor7` << 8)) + (`datagps`.`Sensor6` << 16)) + (`datagps`.`Sensor5` << 24)) + (`datagps`.`Sensor4` << 32)) + (`datagps`.`Sensor3` << 40)) + (`datagps`.`Sensor2` << 48)) + (`datagps`.`Sensor1` << 56)) AS `sensor`,`datagps`.`Events` AS `Events`,`datagps`.`LogID` AS `LogID` from `datagps` order by `datagps`.`LogID` */;

--
-- Final view structure for view `deviceview`
--

/*!50001 DROP VIEW IF EXISTS `deviceview`*/;
/*!50001 CREATE ALGORITHM=MERGE */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `deviceview` AS (select `m`.`Mobitel_ID` AS `Mobitel_ID`,`m`.`Name` AS `Name`,`m`.`Descr` AS `Descr`,`c`.`devIdShort` AS `devIdShort`,`m`.`DeviceType` AS `DeviceType`,`m`.`ConfirmedID` AS `ConfirmedID`,`c`.`moduleIdRf` AS `moduleIdRf` from ((`mobitels` `m` join `internalmobitelconfig` `c`) join `internalmobitelconfigview` `v`) where ((`v`.`ID` = `m`.`InternalMobitelConfig_ID`) and (`v`.`LastRecord` = `c`.`InternalMobitelConfig_ID`)) order by `m`.`Name`) */;

--
-- Final view structure for view `internalmobitelconfigview`
--

/*!50001 DROP VIEW IF EXISTS `internalmobitelconfigview`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `internalmobitelconfigview` AS (select `c`.`ID` AS `ID`,max(`c`.`InternalMobitelConfig_ID`) AS `LastRecord` from `internalmobitelconfig` `c` where (`c`.`devIdShort` <> _cp1251'') group by `c`.`ID`) */;


