-- MySQL dump 10.14  Distrib 5.5.60-MariaDB, for Linux (x86_64)
--
-- Host: localhost    Database: juice4
-- ------------------------------------------------------
-- Server version	5.5.60-MariaDB

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `Xarrears1`
--

DROP TABLE IF EXISTS `Xarrears1`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Xarrears1` (
  `timestamp` bigint(17) DEFAULT NULL,
  `label` varchar(20) NOT NULL DEFAULT '',
  `arrearstype` varchar(20) CHARACTER SET utf8mb4 DEFAULT '',
  `balance` double(19,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Xarrears2`
--

DROP TABLE IF EXISTS `Xarrears2`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Xarrears2` (
  `label` varchar(20) NOT NULL DEFAULT '',
  `PayPlan` double(19,2) DEFAULT NULL,
  `FixedCharge` double(19,2) DEFAULT NULL,
  `HouseWiringLoan` double(19,2) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Xlossanal`
--

DROP TABLE IF EXISTS `Xlossanal`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Xlossanal` (
  `account` varchar(20) NOT NULL DEFAULT '00000001',
  `name` varchar(120) DEFAULT NULL,
  `address1` varchar(80) DEFAULT NULL,
  `address2` varchar(80) DEFAULT NULL,
  `city` varchar(20) DEFAULT NULL,
  `tariff` varchar(10) DEFAULT '',
  `first` datetime DEFAULT '1970-01-01 00:00:01',
  `last` datetime DEFAULT '1970-01-01 00:00:01',
  `trans` double(16,2) DEFAULT '0.00',
  `total` double(16,2) DEFAULT '0.00',
  `averagemth` double(16,2) DEFAULT '0.00',
  `Y2010` decimal(58,4) DEFAULT NULL,
  `Y2011` decimal(58,4) DEFAULT NULL,
  `Y2012` decimal(58,4) DEFAULT NULL,
  `Y2013` decimal(58,4) DEFAULT NULL,
  `Y2014` decimal(58,4) DEFAULT NULL,
  `M201301` decimal(58,4) DEFAULT NULL,
  `M201302` decimal(58,4) DEFAULT NULL,
  `M201303` decimal(58,4) DEFAULT NULL,
  `M201304` decimal(58,4) DEFAULT NULL,
  `M201305` decimal(58,4) DEFAULT NULL,
  `M201306` decimal(58,4) DEFAULT NULL,
  `M201307` decimal(58,4) DEFAULT NULL,
  `M201308` decimal(58,4) DEFAULT NULL,
  `M201309` decimal(58,4) DEFAULT NULL,
  `M201310` decimal(58,4) DEFAULT NULL,
  `M201311` decimal(58,4) DEFAULT NULL,
  `M201312` decimal(58,4) DEFAULT NULL,
  `M201401` decimal(58,4) DEFAULT NULL,
  `M201402` decimal(58,4) DEFAULT NULL,
  `M201403` decimal(58,4) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Xsa`
--

DROP TABLE IF EXISTS `Xsa`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Xsa` (
  `portal` varchar(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT 'demo',
  `account` varchar(20) CHARACTER SET utf8mb4 NOT NULL DEFAULT '0000001',
  `arrearsid` bigint(20) DEFAULT NULL,
  `arrearstype` varchar(20) CHARACTER SET utf8mb4 DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `balance` double(19,2) DEFAULT NULL,
  `age` varchar(20) NOT NULL DEFAULT '',
  `original` double(16,2) DEFAULT '0.00',
  KEY `account` (`account`),
  KEY `arrearsid` (`arrearsid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Xstats`
--

DROP TABLE IF EXISTS `Xstats`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Xstats` (
  `account` varchar(20) NOT NULL DEFAULT '0000000',
  `Y2010` decimal(58,4) DEFAULT NULL,
  `Y2011` decimal(58,4) DEFAULT NULL,
  `Y2012` decimal(58,4) DEFAULT NULL,
  `Y2013` decimal(58,4) DEFAULT NULL,
  `Y2014` decimal(58,4) DEFAULT NULL,
  `M201301` decimal(58,4) DEFAULT NULL,
  `M201302` decimal(58,4) DEFAULT NULL,
  `M201303` decimal(58,4) DEFAULT NULL,
  `M201304` decimal(58,4) DEFAULT NULL,
  `M201305` decimal(58,4) DEFAULT NULL,
  `M201306` decimal(58,4) DEFAULT NULL,
  `M201307` decimal(58,4) DEFAULT NULL,
  `M201308` decimal(58,4) DEFAULT NULL,
  `M201309` decimal(58,4) DEFAULT NULL,
  `M201310` decimal(58,4) DEFAULT NULL,
  `M201311` decimal(58,4) DEFAULT NULL,
  `M201312` decimal(58,4) DEFAULT NULL,
  `M201401` decimal(58,4) DEFAULT NULL,
  `M201402` decimal(58,4) DEFAULT NULL,
  `M201403` decimal(58,4) DEFAULT NULL,
  `first` datetime DEFAULT '1970-01-01 00:00:01',
  `last` datetime DEFAULT '1970-01-01 00:00:01',
  `tariff` varchar(10) DEFAULT '',
  `trans` double(16,2) DEFAULT '0.00',
  `total` double(16,2) DEFAULT '0.00',
  `averagemth` double(16,2) DEFAULT '0.00',
  KEY `account` (`account`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Xuwnotify`
--

DROP TABLE IF EXISTS `Xuwnotify`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Xuwnotify` (
  `uniq` bigint(20) NOT NULL DEFAULT '0',
  `portal` varchar(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT 'demo',
  `account` varchar(20) CHARACTER SET utf8mb4 NOT NULL DEFAULT '00000001',
  `name` varchar(120) CHARACTER SET utf8mb4 DEFAULT NULL,
  `email1` varchar(120) CHARACTER SET utf8mb4 DEFAULT NULL,
  `email2` varchar(120) CHARACTER SET utf8mb4 DEFAULT NULL,
  `sms1` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL,
  `sms2` varchar(20) CHARACTER SET utf8mb4 DEFAULT NULL,
  `meterreaddays` double(16,2) DEFAULT '0.00',
  `adu` double(16,2) DEFAULT '0.00',
  `uwbal` double(16,2) DEFAULT '0.00',
  `days` double(16,2) DEFAULT '0.00',
  `notifydays` int(2) DEFAULT '3',
  `activity` varchar(8) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
  `meterstate` varchar(17) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
  `notify` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
  `email` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
  `sms` varchar(1) CHARACTER SET utf8mb4 NOT NULL DEFAULT '',
  KEY `account` (`account`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Xvb`
--

DROP TABLE IF EXISTS `Xvb`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Xvb` (
  `portal` varchar(20) NOT NULL DEFAULT 'demo',
  `login` varchar(20) DEFAULT '',
  `D` varchar(10) DEFAULT NULL,
  `batchnum` int(10) DEFAULT '0',
  `type` varchar(10) DEFAULT '',
  `total` double(19,2) DEFAULT NULL,
  `B` double(16,2) DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `Xzv`
--

DROP TABLE IF EXISTS `Xzv`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Xzv` (
  `vendornumber` varchar(30) CHARACTER SET utf8mb4 DEFAULT '',
  `vendorname` varchar(30) CHARACTER SET utf8mb4 DEFAULT '',
  `lastpay` datetime DEFAULT '0000-00-00 00:00:00',
  `monthly` double(16,2) DEFAULT '0.00',
  `owed` double(16,2) DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `accttype`
--

DROP TABLE IF EXISTS `accttype`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `accttype` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `accttype` varchar(20) NOT NULL,
  `description` varchar(20) NOT NULL,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `comments` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `accttype` (`accttype`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `adjustments`
--

DROP TABLE IF EXISTS `adjustments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `adjustments` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '*',
  `account` varchar(20) DEFAULT '',
  `status` varchar(20) DEFAULT 'unverified',
  `amount` double(16,2) DEFAULT '0.00',
  `target` varchar(20) DEFAULT 'Wallet',
  `comment` varchar(80) DEFAULT 'Adjustment',
  `credit` varchar(20) DEFAULT '4900',
  `debit` varchar(20) DEFAULT '1110',
  `transaction` bigint(20) NOT NULL DEFAULT '0',
  `created` datetime DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `allreports`
--

DROP TABLE IF EXISTS `allreports`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `allreports` (
  `uniq` int(10) NOT NULL DEFAULT '0',
  `itemgroup` varchar(20) DEFAULT 'lookup',
  `itemid` varchar(20) DEFAULT 'uniqid',
  `itemname` varchar(60) DEFAULT '',
  `itemdesc` text,
  `seclevel` int(6) DEFAULT '90',
  `availtologins` text,
  `availtoroles` text,
  `query` text,
  `query2` text,
  `groupon` text,
  `asnumbers` text NOT NULL,
  `totals` text,
  `input1field` text,
  `input1source` varchar(80) DEFAULT '',
  `input2field` text,
  `input2source` varchar(80) DEFAULT '',
  `input3field` text,
  `input3source` varchar(80) DEFAULT '',
  `input4field` text,
  `input4source` varchar(80) DEFAULT '',
  `input5field` text,
  `input5source` varchar(80) DEFAULT '',
  `input6field` text,
  `input6source` varchar(80) DEFAULT '',
  `input7field` text,
  `input7source` varchar(80) DEFAULT '',
  `input8field` text,
  `input8source` varchar(80) DEFAULT '',
  `input9field` text,
  `input9source` varchar(80) DEFAULT '',
  `output` varchar(20) DEFAULT 'REPORT',
  `outputformats` varchar(80) DEFAULT 'HTML|CSV|XLS|PDF',
  `outputmode` varchar(80) DEFAULT 'NOW|OFFLINE|EMAIL',
  `groupchart` text,
  `totalchart` text,
  `mapchart` text,
  `displaynotes` text,
  `comments` text,
  `defaultdatemode` varchar(10) DEFAULT 'D',
  `fieldcharlimit` int(6) DEFAULT '40',
  `maxtime` double(16,4) DEFAULT '0.0000',
  `counter` int(10) DEFAULT '0',
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT '1970-01-01 00:00:01'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `amical`
--

DROP TABLE IF EXISTS `amical`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `amical` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT 'portal',
  `date` date NOT NULL DEFAULT '1970-01-01',
  `mode` varchar(20) DEFAULT 'NO DISCONNECTS',
  `comment` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `date` (`date`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `amiconfig`
--

DROP TABLE IF EXISTS `amiconfig`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `amiconfig` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `discomode` varchar(20) DEFAULT 'PENDINGDISCO',
  `discodeadline` varchar(20) DEFAULT '13:30',
  `discosaturday` int(1) DEFAULT '0',
  `discosunday` int(1) DEFAULT '0',
  `comment` text,
  `readavgdaysmin` int(10) DEFAULT '9',
  `readusagethreshold` int(10) DEFAULT '5',
  `readmaxperc` int(10) DEFAULT '200',
  `readminperc` int(10) DEFAULT '20',
  `portal` varchar(10) DEFAULT 'juice',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `amicontrol`
--

DROP TABLE IF EXISTS `amicontrol`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `amicontrol` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `time` time DEFAULT '00:00:00',
  `dow` varchar(10) DEFAULT '*',
  `command` varchar(20) DEFAULT 'none',
  `controlgroup` text,
  `controlgroupdesc` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `time` (`time`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `amountasportal`
--

DROP TABLE IF EXISTS `amountasportal`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `amountasportal` (
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `uniq` bigint(20) NOT NULL DEFAULT '0',
  `type` varchar(10) DEFAULT '',
  `login` varchar(20) DEFAULT '',
  `account` varchar(20) NOT NULL DEFAULT '0000000',
  `amount` double(16,2) DEFAULT '0.00',
  `applied` double(16,2) NOT NULL DEFAULT '0.00',
  `arrearsid` int(8) DEFAULT '1',
  `originaltrans` bigint(20) DEFAULT '0',
  `originaldate` date DEFAULT '1970-01-01',
  `original` double(16,2) DEFAULT '0.00',
  `balance` double(16,2) DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `archivebankpays`
--

DROP TABLE IF EXISTS `archivebankpays`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `archivebankpays` (
  `uniq` int(10) NOT NULL DEFAULT '0',
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `account` varchar(20) NOT NULL,
  `contract` varchar(20) NOT NULL,
  `nameonpayment` varchar(40) NOT NULL,
  `invoice` varchar(20) NOT NULL,
  `govnum` varchar(20) NOT NULL,
  `serialnumber` varchar(20) NOT NULL,
  `source` varchar(20) NOT NULL,
  `imported` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `status` varchar(20) NOT NULL DEFAULT 'incoming',
  `substatus` varchar(20) DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `tax` double(16,2) DEFAULT '0.00',
  `currency` varchar(3) DEFAULT 'DOP',
  `transaction` varchar(20) DEFAULT '',
  `applied` datetime DEFAULT '1970-01-01 00:00:01',
  `login` varchar(20) DEFAULT 'system',
  `comments` text,
  `original` text,
  `paytype` varchar(20) NOT NULL DEFAULT '',
  `paynum` varchar(20) NOT NULL DEFAULT '',
  `batch` int(10) NOT NULL DEFAULT '0',
  `checksum` varchar(40) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `arrearstype`
--

DROP TABLE IF EXISTS `arrearstype`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `arrearstype` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `arrearstype` varchar(20) DEFAULT '',
  `description` varchar(80) DEFAULT '',
  `coa` varchar(20) DEFAULT '',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `selectable` int(1) DEFAULT '1',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `what` (`portal`,`coa`),
  KEY `portal` (`portal`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `babel`
--

DROP TABLE IF EXISTS `babel`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `babel` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `lang` varchar(10) DEFAULT 'en_US',
  `english` text,
  `display` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `used` varchar(40) DEFAULT '',
  `counter` int(10) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `lang` (`lang`) USING BTREE,
  KEY `english` (`english`(20)) USING BTREE,
  KEY `display` (`display`(20)) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `babelfr`
--

DROP TABLE IF EXISTS `babelfr`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `babelfr` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `lang` varchar(10) DEFAULT 'en_US',
  `english` text,
  `display` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `lang` (`lang`) USING BTREE,
  KEY `english` (`english`(20)) USING BTREE,
  KEY `display` (`display`(20)) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `batchcharge`
--

DROP TABLE IF EXISTS `batchcharge`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `batchcharge` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `entity` varchar(20) NOT NULL,
  `imported` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `applied` datetime DEFAULT '1970-01-01 00:00:01',
  `account` varchar(20) NOT NULL,
  `contract` varchar(20) NOT NULL,
  `nameoncharge` varchar(40) NOT NULL,
  `invoice` varchar(20) NOT NULL,
  `govnum` varchar(20) NOT NULL,
  `source` varchar(20) NOT NULL,
  `status` varchar(20) NOT NULL DEFAULT 'incoming',
  `substatus` varchar(20) DEFAULT '',
  `typeofcharge` varchar(20) NOT NULL,
  `chargeqty` double(16,2) DEFAULT '0.00',
  `chargedesc` varchar(120) NOT NULL,
  `amount` double(16,2) DEFAULT '0.00',
  `currency` varchar(3) DEFAULT 'DOP',
  `transaction` varchar(20) DEFAULT '',
  `login` varchar(20) DEFAULT 'system',
  `comments` text,
  `original` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `imported` (`imported`) USING BTREE,
  KEY `applied` (`applied`) USING BTREE,
  KEY `transaction` (`transaction`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `batchmaeq`
--

DROP TABLE IF EXISTS `batchmaeq`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `batchmaeq` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `accountuniq` varchar(20) DEFAULT '',
  `meterid` varchar(40) DEFAULT '',
  `command` varchar(80) DEFAULT '',
  `value` varchar(80) DEFAULT '',
  `status` varchar(10) DEFAULT 'new',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `accountuniq` (`accountuniq`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `batchpay`
--

DROP TABLE IF EXISTS `batchpay`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `batchpay` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL,
  `contract` varchar(20) NOT NULL,
  `nameonpayment` varchar(40) NOT NULL,
  `invoice` varchar(20) NOT NULL,
  `govnum` varchar(20) NOT NULL,
  `serialnumber` varchar(20) NOT NULL,
  `source` varchar(20) NOT NULL,
  `imported` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `status` varchar(20) NOT NULL DEFAULT 'incoming',
  `substatus` varchar(20) DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `tax` double(16,2) DEFAULT '0.00',
  `currency` varchar(3) DEFAULT 'DOP',
  `transaction` varchar(20) DEFAULT '',
  `applied` datetime DEFAULT '1970-01-01 00:00:01',
  `login` varchar(20) DEFAULT 'system',
  `comments` text,
  `original` text,
  `paytype` varchar(20) NOT NULL DEFAULT '',
  `paynum` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `imported` (`imported`) USING BTREE,
  KEY `applied` (`applied`) USING BTREE,
  KEY `transaction` (`transaction`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `billing`
--

DROP TABLE IF EXISTS `billing`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `billing` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT '0000001',
  `billdate` date NOT NULL DEFAULT '1970-01-01',
  `itemtype` varchar(10) DEFAULT '',
  `qty` double(16,2) DEFAULT '0.00',
  `units` double(16,2) DEFAULT '0.00',
  `unitstype` varchar(10) DEFAULT '',
  `description` text,
  `amount` double(16,2) DEFAULT '0.00',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `billdate` (`billdate`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `blacklist`
--

DROP TABLE IF EXISTS `blacklist`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `blacklist` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT '0000001',
  `fromip` varchar(20) NOT NULL DEFAULT '127.0.0.2',
  `velocity` int(8) DEFAULT '0',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `comments` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `fromip` (`fromip`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `bluepay`
--

DROP TABLE IF EXISTS `bluepay`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `bluepay` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '*',
  `account` varchar(20) DEFAULT '',
  `transaction` bigint(20) DEFAULT '0',
  `id` varchar(20) DEFAULT '',
  `paymenttype` varchar(20) DEFAULT '',
  `transtype` varchar(10) DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `cardtype` varchar(10) DEFAULT '',
  `paymentaccount` varchar(20) DEFAULT '',
  `orderid` varchar(20) DEFAULT '',
  `invoiceid` varchar(20) DEFAULT '',
  `customid` varchar(20) DEFAULT '',
  `customid2` varchar(20) DEFAULT '',
  `masterid` varchar(20) DEFAULT '',
  `status` varchar(10) DEFAULT '',
  `fvoid` varchar(20) DEFAULT '',
  `message` varchar(20) DEFAULT '',
  `origin` varchar(10) DEFAULT '',
  `issuedate` datetime DEFAULT '1970-01-01 00:00:01',
  `settledate` datetime DEFAULT '1970-01-01 00:00:01',
  `rebillingid` varchar(20) DEFAULT '',
  `settlementid` varchar(20) DEFAULT '',
  `cardexpire` varchar(4) DEFAULT '0000',
  `bankname` varchar(20) DEFAULT '',
  `addr1` varchar(20) DEFAULT '',
  `addr2` varchar(20) DEFAULT '',
  `city` varchar(20) DEFAULT '',
  `state` varchar(20) DEFAULT '',
  `zip` varchar(20) DEFAULT '',
  `phone` varchar(20) DEFAULT '',
  `email` varchar(80) DEFAULT '',
  `authcode` varchar(20) DEFAULT '',
  `name1` varchar(20) DEFAULT '',
  `name2` varchar(20) DEFAULT '',
  `companyname` varchar(20) DEFAULT '',
  `memo` varchar(20) DEFAULT '',
  `backendid` varchar(20) DEFAULT '',
  `accountid` varchar(20) DEFAULT '',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `iduniq` (`uniq`),
  UNIQUE KEY `id` (`id`),
  KEY `account` (`account`) USING BTREE,
  KEY `transaction` (`transaction`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `capmi`
--

DROP TABLE IF EXISTS `capmi`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `capmi` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'eedc',
  `entity` varchar(10) NOT NULL DEFAULT 'eedc',
  `account` varchar(20) NOT NULL DEFAULT '0000001',
  `locid` varchar(20) DEFAULT NULL,
  `serialnumber` varchar(32) DEFAULT NULL,
  `transaction` bigint(20) DEFAULT '0',
  `readstart` double(16,2) DEFAULT '0.00',
  `readend` double(16,2) DEFAULT '0.00',
  `chargedate` date NOT NULL DEFAULT '1970-01-01',
  `chargetype` varchar(10) DEFAULT NULL,
  `chargedesc` varchar(80) DEFAULT '',
  `chargeqty` double(16,2) NOT NULL DEFAULT '0.00',
  `chargeamount` double(16,6) NOT NULL DEFAULT '0.000000',
  `chargetotal` double(16,2) NOT NULL DEFAULT '0.00',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `readstartdate` datetime DEFAULT '1970-01-01 00:00:01',
  `readenddate` datetime DEFAULT '1970-01-01 00:00:01',
  `coa` varchar(20) DEFAULT NULL,
  `arcoa` varchar(10) DEFAULT '1102',
  `chargesuniq` bigint(20) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `chargedate` (`chargedate`) USING BTREE,
  KEY `chargesuniq` (`chargesuniq`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `charges`
--

DROP TABLE IF EXISTS `charges`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `charges` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `entity` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT '0000001',
  `locid` varchar(20) DEFAULT NULL,
  `serialnumber` varchar(32) DEFAULT NULL,
  `transaction` int(10) DEFAULT '0',
  `readstart` double(16,2) DEFAULT '0.00',
  `readend` double(16,2) DEFAULT '0.00',
  `coa` varchar(20) DEFAULT NULL,
  `chargedate` date NOT NULL DEFAULT '1970-01-01',
  `chargetype` varchar(10) DEFAULT NULL,
  `chargedesc` varchar(80) DEFAULT '',
  `chargeqty` double(16,2) NOT NULL DEFAULT '0.00',
  `chargeamount` double(16,6) NOT NULL DEFAULT '0.000000',
  `chargetotal` double(16,2) NOT NULL DEFAULT '0.00',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `readstartdate` datetime DEFAULT '1970-01-01 00:00:01',
  `readenddate` datetime DEFAULT '1970-01-01 00:00:01',
  `arcoa` varchar(10) DEFAULT '1102',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `chargedate` (`chargedate`) USING BTREE,
  KEY `transaction` (`transaction`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `charts`
--

DROP TABLE IF EXISTS `charts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `charts` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `charts` varchar(20) DEFAULT NULL,
  `description` varchar(80) DEFAULT NULL,
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cities`
--

DROP TABLE IF EXISTS `cities`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cities` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `city` varchar(20) NOT NULL,
  `sortorder` smallint(3) DEFAULT '0',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `portal` (`portal`,`city`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `clients`
--

DROP TABLE IF EXISTS `clients`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `clients` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL,
  `state` varchar(20) NOT NULL,
  `name` varchar(80) NOT NULL,
  `description` varchar(80) NOT NULL,
  `url` varchar(80) NOT NULL,
  `url2` varchar(80) NOT NULL,
  `active` int(1) NOT NULL DEFAULT '0',
  `comments` text,
  `lat` varchar(20) DEFAULT '',
  `lon` varchar(20) DEFAULT '',
  `checks` int(1) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `cloudmessage`
--

DROP TABLE IF EXISTS `cloudmessage`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `cloudmessage` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` int(10) NOT NULL DEFAULT '0',
  `account` bigint(20) NOT NULL DEFAULT '0',
  `fcmid` text NOT NULL,
  PRIMARY KEY (`uniq`),
  KEY `portal` (`portal`),
  KEY `account` (`account`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `coa`
--

DROP TABLE IF EXISTS `coa`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `coa` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `coa` varchar(20) DEFAULT '',
  `exportcoa` varchar(20) DEFAULT '',
  `coadesc` varchar(60) DEFAULT '',
  `description` text,
  `accounttype` varchar(20) DEFAULT '',
  `comments` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `what` (`portal`,`coa`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `coa` (`coa`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `com`
--

DROP TABLE IF EXISTS `com`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `com` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `com` varchar(20) NOT NULL DEFAULT 'none',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `com` (`com`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `content`
--

DROP TABLE IF EXISTS `content`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `content` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '',
  `contentid` varchar(40) DEFAULT '',
  `lang` varchar(2) DEFAULT 'en',
  `content` text,
  `comments` varchar(80) DEFAULT '',
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `contentid` (`contentid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `contracts`
--

DROP TABLE IF EXISTS `contracts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `contracts` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `contract` varchar(20) NOT NULL,
  `login` varchar(20) NOT NULL,
  `account` varchar(20) NOT NULL,
  `tariff` varchar(20) NOT NULL,
  `minimum` varchar(20) NOT NULL,
  `discountkwh` int(10) NOT NULL,
  `discountperc` int(10) NOT NULL,
  `start` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `expires` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `comments` text,
  `billpowerfactor` int(1) DEFAULT '0',
  `billkwhpeak` int(1) DEFAULT '0',
  `peaktariff` varchar(12) DEFAULT '',
  `creditlimit` double(16,2) DEFAULT '0.00',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `contract` (`contract`) USING BTREE,
  KEY `account` (`account`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `controlgroup1`
--

DROP TABLE IF EXISTS `controlgroup1`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `controlgroup1` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `controlgroup1` varchar(40) NOT NULL DEFAULT '',
  `controlgroup1desc` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `controlgroup1` (`controlgroup1`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `controlgroup2`
--

DROP TABLE IF EXISTS `controlgroup2`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `controlgroup2` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `controlgroup2` varchar(20) NOT NULL DEFAULT '',
  `controlgroup2desc` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `controlgroup2` (`controlgroup2`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `controlgroup3`
--

DROP TABLE IF EXISTS `controlgroup3`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `controlgroup3` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `controlgroup3` varchar(20) NOT NULL DEFAULT '',
  `controlgroup3desc` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `controlgroup3` (`controlgroup3`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `currencies`
--

DROP TABLE IF EXISTS `currencies`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `currencies` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `mnytext` varchar(10) DEFAULT '',
  `mnydesc` varchar(60) DEFAULT '',
  `premnysymbol` varchar(10) DEFAULT '',
  `postmnysymbol` varchar(10) DEFAULT '',
  `exchangerate` decimal(20,10) DEFAULT '0.0000000000',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `start` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `expire` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `comments` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `start` (`start`) USING BTREE,
  KEY `expire` (`expire`) USING BTREE,
  KEY `portal` (`portal`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `customers`
--

DROP TABLE IF EXISTS `customers`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `customers` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT '00000001',
  `passwd` varchar(20) NOT NULL DEFAULT '87654321010101239',
  `seclevel` int(6) NOT NULL DEFAULT '5',
  `maid` varchar(20) DEFAULT '',
  `name` varchar(120) DEFAULT NULL,
  `accttype` varchar(10) DEFAULT '',
  `lastname` varchar(40) DEFAULT '',
  `firstname` varchar(40) DEFAULT '',
  `phone1` varchar(20) DEFAULT NULL,
  `phone2` varchar(20) DEFAULT NULL,
  `phone3` varchar(20) DEFAULT NULL,
  `phone4` varchar(20) DEFAULT NULL,
  `phonenotify` int(1) NOT NULL DEFAULT '0',
  `sms1` varchar(20) DEFAULT NULL,
  `sms2` varchar(20) DEFAULT NULL,
  `smsnotify` int(1) NOT NULL DEFAULT '0',
  `email1` varchar(120) DEFAULT NULL,
  `email2` varchar(120) DEFAULT NULL,
  `emailnotify` int(1) NOT NULL DEFAULT '0',
  `address1` varchar(80) DEFAULT NULL,
  `address2` varchar(80) DEFAULT NULL,
  `city` varchar(20) DEFAULT NULL,
  `state` varchar(20) DEFAULT NULL,
  `postalcode` varchar(20) DEFAULT NULL,
  `countrycode` varchar(10) DEFAULT '',
  `billaddress` varchar(80) DEFAULT NULL,
  `billcity` varchar(20) DEFAULT NULL,
  `billstate` varchar(10) DEFAULT NULL,
  `billpostalcode` varchar(20) DEFAULT NULL,
  `billcountrycode` varchar(10) DEFAULT '',
  `group1` varchar(40) DEFAULT '',
  `group2` varchar(40) DEFAULT '',
  `group3` varchar(40) DEFAULT '',
  `group4` varchar(40) DEFAULT '',
  `group5` varchar(40) DEFAULT '',
  `group6` varchar(40) DEFAULT '',
  `othergroups` varchar(80) DEFAULT '',
  `tz` varchar(10) DEFAULT '',
  `comments` text,
  `notifydays` int(2) DEFAULT '3',
  `bdom` int(3) DEFAULT '1',
  `sendpdf` int(1) DEFAULT '0',
  `contract` varchar(20) DEFAULT '',
  `defaultlang` varchar(10) DEFAULT 'en',
  `custstatus` varchar(10) DEFAULT 'active',
  `lastbalance` double(16,2) DEFAULT '0.00',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastlogin` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `fromip` varchar(20) NOT NULL DEFAULT '127.0.0.2',
  `velocity` int(8) DEFAULT '0',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `lastseenby` varchar(20) DEFAULT '',
  `mgmtfee` varchar(10) DEFAULT 'none',
  `autovendperc` int(6) DEFAULT '0',
  `autowalletfund` double(16,2) DEFAULT '0.00',
  `discountkwh` int(10) DEFAULT '0',
  `discountperc` int(10) DEFAULT '0',
  `minkwh` int(10) DEFAULT '0',
  `route` varchar(10) DEFAULT '',
  `correlative` varchar(20) DEFAULT '',
  `dailyinterest` double(16,8) DEFAULT '0.00000000',
  `specialstatus` varchar(20) DEFAULT '',
  `specialagent` varchar(20) DEFAULT '',
  `specialmessage` text,
  `creditlimit` double(16,2) DEFAULT '0.00',
  `idtype` varchar(20) DEFAULT '',
  `iddata` varchar(40) DEFAULT '',
  `billpowerfactor` int(1) DEFAULT '0',
  `billkwhpeak` int(1) DEFAULT '0',
  `peaktariff` varchar(12) DEFAULT '',
  `contractkwhpeak` double(16,2) DEFAULT '0.00',
  `invto` varchar(10) DEFAULT 'Door',
  `loclat` varchar(40) DEFAULT NULL,
  `loclong` varchar(40) DEFAULT NULL,
  `locroute` varchar(10) NOT NULL DEFAULT '',
  `branchcode` varchar(20) DEFAULT '',
  `unit` varchar(10) NOT NULL DEFAULT '',
  `tariff` varchar(20) DEFAULT 'deleteme',
  `subtariff` varchar(20) DEFAULT 'deleteme',
  `ssn` varchar(20) DEFAULT 'deleteme',
  `drvlic` varchar(20) DEFAULT 'deleteme',
  `ppn` varchar(20) DEFAULT 'deleteme',
  `payccv2` varchar(20) DEFAULT 'deleteme',
  `govnumtype` varchar(10) DEFAULT 'default',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `what` (`portal`,`account`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `customersarchive`
--

DROP TABLE IF EXISTS `customersarchive`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `customersarchive` (
  `uniq` int(10) NOT NULL DEFAULT '0',
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT '00000001',
  `passwd` varchar(20) NOT NULL DEFAULT '87654321010101239',
  `seclevel` int(6) NOT NULL DEFAULT '5',
  `maid` varchar(20) DEFAULT '',
  `name` varchar(120) DEFAULT NULL,
  `accttype` varchar(10) DEFAULT '',
  `lastname` varchar(40) DEFAULT '',
  `firstname` varchar(40) DEFAULT '',
  `phone1` varchar(20) DEFAULT NULL,
  `phone2` varchar(20) DEFAULT NULL,
  `phone3` varchar(20) DEFAULT NULL,
  `phone4` varchar(20) DEFAULT NULL,
  `phonenotify` int(1) NOT NULL DEFAULT '0',
  `sms1` varchar(20) DEFAULT NULL,
  `sms2` varchar(20) DEFAULT NULL,
  `smsnotify` int(1) NOT NULL DEFAULT '0',
  `email1` varchar(120) DEFAULT NULL,
  `email2` varchar(120) DEFAULT NULL,
  `emailnotify` int(1) NOT NULL DEFAULT '0',
  `address1` varchar(80) DEFAULT NULL,
  `address2` varchar(80) DEFAULT NULL,
  `city` varchar(20) DEFAULT NULL,
  `state` varchar(20) DEFAULT NULL,
  `postalcode` varchar(20) DEFAULT NULL,
  `countrycode` varchar(10) DEFAULT '',
  `billaddress` varchar(80) DEFAULT NULL,
  `billcity` varchar(20) DEFAULT NULL,
  `billstate` varchar(10) DEFAULT NULL,
  `billpostalcode` varchar(20) DEFAULT NULL,
  `billcountrycode` varchar(10) DEFAULT '',
  `group1` varchar(40) DEFAULT '',
  `group2` varchar(40) DEFAULT '',
  `group3` varchar(40) DEFAULT '',
  `group4` varchar(40) DEFAULT '',
  `group5` varchar(40) DEFAULT '',
  `group6` varchar(40) DEFAULT '',
  `othergroups` varchar(80) DEFAULT '',
  `tz` varchar(10) DEFAULT '',
  `comments` text,
  `notifydays` int(2) DEFAULT '3',
  `bdom` int(3) DEFAULT '1',
  `sendpdf` int(1) DEFAULT '0',
  `contract` varchar(20) DEFAULT '',
  `defaultlang` varchar(10) DEFAULT 'en',
  `ssn` varchar(20) DEFAULT '',
  `drvlic` varchar(20) DEFAULT '',
  `ppn` varchar(20) DEFAULT '',
  `custstatus` varchar(10) DEFAULT 'active',
  `lastbalance` double(16,2) DEFAULT '0.00',
  `payname` varchar(20) DEFAULT '',
  `payphone` varchar(20) DEFAULT '',
  `payemail` varchar(80) DEFAULT '',
  `payaddress` varchar(40) DEFAULT '',
  `paycity` varchar(20) DEFAULT '',
  `paystate` varchar(20) DEFAULT '',
  `payzip` varchar(15) DEFAULT '',
  `paycountry` varchar(15) DEFAULT '',
  `payccnum` varchar(20) DEFAULT '',
  `payccexpmonth` varchar(2) DEFAULT '',
  `payccexpyear` varchar(6) DEFAULT '',
  `payccv2` varchar(6) DEFAULT '',
  `payabarouting` varchar(15) DEFAULT '',
  `payabaaccount` varchar(20) DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastlogin` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `fromip` varchar(20) NOT NULL DEFAULT '127.0.0.2',
  `velocity` int(8) DEFAULT '0',
  `lastmod` timestamp NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastseenby` varchar(20) DEFAULT '',
  `mgmtfee` varchar(10) DEFAULT 'none',
  `autovendperc` int(6) DEFAULT '0',
  `autowalletfund` double(16,2) DEFAULT '0.00',
  `discountkwh` int(10) DEFAULT '0',
  `discountperc` int(10) DEFAULT '0',
  `minkwh` int(10) DEFAULT '0',
  `govnumtype` int(1) DEFAULT '0',
  `route` varchar(10) DEFAULT '',
  `correlative` varchar(20) DEFAULT '',
  `dailyinterest` double(16,8) DEFAULT '0.00000000',
  `specialstatus` varchar(20) DEFAULT '',
  `specialagent` varchar(20) DEFAULT '',
  `specialmessage` text,
  `creditlimit` double(16,2) DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `dashboard`
--

DROP TABLE IF EXISTS `dashboard`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dashboard` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `login` varchar(20) NOT NULL DEFAULT 'invalid',
  `dashboardsettings` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `login` (`login`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `defaultlang`
--

DROP TABLE IF EXISTS `defaultlang`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `defaultlang` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `defaultlang` varchar(10) DEFAULT NULL,
  `description` varchar(80) DEFAULT NULL,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `degdays`
--

DROP TABLE IF EXISTS `degdays`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `degdays` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '*',
  `zipcode` varchar(20) DEFAULT '',
  `weatherstation` varchar(20) DEFAULT '',
  `source` varchar(20) DEFAULT '',
  `weatherdate` date NOT NULL DEFAULT '1970-01-01',
  `mdt` int(10) DEFAULT '0',
  `hdd` int(10) DEFAULT '0',
  `cdd` int(10) DEFAULT '0',
  `tdd` int(10) DEFAULT '0',
  `avgtemp` double(8,2) DEFAULT '0.00',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `zipcode` (`zipcode`) USING BTREE,
  KEY `weatherstation` (`weatherstation`) USING BTREE,
  KEY `weatherdate` (`weatherdate`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `depolookup`
--

DROP TABLE IF EXISTS `depolookup`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `depolookup` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `forportal` varchar(10) DEFAULT 'cepm',
  `income` varchar(20) DEFAULT 'Bajo',
  `accttype` varchar(20) DEFAULT 'domestic',
  `phases` int(10) DEFAULT '1',
  `voltage` int(10) DEFAULT '120',
  `depositkwh` int(10) DEFAULT '200',
  `contractcost` double(16,2) DEFAULT '2000.00',
  `comments` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `income` (`income`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `depositbags`
--

DROP TABLE IF EXISTS `depositbags`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `depositbags` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `batch` int(11) NOT NULL,
  `bagid` varchar(20) NOT NULL,
  `amount` double(16,2) NOT NULL DEFAULT '0.00',
  `transtype` varchar(10) DEFAULT 'cash',
  `currency` varchar(10) NOT NULL,
  `sent` datetime NOT NULL,
  `givento` varchar(30) DEFAULT '',
  `evaluated` datetime NOT NULL,
  `status` varchar(20) NOT NULL,
  `comment` text,
  `convrate` double(8,4) DEFAULT '1.0000',
  `login` varchar(20) NOT NULL,
  `coa` varchar(20) DEFAULT NULL,
  `portal` varchar(20) NOT NULL DEFAULT 'cepm',
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `depotrans`
--

DROP TABLE IF EXISTS `depotrans`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `depotrans` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `account` varchar(20) NOT NULL DEFAULT '00000001',
  `target` varchar(20) NOT NULL DEFAULT '00000001',
  `login` varchar(20) DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `type` varchar(10) DEFAULT '',
  `source` varchar(10) DEFAULT '',
  `transaction` varchar(20) NOT NULL DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `description` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `target` (`target`) USING BTREE,
  KEY `login` (`login`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `devices`
--

DROP TABLE IF EXISTS `devices`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `devices` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT '0000001',
  `id` varchar(32) DEFAULT '',
  `serialnumber` varchar(32) DEFAULT '',
  `name` varchar(32) DEFAULT '',
  `typeid` varchar(20) NOT NULL DEFAULT 'Echelon ANSI',
  `statustypeid` varchar(20) NOT NULL DEFAULT 'login',
  `com` varchar(10) NOT NULL DEFAULT 'NES',
  `lastcommunication` varchar(10) NOT NULL DEFAULT '',
  `servicestatus` varchar(10) NOT NULL DEFAULT '',
  `gatewayid` varchar(32) NOT NULL DEFAULT '',
  `gatewayname` varchar(32) NOT NULL DEFAULT '',
  `gatewaystatus` varchar(32) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deviceaddress` varchar(40) DEFAULT '',
  `devicelocation` varchar(40) DEFAULT '',
  `devicecity` varchar(40) DEFAULT '',
  `devicestate` varchar(40) DEFAULT '',
  `devicezip` varchar(40) DEFAULT '',
  `devicegps` varchar(80) DEFAULT '',
  `server` varchar(20) DEFAULT '192.168.1.33',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `guid` (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `display`
--

DROP TABLE IF EXISTS `display`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `display` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `account` varchar(20) NOT NULL DEFAULT '',
  `serialnumber` varchar(20) NOT NULL DEFAULT '',
  `displayid` varchar(20) NOT NULL DEFAULT '',
  `action` varchar(20) NOT NULL DEFAULT '',
  `data` text,
  `text` text,
  `reply` varchar(20) DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `replied` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `serialnumber` (`serialnumber`) USING BTREE,
  KEY `displayid` (`displayid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `email`
--

DROP TABLE IF EXISTS `email`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `email` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `portal` varchar(10) DEFAULT '*',
  `login` varchar(20) DEFAULT 'system',
  `account` varchar(20) DEFAULT '',
  `email` varchar(80) DEFAULT '',
  `subject` varchar(80) DEFAULT '',
  `status` varchar(15) NOT NULL DEFAULT 'UNKNOWN',
  `body` text,
  `retrycount` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `account` (`account`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `encryptor`
--

DROP TABLE IF EXISTS `encryptor`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `encryptor` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `auth_token` tinyblob,
  `last_ip` varchar(45) DEFAULT NULL,
  `first_seen` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `last_seen` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `auth_token` (`auth_token`(16))
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `etelem`
--

DROP TABLE IF EXISTS `etelem`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `etelem` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `readingtimestamp` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `serialnumber` varchar(20) NOT NULL DEFAULT '',
  `smartid` varchar(20) NOT NULL DEFAULT '',
  `factor` double(16,2) DEFAULT '0.00',
  `kWhd` double(16,2) DEFAULT '0.00',
  `kVARhd` double(16,2) DEFAULT '0.00',
  `kWhr` double(16,2) DEFAULT '0.00',
  `kVARhr` double(16,2) DEFAULT '0.00',
  `Max` double(16,2) DEFAULT '0.00',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `kWhdSmooth` double(16,2) DEFAULT '0.00',
  `kVARhdSmooth` double(16,2) DEFAULT '0.00',
  `inter` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `reading` (`serialnumber`,`readingtimestamp`),
  KEY `serialnumber` (`serialnumber`) USING BTREE,
  KEY `readingtimestamp` (`readingtimestamp`) USING BTREE,
  KEY `smartid` (`smartid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `eventdetails`
--

DROP TABLE IF EXISTS `eventdetails`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `eventdetails` (
  `uniq` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `eventuniq` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `value` varchar(255) NOT NULL,
  `listorder` int(10) unsigned NOT NULL,
  `tier` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`uniq`) USING BTREE,
  KEY `eventuniq` (`eventuniq`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `events`
--

DROP TABLE IF EXISTS `events`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `events` (
  `uniq` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `receivedatetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `eventdatetime` timestamp NOT NULL DEFAULT '1970-01-01 00:00:01',
  `server` varchar(255) NOT NULL,
  `sourcetype` varchar(255) NOT NULL DEFAULT 'Unknown',
  `sourceguid` varchar(32) NOT NULL DEFAULT 'Unknown',
  `event` varchar(255) NOT NULL DEFAULT 'Unknown',
  `cleared` bit(1) NOT NULL DEFAULT b'0',
  PRIMARY KEY (`uniq`) USING BTREE,
  KEY `receivedatetime` (`receivedatetime`) USING BTREE,
  KEY `eventdatetime` (`eventdatetime`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `externaldevices`
--

DROP TABLE IF EXISTS `externaldevices`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `externaldevices` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL DEFAULT '*',
  `devicename` varchar(40) NOT NULL,
  `humanname` varchar(40) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `externaldevices` (`devicename`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `fixed`
--

DROP TABLE IF EXISTS `fixed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fixed` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `entity` varchar(20) NOT NULL DEFAULT '',
  `account` varchar(20) NOT NULL DEFAULT '0000001',
  `qty` double(8,2) NOT NULL DEFAULT '1.00',
  `fixeditemtype` varchar(10) DEFAULT '',
  `chargedesc` varchar(20) DEFAULT '',
  `chargeamount` double(16,2) NOT NULL DEFAULT '0.00',
  `chargecomment` varchar(80) DEFAULT '',
  `taxable` int(1) DEFAULT '0',
  `mgmtfeeable` int(1) DEFAULT NULL,
  `arcoa` varchar(20) DEFAULT '1102',
  `startdate` date NOT NULL DEFAULT '1970-01-01',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `fixeditemtype`
--

DROP TABLE IF EXISTS `fixeditemtype`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fixeditemtype` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `fixeditemtype` varchar(10) DEFAULT '',
  `description` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `what` (`portal`,`fixeditemtype`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `fixeditemtyoe` (`fixeditemtype`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `fixedlookup`
--

DROP TABLE IF EXISTS `fixedlookup`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fixedlookup` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '*',
  `entity` varchar(20) NOT NULL DEFAULT '',
  `fixeditemtype` varchar(10) DEFAULT '4900',
  `chargedesc` varchar(20) DEFAULT '',
  `chargeamount` double(16,2) NOT NULL DEFAULT '0.00',
  `chargecomment` varchar(80) DEFAULT '',
  `taxable` int(1) DEFAULT '0',
  `mgmtfeeable` int(11) DEFAULT '0',
  `arcoa` varchar(20) DEFAULT '1102',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `chargedesc` (`chargedesc`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `flexreports`
--

DROP TABLE IF EXISTS `flexreports`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `flexreports` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `repcat` varchar(20) DEFAULT '',
  `repcatname` varchar(80) DEFAULT '',
  `report` varchar(20) DEFAULT 'uniqid',
  `reportname` varchar(60) DEFAULT NULL,
  `seclevel` int(6) DEFAULT NULL,
  `availableto` text,
  `availabletoroles` text,
  `reportdesc` text,
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `report` (`report`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `fount`
--

DROP TABLE IF EXISTS `fount`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fount` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `itemgroup` varchar(20) DEFAULT 'lookup',
  `itemid` varchar(20) DEFAULT 'uniqid',
  `itemname` varchar(60) DEFAULT '',
  `itemdesc` text,
  `seclevel` int(6) DEFAULT '90',
  `availtologins` text,
  `availtoroles` text,
  `primarytable` varchar(40) DEFAULT '',
  `prefunction` text,
  `query` text,
  `groupon` text,
  `totals` text,
  `input1field` text,
  `input1source` varchar(80) DEFAULT '',
  `input2field` text,
  `input2source` varchar(80) DEFAULT '',
  `input3field` text,
  `input3source` varchar(80) DEFAULT '',
  `input4field` text,
  `input4source` varchar(80) DEFAULT '',
  `input5field` text,
  `input5source` varchar(80) DEFAULT '',
  `input6field` text,
  `input6source` varchar(80) DEFAULT '',
  `input7field` text,
  `input7source` varchar(80) DEFAULT '',
  `input8field` text,
  `input8source` varchar(80) DEFAULT '',
  `input9field` text,
  `input9source` varchar(80) DEFAULT '',
  `fieldcharlimit` int(6) DEFAULT '40',
  `defaultdatemode` varchar(10) DEFAULT 'D',
  `output` varchar(20) DEFAULT 'REPORT',
  `outputformats` varchar(80) DEFAULT 'HTML|CSV|XLS|PDF',
  `outputmode` varchar(80) DEFAULT 'NOW|STORED|EMAIL',
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `comments` text,
  `counter` int(10) DEFAULT '0',
  `asnumbers` text NOT NULL,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `itemid` (`itemid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `fountq`
--

DROP TABLE IF EXISTS `fountq`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `fountq` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL DEFAULT 'invalid',
  `login` varchar(20) NOT NULL DEFAULT 'invalid',
  `itemid` varchar(20) NOT NULL DEFAULT 'invalid',
  `request` text,
  `requestdatetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `completedatetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `requestdatetime` (`requestdatetime`) USING BTREE,
  KEY `login` (`login`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `gl`
--

DROP TABLE IF EXISTS `gl`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `gl` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `login` varchar(20) NOT NULL DEFAULT '',
  `account` varchar(20) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `source` varchar(20) DEFAULT '',
  `transaction` varchar(20) DEFAULT '',
  `coa` varchar(20) DEFAULT '',
  `debit` double(16,2) DEFAULT '0.00',
  `credit` double(16,2) DEFAULT '0.00',
  `description` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `arrearid` varchar(20) DEFAULT '',
  `batch` int(10) DEFAULT '0',
  `exported` timestamp NOT NULL DEFAULT '1970-01-01 00:00:01',
  `expinvnum` varchar(20) DEFAULT '',
  `artrans` tinyint(4) DEFAULT '0',
  `vendortrans` tinyint(4) DEFAULT '0',
  `vendornumber` varchar(20) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `login` (`login`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `created` (`created`) USING BTREE,
  KEY `transaction` (`transaction`) USING BTREE,
  KEY `coa` (`coa`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `glfielddesc`
--

DROP TABLE IF EXISTS `glfielddesc`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `glfielddesc` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `targettable` varchar(20) DEFAULT NULL,
  `fieldname` varchar(80) DEFAULT NULL,
  `fielddesctext` text,
  `displayfieldname` varchar(80) DEFAULT NULL,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `targettable` (`targettable`) USING BTREE,
  KEY `fieldname` (`fieldname`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `govnum`
--

DROP TABLE IF EXISTS `govnum`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `govnum` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '',
  `type` varchar(10) DEFAULT '',
  `status` varchar(10) DEFAULT '',
  `length` int(10) DEFAULT '20',
  `alpha` varchar(10) DEFAULT 'A',
  `start` bigint(20) DEFAULT '0',
  `block` bigint(20) DEFAULT '1000',
  `current` bigint(20) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `group1`
--

DROP TABLE IF EXISTS `group1`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `group1` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `group1` varchar(40) NOT NULL DEFAULT '',
  `group1desc` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `group1` (`group1`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `group2`
--

DROP TABLE IF EXISTS `group2`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `group2` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `group2` varchar(40) NOT NULL DEFAULT '',
  `group2desc` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `group2` (`group2`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `group3`
--

DROP TABLE IF EXISTS `group3`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `group3` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `group3` varchar(40) NOT NULL DEFAULT '',
  `group3desc` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `group3` (`group3`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `group4`
--

DROP TABLE IF EXISTS `group4`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `group4` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `group4` varchar(40) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `group4` (`group4`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `group5`
--

DROP TABLE IF EXISTS `group5`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `group5` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `group5` varchar(40) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `group5` (`group5`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `group6`
--

DROP TABLE IF EXISTS `group6`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `group6` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `group6` varchar(40) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `group6` (`group6`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `handhelds`
--

DROP TABLE IF EXISTS `handhelds`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `handhelds` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `number` int(10) NOT NULL,
  `ip` varchar(15) NOT NULL,
  `currentroute` varchar(20) NOT NULL DEFAULT 'unassigned',
  `wotype` varchar(20) NOT NULL DEFAULT 'unassigned',
  `wonum` int(10) NOT NULL DEFAULT '0',
  `assignedto` varchar(20) NOT NULL DEFAULT 'unassigned',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `lastseen` timestamp NOT NULL DEFAULT '1970-01-01 00:00:01',
  `countgood` int(10) DEFAULT '0',
  `countfail` int(10) DEFAULT '0',
  `nfip` varchar(11) NOT NULL,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `number` (`number`),
  UNIQUE KEY `ip` (`ip`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `help`
--

DROP TABLE IF EXISTS `help`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `help` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `page` varchar(20) DEFAULT 'Very Short',
  `pagetitle` varchar(200) DEFAULT 'Page Title',
  `pagenum` int(8) DEFAULT '1',
  `parent` varchar(20) DEFAULT '',
  `content` text,
  `lang` varchar(2) DEFAULT 'en',
  `seclevel` int(6) DEFAULT '50',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `page` (`page`) USING BTREE,
  KEY `parent` (`parent`) USING BTREE,
  KEY `pagenum` (`pagenum`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `idtype`
--

DROP TABLE IF EXISTS `idtype`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `idtype` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `idtype` varchar(20) NOT NULL,
  `description` varchar(20) NOT NULL,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `comments` text,
  `sortorder` smallint(3) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `idtype` (`idtype`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `incomingfiles`
--

DROP TABLE IF EXISTS `incomingfiles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `incomingfiles` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'portal',
  `status` varchar(20) NOT NULL DEFAULT '',
  `filename` text,
  `notes` text,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `processed` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `interdistrict`
--

DROP TABLE IF EXISTS `interdistrict`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `interdistrict` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `district` varchar(20) DEFAULT '',
  `locdistrict` varchar(20) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `district` (`created`) USING BTREE,
  KEY `locdistrict` (`locdistrict`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `interswitch`
--

DROP TABLE IF EXISTS `interswitch`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `interswitch` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `account` varchar(20) DEFAULT '',
  `transaction` bigint(20) DEFAULT '0',
  `message` varchar(120) DEFAULT '',
  `state` varchar(10) DEFAULT '',
  `amount` bigint(20) DEFAULT '0',
  `paymentlogid` bigint(20) DEFAULT '0',
  `paymentreference` varchar(40) DEFAULT '',
  `receiptno` bigint(20) DEFAULT '0',
  `xml` text,
  `xmlout` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `account` (`account`) USING BTREE,
  KEY `created` (`created`) USING BTREE,
  KEY `transaction` (`transaction`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `interswitchsvccenter`
--

DROP TABLE IF EXISTS `interswitchsvccenter`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `interswitchsvccenter` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `svccenter` varchar(20) DEFAULT '',
  `locservicecenter` varchar(20) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `svccenter` (`created`) USING BTREE,
  KEY `locservicecenter` (`locservicecenter`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `issues`
--

DROP TABLE IF EXISTS `issues`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `issues` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `login` varchar(20) NOT NULL,
  `account` varchar(20) NOT NULL,
  `locid` varchar(20) NOT NULL,
  `wotype` varchar(10) NOT NULL DEFAULT '',
  `issuetype` varchar(20) NOT NULL,
  `source` varchar(20) NOT NULL DEFAULT '',
  `contactname` varchar(40) NOT NULL,
  `contactphone` varchar(40) NOT NULL,
  `contactemail` varchar(80) NOT NULL,
  `contactnotes` varchar(80) NOT NULL,
  `assignedto` varchar(20) DEFAULT 'any',
  `issuestatus` varchar(10) NOT NULL DEFAULT 'open',
  `issuesubstatus` varchar(10) DEFAULT '',
  `resolution` varchar(20) NOT NULL DEFAULT '',
  `satisfaction` varchar(20) NOT NULL DEFAULT '',
  `issue` text,
  `priority` int(1) DEFAULT '1',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `expires` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `closed` datetime DEFAULT '1970-01-01 00:00:01',
  `wonum` bigint(20) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `issuesitems`
--

DROP TABLE IF EXISTS `issuesitems`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `issuesitems` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `issue` bigint(20) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `login` varchar(20) NOT NULL,
  `itemtype` varchar(20) NOT NULL DEFAULT '',
  `description` text,
  `timespent` double(8,2) DEFAULT '0.25',
  `materials` double(8,2) DEFAULT '0.00',
  `adjustments` double(8,2) DEFAULT '0.00',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `issue` (`issue`) USING BTREE,
  KEY `login` (`login`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `issuetypes`
--

DROP TABLE IF EXISTS `issuetypes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `issuetypes` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `issuetype` varchar(20) NOT NULL,
  `issuetypedesc` varchar(80) NOT NULL DEFAULT '',
  `woreq` int(1) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `juicecards`
--

DROP TABLE IF EXISTS `juicecards`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `juicecards` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `batch` int(10) DEFAULT '0',
  `coupon` varchar(32) NOT NULL DEFAULT '',
  `value` double(16,2) NOT NULL DEFAULT '0.00',
  `activatedby` varchar(20) NOT NULL DEFAULT '',
  `soldto` varchar(20) NOT NULL DEFAULT '',
  `usedbyaccount` varchar(20) NOT NULL DEFAULT '',
  `remainingvalue` double(16,2) NOT NULL DEFAULT '0.00',
  `attacheditems` text,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `activated` int(1) DEFAULT '0',
  `activatedate` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `redeemed` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `expires` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `transaction` varchar(20) DEFAULT '',
  `createdbylogin` varchar(20) DEFAULT '',
  `redeemedinfo` text,
  `fromip` varchar(20) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `what` (`portal`,`coupon`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `coupon` (`coupon`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `juicedocs`
--

DROP TABLE IF EXISTS `juicedocs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `juicedocs` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `login` varchar(20) NOT NULL DEFAULT 'admin',
  `account` varchar(20) NOT NULL DEFAULT '00000001',
  `filename` varchar(80) NOT NULL DEFAULT '',
  `seclevel` int(6) NOT NULL DEFAULT '5',
  `shortnotes` varchar(40) DEFAULT '',
  `notes` text,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `kvafixed`
--

DROP TABLE IF EXISTS `kvafixed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `kvafixed` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '*',
  `tariff` varchar(20) DEFAULT '*',
  `voltage` int(10) DEFAULT '120',
  `phases` int(1) DEFAULT '1',
  `stspowermax` double(16,2) DEFAULT '0.00',
  `kvademandrating` double(16,2) DEFAULT '0.00',
  `currentperphase` double(16,2) DEFAULT '0.00',
  `l1desc` varchar(20) DEFAULT 'Levy 1',
  `l1amount` double(16,2) DEFAULT '0.00',
  `l1coa` varchar(20) DEFAULT '4900',
  `l1arcoa` varchar(20) DEFAULT '1110',
  `l2desc` varchar(20) DEFAULT 'Levy 2',
  `l2amount` double(16,2) DEFAULT '0.00',
  `l2coa` varchar(20) DEFAULT '4900',
  `l2arcoa` varchar(20) DEFAULT '1110',
  `l3desc` varchar(20) DEFAULT 'Levy 3',
  `l3amount` double(16,2) DEFAULT '0.00',
  `l3coa` varchar(20) DEFAULT '4900',
  `l3arcoa` varchar(20) DEFAULT '1110',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `landlords`
--

DROP TABLE IF EXISTS `landlords`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `landlords` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT 'portal',
  `landlordid` int(10) NOT NULL,
  `passwd` varchar(40) DEFAULT '',
  `name` varchar(40) DEFAULT '',
  `address1` varchar(40) DEFAULT '',
  `address2` varchar(40) DEFAULT '',
  `city` varchar(20) DEFAULT '',
  `state` varchar(20) DEFAULT '',
  `country` varchar(3) DEFAULT '',
  `postalcode` varchar(20) DEFAULT '',
  `phone1` varchar(20) DEFAULT '',
  `phone2` varchar(20) DEFAULT '',
  `sms1` varchar(20) DEFAULT '',
  `sms2` varchar(20) DEFAULT '',
  `email1` varchar(80) DEFAULT '',
  `email2` varchar(80) DEFAULT '',
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `landlord` (`portal`,`landlordid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `life`
--

DROP TABLE IF EXISTS `life`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `life` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `login` varchar(20) NOT NULL DEFAULT '',
  `account` varchar(20) NOT NULL DEFAULT '',
  `locid` varchar(20) NOT NULL DEFAULT '',
  `serialnumber` varchar(32) DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lifeevent` varchar(20) NOT NULL,
  `description` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `login` (`login`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `locid` (`locid`) USING BTREE,
  KEY `serialnumber` (`serialnumber`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `localreports`
--

DROP TABLE IF EXISTS `localreports`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `localreports` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `itemgroup` varchar(20) DEFAULT 'lookup',
  `itemid` varchar(20) DEFAULT 'uniqid',
  `itemname` varchar(60) DEFAULT '',
  `itemdesc` text,
  `seclevel` int(6) DEFAULT '90',
  `availtologins` text,
  `availtoroles` text,
  `query` text,
  `query2` text,
  `groupon` text,
  `asnumbers` text NOT NULL,
  `totals` text,
  `input1field` text,
  `input1source` varchar(80) DEFAULT '',
  `input2field` text,
  `input2source` varchar(80) DEFAULT '',
  `input3field` text,
  `input3source` varchar(80) DEFAULT '',
  `input4field` text,
  `input4source` varchar(80) DEFAULT '',
  `input5field` text,
  `input5source` varchar(80) DEFAULT '',
  `input6field` text,
  `input6source` varchar(80) DEFAULT '',
  `input7field` text,
  `input7source` varchar(80) DEFAULT '',
  `input8field` text,
  `input8source` varchar(80) DEFAULT '',
  `input9field` text,
  `input9source` varchar(80) DEFAULT '',
  `fieldcharlimit` int(6) DEFAULT '40',
  `defaultdatemode` varchar(10) DEFAULT 'D',
  `output` varchar(20) DEFAULT 'REPORT',
  `outputformats` varchar(80) DEFAULT 'HTML|CSV|XLS|PDF',
  `outputmode` varchar(80) DEFAULT 'NOW|OFFLINE|EMAIL',
  `counter` int(10) DEFAULT '0',
  `comments` text,
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `displaynotes` text,
  `groupchart` text,
  `totalchart` text,
  `mapchart` text,
  `maxtime` double(16,4) DEFAULT '0.0000',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `itemid` (`itemid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `locations`
--

DROP TABLE IF EXISTS `locations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `locations` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `locid` varchar(20) NOT NULL DEFAULT '',
  `serialnumber` varchar(32) DEFAULT 'unassigned',
  `account` varchar(20) NOT NULL DEFAULT 'unassigned',
  `locname` varchar(20) DEFAULT '',
  `locaddress1` varchar(40) DEFAULT '',
  `locaddress2` varchar(40) DEFAULT '',
  `loccity` varchar(40) DEFAULT '',
  `locstate` varchar(40) DEFAULT '',
  `loczip` varchar(40) DEFAULT '',
  `loclat` varchar(20) DEFAULT '',
  `loclong` varchar(20) DEFAULT '',
  `locx` varchar(20) DEFAULT '',
  `locy` varchar(20) DEFAULT '',
  `substation` varchar(40) DEFAULT NULL,
  `transformer` varchar(40) DEFAULT NULL,
  `module` varchar(20) DEFAULT '',
  `socket` int(8) DEFAULT '0',
  `route` varchar(20) DEFAULT '',
  `correlative` varchar(20) DEFAULT '',
  `svcbldgtype` varchar(20) DEFAULT '',
  `svcaddress1` varchar(40) DEFAULT '',
  `svcaddress2` varchar(40) DEFAULT '',
  `svclat` varchar(20) DEFAULT '',
  `svclong` varchar(20) DEFAULT '',
  `svcx` varchar(20) DEFAULT '',
  `svcy` varchar(20) DEFAULT '',
  `landlordid` int(10) DEFAULT '0',
  `meterinstalled` date NOT NULL DEFAULT '1970-01-01',
  `securityseal` varchar(32) DEFAULT '',
  `lastcontract` varchar(10) DEFAULT '',
  `comments` text,
  `buildingconstruction` text,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `voltage` varchar(10) DEFAULT '120V',
  `kva` double(16,2) DEFAULT '0.00',
  `tariff` varchar(20) DEFAULT NULL,
  `subtariff` varchar(20) DEFAULT 'PrePaid',
  `type` varchar(10) DEFAULT 'ANSI',
  `formfactor` varchar(10) DEFAULT '1S',
  `wiring` varchar(10) DEFAULT '2W',
  `currentperphase` int(10) DEFAULT '100',
  `feeder` varchar(20) DEFAULT '',
  `unit` varchar(20) DEFAULT '',
  `displayid` varchar(20) DEFAULT '',
  `controlgroup1` varchar(20) DEFAULT '',
  `controlgroup2` varchar(20) DEFAULT '',
  `controlgroup3` varchar(20) DEFAULT '',
  `expectedusage` double(16,2) DEFAULT '0.00',
  `book` varchar(10) NOT NULL DEFAULT '',
  `cycle` varchar(10) NOT NULL DEFAULT '',
  `locservicecenter` varchar(20) NOT NULL DEFAULT '',
  `locdistrict` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `what` (`portal`,`locid`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `locid` (`locid`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `locaddress1` (`locaddress1`) USING BTREE,
  KEY `serialnumber` (`serialnumber`) USING BTREE,
  KEY `module` (`module`) USING BTREE,
  KEY `loclat` (`loclat`) USING BTREE,
  KEY `loclong` (`loclong`) USING BTREE,
  KEY `locx` (`locx`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `masteraccounts`
--

DROP TABLE IF EXISTS `masteraccounts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `masteraccounts` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `maid` varchar(20) NOT NULL,
  `name` varchar(40) DEFAULT '',
  `accttype` varchar(10) DEFAULT '',
  `address1` varchar(40) DEFAULT '',
  `address2` varchar(40) DEFAULT '',
  `city` varchar(20) DEFAULT '',
  `state` varchar(20) DEFAULT '',
  `country` varchar(3) DEFAULT '',
  `postalcode` varchar(20) DEFAULT '',
  `phone1` varchar(20) DEFAULT '',
  `phone2` varchar(20) DEFAULT '',
  `phone3` varchar(20) DEFAULT '',
  `phone4` varchar(20) DEFAULT '',
  `sms1` varchar(20) DEFAULT '',
  `sms2` varchar(20) DEFAULT '',
  `email1` varchar(80) DEFAULT '',
  `email2` varchar(80) DEFAULT '',
  `specialstatus` varchar(20) DEFAULT '',
  `specialagent` varchar(20) DEFAULT '',
  `specialmessage` text,
  `signatory` varchar(40) DEFAULT '',
  `idtype` varchar(20) DEFAULT '',
  `iddata` varchar(40) DEFAULT '',
  `comments` text,
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `sigtitle` varchar(20) DEFAULT NULL,
  `sigidtype` varchar(20) DEFAULT NULL,
  `sigiddata` varchar(40) DEFAULT NULL,
  `cosignername` varchar(80) DEFAULT '',
  `cosidtype` varchar(20) DEFAULT '',
  `cosiddata` varchar(40) DEFAULT '',
  `cosphone` varchar(40) DEFAULT '',
  `cosemail` varchar(80) DEFAULT '',
  `cosaddress` varchar(80) DEFAULT '',
  `coscomments` varchar(80) DEFAULT '',
  `sigphone` varchar(20) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `maid` (`maid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `meterevents`
--

DROP TABLE IF EXISTS `meterevents`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `meterevents` (
  `uniq` int(11) NOT NULL AUTO_INCREMENT,
  `serialnumber` varchar(32) NOT NULL,
  `billingtimestamp` datetime NOT NULL,
  `eventspectype` varchar(250) DEFAULT NULL,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `serialnumber` (`serialnumber`,`billingtimestamp`,`eventspectype`(100)),
  KEY `billingtimestamp` (`billingtimestamp`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `meterfilescompleted`
--

DROP TABLE IF EXISTS `meterfilescompleted`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `meterfilescompleted` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `processedtime` datetime NOT NULL,
  `filename` varchar(100) DEFAULT NULL,
  `billing` int(10) DEFAULT '0',
  `quality` int(10) DEFAULT '0',
  `interval` int(10) DEFAULT '0',
  `other` varchar(40) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `filename` (`filename`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `meterinstrumentationvalues`
--

DROP TABLE IF EXISTS `meterinstrumentationvalues`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `meterinstrumentationvalues` (
  `uniq` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) DEFAULT '',
  `locid` varchar(20) DEFAULT '',
  `serialnumber` varchar(32) DEFAULT '',
  `deviceid` varchar(32) NOT NULL DEFAULT '',
  `source` varchar(10) NOT NULL DEFAULT '',
  `status` varchar(10) NOT NULL DEFAULT '',
  `billingtimestamp` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `timezoneindex` smallint(3) NOT NULL DEFAULT '11',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `frequency` double(8,4) DEFAULT NULL,
  `voltagea` double(8,4) DEFAULT NULL,
  `voltageb` double(8,4) DEFAULT NULL,
  `voltagec` double(8,4) DEFAULT NULL,
  `currenta` double(8,4) DEFAULT '0.0000',
  `currentb` double(8,4) DEFAULT '0.0000',
  `currentc` double(8,4) DEFAULT '0.0000',
  `pfanglea` int(10) DEFAULT '0',
  `pfangleb` int(10) DEFAULT '0',
  `pfanglec` int(10) DEFAULT '0',
  `pftotal` double(8,4) DEFAULT NULL,
  `pfa` double(8,4) DEFAULT '0.0000',
  `pfb` double(8,4) DEFAULT '0.0000',
  `pfc` double(8,4) DEFAULT '0.0000',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `serialnumber` (`serialnumber`,`billingtimestamp`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `deviceid` (`deviceid`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `locid` (`locid`) USING BTREE,
  KEY `billingtimestamp` (`billingtimestamp`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `meterintervaldata`
--

DROP TABLE IF EXISTS `meterintervaldata`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `meterintervaldata` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `serialnumber` varchar(32) NOT NULL,
  `billingtimestamp` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `uom` varchar(20) NOT NULL DEFAULT 'kWh',
  `direction` varchar(20) NOT NULL DEFAULT 'Delivered',
  `value` double(16,4) NOT NULL DEFAULT '0.0000',
  `counter` double(16,2) DEFAULT '0.00',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `serialnumber` (`serialnumber`,`billingtimestamp`,`direction`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `meterreadexceptions`
--

DROP TABLE IF EXISTS `meterreadexceptions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `meterreadexceptions` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `createtime` datetime NOT NULL,
  `errorstring` text NOT NULL,
  PRIMARY KEY (`uniq`),
  KEY `createtime` (`createtime`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `meterreads`
--

DROP TABLE IF EXISTS `meterreads`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `meterreads` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) DEFAULT '',
  `locid` varchar(20) DEFAULT '',
  `serialnumber` varchar(32) DEFAULT '',
  `deviceid` varchar(32) NOT NULL DEFAULT '',
  `source` varchar(10) NOT NULL DEFAULT '',
  `status` varchar(10) NOT NULL DEFAULT '',
  `billingtimestamp` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `timezoneindex` smallint(3) NOT NULL DEFAULT '11',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `multiplier` double(16,4) DEFAULT '1.0000',
  `sumforwardactive` bigint(20) DEFAULT '0',
  `sumreverseactive` bigint(20) DEFAULT '0',
  `sumforwardreactive` bigint(20) DEFAULT '0',
  `sumreversereactive` bigint(20) DEFAULT '0',
  `usagediff` bigint(20) DEFAULT '0',
  `toubucket1wh` bigint(20) DEFAULT '0',
  `toubucket2wh` bigint(20) DEFAULT '0',
  `toubucket3wh` bigint(20) DEFAULT '0',
  `toubucket4wh` bigint(20) DEFAULT '0',
  `toubucket5wh` bigint(20) DEFAULT '0',
  `toubucket6wh` bigint(20) DEFAULT '0',
  `toubucket1w` bigint(20) DEFAULT '0',
  `toubucket2w` bigint(20) DEFAULT '0',
  `toubucket3w` bigint(20) DEFAULT '0',
  `toubucket4w` bigint(20) DEFAULT '0',
  `toubucket5w` bigint(20) DEFAULT '0',
  `toubucket6w` bigint(20) DEFAULT '0',
  `toubucket1whrec` bigint(20) DEFAULT '0',
  `toubucket2whrec` bigint(20) DEFAULT '0',
  `toubucket3whrec` bigint(20) DEFAULT '0',
  `toubucket4whrec` bigint(20) DEFAULT '0',
  `toubucket5whrec` bigint(20) DEFAULT '0',
  `toubucket6whrec` bigint(20) DEFAULT '0',
  `toubucket1var` bigint(20) DEFAULT '0',
  `toubucket2var` bigint(20) DEFAULT '0',
  `toubucket3var` bigint(20) DEFAULT '0',
  `toubucket4var` bigint(20) DEFAULT '0',
  `toubucket5var` bigint(20) DEFAULT '0',
  `toubucket6var` bigint(20) DEFAULT '0',
  `toubucket1varh` bigint(20) DEFAULT '0',
  `toubucket2varh` bigint(20) DEFAULT '0',
  `toubucket3varh` bigint(20) DEFAULT '0',
  `toubucket4varh` bigint(20) DEFAULT '0',
  `toubucket5varh` bigint(20) DEFAULT '0',
  `toubucket6varh` bigint(20) DEFAULT '0',
  `toubucket1pf` double(8,4) DEFAULT '0.0000',
  `toubucket2pf` double(8,4) DEFAULT '0.0000',
  `toubucket3pf` double(8,4) DEFAULT '0.0000',
  `toubucket4pf` double(8,4) DEFAULT '0.0000',
  `toubucket5pf` double(8,4) DEFAULT '0.0000',
  `toubucket6pf` double(8,4) DEFAULT '0.0000',
  `toubucket1varhrec` bigint(20) DEFAULT '0',
  `demandpeakw` bigint(20) DEFAULT '0',
  `est` int(1) DEFAULT '0',
  `xml` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `serialnumber` (`serialnumber`,`billingtimestamp`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `deviceid` (`deviceid`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `locid` (`locid`) USING BTREE,
  KEY `billingtimestamp` (`billingtimestamp`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `meters`
--

DROP TABLE IF EXISTS `meters`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `meters` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `locid` varchar(20) DEFAULT 'unassigned',
  `account` varchar(20) NOT NULL DEFAULT 'unassigned',
  `id` varchar(32) DEFAULT '',
  `serialnumber` varchar(32) DEFAULT '',
  `name` varchar(32) DEFAULT '',
  `com` varchar(20) NOT NULL DEFAULT '',
  `tariff` varchar(20) DEFAULT NULL,
  `subtariff` varchar(20) DEFAULT 'PrePaid',
  `typeid` varchar(20) NOT NULL DEFAULT '',
  `statustypeid` varchar(20) NOT NULL DEFAULT '',
  `lastcommunication` varchar(10) NOT NULL DEFAULT '',
  `servicestatus` int(1) NOT NULL DEFAULT '0',
  `gatewayid` varchar(32) NOT NULL DEFAULT '',
  `gatewayname` varchar(32) NOT NULL DEFAULT '',
  `gatewaystatus` varchar(32) NOT NULL DEFAULT '',
  `sgc` varchar(10) DEFAULT '',
  `server` varchar(100) NOT NULL DEFAULT 'primary',
  `initkwh` double(16,2) DEFAULT '0.00',
  `kvademandrating` int(10) DEFAULT '0',
  `vendable` int(1) DEFAULT '1',
  `meterlocation` varchar(20) NOT NULL DEFAULT '',
  `miscdata` text,
  `meterstate` varchar(15) DEFAULT 'CONNECTED',
  `disconnect` int(1) DEFAULT '1',
  `installer` varchar(20) DEFAULT '',
  `units` varchar(10) DEFAULT 'kWh',
  `factor` double(16,6) DEFAULT '1.000000',
  `phases` int(1) DEFAULT '1',
  `ststi` varchar(2) DEFAULT '01',
  `stsphaseunbal` float(7,3) NOT NULL DEFAULT '0.000',
  `stspowermax` float(7,3) NOT NULL DEFAULT '0.000',
  `stskeyrev` varchar(1) DEFAULT '1',
  `stsexpnum` int(3) NOT NULL DEFAULT '255',
  `sts_version` int(2) DEFAULT NULL,
  `sts_base_date` int(4) NOT NULL DEFAULT '1993',
  `sts_key_type` int(10) NOT NULL DEFAULT '1',
  `discoprofile` varchar(10) DEFAULT 'Default',
  `lastcomby` varchar(20) DEFAULT 'system',
  `parentid` varchar(32) DEFAULT '',
  `minkwh` int(10) DEFAULT '0',
  `discountkwh` int(10) DEFAULT '0',
  `discountperc` int(10) DEFAULT '0',
  `breaker` varchar(10) DEFAULT '',
  `comments` text,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(10) NOT NULL DEFAULT '-',
  `formfactor` varchar(10) NOT NULL DEFAULT '-',
  `wiring` varchar(10) NOT NULL DEFAULT '-',
  `currentperphase` int(10) NOT NULL DEFAULT '0',
  `podisco` varchar(15) NOT NULL DEFAULT '',
  `scanedas` varchar(14) DEFAULT NULL,
  `voltageperphase` int(10) NOT NULL DEFAULT '0',
  `frequency` int(10) NOT NULL DEFAULT '0',
  `att` int(1) DEFAULT '0',
  `lastactived` date DEFAULT '1970-01-01',
  `lastdeactived` date DEFAULT '1970-01-01',
  `lastdeactivednofee` date DEFAULT '1970-01-01',
  `lastread` datetime DEFAULT '1970-01-01 00:00:01',
  `sumforwardactive` int(10) DEFAULT '0',
  `usagediff` int(10) DEFAULT '0',
  `lastreadreq` datetime DEFAULT '1970-01-01 00:00:01',
  `meterstatus` varchar(10) NOT NULL DEFAULT 'ACTIVE',
  `amiwallet` varchar(10) DEFAULT 'units',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `what` (`portal`,`serialnumber`),
  KEY `guid` (`id`) USING BTREE,
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `serialnumber` (`serialnumber`) USING BTREE,
  KEY `deviceid` (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `mgmtfee`
--

DROP TABLE IF EXISTS `mgmtfee`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mgmtfee` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'portal',
  `mgmtfee` varchar(10) DEFAULT 'none',
  `mgmtfeedesc` varchar(80) DEFAULT '',
  `mgmtfeefixed` double(8,2) NOT NULL DEFAULT '0.00',
  `mgmtfeeperc` double(8,2) NOT NULL DEFAULT '0.00',
  `mgmtfeetaxperc` double(8,2) NOT NULL DEFAULT '0.00',
  `mgmtfeemonthlymin` double(8,2) NOT NULL DEFAULT '0.00',
  `mgmtfeemonthlymax` double(8,2) NOT NULL DEFAULT '0.00',
  `allowvendorfunding` int(1) DEFAULT '1',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `mgmtfee` (`mgmtfee`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `modules`
--

DROP TABLE IF EXISTS `modules`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `modules` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `module` varchar(20) NOT NULL,
  `modulename` varchar(40) NOT NULL,
  `serialnumber` varchar(20) NOT NULL,
  `substation` varchar(20) NOT NULL,
  `transformer` varchar(20) NOT NULL,
  `route` varchar(20) NOT NULL,
  `correlative` varchar(20) NOT NULL,
  `moduletype` varchar(10) NOT NULL,
  `oem` varchar(20) NOT NULL,
  `model` varchar(20) NOT NULL,
  `loclat` varchar(20) DEFAULT '',
  `loclong` varchar(20) DEFAULT '',
  `comments` text,
  `locaddress1` varchar(40) DEFAULT '',
  `locaddress2` varchar(40) DEFAULT '',
  `loccity` varchar(40) DEFAULT '',
  `locstate` varchar(40) DEFAULT '',
  `parentid` varchar(32) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `module` (`module`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `motd`
--

DROP TABLE IF EXISTS `motd`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `motd` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '*',
  `portals` varchar(10) NOT NULL DEFAULT '*',
  `startdate` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `enddate` datetime NOT NULL DEFAULT '2030-12-31 23:59:59',
  `message` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `portals` (`portals`) USING BTREE,
  KEY `startdate` (`startdate`) USING BTREE,
  KEY `enddate` (`enddate`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `mq`
--

DROP TABLE IF EXISTS `mq`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `mq` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `account` varchar(20) NOT NULL DEFAULT '',
  `status` varchar(20) NOT NULL DEFAULT 'INPROGRESS',
  `id` varchar(32) NOT NULL DEFAULT '',
  `command` varchar(80) NOT NULL DEFAULT '',
  `statustypeid` varchar(20) NOT NULL DEFAULT '',
  `requestdatetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `completedatetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `parameters` text,
  `result` text,
  `resultdatetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `deviceid` varchar(32) DEFAULT '',
  `server` varchar(20) DEFAULT '192.168.1.33',
  `login` varchar(20) DEFAULT 'system',
  `reqid` varchar(40) DEFAULT NULL,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `mqid` (`id`) USING BTREE,
  KEY `requestdatetime` (`requestdatetime`) USING BTREE,
  KEY `request_id` (`reqid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `myreports`
--

DROP TABLE IF EXISTS `myreports`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `myreports` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `repcat` varchar(20) DEFAULT '',
  `repcatname` varchar(80) DEFAULT '',
  `report` varchar(20) DEFAULT 'uniqid',
  `reportname` varchar(60) DEFAULT NULL,
  `seclevel` int(6) DEFAULT NULL,
  `availableto` text,
  `reportdesc` text,
  `table1` varchar(20) DEFAULT NULL,
  `specialfunction` varchar(20) DEFAULT NULL,
  `charttype` varchar(20) DEFAULT '',
  `query1` text,
  `query2` text,
  `query3` text,
  `query4` text,
  `query5` text,
  `total1` varchar(20) DEFAULT NULL,
  `total2` varchar(20) DEFAULT NULL,
  `total3` varchar(20) DEFAULT NULL,
  `total4` varchar(20) DEFAULT NULL,
  `total5` varchar(20) DEFAULT NULL,
  `subtotal1` varchar(20) DEFAULT NULL,
  `subtotal2` varchar(20) DEFAULT NULL,
  `subtotal3` varchar(20) DEFAULT NULL,
  `subtotal4` varchar(20) DEFAULT NULL,
  `subtotal5` varchar(20) DEFAULT NULL,
  `input1field` varchar(20) DEFAULT NULL,
  `input2field` varchar(20) DEFAULT NULL,
  `input3field` varchar(20) DEFAULT NULL,
  `input4field` varchar(20) DEFAULT NULL,
  `input5field` varchar(20) DEFAULT NULL,
  `input6field` varchar(20) DEFAULT NULL,
  `input1source` varchar(60) DEFAULT '',
  `input2source` varchar(60) DEFAULT '',
  `input3source` varchar(60) DEFAULT '',
  `input4source` varchar(60) DEFAULT '',
  `input5source` varchar(60) DEFAULT '',
  `input6source` varchar(60) DEFAULT '',
  `fieldcharlimit` int(6) DEFAULT '20',
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `nesconstants`
--

DROP TABLE IF EXISTS `nesconstants`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `nesconstants` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `version` varchar(10) DEFAULT '2007',
  `class` varchar(80) DEFAULT NULL,
  `string` varchar(80) DEFAULT NULL,
  `value` varchar(80) DEFAULT NULL,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `numbers`
--

DROP TABLE IF EXISTS `numbers`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `numbers` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `tbl` varchar(20) DEFAULT 'customers',
  `num` int(10) DEFAULT '1',
  `len` int(10) DEFAULT '0',
  `pre` varchar(10) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `tbl` (`tbl`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `paymethods`
--

DROP TABLE IF EXISTS `paymethods`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `paymethods` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `account` varchar(20) NOT NULL DEFAULT '00000001',
  `paydesc` varchar(20) DEFAULT '',
  `paytype` varchar(10) DEFAULT '',
  `payname` varchar(20) DEFAULT '',
  `payphone` varchar(20) DEFAULT '',
  `payemail` varchar(80) DEFAULT '',
  `payaddress` varchar(40) DEFAULT '',
  `paycity` varchar(20) DEFAULT '',
  `paystate` varchar(20) DEFAULT '',
  `payzip` varchar(15) DEFAULT '',
  `paycountry` varchar(15) DEFAULT '',
  `payccnum` varchar(20) DEFAULT '',
  `payccexpmonth` varchar(2) DEFAULT '',
  `payccexpyear` varchar(6) DEFAULT '',
  `payccv2` varchar(6) DEFAULT '',
  `payabarouting` varchar(15) DEFAULT '',
  `payabaaccount` varchar(20) DEFAULT '',
  `paylastused` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `paylastresp` varchar(20) DEFAULT '',
  `paycomments` text,
  `recurring` int(1) DEFAULT '0',
  `preferred` int(1) DEFAULT '0',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `payplan`
--

DROP TABLE IF EXISTS `payplan`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `payplan` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `payplan` varchar(20) DEFAULT '',
  `description` varchar(80) DEFAULT '',
  `variable` varchar(20) DEFAULT '',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `what` (`portal`,`payplan`),
  KEY `portal` (`portal`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `perms`
--

DROP TABLE IF EXISTS `perms`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `perms` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `cat` varchar(40) NOT NULL DEFAULT 'Misc',
  `subcat` varchar(20) DEFAULT '',
  `perm` varchar(10) NOT NULL DEFAULT '',
  `role` varchar(10) NOT NULL DEFAULT '',
  `seclevel` int(10) DEFAULT '50',
  `description` varchar(80) DEFAULT '',
  `longdesc` text NOT NULL,
  `active` int(1) DEFAULT '1',
  `cogs` int(1) DEFAULT '1',
  `icon` varchar(40) DEFAULT '',
  `url` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `cat` (`perm`) USING BTREE,
  KEY `perm` (`perm`) USING BTREE,
  KEY `role` (`role`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `portals`
--

DROP TABLE IF EXISTS `portals`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `portals` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'login',
  `portalname` varchar(80) DEFAULT NULL,
  `header` text,
  `subheader` text,
  `footer` text,
  `welcomepage` text,
  `theme` varchar(20) DEFAULT 'default',
  `group1name` varchar(20) DEFAULT NULL,
  `group2name` varchar(20) DEFAULT NULL,
  `group3name` varchar(20) DEFAULT NULL,
  `group4name` varchar(20) DEFAULT NULL,
  `group5name` varchar(20) DEFAULT NULL,
  `group6name` varchar(20) DEFAULT NULL,
  `color1a` varchar(6) DEFAULT '006699',
  `color1b` varchar(6) DEFAULT '003366',
  `color2a` varchar(6) DEFAULT '009966',
  `color2b` varchar(6) DEFAULT '006633',
  `jcname` varchar(60) DEFAULT 'Juice Card',
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `mnytext` varchar(20) DEFAULT 'Dollars',
  `mnysymbol` varchar(5) DEFAULT '$',
  `mnyplace` varchar(1) DEFAULT 'L',
  `premnysymbol` varchar(10) DEFAULT '$',
  `postmnysymbol` varchar(10) DEFAULT '',
  `contact` varchar(200) DEFAULT '',
  `defaultsgc` varchar(10) DEFAULT '901077',
  `stsmode` varchar(10) DEFAULT 'LIVE',
  `taxperc` double(6,6) DEFAULT '0.000000',
  `payinfomodule` varchar(20) DEFAULT 'default',
  `receiptmodule` varchar(20) DEFAULT 'default',
  `receiptheader` text,
  `weekstart` date DEFAULT '2011-01-02',
  `dailyinterest` double(16,8) DEFAULT '0.00066666',
  `taxabbrev` varchar(10) DEFAULT 'TAX',
  `licensekey` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `prepayreads`
--

DROP TABLE IF EXISTS `prepayreads`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `prepayreads` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL DEFAULT 'portal',
  `serialnumber` varchar(32) DEFAULT '',
  `deviceid` varchar(32) NOT NULL DEFAULT '',
  `source` varchar(10) NOT NULL DEFAULT '',
  `status` varchar(10) NOT NULL DEFAULT '',
  `timestamp` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `normal` bigint(20) DEFAULT '0',
  `emergency` bigint(20) DEFAULT '0',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `what` (`portal`,`deviceid`,`timestamp`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `deviceid` (`deviceid`) USING BTREE,
  KEY `serialnumber` (`serialnumber`) USING BTREE,
  KEY `timestamp` (`timestamp`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `printmgr`
--

DROP TABLE IF EXISTS `printmgr`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `printmgr` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '',
  `statement` varchar(80) DEFAULT '',
  `invoice` varchar(80) DEFAULT '',
  `letter` varchar(80) DEFAULT '',
  `arrears` varchar(80) DEFAULT '',
  `statementback` varchar(30) DEFAULT '',
  `invoiceback` varchar(30) DEFAULT '',
  `letterback` varchar(30) DEFAULT '',
  `arrearsback` varchar(30) DEFAULT '',
  `autoprintwo` int(1) DEFAULT '1',
  `idcard` varchar(30) DEFAULT '',
  `resinvoiceemail` varchar(80) DEFAULT '',
  `resinvoiceprint` varchar(80) DEFAULT '',
  `cominvoiceemail` varchar(80) DEFAULT '',
  `cominvoiceprint` varchar(80) DEFAULT '',
  `resinvoicemode` varchar(30) DEFAULT '',
  `cominvoicemode` varchar(30) DEFAULT '',
  `contractprepaid` varchar(80) DEFAULT '',
  `contractpostpaid` varchar(80) DEFAULT '',
  `scheduledpayments` varchar(80) DEFAULT '',
  `investigatewo1` varchar(80) DEFAULT '',
  `investigatewo2` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `printstats`
--

DROP TABLE IF EXISTS `printstats`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `printstats` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL DEFAULT '*',
  `account` varchar(20) NOT NULL DEFAULT '',
  `transaction` bigint(20) NOT NULL DEFAULT '0',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `route` varchar(10) NOT NULL DEFAULT '',
  `droute` varchar(10) NOT NULL DEFAULT '',
  `correlative` varchar(10) NOT NULL DEFAULT '',
  `printer` varchar(20) NOT NULL DEFAULT '',
  `ack` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `quickpick`
--

DROP TABLE IF EXISTS `quickpick`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `quickpick` (
  `portal` varchar(20) CHARACTER SET utf8mb4 NOT NULL DEFAULT 'demo',
  `amount` double(16,2) DEFAULT '0.00',
  `C` bigint(21) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `rateplan`
--

DROP TABLE IF EXISTS `rateplan`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `rateplan` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `tariff` varchar(20) DEFAULT NULL,
  `service` varchar(12) NOT NULL DEFAULT 'Electricity',
  `tier` varchar(10) NOT NULL DEFAULT '1',
  `rate` double(12,6) NOT NULL DEFAULT '0.100000',
  `startdate` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `enddate` datetime NOT NULL DEFAULT '2030-12-31 23:59:59',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `usagebasestart` int(10) DEFAULT '0',
  `rateplandesc` varchar(80) DEFAULT '',
  `units` varchar(10) DEFAULT 'kWh',
  `taxable` int(1) DEFAULT '1',
  `coa` varchar(20) DEFAULT '4005',
  `arcoa` varchar(10) DEFAULT '1102',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `tariff` (`tariff`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `read_source`
--

DROP TABLE IF EXISTS `read_source`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `read_source` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `com_id` int(10) NOT NULL,
  `source` tinytext NOT NULL,
  `pull_reads` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `com_id` (`com_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `report`
--

DROP TABLE IF EXISTS `report`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `report` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `itemgroup` varchar(20) DEFAULT 'lookup',
  `itemid` varchar(20) DEFAULT 'uniqid',
  `itemname` varchar(60) DEFAULT '',
  `itemdesc` text,
  `seclevel` int(6) DEFAULT '90',
  `availtologins` text,
  `availtoroles` text,
  `query` text,
  `query2` text,
  `groupon` text,
  `asnumbers` text NOT NULL,
  `totals` text,
  `input1field` text,
  `input1source` varchar(80) DEFAULT '',
  `input2field` text,
  `input2source` varchar(80) DEFAULT '',
  `input3field` text,
  `input3source` varchar(80) DEFAULT '',
  `input4field` text,
  `input4source` varchar(80) DEFAULT '',
  `input5field` text,
  `input5source` varchar(80) DEFAULT '',
  `input6field` text,
  `input6source` varchar(80) DEFAULT '',
  `input7field` text,
  `input7source` varchar(80) DEFAULT '',
  `input8field` text,
  `input8source` varchar(80) DEFAULT '',
  `input9field` text,
  `input9source` varchar(80) DEFAULT '',
  `output` varchar(20) DEFAULT 'REPORT',
  `outputformats` varchar(80) DEFAULT 'HTML|CSV|XLS|PDF',
  `outputmode` varchar(80) DEFAULT 'NOW|OFFLINE|EMAIL',
  `groupchart` text,
  `totalchart` text,
  `mapchart` text,
  `displaynotes` text,
  `comments` text,
  `defaultdatemode` varchar(10) DEFAULT 'D',
  `fieldcharlimit` int(6) DEFAULT '40',
  `maxtime` double(16,4) DEFAULT '0.0000',
  `counter` int(10) DEFAULT '0',
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `itemid` (`itemid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `reportq`
--

DROP TABLE IF EXISTS `reportq`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `reportq` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL DEFAULT 'invalid',
  `login` varchar(20) NOT NULL DEFAULT 'invalid',
  `itemid` varchar(20) NOT NULL DEFAULT 'invalid',
  `request` text,
  `requestdatetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `completedatetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `requestdatetime` (`requestdatetime`) USING BTREE,
  KEY `login` (`login`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `reportschedule`
--

DROP TABLE IF EXISTS `reportschedule`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `reportschedule` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL DEFAULT 'invalid',
  `login` varchar(20) NOT NULL DEFAULT 'invalid',
  `itemid` varchar(20) NOT NULL DEFAULT 'invalid',
  `request` text,
  `requestdatetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `completedatetime` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `schedule` varchar(20) DEFAULT 'DAILY',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `requestdatetime` (`requestdatetime`) USING BTREE,
  KEY `login` (`login`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `rrlog`
--

DROP TABLE IF EXISTS `rrlog`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `rrlog` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT '0000001',
  `login` varchar(20) NOT NULL DEFAULT '0000001',
  `rr` varchar(20) DEFAULT '',
  `step` int(6) DEFAULT '0',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `rr` (`rr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `schedcharges`
--

DROP TABLE IF EXISTS `schedcharges`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `schedcharges` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `entity` varchar(10) NOT NULL DEFAULT 'cepm',
  `account` varchar(20) NOT NULL DEFAULT '0000001',
  `locid` varchar(20) DEFAULT NULL,
  `serialnumber` varchar(32) DEFAULT NULL,
  `transaction` bigint(20) DEFAULT '0',
  `readstart` double(16,2) DEFAULT '0.00',
  `readend` double(16,2) DEFAULT '0.00',
  `chargedate` date NOT NULL DEFAULT '1970-01-01',
  `chargetype` varchar(10) DEFAULT NULL,
  `chargedesc` varchar(80) DEFAULT '',
  `chargeqty` double(16,2) NOT NULL DEFAULT '0.00',
  `chargeamount` double(16,6) NOT NULL DEFAULT '0.000000',
  `chargetotal` double(16,2) NOT NULL DEFAULT '0.00',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `readstartdate` datetime DEFAULT '1970-01-01 00:00:01',
  `readenddate` datetime DEFAULT '1970-01-01 00:00:01',
  `coa` varchar(20) DEFAULT NULL,
  `arcoa` varchar(10) DEFAULT '1102',
  `chargesuniq` bigint(20) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `chargedate` (`chargedate`) USING BTREE,
  KEY `chargesuniq` (`chargesuniq`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `schedmgr`
--

DROP TABLE IF EXISTS `schedmgr`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `schedmgr` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT 'portal',
  `route` varchar(20) DEFAULT '1',
  `schedtype` varchar(10) DEFAULT 'Week',
  `value` varchar(20) DEFAULT '1',
  `comment` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `route` (`route`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `schedule`
--

DROP TABLE IF EXISTS `schedule`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `schedule` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT 'portal',
  `reading` int(8) DEFAULT '0',
  `billing` int(8) DEFAULT '3',
  `remindersms1` int(8) DEFAULT '20',
  `remindersms2` int(8) DEFAULT '25',
  `remindersms3` int(8) DEFAULT '30',
  `reminderemail1` int(8) DEFAULT '15',
  `reminderemail2` int(8) DEFAULT '26',
  `reminderemail3` int(8) DEFAULT '29',
  `reminderivr1` int(8) DEFAULT '15',
  `reminderivr2` int(8) DEFAULT '26',
  `reminderivr3` int(8) DEFAULT '29',
  `disconnect1` int(8) DEFAULT '33',
  `disconnect2` int(8) DEFAULT '40',
  `disconnect3` int(8) DEFAULT '60',
  `collections` int(8) DEFAULT '90',
  `cancelled` int(8) DEFAULT '360',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `scheduler`
--

DROP TABLE IF EXISTS `scheduler`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `scheduler` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '',
  `schedule` smallint(2) DEFAULT '0',
  `flag` smallint(1) DEFAULT '0',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `portal` (`portal`,`schedule`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `schema_migrations`
--

DROP TABLE IF EXISTS `schema_migrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `schema_migrations` (
  `version` bigint(20) NOT NULL,
  `dirty` tinyint(1) NOT NULL,
  PRIMARY KEY (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `seclevel`
--

DROP TABLE IF EXISTS `seclevel`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `seclevel` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `seclevel` varchar(20) NOT NULL DEFAULT 'demo',
  `description` varchar(120) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `simplereports`
--

DROP TABLE IF EXISTS `simplereports`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `simplereports` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `repcat` varchar(20) DEFAULT '',
  `repcatname` varchar(80) DEFAULT '',
  `report` varchar(20) DEFAULT 'uniqid',
  `reportname` varchar(60) DEFAULT NULL,
  `seclevel` int(6) DEFAULT NULL,
  `availableto` text,
  `availabletoroles` text,
  `reportdesc` text,
  `table1` varchar(40) DEFAULT NULL,
  `specialfunction` varchar(20) DEFAULT NULL,
  `charttype` varchar(20) DEFAULT '',
  `query1` text,
  `query2` text,
  `query3` text,
  `query4` text,
  `query5` text,
  `total1` varchar(20) DEFAULT NULL,
  `total2` varchar(20) DEFAULT NULL,
  `total3` varchar(20) DEFAULT NULL,
  `total4` varchar(20) DEFAULT NULL,
  `total5` varchar(20) DEFAULT NULL,
  `total6` varchar(20) DEFAULT NULL,
  `total7` varchar(20) DEFAULT NULL,
  `total8` varchar(20) DEFAULT NULL,
  `subtotal1` varchar(20) DEFAULT NULL,
  `subtotal2` varchar(20) DEFAULT NULL,
  `subtotal3` varchar(20) DEFAULT NULL,
  `subtotal4` varchar(20) DEFAULT NULL,
  `subtotal5` varchar(20) DEFAULT NULL,
  `input1field` varchar(20) DEFAULT NULL,
  `input2field` varchar(20) DEFAULT NULL,
  `input3field` varchar(20) DEFAULT NULL,
  `input4field` varchar(20) DEFAULT NULL,
  `input5field` varchar(20) DEFAULT NULL,
  `input6field` varchar(20) DEFAULT NULL,
  `input1source` varchar(60) DEFAULT '',
  `input2source` varchar(60) DEFAULT '',
  `input3source` varchar(60) DEFAULT '',
  `input4source` varchar(60) DEFAULT '',
  `input5source` varchar(60) DEFAULT '',
  `input6source` varchar(60) DEFAULT '',
  `fieldcharlimit` int(6) DEFAULT '20',
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `zed` int(1) DEFAULT '1',
  `defaultfromdatetoday` int(1) DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `report` (`report`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `sms`
--

DROP TABLE IF EXISTS `sms`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sms` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT '00000001',
  `serialnumber` varchar(20) NOT NULL DEFAULT '',
  `action` varchar(20) NOT NULL DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `apiid` varchar(40) NOT NULL DEFAULT '',
  `fromnum` varchar(20) NOT NULL DEFAULT '',
  `tonum` varchar(20) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `momsgid` varchar(40) NOT NULL DEFAULT '',
  `text` varchar(80) DEFAULT '',
  `reply` text,
  `transaction` varchar(20) DEFAULT '',
  `login` varchar(20) DEFAULT '',
  `coupon` varchar(20) DEFAULT '',
  `type` varchar(10) DEFAULT 'receipt',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `error_count` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `serialnumber` (`serialnumber`) USING BTREE,
  KEY `fromnum` (`fromnum`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `specialarrears`
--

DROP TABLE IF EXISTS `specialarrears`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `specialarrears` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT '0000001',
  `serialnumber` varchar(32) DEFAULT '',
  `arrearsid` bigint(20) DEFAULT NULL,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `transaction` int(10) NOT NULL DEFAULT '0',
  `arrearstype` varchar(20) DEFAULT '',
  `payplan` varchar(20) DEFAULT '',
  `amount` double(16,2) NOT NULL DEFAULT '0.00',
  `comment` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `login` varchar(20) DEFAULT '',
  `startdate` date NOT NULL DEFAULT '1970-01-01',
  `interestcharged` date DEFAULT '1970-01-01',
  `mgmtfeeable` int(1) DEFAULT '1',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `arrearsid` (`arrearsid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `specialstatus`
--

DROP TABLE IF EXISTS `specialstatus`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `specialstatus` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `specialstatus` varchar(20) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

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

DROP TABLE IF EXISTS `state`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `state` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT NULL,
  `login` varchar(20) NOT NULL DEFAULT 'admin',
  `state` varchar(20) DEFAULT NULL,
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `state` (`state`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `statustypeid`
--

DROP TABLE IF EXISTS `statustypeid`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `statustypeid` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `statustypeid` varchar(20) NOT NULL,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `statustypeid` (`statustypeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `stsmq`
--

DROP TABLE IF EXISTS `stsmq`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `stsmq` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'invalid',
  `status` varchar(10) NOT NULL DEFAULT 'invalid',
  `command` varchar(12) NOT NULL DEFAULT 'invalid',
  `edsn` varchar(20) NOT NULL DEFAULT '00000000000',
  `amount` double(16,2) NOT NULL DEFAULT '0.00',
  `request_dt` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `key_type` int(10) NOT NULL DEFAULT '1',
  `sgc` varchar(6) NOT NULL DEFAULT '000000',
  `ti` varchar(3) NOT NULL DEFAULT '01',
  `krn` int(2) NOT NULL DEFAULT '1',
  `ken` int(3) NOT NULL DEFAULT '255',
  `base_date` int(4) NOT NULL DEFAULT '1993',
  `tid` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `token1` varchar(20) DEFAULT NULL,
  `token2` varchar(20) DEFAULT NULL,
  `complete_dt` datetime DEFAULT NULL,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `request_dt` (`request_dt`) USING BTREE,
  KEY `edsn` (`edsn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `stsspec`
--

DROP TABLE IF EXISTS `stsspec`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `stsspec` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `stsmquniq` int(10) NOT NULL DEFAULT '0',
  `portal` varchar(20) NOT NULL DEFAULT 'invalid',
  `command` varchar(30) DEFAULT 'invalid',
  `edsn` varchar(20) DEFAULT '00000000000',
  `token` varchar(50) DEFAULT '',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `stsmquniq` (`stsmquniq`) USING BTREE,
  KEY `edsn` (`edsn`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `subtariff`
--

DROP TABLE IF EXISTS `subtariff`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `subtariff` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `subtariff` varchar(20) NOT NULL DEFAULT '',
  `description` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `subtariff` (`subtariff`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `systemrole`
--

DROP TABLE IF EXISTS `systemrole`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `systemrole` (
  `uniq` tinyint(4) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `systemrole` varchar(10) DEFAULT '',
  `description` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `systemrole` (`systemrole`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `systemusers`
--

DROP TABLE IF EXISTS `systemusers`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `systemusers` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `login` varchar(20) DEFAULT '',
  `passwd` varchar(40) DEFAULT '8765asd8761212H78',
  `token` varchar(120) NOT NULL DEFAULT '',
  `name` varchar(30) DEFAULT '',
  `phone1` varchar(20) DEFAULT '',
  `phone2` varchar(20) DEFAULT '',
  `sms1` varchar(20) DEFAULT '',
  `sms2` varchar(20) DEFAULT '',
  `vendphonecid` varchar(20) DEFAULT '',
  `vendphonepin` varchar(10) DEFAULT '',
  `email` varchar(200) DEFAULT '',
  `location` varchar(60) DEFAULT '',
  `systemrole` varchar(10) DEFAULT 'CSR',
  `seclevel` int(6) DEFAULT '0',
  `active` int(1) DEFAULT '0',
  `editdata` int(1) DEFAULT '0',
  `group1` varchar(40) DEFAULT '',
  `group2` varchar(40) DEFAULT '',
  `group3` varchar(40) DEFAULT '',
  `timeout` int(6) DEFAULT '50000',
  `vendor` int(1) DEFAULT '0',
  `vendornumber` varchar(10) DEFAULT '',
  `vendorlimit` double(16,2) DEFAULT '0.00',
  `speciallimit` double(16,2) DEFAULT '0.00',
  `blockedaccounts` text,
  `stationidlist` text,
  `staledays` int(8) NOT NULL DEFAULT '8',
  `notes` text,
  `receiptformat` varchar(10) DEFAULT 'receipt',
  `receiptfontsize` varchar(10) DEFAULT '12',
  `charts` varchar(20) DEFAULT 'FLOT',
  `lastlogin` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `fromip` varchar(20) NOT NULL DEFAULT '127.0.0.2',
  `created` date NOT NULL DEFAULT '1970-01-01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `yubikey` varchar(40) DEFAULT '',
  `target` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `login` (`portal`,`login`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `tariff`
--

DROP TABLE IF EXISTS `tariff`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tariff` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `tariff` varchar(20) DEFAULT NULL,
  `description` varchar(80) DEFAULT '',
  `muni` varchar(20) DEFAULT NULL,
  `tariffgroup` varchar(20) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `tariff` (`tariff`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `tarifffixed`
--

DROP TABLE IF EXISTS `tarifffixed`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tarifffixed` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL DEFAULT '',
  `tariff` varchar(20) DEFAULT '*',
  `description` varchar(20) DEFAULT '',
  `amount` double(16,2) NOT NULL DEFAULT '0.00',
  `comment` varchar(80) DEFAULT '',
  `taxable` int(1) DEFAULT '0',
  `coa` varchar(20) DEFAULT '4900',
  `arcoa` varchar(20) DEFAULT '1102',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `chargedesc` (`tariff`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `tariffgroups`
--

DROP TABLE IF EXISTS `tariffgroups`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tariffgroups` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '*',
  `tariffgroup` varchar(20) DEFAULT '',
  `daystoeval` int(10) DEFAULT '30',
  `tariff1` varchar(20) DEFAULT '',
  `tariff1start` int(10) DEFAULT '0',
  `tariff2` varchar(20) DEFAULT '',
  `tariff2start` int(10) DEFAULT '100',
  `tariff3` varchar(20) DEFAULT '',
  `tariff3start` int(10) DEFAULT '200',
  `tariff4` varchar(20) DEFAULT '',
  `tariff4start` int(10) DEFAULT '300',
  `tariff5` varchar(20) DEFAULT '',
  `tariff5start` int(10) DEFAULT '400',
  `tariff6` varchar(20) DEFAULT '',
  `tariff6start` int(10) DEFAULT '500',
  `created` datetime DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `tier`
--

DROP TABLE IF EXISTS `tier`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tier` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `tier` varchar(10) NOT NULL DEFAULT '1',
  `description` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `tier` (`tier`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `tq`
--

DROP TABLE IF EXISTS `tq`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tq` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `portal` varchar(10) DEFAULT '*',
  `session` varchar(20) DEFAULT '',
  `account` varchar(20) DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `vars` varchar(150) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `account` (`account`) USING BTREE,
  KEY `created` (`created`) USING BTREE,
  KEY `session` (`session`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `transactions`
--

DROP TABLE IF EXISTS `transactions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `transactions` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL DEFAULT 'demo',
  `login` varchar(20) DEFAULT '',
  `account` varchar(20) NOT NULL DEFAULT '0000000',
  `locid` varchar(20) DEFAULT '',
  `serialnumber` varchar(32) DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `type` varchar(10) DEFAULT '',
  `ccnum` varchar(10) DEFAULT '',
  `authcode` varchar(20) NOT NULL DEFAULT '',
  `transaction` varchar(20) NOT NULL DEFAULT '',
  `payinfo` varchar(30) DEFAULT '',
  `source` varchar(10) DEFAULT '',
  `status` varchar(10) NOT NULL DEFAULT '',
  `substatus` varchar(10) NOT NULL DEFAULT '',
  `ststoken` varchar(42) DEFAULT '',
  `tariff` varchar(20) DEFAULT '',
  `subtariff` varchar(10) DEFAULT '',
  `paid` double(16,2) DEFAULT '0.00',
  `currency` varchar(10) DEFAULT 'MNY',
  `wonum` varchar(10) DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `fixed` double(16,2) DEFAULT '0.00',
  `arrears` double(16,2) DEFAULT '0.00',
  `charges` double(16,2) DEFAULT '0.00',
  `services` double(16,2) DEFAULT '0.00',
  `kvademandcharge` double(16,2) DEFAULT '0.00',
  `fuel` double(16,2) DEFAULT '0.00',
  `vat` double(16,2) DEFAULT '0.00',
  `wh` int(10) DEFAULT '0',
  `cfw` double(16,2) DEFAULT '0.00',
  `cfng` double(16,2) DEFAULT '0.00',
  `other` double(16,2) DEFAULT '0.00',
  `bt1wh` int(10) DEFAULT '0',
  `bt1amt` double(16,2) DEFAULT '0.00',
  `bt2wh` int(10) DEFAULT '0',
  `bt2amt` double(16,2) DEFAULT '0.00',
  `bt3wh` int(10) DEFAULT '0',
  `bt3amt` double(16,2) DEFAULT '0.00',
  `bt4wh` int(10) DEFAULT '0',
  `bt4amt` double(16,2) DEFAULT '0.00',
  `bt5wh` int(10) DEFAULT '0',
  `bt5amt` double(16,2) DEFAULT '0.00',
  `bt6wh` int(10) DEFAULT '0',
  `bt6amt` double(16,2) DEFAULT '0.00',
  `mgmtfee` double(16,2) DEFAULT '0.00',
  `mgmtfeetax` double(16,2) DEFAULT '0.00',
  `description` text,
  `batchnum` int(10) DEFAULT '0',
  `vendoraddtransfee` double(16,2) DEFAULT '0.00',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `vendortrans` tinyint(4) DEFAULT '0',
  `vendornumber` varchar(20) DEFAULT '',
  `wallet` double(16,2) DEFAULT '0.00',
  `checknum` varchar(10) DEFAULT '',
  `checkname` varchar(40) DEFAULT '',
  `bankname` varchar(20) DEFAULT '',
  `levy` double(16,2) DEFAULT '0.00',
  `cctrans` varchar(20) DEFAULT NULL,
  `govnum` varchar(20) DEFAULT NULL,
  `gnt` varchar(2) DEFAULT NULL,
  `tid` varchar(10) DEFAULT NULL,
  `levy2` double(16,2) DEFAULT NULL,
  `bt7wh` int(10) DEFAULT '0',
  `bt8wh` int(10) DEFAULT '0',
  `bt9wh` int(10) DEFAULT '0',
  `bt10wh` int(10) DEFAULT '0',
  `bt7amt` double(16,2) DEFAULT '0.00',
  `bt8amt` double(16,2) DEFAULT '0.00',
  `bt9amt` double(16,2) DEFAULT '0.00',
  `bt10amt` double(16,2) DEFAULT '0.00',
  `levy3` double(16,2) DEFAULT '0.00',
  `units` varchar(10) DEFAULT 'kWh',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `locid` (`locid`) USING BTREE,
  KEY `serialnumber` (`serialnumber`) USING BTREE,
  KEY `created` (`created`) USING BTREE,
  KEY `login` (`login`),
  KEY `venornumber` (`vendornumber`),
  KEY `govnum` (`govnum`),
  KEY `batchnum` (`batchnum`),
  KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `transformers`
--

DROP TABLE IF EXISTS `transformers`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `transformers` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `transformer` varchar(20) NOT NULL,
  `transformername` varchar(40) NOT NULL,
  `serialnumber` varchar(20) NOT NULL,
  `substation` varchar(20) NOT NULL,
  `route` varchar(20) NOT NULL,
  `oem` varchar(20) NOT NULL,
  `loclat` varchar(20) DEFAULT '',
  `loclong` varchar(20) DEFAULT '',
  `comments` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `transformer` (`transformer`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `trinity`
--

DROP TABLE IF EXISTS `trinity`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `trinity` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '*',
  `login` varchar(10) DEFAULT '*',
  `status` varchar(10) DEFAULT 'UPLOADED',
  `createdaccount` varchar(20) DEFAULT '',
  `createdlocid` varchar(20) DEFAULT '',
  `createdmeter` varchar(32) DEFAULT '',
  `linetype` varchar(20) DEFAULT 'CSV',
  `linedef` text,
  `linedata` text,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `completed` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `externalrecord` varchar(20) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `units`
--

DROP TABLE IF EXISTS `units`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `units` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `units` varchar(10) DEFAULT NULL,
  `description` varchar(80) DEFAULT NULL,
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `unitwallet`
--

DROP TABLE IF EXISTS `unitwallet`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `unitwallet` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'prepaid',
  `account` varchar(20) NOT NULL DEFAULT '',
  `units` varchar(10) DEFAULT 'kWh',
  `balance` double(16,2) DEFAULT '0.00',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `account` (`account`) USING BTREE,
  KEY `portal` (`portal`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `unitwalltrans`
--

DROP TABLE IF EXISTS `unitwalltrans`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `unitwalltrans` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'prepaid',
  `account` varchar(20) NOT NULL DEFAULT '',
  `target` varchar(20) NOT NULL DEFAULT '',
  `login` varchar(20) DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `type` varchar(10) NOT NULL DEFAULT '',
  `transaction` varchar(20) NOT NULL DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `units` varchar(10) DEFAULT 'kWh',
  `description` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `target` (`target`) USING BTREE,
  KEY `login` (`login`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `userperms`
--

DROP TABLE IF EXISTS `userperms`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `userperms` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `login` varchar(20) NOT NULL DEFAULT '',
  `perm` varchar(10) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `login` (`login`) USING BTREE,
  KEY `perm` (`perm`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `variable`
--

DROP TABLE IF EXISTS `variable`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `variable` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `tariff` varchar(12) DEFAULT 'Domestic',
  `subtariff` varchar(10) DEFAULT 'PrePaid',
  `service` varchar(12) NOT NULL DEFAULT 'Electricity',
  `varcharge` varchar(20) DEFAULT '',
  `varchargedesc` varchar(80) DEFAULT '',
  `varchargeamount` double(6,6) NOT NULL DEFAULT '0.000000',
  `varchargeper` varchar(10) DEFAULT 'Currency',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `tariff` (`tariff`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `velocity`
--

DROP TABLE IF EXISTS `velocity`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `velocity` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT 'account',
  `fromip` varchar(20) NOT NULL DEFAULT '127.0.0.2',
  `velocity` int(8) DEFAULT '0',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `fromip` (`fromip`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `vendorbalance`
--

DROP TABLE IF EXISTS `vendorbalance`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vendorbalance` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `login` varchar(20) DEFAULT '',
  `vendorbalance` double(16,2) DEFAULT '0.00',
  `batchnum` int(10) DEFAULT '0',
  `vendornumber` varchar(30) DEFAULT 'vendor',
  `batchclosed` date NOT NULL DEFAULT '0000-00-00',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `login` (`login`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `vendorpayments`
--

DROP TABLE IF EXISTS `vendorpayments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vendorpayments` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `login` varchar(20) DEFAULT '',
  `fromip` varchar(20) DEFAULT '',
  `batch` int(10) DEFAULT '0',
  `vendornumber` varchar(30) DEFAULT '',
  `vendorlogin` varchar(20) DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `comments` text,
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `type` varchar(10) DEFAULT 'all',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `login` (`login`) USING BTREE,
  KEY `vendorlogin` (`vendorlogin`) USING BTREE,
  KEY `vendornumber` (`vendornumber`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `vendors`
--

DROP TABLE IF EXISTS `vendors`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vendors` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT '',
  `parentvendor` varchar(30) DEFAULT NULL,
  `vendornumber` varchar(30) DEFAULT '',
  `vendorname` varchar(30) DEFAULT '',
  `contact` varchar(20) DEFAULT NULL,
  `vendmode` varchar(10) DEFAULT NULL,
  `deposit` double(16,2) DEFAULT '0.00',
  `vendorlimit` double(16,2) DEFAULT '0.00',
  `overage` double(16,2) DEFAULT '0.00',
  `percentagefee` double(16,4) DEFAULT '0.0000',
  `addtransfee` double(16,2) DEFAULT '0.00',
  `tax` double(8,2) DEFAULT '0.00',
  `transfeedesc` varchar(40) DEFAULT 'Service Charge',
  `comments` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `selfclearbalance` int(1) DEFAULT '0',
  `receiptcomment` text,
  `vendoraddress1` varchar(30) DEFAULT '',
  `vendoraddress2` varchar(30) DEFAULT '',
  `vendoraddress3` varchar(30) DEFAULT '',
  `vendorcity` varchar(30) DEFAULT '',
  `vendorstate` varchar(30) DEFAULT '',
  `vendorpostal` varchar(20) DEFAULT NULL,
  `email` varchar(200) DEFAULT '',
  `phone` varchar(20) DEFAULT '',
  `sms1` varchar(20) DEFAULT NULL,
  `active` int(1) DEFAULT '1',
  `loclat` varchar(20) DEFAULT '',
  `loclong` varchar(20) DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `vendornumber` (`vendornumber`) USING BTREE,
  KEY `portal` (`portal`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `wallet`
--

DROP TABLE IF EXISTS `wallet`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `wallet` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `wallet` varchar(20) NOT NULL DEFAULT '00000001',
  `balance` double(16,2) DEFAULT '0.00',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  UNIQUE KEY `wallet` (`wallet`) USING BTREE,
  KEY `portal` (`portal`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `walltrans`
--

DROP TABLE IF EXISTS `walltrans`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `walltrans` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'prepaid',
  `wallet` varchar(20) NOT NULL DEFAULT '00000001',
  `target` varchar(20) NOT NULL DEFAULT '00000001',
  `login` varchar(20) DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `type` varchar(10) DEFAULT '',
  `ccnum` varchar(10) DEFAULT '',
  `source` varchar(10) DEFAULT '',
  `status` varchar(10) NOT NULL DEFAULT '',
  `transaction` varchar(20) NOT NULL DEFAULT '',
  `authcode` varchar(20) NOT NULL DEFAULT '',
  `amount` double(16,2) DEFAULT '0.00',
  `description` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `wallet` (`wallet`) USING BTREE,
  KEY `target` (`target`) USING BTREE,
  KEY `login` (`login`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `webpages`
--

DROP TABLE IF EXISTS `webpages`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `webpages` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `page` varchar(20) NOT NULL DEFAULT '',
  `content` text,
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `lang` varchar(10) DEFAULT 'en',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `page` (`page`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `whitelist`
--

DROP TABLE IF EXISTS `whitelist`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `whitelist` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL DEFAULT 'account',
  `fromipaddress` varchar(20) NOT NULL DEFAULT '127.0.0.2',
  `velocity` int(8) DEFAULT '0',
  `lastmod` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `comments` text,
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `fromipaddress` (`fromipaddress`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `woextras`
--

DROP TABLE IF EXISTS `woextras`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `woextras` (
  `uniq` bigint(20) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'cepm',
  `wonum` bigint(20) NOT NULL,
  `address1` varchar(80) NOT NULL,
  `address2` varchar(80) NOT NULL,
  `city` varchar(80) NOT NULL,
  `comments` varchar(80) NOT NULL,
  `voltage` int(10) NOT NULL,
  `phases` int(10) NOT NULL,
  `kw` int(10) NOT NULL,
  `extra1` varchar(40) NOT NULL DEFAULT '',
  `extra2` varchar(40) NOT NULL DEFAULT '',
  `extra3` varchar(40) NOT NULL DEFAULT '',
  `extra4` varchar(40) NOT NULL DEFAULT '',
  `extra5` varchar(40) NOT NULL DEFAULT '',
  `extra6` varchar(40) NOT NULL DEFAULT '',
  `extra7` varchar(40) NOT NULL DEFAULT '',
  `extra8` varchar(40) NOT NULL DEFAULT '',
  `extra9` varchar(40) NOT NULL DEFAULT '',
  `extra10` varchar(40) NOT NULL DEFAULT '',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `wonum` (`wonum`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `workorder`
--

DROP TABLE IF EXISTS `workorder`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `workorder` (
  `uniq` bigint(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `account` varchar(20) NOT NULL,
  `name` varchar(20) NOT NULL,
  `locid` varchar(20) NOT NULL,
  `substation` varchar(20) NOT NULL,
  `transformer` varchar(20) NOT NULL,
  `module` varchar(20) NOT NULL,
  `serialnumber` varchar(20) NOT NULL,
  `wotype` varchar(10) NOT NULL DEFAULT 'onsite',
  `type` varchar(20) NOT NULL,
  `assignedto` varchar(20) DEFAULT '',
  `created` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `expires` datetime NOT NULL DEFAULT '1970-01-01 00:00:01',
  `status` varchar(20) NOT NULL DEFAULT 'open',
  `substatus` varchar(20) DEFAULT '',
  `closed` datetime DEFAULT '1970-01-01 00:00:01',
  `timespent` varchar(20) DEFAULT '0',
  `priority` int(1) DEFAULT '1',
  `comments` text,
  `materialsused` text,
  `amount` varchar(20) NOT NULL,
  `batchnum` int(20) DEFAULT '0',
  `tohandheld` int(1) DEFAULT '0',
  `printed` int(1) DEFAULT '0',
  `handheldnum` int(10) NOT NULL DEFAULT '0',
  `socket` int(10) NOT NULL DEFAULT '0',
  `route` varchar(20) NOT NULL DEFAULT '',
  `correlative` varchar(20) NOT NULL DEFAULT '',
  `source` varchar(20) NOT NULL DEFAULT '',
  `special` varchar(20) DEFAULT '',
  `specialstat` varchar(20) DEFAULT '',
  `engid` varchar(20) NOT NULL DEFAULT '000000',
  `engopened` timestamp NOT NULL DEFAULT '1970-01-01 00:00:01',
  PRIMARY KEY (`uniq`),
  UNIQUE KEY `id` (`uniq`),
  KEY `portal` (`portal`) USING BTREE,
  KEY `name` (`name`) USING BTREE,
  KEY `created` (`created`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `workordertypes`
--

DROP TABLE IF EXISTS `workordertypes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `workordertypes` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(20) NOT NULL DEFAULT '*',
  `type` varchar(20) NOT NULL,
  `name` varchar(20) NOT NULL,
  `catagory` varchar(20) NOT NULL DEFAULT 'onsite',
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `writeoffs`
--

DROP TABLE IF EXISTS `writeoffs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `writeoffs` (
  `uniq` int(10) NOT NULL AUTO_INCREMENT,
  `portal` varchar(10) DEFAULT '',
  `coa` varchar(10) DEFAULT '',
  `description` varchar(80) DEFAULT '',
  PRIMARY KEY (`uniq`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `zg`
--

DROP TABLE IF EXISTS `zg`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zg` (
  `label` varchar(35) CHARACTER SET utf8mb4 DEFAULT NULL,
  `sublabel` varchar(32) CHARACTER SET utf8mb4 DEFAULT NULL,
  `parent` varchar(95) CHARACTER SET utf8mb4 DEFAULT NULL,
  `children` double(16,2) DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `zgadmin`
--

DROP TABLE IF EXISTS `zgadmin`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zgadmin` (
  `asof` date DEFAULT '0000-00-00',
  `balance` double(16,2) DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `zgosita`
--

DROP TABLE IF EXISTS `zgosita`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zgosita` (
  `asof` date DEFAULT '1970-01-01',
  `balance` double(16,2) DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `zmarried`
--

DROP TABLE IF EXISTS `zmarried`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `zmarried` (
  `portal` varchar(10) NOT NULL DEFAULT 'demo',
  `married` bigint(21) NOT NULL DEFAULT '0',
  `nonvendable` int(10) DEFAULT '0',
  `nonvendablenomgmtfee` int(10) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2019-02-25  9:08:23
