-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Tempo de geração: 30/01/2024 às 13:04
-- Versão do servidor: 8.0.35-cll-lve
-- Versão do PHP: 8.1.26

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!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 */;

--
-- Banco de dados: `nonoelem_allesdesktop`
--

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

--
-- Estrutura para tabela `atatendente`
--

CREATE TABLE `atatendente` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codatend` int NOT NULL,
  `nomeatend` char(50) NOT NULL,
  `codempta` int NOT NULL,
  `codfilialta` smallint NOT NULL,
  `codtpatend` int NOT NULL,
  `rgatend` char(13) DEFAULT NULL,
  `endatend` char(50) DEFAULT NULL,
  `bairatend` char(30) DEFAULT NULL,
  `cidatend` char(30) DEFAULT NULL,
  `cepatend` char(8) DEFAULT NULL,
  `foneatend` char(12) DEFAULT NULL,
  `faxatend` varchar(9) DEFAULT NULL,
  `emailatend` char(60) DEFAULT NULL,
  `numatend` int DEFAULT NULL,
  `ufatend` char(2) DEFAULT NULL,
  `ibgeatend` varchar(7) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `celatend` varchar(9) DEFAULT NULL,
  `identificatend` char(18) DEFAULT NULL,
  `codempus` int DEFAULT NULL,
  `codfilialus` int DEFAULT NULL,
  `idusu` char(8) DEFAULT NULL,
  `cpfatend` char(11) DEFAULT NULL,
  `codvend` int DEFAULT NULL,
  `codempve` int DEFAULT NULL,
  `codfilialve` int DEFAULT NULL,
  `codempep` int DEFAULT NULL,
  `codfilialep` smallint DEFAULT NULL,
  `matempr` int DEFAULT NULL,
  `metaatend` decimal(15,5) NOT NULL,
  `partpremiatend` char(1) NOT NULL,
  `acesatdolerout` char(1) NOT NULL,
  `acesatdoaltout` char(1) NOT NULL,
  `acesatdodellan` char(1) NOT NULL,
  `acesatdodelout` char(1) NOT NULL,
  `acesrelestout` char(1) NOT NULL,
  `acestrocomis` char(1) NOT NULL,
  `acestrocomisout` char(1) NOT NULL,
  `aceschamlerout` char(1) NOT NULL,
  `aceschamaltout` char(1) NOT NULL,
  `aceschamdellan` char(1) NOT NULL,
  `aceschamaltpro` char(1) NOT NULL,
  `aceschamdelout` char(1) NOT NULL,
  `aceschamfinpro` char(1) NOT NULL,
  `aceschamfinout` char(1) NOT NULL,
  `dtins` date DEFAULT NULL,
  `idusuins` char(8) DEFAULT NULL,
  `dtalt` date DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `hins` time DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `comissao` float(24,2) DEFAULT NULL,
  `inscconreg` varchar(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `atsetor`
--

CREATE TABLE `atsetor` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codsetat` int NOT NULL,
  `descsetat` char(50) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `atsetoratendente`
--

CREATE TABLE `atsetoratendente` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codsetat` int NOT NULL,
  `codempae` int NOT NULL,
  `codfilialae` smallint NOT NULL,
  `codatend` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `attarefa`
--

CREATE TABLE `attarefa` (
  `id` int NOT NULL,
  `datacadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `codemp` int NOT NULL,
  `idusu` int NOT NULL,
  `destino` char(1) NOT NULL,
  `idusuoutro` int NOT NULL,
  `tarefa` varchar(1000) NOT NULL,
  `data` date NOT NULL,
  `hora` time NOT NULL,
  `status` int NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `attipoatend`
--

CREATE TABLE `attipoatend` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtpatend` int NOT NULL,
  `desctpatend` char(50) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `attipoatendo`
--

CREATE TABLE `attipoatendo` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtpatendo` int NOT NULL,
  `desctpatendo` char(50) NOT NULL,
  `tipoatendo` char(1) NOT NULL,
  `codempfx` int DEFAULT NULL,
  `codfilialfx` smallint DEFAULT NULL,
  `codfluxo` int DEFAULT NULL,
  `ativoatendo` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `attipoatendosetor`
--

CREATE TABLE `attipoatendosetor` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtpatendo` int NOT NULL,
  `codempst` int NOT NULL,
  `codfilialst` smallint NOT NULL,
  `codsetat` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpcentral`
--

CREATE TABLE `cpcentral` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `id` int NOT NULL,
  `codcotacao` int NOT NULL,
  `datacriacao` date NOT NULL,
  `dataretorno` date NOT NULL,
  `totitensenviados` int NOT NULL,
  `totitensrecebidos` int DEFAULT NULL,
  `totitensaprovados` int DEFAULT NULL,
  `finalizado` char(1) NOT NULL,
  `obscentral` varchar(500) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpcompra`
--

CREATE TABLE `cpcompra` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codcompra` int NOT NULL,
  `codemppg` int NOT NULL,
  `codfilialpg` smallint NOT NULL,
  `codplanopag` int NOT NULL,
  `codempfr` int NOT NULL,
  `codfilialfr` smallint NOT NULL,
  `codfor` int NOT NULL,
  `codempse` int NOT NULL,
  `codfilialse` smallint NOT NULL,
  `serie` char(4) NOT NULL,
  `codemptm` int NOT NULL,
  `codfilialtm` smallint NOT NULL,
  `codtipomov` int NOT NULL,
  `doccompra` int NOT NULL,
  `dtentcompra` date NOT NULL,
  `dtemitcompra` date NOT NULL,
  `dtcompcompra` date NOT NULL,
  `percdesccompra` decimal(15,5) DEFAULT NULL,
  `percipicompra` decimal(6,2) DEFAULT NULL,
  `vlrprodcompra` decimal(15,5) DEFAULT NULL,
  `vlrliqcompra` decimal(15,5) DEFAULT NULL,
  `vlrcompra` decimal(15,5) DEFAULT NULL,
  `vlrdesccompra` decimal(15,5) DEFAULT NULL,
  `vlrdescitcompra` decimal(15,5) DEFAULT NULL,
  `vlradiccompra` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmscompra` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmsstcompra` decimal(15,5) DEFAULT NULL,
  `vlrbaseipicompra` decimal(15,5) DEFAULT NULL,
  `vlrbasepiscompra` decimal(15,5) DEFAULT NULL,
  `vlrbasecofinscompra` decimal(15,5) DEFAULT NULL,
  `vlricmscompra` decimal(15,5) DEFAULT NULL,
  `vlricmsstcompra` decimal(15,5) DEFAULT NULL,
  `vlripicompra` decimal(15,5) DEFAULT NULL,
  `vlrpiscompra` decimal(15,5) DEFAULT NULL,
  `vlrcofinscompra` decimal(15,5) DEFAULT NULL,
  `vlrfunruralcompra` decimal(15,5) DEFAULT NULL,
  `vlrfretecompra` decimal(15,5) DEFAULT NULL,
  `vlroutrascompra` decimal(15,5) DEFAULT NULL,
  `vlrisentascompra` decimal(15,5) DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtipocob` int DEFAULT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `impnotacompra` char(1) NOT NULL,
  `bloqcompra` char(1) NOT NULL,
  `emmanut` char(1) NOT NULL,
  `flag` char(1) DEFAULT NULL,
  `adicfretecompra` char(1) NOT NULL,
  `tipofretecompra` char(1) DEFAULT NULL,
  `codempsol` int DEFAULT NULL,
  `codfilialsol` smallint DEFAULT NULL,
  `codsol` int DEFAULT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `observacao` varchar(10000) DEFAULT NULL,
  `obs01` varchar(1024) DEFAULT NULL,
  `obs02` varchar(1024) DEFAULT NULL,
  `obs03` varchar(1024) DEFAULT NULL,
  `obs04` varchar(1024) DEFAULT NULL,
  `adicadiccompra` char(1) NOT NULL,
  `qtdfretecompra` decimal(15,5) DEFAULT NULL,
  `adicfretebaseicms` char(1) DEFAULT NULL,
  `adicadicbaseicms` char(1) DEFAULT NULL,
  `adicipibaseicms` char(1) DEFAULT NULL,
  `chavenfecompra` char(44) DEFAULT NULL,
  `statuscompra` char(2) NOT NULL,
  `nrodi` char(10) DEFAULT NULL,
  `dtregdi` date DEFAULT NULL,
  `locdesembdi` char(60) DEFAULT NULL,
  `siglaufdesembdi` char(2) DEFAULT NULL,
  `codpaisdesembdi` int DEFAULT NULL,
  `dtdesembdi` date DEFAULT NULL,
  `identcontainer` char(20) DEFAULT NULL,
  `calctrib` char(1) NOT NULL,
  `codemprm` int DEFAULT NULL,
  `codfilialrm` smallint DEFAULT NULL,
  `ticket` int DEFAULT NULL,
  `codempct` int DEFAULT NULL,
  `codfilialct` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `anocc` smallint DEFAULT NULL,
  `codcc` char(19) DEFAULT NULL,
  `codemppn` int DEFAULT NULL,
  `codfilialpn` smallint DEFAULT NULL,
  `codplan` char(13) DEFAULT NULL,
  `infcompl` varchar(10000) DEFAULT NULL,
  `numacdraw` varchar(20) DEFAULT NULL,
  `tipodocimp` char(1) DEFAULT NULL,
  `sitdoc` char(2) DEFAULT NULL,
  `obsnfe` varchar(10000) DEFAULT NULL,
  `codempop` int DEFAULT NULL,
  `codfilialop` smallint DEFAULT NULL,
  `codop` int DEFAULT NULL,
  `seqop` smallint DEFAULT NULL,
  `codempim` int DEFAULT NULL,
  `codfilialim` smallint DEFAULT NULL,
  `codimp` int DEFAULT NULL,
  `vlrbaseiicompra` decimal(15,5) DEFAULT NULL,
  `vlriicompra` decimal(15,5) DEFAULT NULL,
  `vlricmsdiferido` decimal(15,5) DEFAULT NULL,
  `vlricmsdevido` decimal(15,5) DEFAULT NULL,
  `vlricmscredpresum` decimal(15,5) DEFAULT NULL,
  `obspag` varchar(250) DEFAULT NULL,
  `codempoc` int DEFAULT NULL,
  `codfilialoc` smallint DEFAULT NULL,
  `codordcp` int DEFAULT NULL,
  `vlrisscompra` decimal(15,5) DEFAULT NULL,
  `nroordemcompra` varchar(20) DEFAULT NULL,
  `vlroutrasdesp` decimal(15,5) DEFAULT NULL,
  `cnf` bigint DEFAULT NULL,
  `chavenfevalida` varchar(20) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `motivocanccompra` varchar(255) DEFAULT NULL,
  `vlricmscredor` decimal(15,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpcotacao`
--

CREATE TABLE `cpcotacao` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codsol` int NOT NULL,
  `coditsol` smallint NOT NULL,
  `codcot` smallint NOT NULL,
  `dtcot` date NOT NULL,
  `dtvalidcot` date NOT NULL,
  `idusucot` char(8) NOT NULL,
  `codempfr` int NOT NULL,
  `codfilialfr` smallint NOT NULL,
  `codfor` int NOT NULL,
  `qtdcot` decimal(15,5) NOT NULL,
  `qtdaprovcot` decimal(15,5) NOT NULL,
  `precocot` decimal(15,5) NOT NULL,
  `sitcompitsol` char(2) DEFAULT NULL,
  `sitaprovitsol` char(2) DEFAULT NULL,
  `sititsol` char(2) DEFAULT NULL,
  `motivocanccot` varchar(10000) DEFAULT NULL,
  `motivocotabaixo` varchar(10000) DEFAULT NULL,
  `usarendacot` char(1) DEFAULT NULL,
  `rendacot` smallint DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `vlrfreteitcompra` decimal(15,5) DEFAULT NULL,
  `percipiitcompra` decimal(9,2) DEFAULT NULL,
  `vlrbaseipiitcompra` decimal(15,5) DEFAULT NULL,
  `vlripiitcompra` decimal(15,5) DEFAULT NULL,
  `vlrliqitcompra` decimal(15,5) DEFAULT NULL,
  `codemppp` int DEFAULT NULL,
  `codfilialpp` smallint DEFAULT NULL,
  `codplanopag` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpdevolucao`
--

CREATE TABLE `cpdevolucao` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcompra` int NOT NULL,
  `coditcompra` int NOT NULL,
  `qtddev` decimal(15,5) NOT NULL,
  `codempvd` int NOT NULL,
  `codfilialvd` smallint NOT NULL,
  `codvenda` int NOT NULL,
  `tipovenda` char(2) NOT NULL,
  `coditvenda` int NOT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpforneced`
--

CREATE TABLE `cpforneced` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codfor` int NOT NULL,
  `razfor` char(60) NOT NULL,
  `codemptf` int NOT NULL,
  `codfilialtf` smallint NOT NULL,
  `codtipofor` int NOT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `codemphp` int DEFAULT NULL,
  `codfilialhp` smallint DEFAULT NULL,
  `codhist` int DEFAULT NULL,
  `nomefor` char(50) NOT NULL,
  `datafor` date NOT NULL,
  `ativofor` char(1) DEFAULT NULL,
  `pessoafor` char(1) NOT NULL,
  `cnpjfor` char(14) DEFAULT NULL,
  `cpffor` char(11) DEFAULT NULL,
  `inscfor` varchar(20) DEFAULT NULL,
  `rgfor` char(13) DEFAULT NULL,
  `endfor` char(50) DEFAULT NULL,
  `numfor` int DEFAULT NULL,
  `complfor` char(20) DEFAULT NULL,
  `bairfor` char(30) DEFAULT NULL,
  `cepfor` char(8) DEFAULT NULL,
  `cidfor` char(30) DEFAULT NULL,
  `uffor` char(2) DEFAULT NULL,
  `ibgefor` varchar(7) DEFAULT NULL,
  `contfor` char(40) DEFAULT NULL,
  `fonefor` char(14) DEFAULT NULL,
  `faxfor` varchar(9) DEFAULT NULL,
  `agenciafor` char(6) DEFAULT NULL,
  `contafor` char(10) DEFAULT NULL,
  `emailfor` char(50) DEFAULT NULL,
  `obsfor` varchar(10000) DEFAULT NULL,
  `celfor` varchar(14) DEFAULT NULL,
  `clifor` char(1) DEFAULT NULL,
  `sspfor` char(10) DEFAULT NULL,
  `dddfonefor` char(4) DEFAULT NULL,
  `dddfaxfor` char(4) DEFAULT NULL,
  `dddcelfor` char(4) DEFAULT NULL,
  `sitefor` char(50) DEFAULT NULL,
  `codcontdeb` varchar(20) DEFAULT NULL,
  `codcontcred` varchar(20) DEFAULT NULL,
  `codforcontab` varchar(20) DEFAULT NULL,
  `codmunic` char(7) DEFAULT NULL,
  `siglauf` char(2) DEFAULT NULL,
  `codpais` smallint DEFAULT NULL,
  `codempuc` int DEFAULT NULL,
  `codfilialuc` smallint DEFAULT NULL,
  `codunifcod` int DEFAULT NULL,
  `codempff` int DEFAULT NULL,
  `codfilialff` smallint DEFAULT NULL,
  `codfiscfor` int DEFAULT NULL,
  `suframafor` varchar(9) DEFAULT NULL,
  `nrodependfor` smallint DEFAULT NULL,
  `inscconreg` varchar(15) DEFAULT NULL,
  `codexportador` varchar(20) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpfretecp`
--

CREATE TABLE `cpfretecp` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcompra` int NOT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `tipofretecp` char(1) NOT NULL,
  `placafretecp` char(10) NOT NULL,
  `uffretecp` char(2) NOT NULL,
  `vlrfretecp` decimal(15,5) NOT NULL,
  `qtdfretecp` decimal(15,5) NOT NULL,
  `pesobrutcp` decimal(15,5) NOT NULL,
  `pesoliqcp` decimal(15,5) NOT NULL,
  `espfretecp` char(10) NOT NULL,
  `marcafretecp` char(10) NOT NULL,
  `conhecfretecp` char(13) DEFAULT NULL,
  `perccomprafretecp` decimal(9,2) DEFAULT NULL,
  `adicfretecp` char(1) NOT NULL,
  `adicfretebaseicm` char(1) NOT NULL,
  `aliqicmsfretecp` decimal(15,5) DEFAULT NULL,
  `vlricmsfretecp` decimal(15,5) DEFAULT NULL,
  `vlrsegfretecp` decimal(15,5) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpitcentral`
--

CREATE TABLE `cpitcentral` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `id` int NOT NULL,
  `codcotacao` int NOT NULL,
  `item` int NOT NULL,
  `codprod` int NOT NULL,
  `qtdprod` int NOT NULL,
  `qtddevolvido` int DEFAULT NULL,
  `vlrprod` double DEFAULT NULL,
  `condicao` varchar(100) DEFAULT NULL,
  `status` char(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpitcompra`
--

CREATE TABLE `cpitcompra` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcompra` int NOT NULL,
  `coditcompra` int NOT NULL,
  `codemppd` int NOT NULL,
  `codfilialpd` smallint NOT NULL,
  `codprod` int NOT NULL,
  `codemple` int DEFAULT NULL,
  `codfilialle` smallint DEFAULT NULL,
  `codlote` varchar(20) DEFAULT NULL,
  `codempnt` int NOT NULL,
  `codfilialnt` smallint NOT NULL,
  `codnat` char(4) NOT NULL,
  `codempax` int NOT NULL,
  `codfilialax` smallint NOT NULL,
  `codalmox` int NOT NULL,
  `qtditcompra` decimal(15,5) NOT NULL,
  `qtditcompracanc` decimal(15,5) DEFAULT NULL,
  `precoitcompra` decimal(15,5) NOT NULL,
  `percdescitcompra` decimal(15,5) DEFAULT NULL,
  `vlrdescitcompra` decimal(15,5) DEFAULT NULL,
  `percicmsitcompra` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmsitcompra` decimal(15,5) DEFAULT NULL,
  `vlricmsitcompra` decimal(15,5) DEFAULT NULL,
  `percicmsstitcompra` decimal(15,5) NOT NULL,
  `vlrbaseicmsstitcompra` decimal(15,5) NOT NULL,
  `vlricmsstitcompra` decimal(15,5) NOT NULL,
  `percipiitcompra` decimal(15,5) DEFAULT NULL,
  `vlrbaseipiitcompra` decimal(15,5) DEFAULT NULL,
  `vlripiitcompra` decimal(15,5) DEFAULT NULL,
  `vlrbasefunruralitcompra` decimal(15,5) NOT NULL,
  `aliqfunruralitcompra` decimal(15,5) NOT NULL,
  `vlrfunruralitcompra` decimal(15,5) NOT NULL,
  `vlrliqitcompra` decimal(15,5) DEFAULT NULL,
  `vlradicitcompra` decimal(15,5) DEFAULT NULL,
  `vlrfreteitcompra` decimal(15,5) DEFAULT NULL,
  `vlrisentasitcompra` decimal(15,5) DEFAULT NULL,
  `vlroutrasitcompra` decimal(15,5) DEFAULT NULL,
  `vlrproditcompra` decimal(15,5) DEFAULT NULL,
  `custoitcompra` decimal(15,5) DEFAULT NULL,
  `custovditcompra` decimal(15,5) NOT NULL,
  `refprod` varchar(20) DEFAULT NULL,
  `obsitcompra` varchar(10000) DEFAULT NULL,
  `codempif` int DEFAULT NULL,
  `codfilialif` smallint DEFAULT NULL,
  `codfisc` char(13) DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `coditfisc` smallint DEFAULT NULL,
  `codempns` int DEFAULT NULL,
  `codfilialns` smallint DEFAULT NULL,
  `numserietmp` varchar(30) DEFAULT NULL,
  `nadicao` smallint DEFAULT NULL,
  `seqadic` smallint DEFAULT NULL,
  `descdi` decimal(15,5) DEFAULT NULL,
  `aprovpreco` char(1) DEFAULT NULL,
  `emititcompra` char(1) DEFAULT NULL,
  `aliqissitcompra` decimal(15,5) DEFAULT NULL,
  `vlrissitcompra` decimal(15,5) DEFAULT NULL,
  `vlriiitcompra` decimal(15,5) DEFAULT NULL,
  `vlritoutrasdespitcompra` decimal(15,5) DEFAULT NULL,
  `calccusto` char(1) NOT NULL,
  `adicicmstotnota` char(1) NOT NULL,
  `vlrtxsiscomexitcompra` decimal(15,5) DEFAULT NULL,
  `tiponfitcompra` char(1) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpitordcomprape`
--

CREATE TABLE `cpitordcomprape` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codordcp` int NOT NULL,
  `coditordcp` smallint NOT NULL,
  `seqitordcppe` smallint NOT NULL,
  `dtitpe` date NOT NULL,
  `qtditpe` decimal(15,5) NOT NULL,
  `qtditentpe` decimal(15,5) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cpparc`
--

CREATE TABLE `cpparc` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codparc` int NOT NULL,
  `razparc` char(60) NOT NULL,
  `codemptf` int NOT NULL,
  `codfilialtf` smallint NOT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `codemphp` int DEFAULT NULL,
  `codfilialhp` smallint DEFAULT NULL,
  `codhist` int DEFAULT NULL,
  `nomeparc` char(50) NOT NULL,
  `dataparc` date NOT NULL,
  `ativoparc` char(1) DEFAULT NULL,
  `pessoaparc` char(1) NOT NULL,
  `cnpjparc` char(14) DEFAULT NULL,
  `cpfparc` char(11) DEFAULT NULL,
  `inscparc` varchar(20) DEFAULT NULL,
  `rgparc` char(13) DEFAULT NULL,
  `endparc` char(50) DEFAULT NULL,
  `numparc` int DEFAULT NULL,
  `complparc` char(20) DEFAULT NULL,
  `bairparc` char(30) DEFAULT NULL,
  `cepparc` char(8) DEFAULT NULL,
  `cidparc` char(30) DEFAULT NULL,
  `ufparc` char(2) DEFAULT NULL,
  `ibgeparc` varchar(7) DEFAULT NULL,
  `contparc` char(40) DEFAULT NULL,
  `foneparc` char(14) DEFAULT NULL,
  `faxparc` varchar(9) DEFAULT NULL,
  `agenciaparc` char(6) DEFAULT NULL,
  `contaparc` char(10) DEFAULT NULL,
  `emailparc` char(50) DEFAULT NULL,
  `obsparc` varchar(10000) DEFAULT NULL,
  `celparc` varchar(14) DEFAULT NULL,
  `cliparc` char(1) DEFAULT NULL,
  `sspparc` char(10) DEFAULT NULL,
  `dddfoneparc` char(4) DEFAULT NULL,
  `dddfaxparc` char(4) DEFAULT NULL,
  `dddcelparc` char(4) DEFAULT NULL,
  `siteparc` char(50) DEFAULT NULL,
  `codcontdeb` varchar(20) DEFAULT NULL,
  `codcontcred` varchar(20) DEFAULT NULL,
  `codparccontab` varchar(20) DEFAULT NULL,
  `codmunic` char(7) DEFAULT NULL,
  `siglauf` char(2) DEFAULT NULL,
  `codpais` smallint DEFAULT NULL,
  `codempuc` int DEFAULT NULL,
  `codfilialuc` smallint DEFAULT NULL,
  `codunifcod` int DEFAULT NULL,
  `codempff` int DEFAULT NULL,
  `codfilialff` smallint DEFAULT NULL,
  `codfiscparc` int DEFAULT NULL,
  `suframaparc` varchar(9) DEFAULT NULL,
  `nrodependparc` smallint DEFAULT NULL,
  `inscconreg` varchar(15) DEFAULT NULL,
  `codexportador` varchar(20) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `cptipofor`
--

CREATE TABLE `cptipofor` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtipofor` int NOT NULL,
  `id` int NOT NULL,
  `desctipofor` char(40) DEFAULT NULL,
  `retencaoinss` char(1) DEFAULT NULL,
  `percbaseinss` decimal(15,5) DEFAULT NULL,
  `retencaooutros` char(1) DEFAULT NULL,
  `percretoutros` decimal(15,5) DEFAULT NULL,
  `retencaoirrf` char(1) DEFAULT NULL,
  `percbaseirrf` decimal(15,5) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqalmox`
--

CREATE TABLE `eqalmox` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codalmox` int NOT NULL,
  `id` int NOT NULL,
  `descalmox` char(40) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqalmoxfilial`
--

CREATE TABLE `eqalmoxfilial` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codalmox` int NOT NULL,
  `codempaf` int NOT NULL,
  `codfilialaf` smallint NOT NULL,
  `baixaestoqaf` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqcultura`
--

CREATE TABLE `eqcultura` (
  `codcultura` int NOT NULL,
  `cultura` varchar(50) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqdepos`
--

CREATE TABLE `eqdepos` (
  `coddepos` int NOT NULL,
  `codemp` int DEFAULT NULL,
  `codfilial` int DEFAULT NULL,
  `descdepos` varchar(40) NOT NULL,
  `codvend` int NOT NULL,
  `dtins` date DEFAULT NULL,
  `hins` time DEFAULT NULL,
  `idusuins` char(8) DEFAULT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqgrupo`
--

CREATE TABLE `eqgrupo` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codgrup` char(14) NOT NULL,
  `descgrup` char(50) NOT NULL,
  `nivelgrup` int DEFAULT NULL,
  `codempsg` int DEFAULT NULL,
  `codfilialsg` smallint DEFAULT NULL,
  `codsubgrup` char(14) DEFAULT NULL,
  `siglagrup` char(10) DEFAULT NULL,
  `estneggrup` char(1) NOT NULL,
  `estlotneggrup` char(1) NOT NULL,
  `web` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `markup` float(24,2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqinvprod`
--

CREATE TABLE `eqinvprod` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codinvprod` int NOT NULL,
  `codemppd` int NOT NULL,
  `codfilialpd` smallint NOT NULL,
  `codprod` int NOT NULL,
  `codemple` int DEFAULT NULL,
  `codfilialle` smallint DEFAULT NULL,
  `codlote` varchar(20) DEFAULT NULL,
  `codemptm` int NOT NULL,
  `codfilialtm` smallint NOT NULL,
  `codtipomov` int NOT NULL,
  `datainvp` date NOT NULL,
  `qtdinvp` decimal(15,5) NOT NULL,
  `precoinvp` decimal(15,5) NOT NULL,
  `codempax` int NOT NULL,
  `codfilialax` smallint NOT NULL,
  `codalmox` int NOT NULL,
  `refprod` varchar(20) DEFAULT NULL,
  `sldatualinvp` decimal(15,5) DEFAULT NULL,
  `slddiginvp` decimal(15,5) DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `obsinvp` varchar(500) DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqlote`
--

CREATE TABLE `eqlote` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codprod` int NOT NULL,
  `codlote` varchar(20) NOT NULL,
  `venctolote` date NOT NULL,
  `sldlote` decimal(15,5) DEFAULT NULL,
  `sldreslote` decimal(15,5) DEFAULT NULL,
  `sldconsiglote` decimal(15,5) DEFAULT NULL,
  `sldliqlote` decimal(15,5) DEFAULT NULL,
  `qtdprodlote` decimal(15,5) DEFAULT NULL,
  `dinilote` date DEFAULT NULL,
  `diasavisolote` smallint NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqmarca`
--

CREATE TABLE `eqmarca` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codmarca` char(6) NOT NULL,
  `descmarca` char(40) NOT NULL,
  `siglamarca` char(20) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqmovprod`
--

CREATE TABLE `eqmovprod` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codmovprod` int NOT NULL,
  `codemppd` int NOT NULL,
  `codfilialpd` smallint NOT NULL,
  `codprod` int NOT NULL,
  `codempvd` int DEFAULT NULL,
  `codfilialvd` smallint DEFAULT NULL,
  `tipovenda` char(1) DEFAULT NULL,
  `codvenda` int DEFAULT NULL,
  `coditvenda` int DEFAULT NULL,
  `codemple` int DEFAULT NULL,
  `codfilialle` smallint DEFAULT NULL,
  `codlote` varchar(20) DEFAULT NULL,
  `codemptm` int NOT NULL,
  `codfilialtm` smallint NOT NULL,
  `codtipomov` int NOT NULL,
  `codempcp` int DEFAULT NULL,
  `codfilialcp` smallint DEFAULT NULL,
  `codcompra` int DEFAULT NULL,
  `coditcompra` int DEFAULT NULL,
  `codempiv` int DEFAULT NULL,
  `codfilialiv` smallint DEFAULT NULL,
  `codinvprod` int DEFAULT NULL,
  `dtmovprod` date NOT NULL,
  `tipomovprod` char(1) NOT NULL,
  `estoqmovprod` char(1) NOT NULL,
  `codempax` int NOT NULL,
  `codfilialax` smallint NOT NULL,
  `codalmox` int NOT NULL,
  `qtdmovprod` decimal(15,5) NOT NULL,
  `precomovprod` decimal(15,5) DEFAULT NULL,
  `custompmmovprod` decimal(15,5) DEFAULT NULL,
  `custompmmovprodax` decimal(15,5) DEFAULT NULL,
  `sldmovprod` decimal(15,5) DEFAULT NULL,
  `sldmovprodax` decimal(15,5) DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `codempnt` int DEFAULT NULL,
  `codfilialnt` smallint DEFAULT NULL,
  `codnat` char(4) DEFAULT NULL,
  `docmovprod` int DEFAULT NULL,
  `codemprm` int DEFAULT NULL,
  `codfilialrm` smallint DEFAULT NULL,
  `codrma` int DEFAULT NULL,
  `coditrma` smallint DEFAULT NULL,
  `emmanut` char(1) DEFAULT NULL,
  `codempop` int DEFAULT NULL,
  `codfilialop` smallint DEFAULT NULL,
  `codop` int DEFAULT NULL,
  `seqop` smallint DEFAULT NULL,
  `seqentop` smallint DEFAULT NULL,
  `seqsubprod` smallint DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqproced`
--

CREATE TABLE `eqproced` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codparc` int NOT NULL,
  `datacadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `tipoproced` varchar(30) NOT NULL,
  `nome` varchar(50) NOT NULL,
  `descritivo` varchar(300) DEFAULT NULL,
  `valor` varchar(20) NOT NULL,
  `ativo` char(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqproduto`
--

CREATE TABLE `eqproduto` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codprod` int NOT NULL,
  `descprod` char(100) NOT NULL,
  `refprod` varchar(20) NOT NULL,
  `codempax` int NOT NULL,
  `codfilialax` smallint NOT NULL,
  `codalmox` int NOT NULL,
  `codempma` int NOT NULL,
  `codfilialma` smallint NOT NULL,
  `codmoeda` char(4) NOT NULL,
  `codempud` int NOT NULL,
  `codfilialud` smallint NOT NULL,
  `codunid` varchar(20) NOT NULL,
  `codempfc` int NOT NULL,
  `codfilialfc` smallint NOT NULL,
  `codfisc` char(13) NOT NULL,
  `codempmc` int NOT NULL,
  `codfilialmc` smallint NOT NULL,
  `codmarca` char(6) NOT NULL,
  `descauxprod` char(40) DEFAULT NULL,
  `tipoprod` varchar(2) NOT NULL,
  `cvprod` char(1) NOT NULL,
  `codempgp` int NOT NULL,
  `codfilialgp` smallint NOT NULL,
  `codgrup` char(14) NOT NULL,
  `codbarprod` char(15) DEFAULT NULL,
  `cloteprod` char(1) NOT NULL,
  `serieprod` char(1) NOT NULL,
  `codfabprod` char(30) DEFAULT NULL,
  `comisprod` decimal(6,2) DEFAULT NULL,
  `pesoliqprod` decimal(10,3) DEFAULT NULL,
  `pesobrutprod` decimal(10,3) DEFAULT NULL,
  `qtdminprod` decimal(15,5) DEFAULT NULL,
  `qtdmaxprod` decimal(15,5) DEFAULT NULL,
  `dtmpmprod` date DEFAULT NULL,
  `custompmprod` decimal(15,5) DEFAULT NULL,
  `custopepsprod` decimal(15,5) DEFAULT NULL,
  `custoinfoprod` decimal(15,5) DEFAULT NULL,
  `precobaseprod` decimal(15,5) DEFAULT NULL,
  `precocomisprod` decimal(15,5) DEFAULT NULL,
  `sldprod` decimal(15,5) DEFAULT NULL,
  `sldresprod` decimal(15,5) DEFAULT NULL,
  `sldconsigprod` decimal(15,5) DEFAULT NULL,
  `sldliqprod` decimal(15,5) DEFAULT NULL,
  `ativoprod` char(1) DEFAULT NULL,
  `dtultcpprod` date DEFAULT NULL,
  `qtdultcpprod` decimal(15,5) DEFAULT NULL,
  `desccompprod` varchar(500) DEFAULT NULL,
  `obsprod` varchar(10000) DEFAULT NULL,
  `verifprod` char(1) DEFAULT NULL,
  `localprod` char(15) DEFAULT NULL,
  `rmaprod` char(1) NOT NULL,
  `codemppe` int DEFAULT NULL,
  `codfilialpe` smallint DEFAULT NULL,
  `codpe` int DEFAULT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `anocc` smallint DEFAULT NULL,
  `codcc` char(19) DEFAULT NULL,
  `usareceitaprod` char(1) NOT NULL,
  `usatelaadicpdv` char(1) NOT NULL,
  `vlrdensidade` decimal(15,5) DEFAULT NULL,
  `vlrconcent` decimal(15,5) DEFAULT NULL,
  `comprimento` decimal(15,5) DEFAULT NULL,
  `largura` decimal(15,5) DEFAULT NULL,
  `espessura` decimal(15,5) DEFAULT NULL,
  `guiatrafprod` char(1) NOT NULL,
  `qtdembalagem` decimal(15,5) NOT NULL,
  `codeanprod` varchar(14) DEFAULT NULL,
  `cubagem` decimal(15,5) DEFAULT NULL,
  `codempsc` int DEFAULT NULL,
  `codfilialsc` smallint DEFAULT NULL,
  `codsecao` varchar(13) DEFAULT NULL,
  `codemptc` smallint DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtpchamado` int DEFAULT NULL,
  `qtdhorasserv` decimal(15,5) DEFAULT NULL,
  `nrodiasvalid` smallint DEFAULT NULL,
  `desccli` char(1) DEFAULT NULL,
  `qtdporplano` smallint DEFAULT NULL,
  `nroplanos` smallint DEFAULT NULL,
  `certfsc` char(1) DEFAULT NULL,
  `fatorfsc` decimal(15,5) DEFAULT NULL,
  `codempog` int DEFAULT NULL,
  `codfilialog` smallint DEFAULT NULL,
  `codprodog` int DEFAULT NULL,
  `codempmg` int DEFAULT NULL,
  `codfilialmg` smallint DEFAULT NULL,
  `codmodg` int DEFAULT NULL,
  `prazorepo` int DEFAULT NULL,
  `mediavenda` decimal(15,5) DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `finame` varchar(10) DEFAULT NULL,
  `mda` varchar(10) DEFAULT NULL,
  `ptsfidelidade` int DEFAULT NULL,
  `curva` varchar(1) DEFAULT NULL,
  `prod_sitributaria` varchar(10) DEFAULT NULL,
  `prod_origem` varchar(10) DEFAULT NULL,
  `prod_iat` varchar(3) DEFAULT NULL,
  `prod_sitributaria_outro_est` varchar(7) DEFAULT NULL,
  `prod_sitributaria_ipi_entrada` varchar(7) DEFAULT NULL,
  `prod_sitributaria_ipi_saida` varchar(7) DEFAULT NULL,
  `prod_sitributaria_pis` varchar(7) DEFAULT NULL,
  `prod_sitributaria_cofins` varchar(7) DEFAULT NULL,
  `prod_sitributaria_issqn` varchar(7) DEFAULT NULL,
  `prod_icms` varchar(11) DEFAULT NULL,
  `prod_cod_servico_issqn` varchar(7) DEFAULT NULL,
  `prod_bloqueio` varchar(3) DEFAULT NULL,
  `prod_usa_promo` varchar(3) DEFAULT NULL,
  `prod_pbalanca` varchar(3) DEFAULT NULL,
  `prod_ativo` varchar(3) DEFAULT NULL,
  `codncm` varchar(10) DEFAULT NULL,
  `markup` double DEFAULT NULL,
  `icre` varchar(15) DEFAULT NULL,
  `cest` char(7) DEFAULT NULL,
  `promocao` char(1) DEFAULT NULL,
  `codmix` int DEFAULT NULL,
  `intervsegur` int DEFAULT NULL,
  `classetoxico` varchar(2) DEFAULT NULL,
  `grupoquimico` varchar(50) DEFAULT NULL,
  `nometecnico` varchar(50) DEFAULT NULL,
  `principioativo` varchar(50) DEFAULT NULL,
  `codclasse` varchar(1) DEFAULT NULL,
  `classe` varchar(50) DEFAULT NULL,
  `concentracao` varchar(15) DEFAULT NULL,
  `formulacao` varchar(50) DEFAULT NULL,
  `antidoto` varchar(10000) DEFAULT NULL,
  `multiplicador` float(24,2) DEFAULT NULL,
  `codbalanca` int DEFAULT NULL,
  `codrfidprod` int DEFAULT NULL,
  `prod_sitributaria_csosn` varchar(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqprodutolog`
--

CREATE TABLE `eqprodutolog` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codprod` int NOT NULL,
  `precobaseprodant` decimal(15,5) NOT NULL,
  `precobaseprodnovo` decimal(15,5) NOT NULL,
  `seqlog` int NOT NULL,
  `precoproc` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqsaldodepos`
--

CREATE TABLE `eqsaldodepos` (
  `codtrandepos` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codprod` int NOT NULL,
  `coddepos` int NOT NULL,
  `codlote` varchar(20) DEFAULT NULL,
  `sldprod` decimal(15,5) DEFAULT NULL,
  `sldlote` decimal(15,5) DEFAULT NULL,
  `sldreslote` decimal(15,5) DEFAULT NULL,
  `sldliqlote` decimal(15,5) DEFAULT NULL,
  `dtvenclote` date DEFAULT NULL,
  `dtins` date DEFAULT NULL,
  `hins` time DEFAULT NULL,
  `idusuins` char(8) DEFAULT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `isusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqsaldolote`
--

CREATE TABLE `eqsaldolote` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codprod` int NOT NULL,
  `codlote` varchar(20) NOT NULL,
  `codempax` int NOT NULL,
  `codfilialax` smallint NOT NULL,
  `codalmox` int NOT NULL,
  `sldlote` decimal(15,5) NOT NULL,
  `sldreslote` decimal(15,5) NOT NULL,
  `sldconsiglote` decimal(15,5) NOT NULL,
  `sldliqlote` decimal(15,5) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqsaldoprod`
--

CREATE TABLE `eqsaldoprod` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codprod` int NOT NULL,
  `codempax` int NOT NULL,
  `codfilialax` smallint NOT NULL,
  `codalmox` int NOT NULL,
  `sldprod` decimal(15,5) NOT NULL,
  `sldresprod` decimal(15,5) NOT NULL,
  `sldconsigprod` decimal(15,5) NOT NULL,
  `sldliqprod` decimal(15,5) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqsecao`
--

CREATE TABLE `eqsecao` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codsecao` varchar(13) NOT NULL,
  `descsecao` char(50) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqserie`
--

CREATE TABLE `eqserie` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codprod` int NOT NULL,
  `numserie` varchar(30) NOT NULL,
  `dtfabricserie` date DEFAULT NULL,
  `dtvalidserie` date DEFAULT NULL,
  `obsserie` varchar(500) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqtipomov`
--

CREATE TABLE `eqtipomov` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtipomov` int NOT NULL,
  `codempmn` int NOT NULL,
  `codfilialmn` smallint NOT NULL,
  `codmodnota` int NOT NULL,
  `codempse` int NOT NULL,
  `codfilialse` smallint NOT NULL,
  `serie` char(4) NOT NULL,
  `desctipomov` char(40) NOT NULL,
  `estipomov` char(1) NOT NULL,
  `fiscaltipomov` char(1) NOT NULL,
  `estoqtipomov` char(1) NOT NULL,
  `tipomov` char(2) NOT NULL,
  `codemptb` int DEFAULT NULL,
  `codfilialtb` smallint DEFAULT NULL,
  `codtab` int DEFAULT NULL,
  `especietipomov` char(4) DEFAULT NULL,
  `codemptm` int DEFAULT NULL,
  `codfilialtm` smallint DEFAULT NULL,
  `codtipomovtm` int DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtipomovtc` int DEFAULT NULL,
  `imppedtipomov` char(1) NOT NULL,
  `impnftipomov` char(1) NOT NULL,
  `impboltipomov` char(1) NOT NULL,
  `imprectipomov` char(1) NOT NULL,
  `reimpnftipomov` char(1) NOT NULL,
  `tusutipomov` char(1) NOT NULL,
  `somavdtipomov` char(1) DEFAULT NULL,
  `seqnftipomov` char(1) NOT NULL,
  `vlrmfintipomov` char(1) NOT NULL,
  `mcomistipomov` char(1) NOT NULL,
  `opertipomov` char(1) NOT NULL,
  `ctipofrete` char(1) DEFAULT NULL,
  `codemprc` int DEFAULT NULL,
  `codfilialrc` smallint DEFAULT NULL,
  `codregrcomis` int DEFAULT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `emitnfcpmov` char(1) NOT NULL,
  `codempdf` int DEFAULT NULL,
  `codfilialdf` smallint DEFAULT NULL,
  `codmoddocfisc` char(3) DEFAULT NULL,
  `codemppp` int DEFAULT NULL,
  `codfilialpp` smallint DEFAULT NULL,
  `codplanopag` int DEFAULT NULL,
  `descnatcompl` varchar(60) DEFAULT NULL,
  `codempmc` int DEFAULT NULL,
  `codfilialmc` smallint DEFAULT NULL,
  `codmens` int DEFAULT NULL,
  `desbloqcv` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `codempsc` int DEFAULT NULL,
  `codfilialsc` smallint DEFAULT NULL,
  `seriec` char(4) DEFAULT NULL,
  `permitdigipi` varchar(10) DEFAULT NULL,
  `natoperacao` varchar(50) DEFAULT NULL,
  `calcimpcp` char(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqtipomovusu`
--

CREATE TABLE `eqtipomovusu` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtipomov` int NOT NULL,
  `codempus` int NOT NULL,
  `codfilialus` smallint NOT NULL,
  `idusu` char(8) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqtipoprod`
--

CREATE TABLE `eqtipoprod` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtipoprod` varchar(3) NOT NULL,
  `tipoprod` varchar(50) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(8) NOT NULL DEFAULT 'USER',
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` varchar(8) DEFAULT 'USER',
  `isync` char(1) NOT NULL,
  `esync` char(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `eqtrocarefprod`
--

CREATE TABLE `eqtrocarefprod` (
  `id` bigint NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `motivo` varchar(80) DEFAULT NULL,
  `dttroca` date NOT NULL,
  `situacao` char(2) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` varchar(128) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `equnidade`
--

CREATE TABLE `equnidade` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codunid` varchar(20) NOT NULL,
  `descunid` varchar(60) NOT NULL,
  `casasdec` smallint NOT NULL,
  `calcvolemb` char(1) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnbanco`
--

CREATE TABLE `fnbanco` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codbanco` char(3) NOT NULL,
  `nomebanco` char(40) NOT NULL,
  `dvbanco` char(1) NOT NULL,
  `sitebanco` varchar(80) DEFAULT NULL,
  `codempmb` int DEFAULT NULL,
  `codfilialmb` int DEFAULT NULL,
  `codmodbol` int DEFAULT NULL,
  `layoutcheqbanco` varchar(1000) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `codempbp` int DEFAULT NULL,
  `codfilialbp` smallint DEFAULT NULL,
  `codbancobp` char(3) DEFAULT NULL,
  `appremessa` varchar(500) DEFAULT NULL,
  `appretorno` varchar(500) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fncartcob`
--

CREATE TABLE `fncartcob` (
  `codempbo` int NOT NULL,
  `codfilialbo` smallint NOT NULL,
  `codbanco` char(3) NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcartcob` char(3) NOT NULL,
  `variacaocartcob` char(10) DEFAULT NULL,
  `desccartcob` varchar(50) NOT NULL,
  `cartcobcnab` char(3) NOT NULL,
  `codcartcobcnab` char(1) DEFAULT NULL,
  `convcob` varchar(20) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fncc`
--

CREATE TABLE `fncc` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `anocc` smallint NOT NULL,
  `codcc` char(19) NOT NULL,
  `desccc` char(50) NOT NULL,
  `nivelcc` int NOT NULL,
  `codredcc` int DEFAULT NULL,
  `codempscc` int DEFAULT NULL,
  `codfilialscc` smallint DEFAULT NULL,
  `anoscc` smallint DEFAULT NULL,
  `codsubcc` char(19) DEFAULT NULL,
  `siglacc` char(10) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnconta`
--

CREATE TABLE `fnconta` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `numconta` char(10) NOT NULL,
  `descconta` char(50) NOT NULL,
  `codempma` int NOT NULL,
  `codfilialma` smallint NOT NULL,
  `codmoeda` char(4) NOT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `codemppn` int NOT NULL,
  `codfilialpn` smallint NOT NULL,
  `codplan` char(13) NOT NULL,
  `tipoconta` char(1) NOT NULL,
  `dataconta` date NOT NULL,
  `codemphp` int DEFAULT NULL,
  `codfilialhp` smallint DEFAULT NULL,
  `codhist` int DEFAULT NULL,
  `codcontdeb` varchar(20) DEFAULT NULL,
  `codcontcred` varchar(20) DEFAULT NULL,
  `agenciaconta` char(6) DEFAULT NULL,
  `convcobconta` varchar(20) DEFAULT NULL,
  `ativaconta` char(1) NOT NULL,
  `tusuconta` char(1) NOT NULL,
  `tipocaixa` char(1) NOT NULL,
  `postoconta` char(2) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `agenciacontabol` varchar(6) DEFAULT NULL,
  `numcontabol` char(10) DEFAULT NULL,
  `dvagencia` varchar(5) DEFAULT NULL,
  `dvconta` varchar(5) DEFAULT NULL,
  `dvnumcontabol` varchar(5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fncotmoeda`
--

CREATE TABLE `fncotmoeda` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codmoeda` char(4) NOT NULL,
  `datacot` date NOT NULL,
  `valorcot` decimal(15,5) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnfinalidade`
--

CREATE TABLE `fnfinalidade` (
  `codfin` varchar(3) NOT NULL,
  `descfin` varchar(50) NOT NULL,
  `esfin` char(1) NOT NULL,
  `clasfin` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnhistpad`
--

CREATE TABLE `fnhistpad` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codhist` int NOT NULL,
  `deschist` varchar(80) NOT NULL,
  `txahistpad` varchar(500) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` char(8) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnitmodboleto`
--

CREATE TABLE `fnitmodboleto` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codmodbol` int NOT NULL,
  `codempbo` int NOT NULL,
  `codfilialbo` smallint NOT NULL,
  `codbanco` char(3) NOT NULL,
  `codempcb` int NOT NULL,
  `codfilialcb` smallint NOT NULL,
  `codcartcob` char(3) NOT NULL,
  `convcob` varchar(20) NOT NULL,
  `dvconvcob` char(4) DEFAULT NULL,
  `codempct` int DEFAULT NULL,
  `codfilialct` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `seqnossonumero` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnitpagar`
--

CREATE TABLE `fnitpagar` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codpag` int NOT NULL,
  `nparcpag` int NOT NULL,
  `vlritpag` decimal(15,5) NOT NULL,
  `vlrdescitpag` decimal(15,5) DEFAULT NULL,
  `vlrmultaitpag` decimal(15,5) DEFAULT NULL,
  `vlrjurositpag` decimal(15,5) DEFAULT NULL,
  `vlrdevitpag` decimal(15,5) NOT NULL,
  `vlrparcitpag` decimal(15,5) NOT NULL,
  `vlrpagoitpag` decimal(15,5) DEFAULT NULL,
  `vlrapagitpag` decimal(15,5) DEFAULT NULL,
  `vlradicitpag` decimal(15,5) DEFAULT NULL,
  `vlrcancitpag` decimal(15,5) DEFAULT NULL,
  `dtitpag` date NOT NULL,
  `dtcompitpag` date NOT NULL,
  `dtvencitpag` date NOT NULL,
  `dtpagoitpag` date DEFAULT NULL,
  `statusitpag` char(2) NOT NULL,
  `codempca` int DEFAULT NULL,
  `codfilialca` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `codemppn` int DEFAULT NULL,
  `codfilialpn` smallint DEFAULT NULL,
  `codplan` char(13) DEFAULT NULL,
  `doclancaitpag` varchar(15) DEFAULT NULL,
  `obsitpag` varchar(250) DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `anocc` smallint DEFAULT NULL,
  `codcc` char(19) DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtipocob` int DEFAULT NULL,
  `codempct` int DEFAULT NULL,
  `codfilialct` smallint DEFAULT NULL,
  `codcontr` int DEFAULT NULL,
  `coditcontr` smallint DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `codempsn` int DEFAULT NULL,
  `codfilialsn` smallint DEFAULT NULL,
  `codsinal` smallint DEFAULT NULL,
  `multibaixa` char(1) DEFAULT NULL,
  `edititpag` char(1) DEFAULT NULL,
  `dtins` date NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `hins` time NOT NULL,
  `halt` time DEFAULT NULL,
  `codempem` int DEFAULT NULL,
  `codfilialem` smallint DEFAULT NULL,
  `matempr` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnitreceber`
--

CREATE TABLE `fnitreceber` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codrec` int NOT NULL,
  `nparcitrec` int NOT NULL,
  `vlritrec` decimal(15,5) NOT NULL,
  `vlrdescitrec` decimal(15,5) DEFAULT NULL,
  `vlrmultaitrec` decimal(15,5) DEFAULT NULL,
  `vlrjurositrec` decimal(15,5) DEFAULT NULL,
  `vlrdevitrec` decimal(15,5) NOT NULL,
  `vlrparcitrec` decimal(15,5) DEFAULT NULL,
  `vlrpagoitrec` decimal(15,5) DEFAULT NULL,
  `vlrapagitrec` decimal(15,5) DEFAULT NULL,
  `vlrcomiitrec` decimal(15,5) DEFAULT NULL,
  `vlrcancitrec` decimal(15,5) DEFAULT NULL,
  `vlrbasecomis` decimal(15,5) DEFAULT NULL,
  `descpont` char(1) NOT NULL,
  `dtitrec` date NOT NULL,
  `dtcompitrec` date NOT NULL,
  `dtvencitrec` date NOT NULL,
  `dtprevitrec` date DEFAULT NULL,
  `dtpagoitrec` date DEFAULT NULL,
  `dtliqitrec` date DEFAULT NULL,
  `statusitrec` char(2) NOT NULL,
  `codemppn` int DEFAULT NULL,
  `codfilialpn` smallint DEFAULT NULL,
  `codplan` char(13) DEFAULT NULL,
  `obsitrec` varchar(250) DEFAULT NULL,
  `codempca` int DEFAULT NULL,
  `codfilialca` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtipocob` int DEFAULT NULL,
  `codempcb` int DEFAULT NULL,
  `codfilialcb` smallint DEFAULT NULL,
  `codcartcob` char(3) DEFAULT NULL,
  `doclancaitrec` varchar(15) DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `anocc` smallint DEFAULT NULL,
  `codcc` char(19) DEFAULT NULL,
  `impreciboitrec` char(1) NOT NULL,
  `reciboitrec` int DEFAULT NULL,
  `altusuitrec` char(1) NOT NULL,
  `pdvitrec` char(1) NOT NULL,
  `recemcob` char(1) NOT NULL,
  `dtiniemcob` date DEFAULT NULL,
  `dtfimemcob` date DEFAULT NULL,
  `seqnossonumero` int DEFAULT NULL,
  `nossonumero` varchar(20) DEFAULT NULL,
  `linhadigitavel` char(52) DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `codempsn` int DEFAULT NULL,
  `codfilialsn` smallint DEFAULT NULL,
  `codsinal` smallint DEFAULT NULL,
  `multibaixa` char(1) DEFAULT NULL,
  `codempct` int DEFAULT NULL,
  `codfilialct` smallint DEFAULT NULL,
  `codcontr` int DEFAULT NULL,
  `coditcontr` smallint DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `codempem` int DEFAULT NULL,
  `codfilialem` smallint DEFAULT NULL,
  `matempr` int DEFAULT NULL,
  `dtproces` date DEFAULT NULL,
  `ocor_ret` varchar(50) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnlanca`
--

CREATE TABLE `fnlanca` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codlanca` int NOT NULL,
  `codcomi` int DEFAULT NULL,
  `codemppg` int DEFAULT NULL,
  `codfilialpg` smallint DEFAULT NULL,
  `codpag` int DEFAULT NULL,
  `nparcpag` int DEFAULT NULL,
  `codemprc` int DEFAULT NULL,
  `codfilialrc` smallint DEFAULT NULL,
  `codrec` int DEFAULT NULL,
  `nparcitrec` int DEFAULT NULL,
  `codemppn` int NOT NULL,
  `codfilialpn` smallint NOT NULL,
  `codplan` char(13) NOT NULL,
  `dtcomplanca` date NOT NULL,
  `datalanca` date NOT NULL,
  `doclanca` varchar(15) DEFAULT NULL,
  `histblanca` varchar(250) NOT NULL,
  `histlanca` varchar(10000) DEFAULT NULL,
  `transflanca` char(1) DEFAULT NULL,
  `statuslanca` char(2) DEFAULT NULL,
  `dtprevlanca` date DEFAULT NULL,
  `dtprevsublanca` date DEFAULT NULL,
  `vlrlanca` decimal(15,5) DEFAULT NULL,
  `codempci` int DEFAULT NULL,
  `codfilialci` smallint DEFAULT NULL,
  `codpcomi` int DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `tipolanca` char(1) NOT NULL,
  `pdvitrec` char(1) NOT NULL,
  `codcli` int DEFAULT NULL,
  `codempcl` int DEFAULT NULL,
  `codfilialcl` smallint DEFAULT NULL,
  `codempfr` int DEFAULT NULL,
  `codfilialfr` smallint DEFAULT NULL,
  `codfor` int DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `codempsn` int DEFAULT NULL,
  `codfilialsn` smallint DEFAULT NULL,
  `codsinal` smallint DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnlibcred`
--

CREATE TABLE `fnlibcred` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codlcred` int NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codempvd` int NOT NULL,
  `codfilialvd` smallint NOT NULL,
  `codvenda` int NOT NULL,
  `dtaemitlcred` date NOT NULL,
  `vlrautorizlcred` decimal(15,5) NOT NULL,
  `vlrutillcred` decimal(15,5) NOT NULL,
  `vlrvendacred` decimal(15,5) DEFAULT NULL,
  `codempus` int DEFAULT NULL,
  `codfilialus` smallint DEFAULT NULL,
  `idusu` char(8) DEFAULT NULL,
  `dtautillcred` date DEFAULT NULL,
  `sitlcred` char(1) NOT NULL,
  `codempcl` int NOT NULL,
  `codfilialcl` smallint NOT NULL,
  `codcli` int NOT NULL,
  `dtavctolcred` date NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnmodboleto`
--

CREATE TABLE `fnmodboleto` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `codmodbol` int NOT NULL,
  `descmodbol` char(30) NOT NULL,
  `txamodbol` varchar(10000) NOT NULL,
  `preimpmodbol` char(1) NOT NULL,
  `cartcob` char(2) NOT NULL,
  `mdecob` varchar(8) NOT NULL,
  `aceitemodbol` char(1) NOT NULL,
  `classmodbol` varchar(80) DEFAULT NULL,
  `espdocmodbol` char(3) DEFAULT NULL,
  `desclpmodbol` varchar(80) DEFAULT NULL,
  `instpagmodbol` varchar(500) DEFAULT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `impinfoparc` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnmoeda`
--

CREATE TABLE `fnmoeda` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codmoeda` char(4) NOT NULL,
  `tipomoeda` char(1) NOT NULL,
  `atualizamoeda` char(1) NOT NULL,
  `singmoeda` char(20) NOT NULL,
  `plurmoeda` char(20) NOT NULL,
  `codfbnmoeda` char(1) NOT NULL,
  `decsmoeda` char(20) DEFAULT NULL,
  `decpmoeda` char(20) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnmovimento`
--

CREATE TABLE `fnmovimento` (
  `id` bigint NOT NULL,
  `tipomov` char(1) NOT NULL,
  `sitmov` char(1) NOT NULL,
  `dtmov` date NOT NULL,
  `statusold` char(2) NOT NULL,
  `vlrtitulo` decimal(15,5) NOT NULL,
  `vlrparc` decimal(15,5) NOT NULL,
  `vlrapag` decimal(15,5) NOT NULL,
  `vlrpago` decimal(15,5) NOT NULL,
  `vlrdev` decimal(15,5) NOT NULL,
  `vlrjuros` decimal(15,5) NOT NULL,
  `vlrdesc` decimal(15,5) NOT NULL,
  `codemprc` int DEFAULT NULL,
  `codfilialrc` smallint DEFAULT NULL,
  `codrec` int DEFAULT NULL,
  `nparcitrec` smallint DEFAULT NULL,
  `codemppg` int DEFAULT NULL,
  `codfilialpg` smallint DEFAULT NULL,
  `codpag` int DEFAULT NULL,
  `nparcpag` smallint DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` varchar(128) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnpagar`
--

CREATE TABLE `fnpagar` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codpag` int NOT NULL,
  `codempcp` int DEFAULT NULL,
  `codfilialcp` smallint DEFAULT NULL,
  `codcompra` int DEFAULT NULL,
  `codemppg` int NOT NULL,
  `codfilialpg` smallint NOT NULL,
  `codplanopag` int NOT NULL,
  `codempfr` int NOT NULL,
  `codfilialfr` smallint NOT NULL,
  `codfor` int NOT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `vlrdescpag` decimal(15,5) DEFAULT NULL,
  `vlrmultapag` decimal(15,5) DEFAULT NULL,
  `vlrjurospag` decimal(15,5) DEFAULT NULL,
  `vlrdevpag` decimal(15,5) NOT NULL,
  `vlrparcpag` decimal(15,5) NOT NULL,
  `vlrpagopag` decimal(15,5) DEFAULT NULL,
  `vlrapagpag` decimal(15,5) DEFAULT NULL,
  `datapag` date DEFAULT NULL,
  `dtcomppag` date NOT NULL,
  `statuspag` char(2) NOT NULL,
  `dtquitpag` date DEFAULT NULL,
  `docpag` int NOT NULL,
  `vlrpag` decimal(15,5) DEFAULT NULL,
  `nroparcpag` int DEFAULT NULL,
  `obspag` varchar(250) DEFAULT NULL,
  `vlradicpag` decimal(15,5) DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtipocob` int DEFAULT NULL,
  `codempca` int DEFAULT NULL,
  `codfilialca` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `vlrbaseirrf` decimal(15,5) DEFAULT NULL,
  `vlrbaseinss` decimal(15,5) DEFAULT NULL,
  `vlrretirrf` decimal(15,5) DEFAULT NULL,
  `vlrretinss` decimal(15,5) DEFAULT NULL,
  `codemppn` int DEFAULT NULL,
  `codfilialpn` smallint DEFAULT NULL,
  `codplan` char(13) DEFAULT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `anocc` smallint DEFAULT NULL,
  `codcc` char(19) DEFAULT NULL,
  `codempoc` int DEFAULT NULL,
  `codfilialoc` smallint DEFAULT NULL,
  `codordcp` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `anoplan` smallint DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnparcpag`
--

CREATE TABLE `fnparcpag` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `codplanopag` int NOT NULL,
  `nroparcpag` int NOT NULL,
  `percpag` double NOT NULL,
  `diaspag` int NOT NULL,
  `autobaixaparc` char(1) NOT NULL,
  `idusuins` varchar(30) NOT NULL,
  `dtins` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnplanejamento`
--

CREATE TABLE `fnplanejamento` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codplan` char(13) NOT NULL,
  `descplan` char(50) NOT NULL,
  `nivelplan` int NOT NULL,
  `codredplan` int DEFAULT NULL,
  `codempsp` int DEFAULT NULL,
  `codfilialsp` smallint DEFAULT NULL,
  `codsubplan` char(13) DEFAULT NULL,
  `tipoplan` char(1) NOT NULL,
  `finplan` char(3) DEFAULT NULL,
  `compsldcxplan` char(1) NOT NULL,
  `codemphp` int DEFAULT NULL,
  `codfilialhp` smallint DEFAULT NULL,
  `codhist` int DEFAULT NULL,
  `codcontcred` varchar(20) DEFAULT NULL,
  `codcontdeb` varchar(20) DEFAULT NULL,
  `esfinplan` char(1) NOT NULL,
  `clasfinplan` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `lanctoxplan` char(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnplanopag`
--

CREATE TABLE `fnplanopag` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codplanopag` int NOT NULL,
  `descplanopag` char(40) DEFAULT NULL,
  `parcplanopag` int NOT NULL,
  `aporcplanopag` char(1) NOT NULL,
  `vlracresglobal` double DEFAULT NULL,
  `vlrdescglobal` double DEFAULT NULL,
  `autobaixaplanopag` char(1) DEFAULT NULL,
  `codempca` int DEFAULT NULL,
  `codfilialca` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `codemppn` int DEFAULT NULL,
  `codfilialpn` smallint DEFAULT NULL,
  `codplan` char(13) DEFAULT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `anocc` smallint DEFAULT NULL,
  `codcc` char(19) DEFAULT NULL,
  `ativoplanopag` char(1) NOT NULL,
  `cvplanopag` char(1) NOT NULL,
  `codemptbj` int DEFAULT NULL,
  `codfilialtbj` smallint DEFAULT NULL,
  `codtbj` int DEFAULT NULL,
  `percdesc` decimal(15,5) DEFAULT NULL,
  `regrvctoplanopag` char(1) NOT NULL,
  `rvsabplanopag` char(1) NOT NULL,
  `rvdomplanopag` char(1) NOT NULL,
  `rvferplanopag` char(1) NOT NULL,
  `rvdiaplanopag` char(1) NOT NULL,
  `diavctoplanopag` smallint NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnreceber`
--

CREATE TABLE `fnreceber` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codrec` int NOT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `codemppg` int NOT NULL,
  `codfilialpg` smallint NOT NULL,
  `codplanopag` int NOT NULL,
  `codempcl` int NOT NULL,
  `codfilialcl` smallint NOT NULL,
  `codcli` int NOT NULL,
  `codempvd` int DEFAULT NULL,
  `codfilialvd` smallint DEFAULT NULL,
  `codvend` int DEFAULT NULL,
  `codempva` int DEFAULT NULL,
  `codfilialva` smallint DEFAULT NULL,
  `tipovenda` char(1) DEFAULT NULL,
  `codvenda` int DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtipocob` int DEFAULT NULL,
  `codempcb` int DEFAULT NULL,
  `codfilialcb` smallint DEFAULT NULL,
  `codcartcob` char(3) DEFAULT NULL,
  `vlrrec` decimal(15,5) NOT NULL,
  `vlrdescrec` decimal(15,5) DEFAULT NULL,
  `vlrmultarec` decimal(15,5) DEFAULT NULL,
  `vlrjurosrec` decimal(15,5) DEFAULT NULL,
  `vlrdevrec` decimal(15,5) NOT NULL,
  `vlrparcrec` decimal(15,5) NOT NULL,
  `vlrpagorec` decimal(15,5) DEFAULT NULL,
  `vlrapagrec` decimal(15,5) DEFAULT NULL,
  `vlrbasecomis` decimal(15,5) DEFAULT NULL,
  `vlrretensaoiss` decimal(15,5) DEFAULT NULL,
  `dtcomprec` date NOT NULL,
  `datarec` date NOT NULL,
  `statusrec` char(2) NOT NULL,
  `vlrcomirec` decimal(15,5) DEFAULT NULL,
  `dtquitrec` date DEFAULT NULL,
  `docrec` int NOT NULL,
  `nroparcrec` int DEFAULT NULL,
  `obsrec` varchar(250) DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `altusurec` char(1) DEFAULT NULL,
  `codempca` int DEFAULT NULL,
  `codfilialca` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `codemppn` int DEFAULT NULL,
  `codfilialpn` smallint DEFAULT NULL,
  `codplan` char(13) DEFAULT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `anocc` smallint DEFAULT NULL,
  `codcc` char(19) DEFAULT NULL,
  `codemprr` int DEFAULT NULL,
  `codfilialrr` smallint DEFAULT NULL,
  `codrenegrec` int DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `numcontrole` int DEFAULT NULL,
  `numautorizacao` int DEFAULT NULL,
  `bandeira` varchar(10) DEFAULT NULL,
  `codterminal` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnrenegrec`
--

CREATE TABLE `fnrenegrec` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codrenegrec` int NOT NULL,
  `dtrenegrec` date NOT NULL,
  `vlroriginal` decimal(15,5) NOT NULL,
  `vlrdesconto` decimal(15,5) DEFAULT NULL,
  `vlradicional` decimal(15,5) DEFAULT NULL,
  `vlrjuros` decimal(15,5) DEFAULT NULL,
  `vlrliqrenegrec` decimal(15,5) NOT NULL,
  `codemppg` int NOT NULL,
  `codfilialpg` int NOT NULL,
  `codplanopag` int NOT NULL,
  `obsrenegrec` varchar(250) DEFAULT NULL,
  `dtini` date DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnrestricao`
--

CREATE TABLE `fnrestricao` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcli` int NOT NULL,
  `seqrestr` smallint NOT NULL,
  `codemptr` int NOT NULL,
  `codfilialtr` smallint NOT NULL,
  `codtprestr` int NOT NULL,
  `sitrestr` char(1) NOT NULL,
  `dtrestr` date NOT NULL,
  `obsrestr` varchar(512) DEFAULT NULL,
  `dtcancrestr` date DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` varchar(128) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnretboleto`
--

CREATE TABLE `fnretboleto` (
  `codretorno` int NOT NULL,
  `codemp` int DEFAULT NULL,
  `codfilial` smallint DEFAULT NULL,
  `dtprocessa` date DEFAULT NULL,
  `conta` varchar(10) DEFAULT NULL,
  `codcedente` varchar(10) DEFAULT NULL,
  `numdocumento` varchar(10) DEFAULT NULL,
  `nossonumero` varchar(10) DEFAULT NULL,
  `dtocorrencia` date DEFAULT NULL,
  `vlrrecebido` double DEFAULT NULL,
  `vlrdocumento` double DEFAULT NULL,
  `vlrpago` double DEFAULT NULL,
  `vlrdesp` double DEFAULT NULL,
  `codretbanco` varchar(2) DEFAULT NULL,
  `descretbanco` varchar(100) DEFAULT NULL,
  `dtcredito` date DEFAULT NULL,
  `codrec` int DEFAULT NULL,
  `codcli` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnsaldolanca`
--

CREATE TABLE `fnsaldolanca` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codemppn` int NOT NULL,
  `codfilialpn` int NOT NULL,
  `codplan` char(13) NOT NULL,
  `datasl` date NOT NULL,
  `prevsl` decimal(15,5) DEFAULT NULL,
  `saldosl` decimal(15,5) NOT NULL,
  `fechado` char(1) DEFAULT NULL,
  `emmanut` char(1) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnsinal`
--

CREATE TABLE `fnsinal` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codsinal` smallint NOT NULL,
  `descsinal` varchar(100) NOT NULL,
  `corsinal` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` varchar(128) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fnsublanca`
--

CREATE TABLE `fnsublanca` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codlanca` int NOT NULL,
  `codsublanca` int NOT NULL,
  `codemppn` int NOT NULL,
  `codfilialpn` smallint NOT NULL,
  `codplan` char(13) NOT NULL,
  `statussublanca` char(2) NOT NULL,
  `origsublanca` char(1) DEFAULT NULL,
  `dtcompsublanca` date NOT NULL,
  `dtprevsublanca` date DEFAULT NULL,
  `tiposublanca` char(1) NOT NULL,
  `datasublanca` date DEFAULT NULL,
  `vlrsublanca` decimal(15,5) DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `anocc` smallint DEFAULT NULL,
  `codcc` char(19) DEFAULT NULL,
  `codempcl` int DEFAULT NULL,
  `codfilialcl` smallint DEFAULT NULL,
  `codcli` int DEFAULT NULL,
  `codempfr` int DEFAULT NULL,
  `codfilialfr` smallint DEFAULT NULL,
  `codfor` int DEFAULT NULL,
  `histsublanca` varchar(250) DEFAULT NULL,
  `codempct` int DEFAULT NULL,
  `codfilialct` smallint DEFAULT NULL,
  `codcontr` int DEFAULT NULL,
  `coditcontr` smallint DEFAULT NULL,
  `codemppg` int DEFAULT NULL,
  `codfilialpg` smallint DEFAULT NULL,
  `codpag` int DEFAULT NULL,
  `nparcpag` int DEFAULT NULL,
  `codemprc` int DEFAULT NULL,
  `codfilialrc` smallint DEFAULT NULL,
  `codrec` int DEFAULT NULL,
  `nparcitrec` int DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `codempem` int DEFAULT NULL,
  `codfilialem` smallint DEFAULT NULL,
  `matempr` int DEFAULT NULL,
  `anoplan` smallint DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fntalaocheq`
--

CREATE TABLE `fntalaocheq` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `numconta` char(10) NOT NULL,
  `seqtalao` smallint NOT NULL,
  `dttalao` date NOT NULL,
  `cheqinitalao` int NOT NULL,
  `cheqfimtalao` int NOT NULL,
  `cheqatualtalao` int NOT NULL,
  `ativotalao` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` varchar(128) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fntbjuros`
--

CREATE TABLE `fntbjuros` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtbj` int NOT NULL,
  `desctbj` char(50) NOT NULL,
  `tipotbj` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fntipocob`
--

CREATE TABLE `fntipocob` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtipocob` int NOT NULL,
  `desctipocob` char(40) NOT NULL,
  `tipofebraban` char(2) NOT NULL,
  `tiposped` char(2) DEFAULT NULL,
  `duplcob` char(8) DEFAULT NULL,
  `obrigcartcob` char(1) NOT NULL,
  `codempct` int DEFAULT NULL,
  `codfilialct` smallint DEFAULT NULL,
  `numconta` varchar(10) DEFAULT NULL,
  `seqtalao` smallint DEFAULT NULL,
  `nrodiascomp` smallint DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `tiponfe` int DEFAULT NULL,
  `checkout` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fntipocred`
--

CREATE TABLE `fntipocred` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtpcred` int NOT NULL,
  `desctpcred` char(50) NOT NULL,
  `vlrtpcred` decimal(15,5) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `fntiporestr`
--

CREATE TABLE `fntiporestr` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtprestr` int NOT NULL,
  `desctprestr` char(50) NOT NULL,
  `bloqtprestr` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` varchar(128) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfcalccusto`
--

CREATE TABLE `lfcalccusto` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcalc` int NOT NULL,
  `desccalc` varchar(60) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` varchar(128) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfcest`
--

CREATE TABLE `lfcest` (
  `cest` varchar(7) NOT NULL,
  `ncm` varchar(8) DEFAULT NULL,
  `descricao` varchar(512) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfclfiscal`
--

CREATE TABLE `lfclfiscal` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codfisc` char(13) NOT NULL,
  `descfisc` char(50) NOT NULL,
  `tipofisc` char(2) DEFAULT NULL,
  `tpredicmsfisc` char(1) DEFAULT NULL,
  `aliqfisc` decimal(6,2) DEFAULT NULL,
  `aliqlfisc` decimal(6,2) DEFAULT NULL,
  `redfisc` decimal(6,2) DEFAULT NULL,
  `aliqipifisc` decimal(6,2) DEFAULT NULL,
  `codempra` int NOT NULL,
  `codfilialra` smallint NOT NULL,
  `codregra` char(4) NOT NULL,
  `origfisc` char(1) DEFAULT NULL,
  `codemptt` int DEFAULT NULL,
  `codfilialtt` smallint DEFAULT NULL,
  `codtrattrib` char(2) DEFAULT NULL,
  `codempme` int DEFAULT NULL,
  `codfilialme` smallint DEFAULT NULL,
  `codmens` int DEFAULT NULL,
  `sitpisfisc` char(1) DEFAULT NULL,
  `sitcofinsfisc` char(1) DEFAULT NULL,
  `tipost` char(2) DEFAULT NULL,
  `margemvlagr` decimal(15,5) DEFAULT NULL,
  `codncm` varchar(10) DEFAULT NULL,
  `codnbm` varchar(12) DEFAULT NULL,
  `extipi` char(2) DEFAULT NULL,
  `codserv` char(5) DEFAULT NULL,
  `cst` char(2) DEFAULT NULL,
  `codigo` varchar(10) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfcsosn`
--

CREATE TABLE `lfcsosn` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `csosn` char(4) NOT NULL,
  `desccsosn` varchar(1000) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lffrete`
--

CREATE TABLE `lffrete` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codfrete` int NOT NULL,
  `docfrete` varchar(13) DEFAULT NULL,
  `codemptn` int NOT NULL,
  `codfilialtn` smallint NOT NULL,
  `codtran` int NOT NULL,
  `codemptm` int NOT NULL,
  `codfilialtm` smallint NOT NULL,
  `codtipomov` int NOT NULL,
  `codempnt` int DEFAULT NULL,
  `codfilialnt` smallint DEFAULT NULL,
  `codnat` char(4) DEFAULT NULL,
  `tipofrete` char(1) NOT NULL,
  `tipopgto` char(1) NOT NULL,
  `codempre` int NOT NULL,
  `codfilialre` smallint NOT NULL,
  `codremet` int NOT NULL,
  `codempde` int NOT NULL,
  `codfilialde` smallint NOT NULL,
  `coddestinat` int NOT NULL,
  `dtemitfrete` date NOT NULL,
  `dtpagfrete` date DEFAULT NULL,
  `qtdfrete` decimal(15,5) NOT NULL,
  `vlrmercadoria` decimal(15,5) NOT NULL,
  `vlrfrete` decimal(15,5) NOT NULL,
  `vlrfretenota` decimal(15,5) DEFAULT NULL,
  `pesobruto` decimal(15,5) NOT NULL,
  `pesoliquido` decimal(15,5) NOT NULL,
  `aliqicmsfrete` decimal(15,5) NOT NULL,
  `vlricmsfrete` decimal(15,5) NOT NULL,
  `vlrbaseicmsfrete` decimal(15,5) NOT NULL,
  `codemppa` int DEFAULT NULL,
  `codfilialpa` smallint DEFAULT NULL,
  `codpag` int DEFAULT NULL,
  `serie` char(4) DEFAULT NULL,
  `codemprm` int DEFAULT NULL,
  `codfilialrm` smallint DEFAULT NULL,
  `ticket` int DEFAULT NULL,
  `chavecte` varchar(44) DEFAULT NULL,
  `codemptt` int DEFAULT NULL,
  `codfilialtt` smallint DEFAULT NULL,
  `codtrattrib` char(2) DEFAULT NULL,
  `codempex` int DEFAULT NULL,
  `codfilialex` smallint DEFAULT NULL,
  `ticketex` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `dtmovfrete` date DEFAULT NULL,
  `emmanut` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lffretecompra`
--

CREATE TABLE `lffretecompra` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codfrete` int NOT NULL,
  `codcompra` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lffretevenda`
--

CREATE TABLE `lffretevenda` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codfrete` int NOT NULL,
  `codvenda` int NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfitcalccusto`
--

CREATE TABLE `lfitcalccusto` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcalc` int NOT NULL,
  `seqitcalc` smallint NOT NULL,
  `siglacalc` varchar(10) NOT NULL,
  `operacaocalc` varchar(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` varchar(128) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfitclfiscal`
--

CREATE TABLE `lfitclfiscal` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `codfisc` char(13) NOT NULL,
  `coditfisc` int NOT NULL,
  `origfisc` char(1) NOT NULL,
  `codemptt` int NOT NULL,
  `codfilialtt` int NOT NULL,
  `tipofisc` char(2) NOT NULL,
  `tpredicmsfisc` char(1) NOT NULL,
  `redfisc` decimal(15,9) DEFAULT NULL,
  `codtrattrib` char(2) NOT NULL,
  `noufitfisc` char(1) NOT NULL,
  `codempfc` int DEFAULT NULL,
  `codfilialfc` int DEFAULT NULL,
  `codfisccli` int DEFAULT NULL,
  `aliqfisc` decimal(9,2) DEFAULT NULL,
  `aliqfiscintra` decimal(9,2) DEFAULT NULL,
  `aliqlfisc` decimal(9,2) DEFAULT NULL,
  `aliqipifisc` decimal(6,2) NOT NULL,
  `aliqpisfisc` decimal(6,2) NOT NULL,
  `aliqcofinsfisc` decimal(6,2) NOT NULL,
  `aliqcsocialfisc` decimal(6,2) NOT NULL,
  `aliqirfisc` decimal(6,2) NOT NULL,
  `aliqfunruralfisc` decimal(6,2) NOT NULL,
  `aliqiifisc` decimal(9,2) NOT NULL,
  `codempme` int DEFAULT NULL,
  `codfilialme` smallint DEFAULT NULL,
  `codmens` int DEFAULT NULL,
  `codemptm` int DEFAULT NULL,
  `codfilialtm` smallint DEFAULT NULL,
  `codtipomov` int DEFAULT NULL,
  `tipost` char(2) DEFAULT NULL,
  `margemvlagr` decimal(15,5) DEFAULT NULL,
  `geralfisc` char(1) NOT NULL,
  `codempsp` int DEFAULT NULL,
  `codfilialsp` smallint DEFAULT NULL,
  `codsittribpis` char(2) DEFAULT NULL,
  `impsittribpis` char(2) DEFAULT NULL,
  `codempsc` int DEFAULT NULL,
  `codfilialsc` smallint DEFAULT NULL,
  `codsittribcof` char(2) DEFAULT NULL,
  `impsittribcof` char(2) DEFAULT NULL,
  `codempsi` int DEFAULT NULL,
  `codfilialsi` smallint DEFAULT NULL,
  `codsittribipi` char(2) DEFAULT NULL,
  `impsittribipi` char(2) DEFAULT NULL,
  `tpcalcipi` char(1) DEFAULT NULL,
  `vlripiunidtrib` decimal(15,5) DEFAULT NULL,
  `modbcicms` smallint NOT NULL,
  `modbcicmsst` smallint NOT NULL,
  `codpais` smallint DEFAULT NULL,
  `siglauf` char(2) DEFAULT NULL,
  `vlrpisunidtrib` decimal(15,5) DEFAULT NULL,
  `vlrcofunidtrib` decimal(15,5) DEFAULT NULL,
  `tipousoitfisc` char(2) NOT NULL,
  `redbasest` char(1) DEFAULT NULL,
  `redbasefrete` char(1) DEFAULT NULL,
  `codempra` int DEFAULT NULL,
  `codfilialra` smallint DEFAULT NULL,
  `codregra` char(4) DEFAULT NULL,
  `codempis` int DEFAULT NULL,
  `codfilialis` smallint DEFAULT NULL,
  `codsittribiss` char(2) DEFAULT NULL,
  `impsittribiss` char(2) DEFAULT NULL,
  `aliqissfisc` decimal(6,2) DEFAULT NULL,
  `retensaoiss` char(1) DEFAULT NULL,
  `indapuripi` char(1) DEFAULT NULL,
  `codempcn` int DEFAULT NULL,
  `codfilialcn` smallint DEFAULT NULL,
  `csosn` char(4) DEFAULT NULL,
  `aliqicmsimp` decimal(15,5) DEFAULT NULL,
  `perccredpresimp` decimal(15,5) NOT NULL,
  `adicipibaseicms` char(1) NOT NULL,
  `adicicmstotnota` char(1) NOT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `codcalc` int DEFAULT NULL,
  `aliqicmsstcm` decimal(9,2) DEFAULT NULL,
  `calcstcm` char(1) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `ativoitfisc` char(1) NOT NULL,
  `cenq` char(3) DEFAULT NULL,
  `clenq` int DEFAULT NULL,
  `simplesfilial` char(1) DEFAULT NULL,
  `icmspart` char(1) DEFAULT NULL,
  `pbcop` decimal(15,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfitcompra`
--

CREATE TABLE `lfitcompra` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcompra` int NOT NULL,
  `coditcompra` int NOT NULL,
  `aliqcofins` decimal(15,5) DEFAULT NULL,
  `codempsp` int DEFAULT NULL,
  `codfilialsp` smallint DEFAULT NULL,
  `codsittribpis` char(2) DEFAULT NULL,
  `impsittribpis` char(2) DEFAULT NULL,
  `codempsc` int DEFAULT NULL,
  `codfilialsc` smallint DEFAULT NULL,
  `codsittribcof` char(2) DEFAULT NULL,
  `impsittribcof` char(2) DEFAULT NULL,
  `codempsi` int DEFAULT NULL,
  `codfilialsi` smallint DEFAULT NULL,
  `codsittribipi` char(2) DEFAULT NULL,
  `impsittribipi` char(2) DEFAULT NULL,
  `vlripiunidtrib` decimal(15,5) DEFAULT NULL,
  `modbcicms` smallint DEFAULT NULL,
  `modbcicmsst` smallint DEFAULT NULL,
  `aliqredbcicms` decimal(15,5) DEFAULT NULL,
  `aliqredbcicmsst` decimal(15,5) DEFAULT NULL,
  `aliqicmsst` decimal(15,5) DEFAULT NULL,
  `aliqpis` decimal(15,5) DEFAULT NULL,
  `vlrpisunidtrib` decimal(15,5) DEFAULT NULL,
  `vlrbasepis` decimal(15,5) DEFAULT NULL,
  `vlrbasecofins` decimal(15,5) DEFAULT NULL,
  `vlrcofunidtrib` decimal(15,5) DEFAULT NULL,
  `vlrir` decimal(15,5) DEFAULT NULL,
  `vlrpis` decimal(15,5) DEFAULT NULL,
  `vlrcofins` decimal(15,5) DEFAULT NULL,
  `vlrcsocial` decimal(15,5) DEFAULT NULL,
  `origfisc` char(1) DEFAULT NULL,
  `codtrattrib` char(2) DEFAULT NULL,
  `margemvlagritcompra` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmsstitcompra` decimal(15,5) DEFAULT NULL,
  `vlricmsstitcompra` decimal(15,5) DEFAULT NULL,
  `percissitcompra` decimal(15,5) DEFAULT NULL,
  `vlrbaseissitcompra` decimal(15,5) DEFAULT NULL,
  `vlrissitcompra` decimal(15,5) DEFAULT NULL,
  `percicmssimples` decimal(15,5) DEFAULT NULL,
  `emmanut` char(1) NOT NULL,
  `vlrbaseicmsstitretcompra` decimal(15,5) DEFAULT NULL,
  `vlricmsstretitcompra` decimal(15,5) DEFAULT NULL,
  `aliqii` decimal(15,5) DEFAULT NULL,
  `vlrbaseii` decimal(15,5) DEFAULT NULL,
  `vlrii` decimal(15,5) DEFAULT NULL,
  `vlricmsdiferido` decimal(15,5) DEFAULT NULL,
  `vlricmsdevido` decimal(15,5) DEFAULT NULL,
  `vlricmscredpresum` decimal(15,5) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfitnatoper`
--

CREATE TABLE `lfitnatoper` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `codnat` char(4) NOT NULL,
  `coditnatoper` int NOT NULL,
  `codempti` int NOT NULL,
  `codfilialti` int NOT NULL,
  `ufti` char(2) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfitregrafiscal`
--

CREATE TABLE `lfitregrafiscal` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codregra` char(4) NOT NULL,
  `codnat` char(4) NOT NULL,
  `noufitrf` char(1) NOT NULL,
  `cvitrf` char(1) NOT NULL,
  `codemptm` int DEFAULT NULL,
  `codfilialtm` smallint DEFAULT NULL,
  `codtipomov` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lflivrofiscal`
--

CREATE TABLE `lflivrofiscal` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipolf` char(1) NOT NULL,
  `anomeslf` char(6) NOT NULL,
  `codlf` int NOT NULL,
  `codempet` int NOT NULL,
  `codfilialet` smallint NOT NULL,
  `codemitlf` int NOT NULL,
  `serielf` char(4) NOT NULL,
  `docinilf` int NOT NULL,
  `dtemitlf` date NOT NULL,
  `dteslf` date NOT NULL,
  `codempnt` int DEFAULT NULL,
  `codfilialnt` smallint DEFAULT NULL,
  `codnat` char(4) DEFAULT NULL,
  `docfimlf` int NOT NULL,
  `especielf` char(3) NOT NULL,
  `uflf` char(2) NOT NULL,
  `vlrcontabillf` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmslf` decimal(15,5) DEFAULT NULL,
  `aliqicmslf` decimal(7,3) DEFAULT NULL,
  `vlricmslf` decimal(15,5) DEFAULT NULL,
  `vlrisentasicmslf` decimal(15,5) DEFAULT NULL,
  `vlroutrasicmslf` decimal(15,5) DEFAULT NULL,
  `vlrbaseipilf` decimal(15,5) DEFAULT NULL,
  `aliqipilf` decimal(7,3) DEFAULT NULL,
  `vlripilf` decimal(15,5) DEFAULT NULL,
  `vlrisentasipilf` decimal(15,5) DEFAULT NULL,
  `vlroutrasipilf` decimal(15,5) DEFAULT NULL,
  `obslf` char(30) DEFAULT NULL,
  `codempmn` int DEFAULT NULL,
  `codfilialmn` smallint DEFAULT NULL,
  `codmodnota` int DEFAULT NULL,
  `situacaolf` char(1) NOT NULL,
  `vlrbaseicmsstlf` decimal(15,5) DEFAULT NULL,
  `vlricmsstlf` decimal(15,5) DEFAULT NULL,
  `vlracessoriaslf` decimal(15,5) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfmensagem`
--

CREATE TABLE `lfmensagem` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codmens` int NOT NULL,
  `mens` varchar(10000) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfmoddocfisc`
--

CREATE TABLE `lfmoddocfisc` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codmoddocfisc` char(2) NOT NULL,
  `descmoddocfisc` char(60) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfmodnota`
--

CREATE TABLE `lfmodnota` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codmodnota` int NOT NULL,
  `descmodnota` char(30) NOT NULL,
  `tipomodnota` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfnatoper`
--

CREATE TABLE `lfnatoper` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codnat` char(4) NOT NULL,
  `descnat` char(60) NOT NULL,
  `impdtsaidanat` char(1) NOT NULL,
  `aliqenat` decimal(6,2) NOT NULL,
  `aliqfnat` decimal(6,2) NOT NULL,
  `txtnat` varchar(500) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfncm`
--

CREATE TABLE `lfncm` (
  `codncm` varchar(10) NOT NULL,
  `descncm` varchar(60) NOT NULL,
  `aliqncm` varchar(6) DEFAULT NULL,
  `textoncm` varchar(2000) DEFAULT NULL,
  `excecaoncm` varchar(1000) DEFAULT NULL,
  `aliqnac` decimal(9,2) NOT NULL,
  `aliqimp` decimal(9,2) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` char(8) NOT NULL,
  `codemp` int DEFAULT NULL,
  `codfilial` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfregrafiscal`
--

CREATE TABLE `lfregrafiscal` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codregra` char(4) NOT NULL,
  `descregra` char(50) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfseqserie`
--

CREATE TABLE `lfseqserie` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `serie` char(4) NOT NULL,
  `codempss` int NOT NULL,
  `codfilialss` smallint NOT NULL,
  `seqserie` smallint NOT NULL,
  `docserie` int NOT NULL,
  `ativserie` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` varchar(128) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfserie`
--

CREATE TABLE `lfserie` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `serie` char(4) NOT NULL,
  `docserie` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfservico`
--

CREATE TABLE `lfservico` (
  `codserv` char(5) NOT NULL,
  `descserv` varchar(500) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lfsittrib`
--

CREATE TABLE `lfsittrib` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codsittrib` char(2) NOT NULL,
  `impsittrib` char(2) NOT NULL,
  `descsittrib` varchar(200) NOT NULL,
  `operacao` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lftabicms`
--

CREATE TABLE `lftabicms` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `ufti` char(2) NOT NULL,
  `aliqti` decimal(9,2) NOT NULL,
  `aliqintrati` decimal(15,5) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `aliqfcpti` decimal(6,2) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lftipofisccli`
--

CREATE TABLE `lftipofisccli` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `codfisccli` int NOT NULL,
  `descfisccli` char(40) NOT NULL,
  `calccofinstf` char(1) NOT NULL,
  `calccsocialtf` char(1) NOT NULL,
  `calcicmstf` char(1) NOT NULL,
  `calcipitf` char(1) NOT NULL,
  `calcirtf` char(1) NOT NULL,
  `calcisstf` char(1) NOT NULL,
  `calcpistf` char(1) NOT NULL,
  `impcofinstf` char(1) NOT NULL,
  `impcsocialtf` char(1) NOT NULL,
  `impicmstf` char(1) NOT NULL,
  `impisstf` char(1) NOT NULL,
  `impipitf` char(1) NOT NULL,
  `impirtf` char(1) NOT NULL,
  `imppistf` char(1) NOT NULL,
  `leitransp` char(1) NOT NULL,
  `codempoc` int DEFAULT NULL,
  `codfilialoc` smallint DEFAULT NULL,
  `codtipomovoc` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `lftrattrib`
--

CREATE TABLE `lftrattrib` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtrattrib` char(2) NOT NULL,
  `desctrattrib` char(60) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `pvcaixa`
--

CREATE TABLE `pvcaixa` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcaixa` int NOT NULL,
  `desccaixa` char(40) NOT NULL,
  `codempet` int NOT NULL,
  `codfilialet` smallint NOT NULL,
  `codest` int NOT NULL,
  `seqini` int DEFAULT NULL,
  `seqmax` int DEFAULT NULL,
  `ecfcaixa` char(1) NOT NULL,
  `tefcaixa` char(1) DEFAULT NULL,
  `orccaixa` char(1) NOT NULL,
  `mododemo` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `pvcaixaimp`
--

CREATE TABLE `pvcaixaimp` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcaixa` int NOT NULL,
  `codimp` int NOT NULL,
  `imppad` char(1) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `pvmovcaixa`
--

CREATE TABLE `pvmovcaixa` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcaixa` int NOT NULL,
  `dtamov` date NOT NULL,
  `nromov` int NOT NULL,
  `tipomov` char(1) NOT NULL,
  `vlrmov` decimal(15,5) NOT NULL,
  `vlrsldmov` decimal(15,5) DEFAULT NULL,
  `codempus` int NOT NULL,
  `codfilialus` smallint NOT NULL,
  `idusu` char(8) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `item` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `pvseqmovcaixa`
--

CREATE TABLE `pvseqmovcaixa` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcaixa` int NOT NULL,
  `dtamov` date NOT NULL,
  `nromov` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` date NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `pvsequencia`
--

CREATE TABLE `pvsequencia` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcaixa` int NOT NULL,
  `seqcaixa` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgacessoeu`
--

CREATE TABLE `sgacessoeu` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `idusu` char(8) NOT NULL,
  `codempfl` int NOT NULL,
  `codfilialfl` smallint NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgacessomg`
--

CREATE TABLE `sgacessomg` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `idgrpusu` char(8) NOT NULL,
  `codsis` int NOT NULL,
  `codmodu` int NOT NULL,
  `codmenu` int NOT NULL,
  `tpacessomg` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgacessomu`
--

CREATE TABLE `sgacessomu` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `idusu` char(8) NOT NULL,
  `codsis` int NOT NULL,
  `codmodu` int NOT NULL,
  `codmenu` int NOT NULL,
  `tpacessomu` char(1) NOT NULL,
  `planomu` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgagente`
--

CREATE TABLE `sgagente` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipoage` char(5) NOT NULL,
  `codage` int NOT NULL,
  `descage` char(50) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgatribuicao`
--

CREATE TABLE `sgatribuicao` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `idatrib` char(10) NOT NULL,
  `descatrib` char(50) NOT NULL,
  `rmaatrib` char(2) NOT NULL,
  `obsatrib` varchar(500) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgatribusu`
--

CREATE TABLE `sgatribusu` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `idatrib` char(10) NOT NULL,
  `codempuu` int NOT NULL,
  `codfilialuu` smallint NOT NULL,
  `idusu` char(8) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgatualizacao`
--

CREATE TABLE `sgatualizacao` (
  `codatualizacao` int NOT NULL,
  `codenvio` int DEFAULT NULL,
  `datalancamento` datetime DEFAULT NULL,
  `modulo` varchar(10) DEFAULT NULL,
  `link` varchar(255) DEFAULT NULL,
  `versao` varchar(10) DEFAULT NULL,
  `codest` int DEFAULT NULL,
  `atualizado` char(1) DEFAULT NULL,
  `script` varchar(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgconexao`
--

CREATE TABLE `sgconexao` (
  `nrconexao` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `idusu` char(10) NOT NULL,
  `codfilialsel` smallint NOT NULL,
  `codterm` int DEFAULT NULL,
  `conectado` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgempresa`
--

CREATE TABLE `sgempresa` (
  `codemp` int NOT NULL,
  `codrev` int NOT NULL,
  `razemp` char(50) DEFAULT NULL,
  `nomeemp` char(50) DEFAULT NULL,
  `cnpjemp` char(18) DEFAULT NULL,
  `inscemp` varchar(20) DEFAULT NULL,
  `endemp` char(50) DEFAULT NULL,
  `numemp` int DEFAULT NULL,
  `complemp` char(20) DEFAULT NULL,
  `bairemp` char(30) DEFAULT NULL,
  `cepemp` char(8) DEFAULT NULL,
  `cidemp` char(30) DEFAULT NULL,
  `ufemp` char(2) DEFAULT NULL,
  `dddemp` char(4) DEFAULT NULL,
  `foneemp` char(15) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `celemp` varchar(14) DEFAULT NULL,
  `faxemp` varchar(9) DEFAULT NULL,
  `emailemp` char(50) DEFAULT NULL,
  `wwwemp` char(50) DEFAULT NULL,
  `codeanemp` char(10) DEFAULT NULL,
  `nomecontemp` char(40) DEFAULT NULL,
  `multialmoxemp` char(1) DEFAULT NULL,
  `codmunic` char(7) DEFAULT NULL,
  `siglauf` char(2) DEFAULT NULL,
  `codpais` smallint DEFAULT NULL,
  `percissemp` decimal(6,2) DEFAULT NULL,
  `codpaisemp` char(3) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `ativo` char(1) NOT NULL,
  `tipoempresa` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgeqvclifor`
--

CREATE TABLE `sgeqvclifor` (
  `codempcl` int NOT NULL,
  `codfilialcl` int NOT NULL,
  `codcli` int NOT NULL,
  `codempfr` int NOT NULL,
  `codfilialfr` int NOT NULL,
  `codfor` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgestacao`
--

CREATE TABLE `sgestacao` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codest` smallint NOT NULL,
  `descest` char(50) NOT NULL,
  `mododemoest` char(1) NOT NULL,
  `nfeest` char(1) NOT NULL,
  `tamfontetxt` smallint DEFAULT NULL,
  `fontetxt` char(30) DEFAULT NULL,
  `pathcacerts` varchar(256) DEFAULT NULL,
  `codemppx` int DEFAULT NULL,
  `codfilialpx` smallint DEFAULT NULL,
  `codproxy` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `ativaest` char(1) NOT NULL,
  `hostest` varchar(100) DEFAULT NULL,
  `ipest` varchar(20) DEFAULT NULL,
  `macaddressest` varchar(20) DEFAULT NULL,
  `desclocalest` varchar(1000) DEFAULT NULL,
  `nomecontest` varchar(50) DEFAULT NULL,
  `ramalest` varchar(10) DEFAULT NULL,
  `emailest` varchar(80) DEFAULT NULL,
  `pathpdfreader` varchar(256) DEFAULT NULL,
  `printpdf` varchar(30) DEFAULT NULL,
  `chavea` varchar(4) DEFAULT NULL,
  `chaveb` varchar(4) DEFAULT NULL,
  `conectado` char(1) DEFAULT NULL,
  `logado` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgestacaobal`
--

CREATE TABLE `sgestacaobal` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codest` int NOT NULL,
  `nrobal` smallint NOT NULL,
  `driverbal` char(50) NOT NULL,
  `portabal` smallint NOT NULL,
  `speedbal` smallint NOT NULL,
  `bitsbal` smallint NOT NULL,
  `stopbitbal` smallint NOT NULL,
  `paritybal` smallint NOT NULL,
  `tipoprocrecmerc` char(2) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgestacaoimp`
--

CREATE TABLE `sgestacaoimp` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codest` int NOT NULL,
  `nroimp` smallint NOT NULL,
  `codempip` int NOT NULL,
  `codfilialip` smallint NOT NULL,
  `codimp` int NOT NULL,
  `codemppp` int NOT NULL,
  `codfilialpp` smallint NOT NULL,
  `codpapel` char(10) NOT NULL,
  `portawin` char(50) NOT NULL,
  `portalin` char(50) NOT NULL,
  `imppad` char(1) NOT NULL,
  `tipousoimp` char(2) NOT NULL,
  `impgrafica` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgestcivil`
--

CREATE TABLE `sgestcivil` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codestcivil` char(2) NOT NULL,
  `descestcivil` char(50) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgferiado`
--

CREATE TABLE `sgferiado` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `datafer` date NOT NULL,
  `descfer` char(50) NOT NULL,
  `bancfer` char(1) NOT NULL,
  `trabfer` char(1) NOT NULL,
  `optfer` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` varchar(128) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgfilial`
--

CREATE TABLE `sgfilial` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `razfilial` char(50) NOT NULL,
  `nomefilial` char(50) NOT NULL,
  `mzfilial` char(1) DEFAULT NULL,
  `cnpjfilial` char(14) DEFAULT NULL,
  `inscfilial` varchar(20) DEFAULT NULL,
  `endfilial` char(50) DEFAULT NULL,
  `numfilial` int DEFAULT NULL,
  `complfilial` char(20) DEFAULT NULL,
  `bairfilial` char(30) DEFAULT NULL,
  `cepfilial` char(8) DEFAULT NULL,
  `cidfilial` char(30) DEFAULT NULL,
  `uffilial` char(2) DEFAULT NULL,
  `dddfilial` char(4) DEFAULT NULL,
  `fonefilial` char(12) DEFAULT NULL,
  `faxfilial` varchar(9) DEFAULT NULL,
  `emailfilial` char(50) DEFAULT NULL,
  `wwwfilial` char(50) DEFAULT NULL,
  `coddistfilial` int DEFAULT NULL,
  `percpisfilial` decimal(5,2) DEFAULT NULL,
  `perccofinsfilial` decimal(5,2) DEFAULT NULL,
  `percirfilial` decimal(5,2) DEFAULT NULL,
  `perccsocialfilial` decimal(5,2) DEFAULT NULL,
  `simplesfilial` char(1) DEFAULT NULL,
  `percsimplesfilial` decimal(9,2) DEFAULT NULL,
  `codmunic` char(7) DEFAULT NULL,
  `siglauf` char(2) DEFAULT NULL,
  `codpais` smallint DEFAULT NULL,
  `codempuc` int DEFAULT NULL,
  `codfilialuc` smallint DEFAULT NULL,
  `codunifcod` int DEFAULT NULL,
  `inscmunfilial` char(15) DEFAULT NULL,
  `cnaefilial` char(7) DEFAULT NULL,
  `percissfilial` decimal(5,2) DEFAULT NULL,
  `contribipifilial` char(1) DEFAULT NULL,
  `perfilfilial` char(1) DEFAULT NULL,
  `indativfilial` char(1) DEFAULT NULL,
  `indnatpjfilial` char(2) DEFAULT NULL,
  `codempco` int DEFAULT NULL,
  `codfilialco` smallint DEFAULT NULL,
  `codfor` int DEFAULT NULL,
  `suframa` char(9) DEFAULT NULL,
  `codinctrib` char(1) DEFAULT NULL,
  `indaprocred` char(1) DEFAULT NULL,
  `codtipocont` char(1) DEFAULT NULL,
  `indregcum` char(1) DEFAULT NULL,
  `unidfranqueada` char(30) DEFAULT NULL,
  `marcafranqueadora` char(30) DEFAULT NULL,
  `wwwfranqueadora` char(50) DEFAULT NULL,
  `codreceita` varchar(20) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `perfilepc` char(1) DEFAULT NULL,
  `indativepc` char(1) DEFAULT NULL,
  `coduf` int DEFAULT NULL,
  `nomeresp` varchar(50) DEFAULT NULL,
  `cpfresp` varchar(11) DEFAULT NULL,
  `cepresp` varchar(8) DEFAULT NULL,
  `endresp` varchar(50) DEFAULT NULL,
  `numresp` varchar(10) DEFAULT NULL,
  `complresp` varchar(10) DEFAULT NULL,
  `bairroresp` varchar(30) DEFAULT NULL,
  `foneresp` varchar(14) DEFAULT NULL,
  `faxresp` varchar(14) DEFAULT NULL,
  `emailresp` varchar(100) DEFAULT NULL,
  `foto` longtext,
  `desativado` varchar(1) DEFAULT NULL,
  `nomereduzido` varchar(15) DEFAULT NULL,
  `tx_juros_boleto` float(24,2) DEFAULT NULL,
  `tx_multa_boleto` float(24,2) DEFAULT NULL,
  `dias_atraso_boleto` smallint DEFAULT NULL,
  `dias_protesto_boleto` smallint DEFAULT NULL,
  `msg_boleto` varchar(100) DEFAULT NULL,
  `path_copia_nfe` varchar(255) DEFAULT NULL,
  `marcaunica` varchar(20) DEFAULT NULL,
  `tef_cappta` char(1) DEFAULT NULL,
  `tef_troca` char(1) DEFAULT NULL,
  `numconta` varchar(10) DEFAULT NULL,
  `codplan` varchar(13) DEFAULT NULL,
  `caixa_finaliza` int DEFAULT NULL,
  `codforn_rec` int DEFAULT NULL,
  `codatend` int DEFAULT NULL,
  `recagro` char(1) DEFAULT NULL,
  `codemprec` int DEFAULT NULL,
  `codfilialrec` int DEFAULT NULL,
  `codemprecat` int DEFAULT NULL,
  `codfilialrecat` int DEFAULT NULL,
  `desticms` float(24,2) DEFAULT NULL,
  `tipo_parc_tef` char(1) DEFAULT NULL,
  `satcfe` char(1) DEFAULT NULL,
  `escola` char(1) DEFAULT NULL,
  `codrev` int DEFAULT NULL,
  `crccontador` varchar(15) DEFAULT NULL,
  `ativo` char(1) NOT NULL,
  `tipoempresa` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sggatilho`
--

CREATE TABLE `sggatilho` (
  `codemp` int NOT NULL,
  `codobj` int NOT NULL,
  `dispgat` char(2) NOT NULL,
  `ativogat` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgimagem`
--

CREATE TABLE `sgimagem` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codimg` int NOT NULL,
  `descimg` varchar(100) NOT NULL,
  `codempci` int NOT NULL,
  `codfilialci` smallint NOT NULL,
  `codcatimg` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgimpressora`
--

CREATE TABLE `sgimpressora` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codimp` int NOT NULL,
  `descimp` char(40) NOT NULL,
  `tipoimp` char(2) NOT NULL,
  `linpagimp` int DEFAULT NULL,
  `nserieimp` varchar(20) DEFAULT NULL,
  `portawinimp` char(4) DEFAULT NULL,
  `portalinimp` char(60) DEFAULT NULL,
  `codemppl` int DEFAULT NULL,
  `codfilialpl` smallint DEFAULT NULL,
  `codpapel` char(10) DEFAULT NULL,
  `destimp` char(2) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgitfluxo`
--

CREATE TABLE `sgitfluxo` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codfluxo` int NOT NULL,
  `seqitfluxo` smallint NOT NULL,
  `codemppc` int NOT NULL,
  `codfilialpc` smallint NOT NULL,
  `codproc` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` date NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sglicenca`
--

CREATE TABLE `sglicenca` (
  `codlicenca` int NOT NULL,
  `codemp` int NOT NULL,
  `codrev` int NOT NULL,
  `codplano` int NOT NULL,
  `datacadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `mesbase` char(3) NOT NULL,
  `vlracordado` double NOT NULL,
  `ativo` char(1) NOT NULL,
  `registrado` char(1) NOT NULL,
  `revogado` char(1) NOT NULL,
  `demo` char(1) NOT NULL,
  `nativo` char(1) NOT NULL,
  `numeroserie` varchar(10) NOT NULL,
  `cnpjcpfcli` char(5) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sglog`
--

CREATE TABLE `sglog` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codlog` int NOT NULL,
  `datalog` date NOT NULL,
  `horalog` time NOT NULL,
  `codempus` int NOT NULL,
  `codfilialus` smallint NOT NULL,
  `idusu` char(8) NOT NULL,
  `claslog` char(2) NOT NULL,
  `tipolog` char(3) NOT NULL,
  `codempcx` int NOT NULL,
  `codfilialcx` smallint NOT NULL,
  `codcaixa` int NOT NULL,
  `desclog` char(60) NOT NULL,
  `obslog` varchar(1000) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sglogcrud`
--

CREATE TABLE `sglogcrud` (
  `id` bigint NOT NULL,
  `tablename` varchar(100) NOT NULL,
  `operation` char(1) NOT NULL,
  `eventlog` char(1) NOT NULL,
  `dtlog` date NOT NULL,
  `hlog` time NOT NULL,
  `idusu` varchar(128) NOT NULL,
  `xml` longtext NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgmenu`
--

CREATE TABLE `sgmenu` (
  `codsis` int NOT NULL,
  `codmodu` int NOT NULL,
  `codmenu` int NOT NULL,
  `descmenu` char(200) NOT NULL,
  `nomemenu` char(200) NOT NULL,
  `planomenu` char(1) NOT NULL,
  `acaomenu` char(200) NOT NULL,
  `codsispai` int DEFAULT NULL,
  `codmodupai` int DEFAULT NULL,
  `codmenupai` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgmenuobj`
--

CREATE TABLE `sgmenuobj` (
  `codemp` int NOT NULL,
  `idobj` char(30) NOT NULL,
  `codsis` int NOT NULL,
  `codmodu` int NOT NULL,
  `codmenu` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgmodetiqueta`
--

CREATE TABLE `sgmodetiqueta` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `codmodetiq` int NOT NULL,
  `descmodetiq` char(30) NOT NULL,
  `ncolmodetiq` smallint DEFAULT NULL,
  `eecmodetiq` smallint DEFAULT NULL,
  `txamodetiq` varchar(1000) DEFAULT NULL,
  `codemppl` int DEFAULT NULL,
  `codfilialpl` smallint DEFAULT NULL,
  `codpapel` char(10) DEFAULT NULL,
  `comprimido` char(1) NOT NULL,
  `posscript` char(1) DEFAULT NULL,
  `modetiq` varchar(30) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgmodulado`
--

CREATE TABLE `sgmodulado` (
  `codmodulado` int DEFAULT NULL,
  `l1c1` varchar(25) DEFAULT NULL,
  `l1c2` varchar(25) DEFAULT NULL,
  `l1c3` varchar(25) DEFAULT NULL,
  `l1c4` varchar(25) DEFAULT NULL,
  `l1c5` varchar(25) DEFAULT NULL,
  `l1c6` varchar(25) DEFAULT NULL,
  `l1c7` varchar(25) DEFAULT NULL,
  `l1c8` varchar(25) DEFAULT NULL,
  `l1c9` varchar(25) DEFAULT NULL,
  `l2c1` varchar(25) DEFAULT NULL,
  `l2c2` varchar(25) DEFAULT NULL,
  `l2c3` varchar(25) DEFAULT NULL,
  `l2c4` varchar(25) DEFAULT NULL,
  `l2c5` varchar(25) DEFAULT NULL,
  `l2c6` varchar(25) DEFAULT NULL,
  `l2c7` varchar(25) DEFAULT NULL,
  `l2c8` varchar(25) DEFAULT NULL,
  `l2c9` varchar(25) DEFAULT NULL,
  `l3c1` varchar(25) DEFAULT NULL,
  `l3c2` varchar(25) DEFAULT NULL,
  `l3c3` varchar(25) DEFAULT NULL,
  `l3c4` varchar(25) DEFAULT NULL,
  `l3c5` varchar(25) DEFAULT NULL,
  `l3c6` varchar(25) DEFAULT NULL,
  `l3c7` varchar(25) DEFAULT NULL,
  `l3c8` varchar(25) DEFAULT NULL,
  `l3c9` varchar(25) DEFAULT NULL,
  `caos` varchar(10) DEFAULT NULL,
  `nomeregistro` varchar(50) DEFAULT NULL,
  `documento` varchar(14) DEFAULT NULL,
  `tpversao` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgmodulo`
--

CREATE TABLE `sgmodulo` (
  `codsis` int NOT NULL,
  `codmodu` int NOT NULL,
  `descmodu` char(50) NOT NULL,
  `comentmodu` varchar(10000) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgnf`
--

CREATE TABLE `sgnf` (
  `codigo` int NOT NULL,
  `chave` varchar(44) DEFAULT NULL,
  `data` date DEFAULT NULL,
  `hora` time DEFAULT NULL,
  `upload` varchar(255) DEFAULT NULL,
  `situacao` varchar(30) DEFAULT NULL,
  `valor` float(24,2) DEFAULT NULL,
  `numero` int DEFAULT NULL,
  `codmov` int DEFAULT NULL,
  `nfce` char(1) DEFAULT NULL,
  `refdevolucao` varchar(45) DEFAULT NULL,
  `enviado` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgnfcce`
--

CREATE TABLE `sgnfcce` (
  `numnf` int NOT NULL,
  `modnf` int NOT NULL,
  `seqnf` int NOT NULL,
  `protocolo` varchar(15) DEFAULT NULL,
  `correcao` varchar(200) DEFAULT NULL,
  `data` date DEFAULT NULL,
  `hora` time DEFAULT NULL,
  `enviado` char(1) DEFAULT NULL,
  `arquivo` varchar(80) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgnfcstat`
--

CREATE TABLE `sgnfcstat` (
  `cstat` int NOT NULL,
  `mensagem` varchar(100) DEFAULT NULL,
  `resumo` varchar(1000) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgnflog`
--

CREATE TABLE `sgnflog` (
  `numnf` int NOT NULL,
  `modnf` int NOT NULL,
  `seqnf` int NOT NULL,
  `protocolo` varchar(15) DEFAULT NULL,
  `tipolog` char(1) DEFAULT NULL,
  `log` varchar(100) DEFAULT NULL,
  `data` date DEFAULT NULL,
  `hora` time DEFAULT NULL,
  `usuario` varchar(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgobjeto`
--

CREATE TABLE `sgobjeto` (
  `codemp` int NOT NULL,
  `idobj` char(30) NOT NULL,
  `descobj` char(50) NOT NULL,
  `tipoobj` char(2) NOT NULL,
  `comentobj` varchar(10000) DEFAULT NULL,
  `usomeobj` char(1) DEFAULT NULL,
  `siglaobj` char(8) DEFAULT NULL,
  `nivelobj` smallint NOT NULL,
  `numregobj` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgobjetotb`
--

CREATE TABLE `sgobjetotb` (
  `codemp` int NOT NULL,
  `idobj` char(30) NOT NULL,
  `codemptb` int NOT NULL,
  `codfilialtb` smallint NOT NULL,
  `codtb` smallint NOT NULL,
  `obrigobjtb` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgpais`
--

CREATE TABLE `sgpais` (
  `codpais` smallint NOT NULL,
  `nomepais` char(50) NOT NULL,
  `sigla3cpais` char(3) NOT NULL,
  `ddipais` smallint DEFAULT NULL,
  `sigla2cpais` char(2) NOT NULL,
  `codbacenpais` int DEFAULT NULL,
  `codeanpais` char(3) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgpapel`
--

CREATE TABLE `sgpapel` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codpapel` char(10) NOT NULL,
  `descpapel` char(40) DEFAULT NULL,
  `linpapel` int DEFAULT NULL,
  `altpapel` int DEFAULT NULL,
  `largpapel` int DEFAULT NULL,
  `classnotapapel` char(20) DEFAULT NULL,
  `colpapel` smallint DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgpermissao`
--

CREATE TABLE `sgpermissao` (
  `nivelusu` int NOT NULL,
  `permissao` varchar(30) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgprefere`
--

CREATE TABLE `sgprefere` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `idioma` char(2) DEFAULT NULL,
  `tipovenda` char(1) DEFAULT NULL,
  `tipoproduto` char(1) DEFAULT NULL,
  `codvenda` char(1) DEFAULT NULL,
  `cartaofrente` varchar(1000) DEFAULT NULL,
  `cartaoverso` varchar(1000) DEFAULT NULL,
  `logogrande` varchar(1000) DEFAULT NULL,
  `logomedio` varchar(1000) DEFAULT NULL,
  `logopequeno` varchar(1000) DEFAULT NULL,
  `favicon` varchar(1000) DEFAULT NULL,
  `perfil` varchar(1000) DEFAULT NULL,
  `usarefprod` char(1) NOT NULL,
  `codtipomov` int DEFAULT NULL,
  `codemptm` int DEFAULT NULL,
  `codfilialtm` smallint DEFAULT NULL,
  `usapedseq` char(1) DEFAULT NULL,
  `usaorcseq` char(1) NOT NULL,
  `filtro` char(2) DEFAULT NULL,
  `usaliqrel` char(1) DEFAULT NULL,
  `tipoprecocusto` char(1) NOT NULL,
  `anocentrocusto` smallint DEFAULT NULL,
  `obsorcpad` varchar(10000) DEFAULT NULL,
  `codtipomov2` int DEFAULT NULL,
  `codfilialt2` smallint DEFAULT NULL,
  `codempt2` int DEFAULT NULL,
  `classorc` varchar(80) DEFAULT NULL,
  `classorcpd` varchar(80) DEFAULT NULL,
  `titorctxt01` char(20) DEFAULT NULL,
  `codtipomov3` int DEFAULT NULL,
  `codfilialt3` smallint DEFAULT NULL,
  `codempt3` int DEFAULT NULL,
  `ordnota` char(1) DEFAULT NULL,
  `setorvenda` char(1) DEFAULT NULL,
  `prefcred` char(1) DEFAULT NULL,
  `tipoprefcred` char(2) NOT NULL,
  `codempmo` int NOT NULL,
  `codfilialmo` int NOT NULL,
  `codmoeda` char(4) NOT NULL,
  `codtipomov4` int DEFAULT NULL,
  `codfilialt4` int DEFAULT NULL,
  `codempt4` int DEFAULT NULL,
  `usaclascomis` char(1) DEFAULT NULL,
  `percprecocusto` decimal(9,2) NOT NULL,
  `codgrup` char(14) DEFAULT NULL,
  `codfilialgp` int DEFAULT NULL,
  `codempgp` int DEFAULT NULL,
  `codmarca` char(6) DEFAULT NULL,
  `codfilialmc` int DEFAULT NULL,
  `codempmc` int DEFAULT NULL,
  `rgcliobrig` char(1) NOT NULL,
  `tabfretevd` char(1) NOT NULL,
  `tabadicvd` char(1) NOT NULL,
  `travatmnfvd` char(1) NOT NULL,
  `tipovalidorc` char(1) DEFAULT NULL,
  `climesmocnpj` char(1) DEFAULT NULL,
  `codtbj` int DEFAULT NULL,
  `codemptj` int DEFAULT NULL,
  `codfilialtj` int DEFAULT NULL,
  `cnpjobrigcli` char(1) NOT NULL,
  `jurosposcalc` char(1) DEFAULT NULL,
  `codempfr` int DEFAULT NULL,
  `codfilialfr` int DEFAULT NULL,
  `codfor` int DEFAULT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `codemptf` int DEFAULT NULL,
  `codfilialtf` int DEFAULT NULL,
  `codtipofor` int DEFAULT NULL,
  `codempt5` int DEFAULT NULL,
  `codfilialt5` int DEFAULT NULL,
  `codtipomov5` int DEFAULT NULL,
  `estlotneg` char(1) DEFAULT NULL,
  `estneg` char(1) DEFAULT NULL,
  `natvenda` char(1) DEFAULT NULL,
  `ipivenda` char(1) DEFAULT NULL,
  `custosicms` char(1) NOT NULL,
  `codemppg` int DEFAULT NULL,
  `codfilialpg` smallint DEFAULT NULL,
  `codplanopag` int DEFAULT NULL,
  `codemptb` int DEFAULT NULL,
  `codfilialtb` smallint DEFAULT NULL,
  `codtab` int DEFAULT NULL,
  `codempce` int DEFAULT NULL,
  `codfilialce` smallint DEFAULT NULL,
  `codclascli` int DEFAULT NULL,
  `casasdec` smallint DEFAULT NULL,
  `casasdecfin` smallint DEFAULT NULL,
  `comispdupl` char(1) DEFAULT NULL,
  `codempt6` int DEFAULT NULL,
  `codfilialt6` smallint DEFAULT NULL,
  `codtipomov6` int DEFAULT NULL,
  `bloqvenda` char(1) NOT NULL,
  `bloqcompra` char(1) NOT NULL,
  `vendamatprim` char(1) NOT NULL,
  `vendapatrim` char(1) NOT NULL,
  `pepsprod` char(1) NOT NULL,
  `cnpjforobrig` char(1) NOT NULL,
  `inscestforobrig` char(1) NOT NULL,
  `buscaprodsimilar` char(1) NOT NULL,
  `multialmox` char(1) NOT NULL,
  `codempt8` int DEFAULT NULL,
  `codfilialt8` smallint DEFAULT NULL,
  `codtipomov8` int DEFAULT NULL,
  `estneggrup` char(1) NOT NULL,
  `usatabpe` char(1) NOT NULL,
  `tamdescprod` smallint DEFAULT NULL,
  `desccompped` char(1) NOT NULL,
  `obsclivend` char(1) NOT NULL,
  `contestoq` char(1) NOT NULL,
  `diaspedt` char(1) NOT NULL,
  `recalcpcvenda` char(1) NOT NULL,
  `recalcpcorc` char(1) NOT NULL,
  `usalayoutped` char(1) NOT NULL,
  `verifaltparcvenda` char(1) NOT NULL,
  `buscacodprodgen` char(1) NOT NULL,
  `filbuscgenprod` char(1) NOT NULL,
  `filbuscgenref` char(1) NOT NULL,
  `filbuscgencodbar` char(1) NOT NULL,
  `filbuscgencodfab` char(1) NOT NULL,
  `filbuscgencodfor` char(1) NOT NULL,
  `buscavlrultcompra` char(1) NOT NULL,
  `icmsvenda` char(1) NOT NULL,
  `usaprecozero` char(1) NOT NULL,
  `usaimgassorc` char(1) NOT NULL,
  `consistcpfcli` char(1) NOT NULL,
  `consisteiecli` char(1) NOT NULL,
  `consisteiefor` char(1) NOT NULL,
  `consistecpffor` char(1) NOT NULL,
  `usanomevendorc` char(1) NOT NULL,
  `siscontabil` char(2) NOT NULL,
  `atbancoimpbol` char(1) NOT NULL,
  `tipocodbar` char(1) NOT NULL,
  `adicorcobsped` char(1) NOT NULL,
  `codempmensorc` int DEFAULT NULL,
  `codfilialmensorc` smallint DEFAULT NULL,
  `codmensorc` int DEFAULT NULL,
  `custocompra` char(1) NOT NULL,
  `tabtranspcp` char(1) NOT NULL,
  `tabtransporc` char(1) DEFAULT NULL,
  `tabsolcp` char(1) NOT NULL,
  `adicfretebaseicm` char(1) NOT NULL,
  `precocprel` char(1) NOT NULL,
  `descorc` varchar(80) DEFAULT NULL,
  `multicomis` char(1) NOT NULL,
  `usuativcli` char(1) NOT NULL,
  `codemphistrec` int DEFAULT NULL,
  `codfilialhistrec` smallint DEFAULT NULL,
  `codhistrec` int DEFAULT NULL,
  `codemphistpag` int DEFAULT NULL,
  `codfilialhistpag` smallint DEFAULT NULL,
  `codhistpag` int DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtipocli` int DEFAULT NULL,
  `estitrecaltdtvenc` char(1) NOT NULL,
  `lcredglobal` char(1) NOT NULL,
  `vdmanutcomobrig` char(1) NOT NULL,
  `classped` varchar(80) DEFAULT NULL,
  `classped02` varchar(80) DEFAULT NULL,
  `tipoclassped` char(2) NOT NULL,
  `usaibgecli` char(1) NOT NULL,
  `usaibgefor` char(1) NOT NULL,
  `usaibgetransp` char(1) NOT NULL,
  `somavolumes` char(1) NOT NULL,
  `buscacep` char(1) NOT NULL,
  `urlwscep` varchar(150) DEFAULT NULL,
  `classcp` varchar(80) DEFAULT NULL,
  `labelobs01cp` char(40) DEFAULT NULL,
  `labelobs02cp` char(40) DEFAULT NULL,
  `labelobs03cp` char(40) DEFAULT NULL,
  `labelobs04cp` char(40) DEFAULT NULL,
  `consisteiepf` char(1) NOT NULL,
  `credicmssimples` char(1) NOT NULL,
  `codempms` int DEFAULT NULL,
  `codfilialms` smallint DEFAULT NULL,
  `codmensicmssimples` smallint DEFAULT NULL,
  `geracomisvendaorc` char(1) NOT NULL,
  `geracodunif` char(1) NOT NULL,
  `codtipomov9` int DEFAULT NULL,
  `codfilialt9` smallint DEFAULT NULL,
  `codempt9` int DEFAULT NULL,
  `codempjp` int DEFAULT NULL,
  `codfilialjp` smallint DEFAULT NULL,
  `codplanjp` char(13) DEFAULT NULL,
  `codempjr` int DEFAULT NULL,
  `codfilialjr` smallint DEFAULT NULL,
  `codplanjr` char(13) DEFAULT NULL,
  `codempdr` int DEFAULT NULL,
  `codfilialdr` smallint DEFAULT NULL,
  `codplandr` char(13) DEFAULT NULL,
  `codempdc` int DEFAULT NULL,
  `codfilialdc` smallint DEFAULT NULL,
  `codplandc` char(13) DEFAULT NULL,
  `gerapagemis` char(1) NOT NULL,
  `lancafincontr` char(1) NOT NULL,
  `lancarmacontr` char(1) NOT NULL,
  `casasdecpre` smallint DEFAULT NULL,
  `visualizalucr` char(1) NOT NULL,
  `classnfe` varchar(80) DEFAULT NULL,
  `dirnfe` varchar(80) DEFAULT NULL,
  `dirnfelin` varchar(80) DEFAULT NULL,
  `formatodanfe` smallint DEFAULT NULL,
  `ambientenfe` smallint DEFAULT NULL,
  `proceminfe` smallint DEFAULT NULL,
  `verprocnfe` varchar(20) DEFAULT NULL,
  `keylicnfe` varchar(500) DEFAULT NULL,
  `dtvenctonfe` date DEFAULT NULL,
  `infadprodnfe` char(1) DEFAULT NULL,
  `codempnf` int DEFAULT NULL,
  `codfilialnf` smallint DEFAULT NULL,
  `codemailnf` int DEFAULT NULL,
  `exibeparcobsdanfe` char(1) DEFAULT NULL,
  `versaonfe` char(8) DEFAULT NULL,
  `regimetribnfe` char(1) DEFAULT NULL,
  `infcpdevolucao` char(1) NOT NULL,
  `infvdremessa` char(1) NOT NULL,
  `gerarecemis` char(1) NOT NULL,
  `retensaoimp` char(1) NOT NULL,
  `tipocustoluc` char(1) NOT NULL,
  `tabimportcp` char(1) NOT NULL,
  `habvlrtotitorc` char(1) NOT NULL,
  `usabuscagenprodcp` char(1) NOT NULL,
  `adicobsorcped` char(1) NOT NULL,
  `usaprecocot` char(1) DEFAULT NULL,
  `bloqprecoaprov` char(1) DEFAULT NULL,
  `codempft` int DEFAULT NULL,
  `codfilialft` smallint DEFAULT NULL,
  `codtipoforft` int DEFAULT NULL,
  `usaprecocomis` char(1) NOT NULL,
  `especialcomis` char(1) DEFAULT NULL,
  `codfilialts` smallint DEFAULT NULL,
  `codtipomovs` int DEFAULT NULL,
  `codempts` int DEFAULT NULL,
  `codempsv` int DEFAULT NULL,
  `codfilialsv` smallint DEFAULT NULL,
  `codplanopagsv` int DEFAULT NULL,
  `arredpreco` smallint DEFAULT NULL,
  `codemppc` int DEFAULT NULL,
  `codfilialpc` smallint DEFAULT NULL,
  `codplanpc` char(13) DEFAULT NULL,
  `tpnossonumero` char(1) DEFAULT NULL,
  `impdocbol` char(1) NOT NULL,
  `fechacaixa` char(1) DEFAULT NULL,
  `fechacaixaauto` char(1) DEFAULT NULL,
  `numdigidenttit` smallint DEFAULT NULL,
  `keylicefd` varchar(500) DEFAULT NULL,
  `dtvenctoefd` date DEFAULT NULL,
  `revalidarlotecompra` char(1) DEFAULT NULL,
  `encorcprod` char(1) DEFAULT NULL,
  `codempim` int DEFAULT NULL,
  `codfilialim` smallint DEFAULT NULL,
  `codtipomovim` int DEFAULT NULL,
  `comissaodesconto` char(1) DEFAULT NULL,
  `codemphc` int DEFAULT NULL,
  `codfilialhc` smallint DEFAULT NULL,
  `codhistcnab` int DEFAULT NULL,
  `alinhatelalanca` char(1) DEFAULT NULL,
  `vendaconsum` char(1) NOT NULL,
  `cvprod` char(1) DEFAULT NULL,
  `verifprod` char(1) DEFAULT NULL,
  `rmaprod` char(1) NOT NULL,
  `tipoprod` varchar(2) DEFAULT NULL,
  `codempig` int DEFAULT NULL,
  `codfilialig` smallint DEFAULT NULL,
  `codimg` int DEFAULT NULL,
  `obsitvendaped` char(1) NOT NULL,
  `fatorcparc` char(1) NOT NULL,
  `aprovorcfatparc` char(1) NOT NULL,
  `bloqseqicp` char(1) NOT NULL,
  `bloqseqivd` char(1) NOT NULL,
  `utilordcpint` char(1) NOT NULL,
  `keylicepc` varchar(500) DEFAULT NULL,
  `dtvenctoepc` date DEFAULT NULL,
  `implotenfe` char(1) NOT NULL,
  `totcpsfrete` char(1) NOT NULL,
  `identclibco` char(1) NOT NULL,
  `qtddesc` char(1) NOT NULL,
  `localserv` char(1) NOT NULL,
  `vdprodqqclas` char(1) NOT NULL,
  `codempvd` int DEFAULT NULL,
  `codfilialvd` smallint DEFAULT NULL,
  `codvend` int DEFAULT NULL,
  `padraonfe` char(1) NOT NULL,
  `codempme` int DEFAULT NULL,
  `codfilialme` smallint DEFAULT NULL,
  `codmensvenda` int DEFAULT NULL,
  `tipoemissaonfe` char(1) DEFAULT NULL,
  `ccnfecp` char(1) NOT NULL,
  `adicicmstotnota` char(1) NOT NULL,
  `utilizatbcalcca` char(1) NOT NULL,
  `habcompracompl` char(1) NOT NULL,
  `codempic` int DEFAULT NULL,
  `codfilialic` smallint DEFAULT NULL,
  `codtipomovic` int DEFAULT NULL,
  `descnatcompl` varchar(60) DEFAULT NULL,
  `hablogpagar` char(1) NOT NULL,
  `hablogreceber` char(1) NOT NULL,
  `consistendentvd` char(1) NOT NULL,
  `usacliseq` char(1) NOT NULL,
  `bloqdesccomporc` char(1) NOT NULL,
  `bloqprecoorc` char(1) NOT NULL,
  `bloqdesccompvd` char(1) NOT NULL,
  `bloqprecovd` char(1) NOT NULL,
  `desabdescfechavd` char(1) NOT NULL,
  `desabdescfechaorc` char(1) NOT NULL,
  `permitbaixaparcjdm` char(1) NOT NULL,
  `bloqcomissorc` char(1) NOT NULL,
  `bloqcomissvd` char(1) NOT NULL,
  `calcprecog` char(1) NOT NULL,
  `enderecoobrigcli` char(1) NOT NULL,
  `entregaobrigcli` char(1) NOT NULL,
  `periodoconsch` char(1) NOT NULL,
  `bloqpedvd` char(1) NOT NULL,
  `agendafprincipal` char(1) NOT NULL,
  `atualizaagenda` char(1) NOT NULL,
  `tempoatuagenda` int NOT NULL,
  `soldtsaida` char(1) NOT NULL,
  `npermitdtmaior` char(1) NOT NULL,
  `permitimporcantap` char(1) NOT NULL,
  `bloqeditorcaposap` char(1) NOT NULL,
  `bloqvdporatraso` char(1) NOT NULL,
  `numdiasbloqvd` smallint NOT NULL,
  `fatorsegestoq` decimal(9,5) NOT NULL,
  `leitransp` char(1) NOT NULL,
  `tipoimpdanfe` char(1) NOT NULL,
  `replicaorc` char(1) NOT NULL,
  `sqlreplicaorc` longtext,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `classorclaudosus` varchar(80) DEFAULT NULL,
  `classorcctaluguel` varchar(80) DEFAULT NULL,
  `bloqnfevdautoriz` char(1) NOT NULL,
  `obrigtipofisc` char(1) NOT NULL,
  `matricempfn` char(1) NOT NULL,
  `estoqalmox` varchar(10) DEFAULT NULL,
  `maxobscli` varchar(255) DEFAULT NULL,
  `rateioestbuscaorc` varchar(30) DEFAULT NULL,
  `codtipomovrs` int DEFAULT NULL,
  `almoxpdorc` varchar(30) DEFAULT NULL,
  `codemprs` int DEFAULT NULL,
  `codfilialrs` int DEFAULT NULL,
  `valorponto` decimal(15,5) DEFAULT NULL,
  `codbloq` smallint DEFAULT NULL,
  `ordemped` varchar(10) DEFAULT NULL,
  `ipicomis` double DEFAULT NULL,
  `ipiped` double DEFAULT NULL,
  `codbarprod` varchar(15) DEFAULT NULL,
  `endcliped` varchar(100) DEFAULT NULL,
  `servidorsmtp` varchar(100) DEFAULT NULL,
  `portasmtp` varchar(10) DEFAULT NULL,
  `usuariosmtp` varchar(50) DEFAULT NULL,
  `senhasmtp` varchar(10) DEFAULT NULL,
  `autenticasmtp` varchar(3) DEFAULT NULL,
  `sslsmtp` varchar(3) DEFAULT NULL,
  `layoutped` varchar(150) DEFAULT NULL,
  `enviacopia` varchar(3) DEFAULT NULL,
  `codunid` varchar(3) DEFAULT NULL,
  `mostrafatlucr` varchar(3) DEFAULT NULL,
  `codempud` int DEFAULT NULL,
  `codfilialud` int DEFAULT NULL,
  `exibirpainelcomandas` varchar(3) DEFAULT NULL,
  `tpcalclucro` varchar(3) DEFAULT NULL,
  `sef2indicador01` varchar(100) DEFAULT NULL,
  `sef2indicador02` varchar(100) DEFAULT NULL,
  `sef2indicador03` varchar(100) DEFAULT NULL,
  `sef2indicador04` varchar(100) DEFAULT NULL,
  `sef2indicador05` varchar(100) DEFAULT NULL,
  `sef2indicador06` varchar(100) DEFAULT NULL,
  `sef2indicador07` varchar(100) DEFAULT NULL,
  `sef2indicador08` varchar(100) DEFAULT NULL,
  `sef2indicador09` varchar(100) DEFAULT NULL,
  `sef2indicador10` varchar(100) DEFAULT NULL,
  `sef2indicador11` varchar(100) DEFAULT NULL,
  `sef2indicador12` varchar(100) DEFAULT NULL,
  `sef2indicador13` varchar(100) DEFAULT NULL,
  `sef2indicador14` varchar(100) DEFAULT NULL,
  `sef2indicador15` varchar(100) DEFAULT NULL,
  `sef2indicador16` varchar(100) DEFAULT NULL,
  `sef2indicador17` varchar(100) DEFAULT NULL,
  `codempintegra` int DEFAULT NULL,
  `pdv_buscaean` char(1) DEFAULT NULL,
  `codmensnfe` int DEFAULT NULL,
  `somastdupnfe` varchar(1) DEFAULT NULL,
  `cnpjcpf` varchar(15) DEFAULT NULL,
  `pathserver` varchar(20) DEFAULT NULL,
  `recolheicmspf` char(1) DEFAULT NULL,
  `aliqrecolheicmpf` float(24,2) DEFAULT NULL,
  `majaliqrecolheicmpf` float(24,2) DEFAULT NULL,
  `codtipomovproc` int DEFAULT NULL,
  `clfiscalvdespecifica` char(1) DEFAULT NULL,
  `codempcloud` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgprocesso`
--

CREATE TABLE `sgprocesso` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codproc` int NOT NULL,
  `descproc` char(50) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgrastro`
--

CREATE TABLE `sgrastro` (
  `codrastro` int NOT NULL,
  `cadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `usuario` varchar(14) NOT NULL,
  `acao` varchar(50) NOT NULL,
  `data` date NOT NULL,
  `hora` time NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgrecado`
--

CREATE TABLE `sgrecado` (
  `codrecado` int NOT NULL,
  `codemp` int DEFAULT NULL,
  `administrativo` char(1) DEFAULT NULL,
  `assunto` varchar(30) DEFAULT NULL,
  `mensagem` varchar(1000) DEFAULT NULL,
  `link` varchar(1000) DEFAULT NULL,
  `data` date DEFAULT NULL,
  `hora` time DEFAULT NULL,
  `cadastro` datetime DEFAULT NULL,
  `lido` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgregistro`
--

CREATE TABLE `sgregistro` (
  `id_sgregistro` int NOT NULL,
  `datacadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `nomecontato` varchar(100) NOT NULL,
  `emailcontato` varchar(100) NOT NULL,
  `telcontato` varchar(15) NOT NULL,
  `porteempresa` varchar(30) NOT NULL,
  `regimeempresa` varchar(30) NOT NULL,
  `situacao` char(1) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgrevenda`
--

CREATE TABLE `sgrevenda` (
  `codrev` int NOT NULL,
  `razsocial` varchar(50) DEFAULT NULL,
  `nomerev` varchar(50) DEFAULT NULL,
  `cnpjrev` varchar(18) DEFAULT NULL,
  `cpfrev` varchar(14) DEFAULT NULL,
  `inscrev` varchar(20) DEFAULT NULL,
  `endrev` varchar(50) DEFAULT NULL,
  `numrev` int DEFAULT NULL,
  `complrev` varchar(20) DEFAULT NULL,
  `bairrev` varchar(30) DEFAULT NULL,
  `ceprev` varchar(8) DEFAULT NULL,
  `cidrev` varchar(30) DEFAULT NULL,
  `ufrev` varchar(2) DEFAULT NULL,
  `dddrev` varchar(4) DEFAULT NULL,
  `fonerev` varchar(12) DEFAULT NULL,
  `outrofonerev` varchar(14) DEFAULT NULL,
  `emailrev` varchar(50) DEFAULT NULL,
  `wwwrev` varchar(50) DEFAULT NULL,
  `codmunic` varchar(7) DEFAULT NULL,
  `codpais` smallint DEFAULT NULL,
  `logorev` varchar(255) DEFAULT NULL,
  `dtins` date DEFAULT NULL,
  `hins` time DEFAULT NULL,
  `idusuins` varchar(8) DEFAULT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` varchar(8) DEFAULT NULL,
  `ativo` varchar(1) DEFAULT NULL,
  `diabase` varchar(2) DEFAULT NULL,
  `vlrmensal` float(24,2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgsequence_id`
--

CREATE TABLE `sgsequence_id` (
  `table_name` varchar(128) NOT NULL,
  `seq_id` bigint NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgsequencia`
--

CREATE TABLE `sgsequencia` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `sgtab` char(2) NOT NULL,
  `nroseq` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgsistema`
--

CREATE TABLE `sgsistema` (
  `id` int NOT NULL,
  `codsis` int NOT NULL,
  `nomesistema` varchar(10) NOT NULL,
  `descsis` char(50) NOT NULL,
  `comentsis` varchar(10000) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgtabela`
--

CREATE TABLE `sgtabela` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtb` smallint NOT NULL,
  `desctb` char(50) NOT NULL,
  `siglatb` char(10) DEFAULT NULL,
  `dtins` date DEFAULT NULL,
  `idusuins` char(8) DEFAULT NULL,
  `dtalt` date DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `hins` time DEFAULT NULL,
  `halt` time DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgtarefa`
--

CREATE TABLE `sgtarefa` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtarefa` int NOT NULL,
  `desctarefa` char(50) NOT NULL,
  `codempob` int NOT NULL,
  `codobj` int NOT NULL,
  `tipotarefa` char(2) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgtipoagenda`
--

CREATE TABLE `sgtipoagenda` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtipoagd` int NOT NULL,
  `desctipoagd` char(50) DEFAULT NULL,
  `dtini` date DEFAULT NULL,
  `idusuini` char(8) DEFAULT NULL,
  `hini` time DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgtrataret`
--

CREATE TABLE `sgtrataret` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codproc` int NOT NULL,
  `seqitproc` smallint NOT NULL,
  `codtratret` smallint NOT NULL,
  `tipotratret` char(2) NOT NULL,
  `codempgt` int DEFAULT NULL,
  `codfilialgt` smallint DEFAULT NULL,
  `seqitprocgt` smallint DEFAULT NULL,
  `codprocgt` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sguf`
--

CREATE TABLE `sguf` (
  `siglauf` char(2) NOT NULL,
  `codpais` smallint NOT NULL,
  `nomeuf` varchar(80) NOT NULL,
  `nomecurto` varchar(40) NOT NULL,
  `coduf` smallint NOT NULL,
  `regiaouf` char(2) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `indiedest` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgunifcod`
--

CREATE TABLE `sgunifcod` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codunifcod` int NOT NULL,
  `tipounifcod` char(1) NOT NULL,
  `descunifcod` varchar(80) NOT NULL,
  `codtmp` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgusuario`
--

CREATE TABLE `sgusuario` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `idusu` int NOT NULL,
  `nomeusu` char(50) NOT NULL,
  `emailusu` varchar(255) NOT NULL,
  `ativousu` char(1) NOT NULL,
  `codparc` int DEFAULT NULL,
  `visualizalucr` char(1) NOT NULL,
  `cadoutusu` char(1) NOT NULL,
  `dtins` date DEFAULT NULL,
  `hins` time DEFAULT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `senhausu` varchar(128) DEFAULT NULL,
  `nivelusu` int DEFAULT NULL,
  `fotousu` varchar(255) DEFAULT NULL,
  `modusu` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `sgversao`
--

CREATE TABLE `sgversao` (
  `id` int NOT NULL,
  `versao` varchar(8) NOT NULL,
  `datacadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `descritivo` varchar(500) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `spnatoper`
--

CREATE TABLE `spnatoper` (
  `cst` char(2) NOT NULL,
  `codigo` varchar(10) NOT NULL,
  `desc_prod` varchar(500) NOT NULL,
  `dt_ini` date DEFAULT NULL,
  `dt_fim` date DEFAULT NULL,
  `ncm` varchar(1000) DEFAULT NULL,
  `ncm_ex` varchar(1000) DEFAULT NULL,
  `ex_ipi` varchar(1000) DEFAULT NULL,
  `unid` varchar(250) DEFAULT NULL,
  `aliq_pis` decimal(10,2) DEFAULT NULL,
  `aliq_cofin` decimal(10,2) DEFAULT NULL,
  `ex_tab_oper_sem_csl` varchar(1000) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` varchar(128) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `tai_empresas`
--

CREATE TABLE `tai_empresas` (
  `codacesso` char(5) NOT NULL,
  `codemp` varchar(4) NOT NULL,
  `nomeempresa` varchar(50) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `tai_emp_servicos`
--

CREATE TABLE `tai_emp_servicos` (
  `id` int NOT NULL,
  `codacesso` varchar(5) NOT NULL,
  `codemp` varchar(4) NOT NULL,
  `servico` varchar(20) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `tai_it_tickets`
--

CREATE TABLE `tai_it_tickets` (
  `id` int NOT NULL,
  `idticket` int NOT NULL,
  `item` int NOT NULL,
  `atendido` varchar(20) DEFAULT NULL,
  `datacadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `descritivo` varchar(1000) DEFAULT NULL,
  `finalizado` char(1) DEFAULT NULL,
  `inatividade` char(1) DEFAULT NULL,
  `anydesk` char(1) DEFAULT NULL,
  `end_anydesk` varchar(15) DEFAULT NULL,
  `teamviewer` char(1) DEFAULT NULL,
  `end_team` varchar(15) DEFAULT NULL,
  `so` varchar(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `tai_tickets`
--

CREATE TABLE `tai_tickets` (
  `id` int NOT NULL,
  `datacadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `codacesso` varchar(5) NOT NULL,
  `nome` varchar(30) NOT NULL,
  `telefone` varchar(11) DEFAULT NULL,
  `tiposolicita` int NOT NULL,
  `tiposervico` int NOT NULL,
  `status` char(1) NOT NULL,
  `titulo` varchar(30) NOT NULL,
  `descritivo` varchar(1000) NOT NULL,
  `foto` varchar(1000) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `tai_tipos`
--

CREATE TABLE `tai_tipos` (
  `id` int NOT NULL,
  `tipos` varchar(15) NOT NULL,
  `peso` int NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `tai_whats`
--

CREATE TABLE `tai_whats` (
  `id_tai_whats` int NOT NULL,
  `datacadastro` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `ticket` char(12) NOT NULL,
  `nomecliente` varchar(50) NOT NULL,
  `situacao` char(1) NOT NULL,
  `remoto` char(1) NOT NULL,
  `resolvido` char(1) NOT NULL,
  `atendente` varchar(30) NOT NULL,
  `contealgo` varchar(10000) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdauxvenda`
--

CREATE TABLE `vdauxvenda` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `codauxv` smallint NOT NULL,
  `cpfcliauxv` char(11) DEFAULT NULL,
  `nomecliauxv` char(50) DEFAULT NULL,
  `endcliauxv` char(50) DEFAULT NULL,
  `numcliauxv` int DEFAULT NULL,
  `cidcliauxv` char(30) DEFAULT NULL,
  `ufcliauxv` char(2) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdclascli`
--

CREATE TABLE `vdclascli` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codclascli` int NOT NULL,
  `descclascli` char(40) NOT NULL,
  `siglaclascli` char(3) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdclcomis`
--

CREATE TABLE `vdclcomis` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `codclcomis` int NOT NULL,
  `descclcomis` char(50) NOT NULL,
  `percfatclcomis` decimal(9,2) DEFAULT NULL,
  `percpgtoclcomis` decimal(9,2) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdcliente`
--

CREATE TABLE `vdcliente` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codcli` int NOT NULL,
  `razcli` char(60) NOT NULL,
  `nomecli` char(50) NOT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `codclascli` int DEFAULT NULL,
  `codempvd` int DEFAULT NULL,
  `codfilialvd` smallint DEFAULT NULL,
  `codvend` int DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtipocob` int DEFAULT NULL,
  `codemppg` int DEFAULT NULL,
  `codfilialpg` smallint DEFAULT NULL,
  `codplanopag` int DEFAULT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `codempsr` int DEFAULT NULL,
  `codfilialsr` smallint DEFAULT NULL,
  `codsetor` int DEFAULT NULL,
  `codempti` int NOT NULL,
  `codfilialti` smallint NOT NULL,
  `codtipocli` int NOT NULL,
  `codtpcred` int DEFAULT NULL,
  `codfilialtr` int DEFAULT NULL,
  `codemptr` int DEFAULT NULL,
  `codfisccli` int DEFAULT NULL,
  `codempfc` int DEFAULT NULL,
  `codfilialfc` int DEFAULT NULL,
  `codempec` int DEFAULT NULL,
  `codfilialec` smallint DEFAULT NULL,
  `codtbec` smallint DEFAULT NULL,
  `codittbec` int DEFAULT NULL,
  `codemphp` int DEFAULT NULL,
  `codfilialhp` smallint DEFAULT NULL,
  `codhist` int DEFAULT NULL,
  `codempcb` int DEFAULT NULL,
  `codfilialcb` smallint DEFAULT NULL,
  `codcartcob` char(3) DEFAULT NULL,
  `datacli` date NOT NULL,
  `pessoacli` char(1) NOT NULL,
  `ativocli` char(1) NOT NULL,
  `cnpjcli` char(14) DEFAULT NULL,
  `insccli` varchar(20) DEFAULT NULL,
  `cpfcli` char(11) DEFAULT NULL,
  `rgcli` char(13) DEFAULT NULL,
  `sspcli` char(10) DEFAULT NULL,
  `endcli` char(50) DEFAULT NULL,
  `numcli` int DEFAULT NULL,
  `complcli` char(20) DEFAULT NULL,
  `edificiocli` varchar(30) DEFAULT NULL,
  `baircli` char(30) DEFAULT NULL,
  `cidcli` char(30) DEFAULT NULL,
  `ufcli` char(2) DEFAULT NULL,
  `cepcli` char(8) DEFAULT NULL,
  `dddcli` char(4) DEFAULT NULL,
  `fonecli` char(14) DEFAULT NULL,
  `ramalcli` char(6) DEFAULT NULL,
  `dddfaxcli` char(4) DEFAULT NULL,
  `faxcli` varchar(9) DEFAULT NULL,
  `emailcli` char(50) DEFAULT NULL,
  `emailcob` char(50) DEFAULT NULL,
  `emailent` char(50) DEFAULT NULL,
  `emailnfecli` char(50) DEFAULT NULL,
  `contcli` char(40) DEFAULT NULL,
  `endcob` char(50) DEFAULT NULL,
  `numcob` int DEFAULT NULL,
  `complcob` char(20) DEFAULT NULL,
  `baircob` char(30) DEFAULT NULL,
  `cidcob` char(30) DEFAULT NULL,
  `ufcob` char(2) DEFAULT NULL,
  `cepcob` char(8) DEFAULT NULL,
  `dddfonecob` char(4) DEFAULT NULL,
  `fonecob` char(14) DEFAULT NULL,
  `dddfaxcob` char(4) DEFAULT NULL,
  `faxcob` varchar(9) DEFAULT NULL,
  `endent` char(50) DEFAULT NULL,
  `nument` int DEFAULT NULL,
  `complent` char(20) DEFAULT NULL,
  `bairent` char(30) DEFAULT NULL,
  `cident` char(30) DEFAULT NULL,
  `ufent` char(2) DEFAULT NULL,
  `cepent` char(8) DEFAULT NULL,
  `dddfoneent` char(4) DEFAULT NULL,
  `foneent` char(14) DEFAULT NULL,
  `dddfaxent` char(4) DEFAULT NULL,
  `faxent` varchar(9) DEFAULT NULL,
  `dddcelent` char(4) DEFAULT NULL,
  `celent` varchar(9) DEFAULT NULL,
  `obscli` varchar(10000) DEFAULT NULL,
  `agenciacli` char(6) DEFAULT NULL,
  `ncontabcocli` varchar(20) DEFAULT NULL,
  `codemppq` int DEFAULT NULL,
  `codfilialpq` smallint DEFAULT NULL,
  `codpesq` int DEFAULT NULL,
  `incracli` char(15) DEFAULT NULL,
  `dtinitr` date DEFAULT NULL,
  `dtvenctotr` date DEFAULT NULL,
  `nirfcli` char(15) DEFAULT NULL,
  `simplescli` char(1) DEFAULT NULL,
  `dddcelcli` char(4) DEFAULT NULL,
  `celcli` varchar(14) DEFAULT NULL,
  `natcli` char(30) DEFAULT NULL,
  `ufnatcli` char(2) DEFAULT NULL,
  `temporescli` char(20) DEFAULT NULL,
  `apelidocli` char(30) DEFAULT NULL,
  `sitecli` char(50) DEFAULT NULL,
  `codcontdeb` varchar(20) DEFAULT NULL,
  `codcontcred` varchar(20) DEFAULT NULL,
  `codclicontab` varchar(20) DEFAULT NULL,
  `codmunic` char(7) DEFAULT NULL,
  `siglauf` char(2) DEFAULT NULL,
  `codpais` smallint DEFAULT NULL,
  `codmunicent` char(7) DEFAULT NULL,
  `siglaufent` char(2) DEFAULT NULL,
  `codpaisent` smallint DEFAULT NULL,
  `codmuniccob` char(7) DEFAULT NULL,
  `siglaufcob` char(2) DEFAULT NULL,
  `codpaiscob` smallint DEFAULT NULL,
  `codempuc` int DEFAULT NULL,
  `codfilialuc` smallint DEFAULT NULL,
  `codunifcod` int DEFAULT NULL,
  `suframacli` varchar(9) DEFAULT NULL,
  `prodruralcli` char(1) NOT NULL,
  `ctocli` char(1) NOT NULL,
  `codcnae` varchar(15) DEFAULT NULL,
  `inscmuncli` char(20) DEFAULT NULL,
  `percdesccli` decimal(3,2) DEFAULT NULL,
  `contclicob` char(40) DEFAULT NULL,
  `contclient` char(40) DEFAULT NULL,
  `descipi` char(1) DEFAULT NULL,
  `identclibco` char(1) NOT NULL,
  `dtnasccli` date DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `consumidorcli` char(1) NOT NULL,
  `sitrevcli` char(1) NOT NULL,
  `idusurevcli` varchar(128) DEFAULT NULL,
  `dtrevcli` date DEFAULT NULL,
  `hrevcli` time DEFAULT NULL,
  `celentoperadora` varchar(10) DEFAULT NULL,
  `celentwhatsapp` varchar(1) DEFAULT NULL,
  `celclioperadora` varchar(10) DEFAULT NULL,
  `celcliwhatsapp` varchar(1) DEFAULT NULL,
  `qtdpontos` int DEFAULT NULL,
  `saldocredito` float(24,2) DEFAULT NULL,
  `estcivil` varchar(20) DEFAULT NULL,
  `codatend` int DEFAULT NULL,
  `dtsync` date DEFAULT NULL,
  `sync` char(1) DEFAULT NULL,
  `cartaorfdi` int DEFAULT NULL,
  `diavencto` int DEFAULT NULL,
  `inscprodrural` int DEFAULT NULL,
  `cartaorfid` int DEFAULT NULL,
  `meiruralcli` char(1) DEFAULT NULL,
  `arrendatario` char(1) DEFAULT NULL,
  `dddcelcli2` char(4) DEFAULT NULL,
  `celcli2` varchar(9) DEFAULT NULL,
  `celclioperadora2` varchar(10) DEFAULT NULL,
  `celcliwhatsapp2` varchar(1) DEFAULT NULL,
  `aluno` char(1) DEFAULT NULL,
  `respaluno` char(1) DEFAULT NULL,
  `sldprod` decimal(15,5) DEFAULT NULL,
  `nomerespcli` varchar(50) DEFAULT NULL,
  `ibgecli` int DEFAULT NULL,
  `dataabecli` date DEFAULT NULL,
  `capitalcli` double DEFAULT NULL,
  `naturezacli` varchar(100) DEFAULT NULL,
  `situacaocli` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vddepvenda`
--

CREATE TABLE `vddepvenda` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `codvenda` int NOT NULL,
  `item` int NOT NULL,
  `coddependente` char(11) NOT NULL,
  `tipo` varchar(10) NOT NULL,
  `nome` varchar(50) NOT NULL,
  `grau` varchar(10) NOT NULL,
  `cpf` varchar(14) DEFAULT NULL,
  `datanasc` date DEFAULT NULL,
  `bloqueado` char(1) DEFAULT NULL,
  `databloqueio` date DEFAULT NULL,
  `telefone` varchar(14) DEFAULT NULL,
  `idusuins` varchar(30) NOT NULL,
  `dtins` date NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdfretevd`
--

CREATE TABLE `vdfretevd` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `tipofretevd` char(1) NOT NULL,
  `placafretevd` char(10) NOT NULL,
  `uffretevd` char(2) NOT NULL,
  `vlrfretevd` decimal(15,5) NOT NULL,
  `qtdfretevd` decimal(15,5) NOT NULL,
  `pesobrutvd` decimal(15,5) NOT NULL,
  `pesoliqvd` decimal(15,5) NOT NULL,
  `espfretevd` char(10) NOT NULL,
  `marcafretevd` char(10) NOT NULL,
  `conhecfretevd` char(13) DEFAULT NULL,
  `percvendafretevd` decimal(9,2) DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `adicfretevd` char(1) NOT NULL,
  `adicfretebaseicm` char(1) NOT NULL,
  `vlrbaseicmsfretevd` decimal(15,5) DEFAULT NULL,
  `aliqicmsfretevd` decimal(15,5) DEFAULT NULL,
  `vlricmsfretevd` decimal(15,5) DEFAULT NULL,
  `vlrsegfretevd` decimal(15,5) DEFAULT NULL,
  `rntcvd` varchar(20) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vditorcamento`
--

CREATE TABLE `vditorcamento` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipoorc` char(1) NOT NULL,
  `codorc` int NOT NULL,
  `coditorc` int NOT NULL,
  `codemppd` int NOT NULL,
  `codfilialpd` smallint NOT NULL,
  `codprod` int NOT NULL,
  `codempax` int NOT NULL,
  `codfilialax` smallint NOT NULL,
  `codalmox` int NOT NULL,
  `qtditorc` decimal(15,5) NOT NULL,
  `qtdaprovitorc` decimal(15,5) DEFAULT NULL,
  `qtdafatitorc` decimal(15,5) NOT NULL,
  `qtdfatitorc` decimal(15,5) NOT NULL,
  `precoitorc` decimal(15,5) NOT NULL,
  `percdescitorc` decimal(15,5) DEFAULT NULL,
  `vlrdescitorc` decimal(15,5) DEFAULT NULL,
  `vlrliqitorc` decimal(15,5) DEFAULT NULL,
  `vlrproditorc` decimal(15,5) DEFAULT NULL,
  `refprod` varchar(20) DEFAULT NULL,
  `numautorizorc` char(15) DEFAULT NULL,
  `aceiteitorc` char(1) NOT NULL,
  `aprovitorc` char(1) NOT NULL,
  `emititorc` char(1) NOT NULL,
  `vencautorizorc` date DEFAULT NULL,
  `strdescitorc` char(50) DEFAULT NULL,
  `obsitorc` varchar(10000) DEFAULT NULL,
  `statusitorc` char(2) DEFAULT NULL,
  `codemppe` int DEFAULT NULL,
  `codfilialpe` smallint DEFAULT NULL,
  `codpe` int DEFAULT NULL,
  `diaspe` smallint DEFAULT NULL,
  `emmanut` char(1) DEFAULT NULL,
  `codemplg` int DEFAULT NULL,
  `codfiliallg` int DEFAULT NULL,
  `codlog` int DEFAULT NULL,
  `codemple` int DEFAULT NULL,
  `codfilialle` smallint DEFAULT NULL,
  `codlote` varchar(20) DEFAULT NULL,
  `sitentitorc` char(1) NOT NULL,
  `sittermritorc` char(1) NOT NULL,
  `cancitorc` char(1) NOT NULL,
  `fatitorc` char(1) NOT NULL,
  `vlrcomisitorc` decimal(15,5) DEFAULT NULL,
  `perccomisitorc` decimal(9,2) DEFAULT NULL,
  `vlrfreteitorc` decimal(15,5) DEFAULT NULL,
  `dtaprovitorc` date DEFAULT NULL,
  `sitproditorc` char(2) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `descritivoitem` varchar(255) DEFAULT NULL,
  `obsitem` varchar(500) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vditregracomis`
--

CREATE TABLE `vditregracomis` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codregrcomis` int NOT NULL,
  `seqitrc` smallint NOT NULL,
  `codemptv` int NOT NULL,
  `codfilialtv` smallint NOT NULL,
  `codtipovend` int NOT NULL,
  `obrigitrc` char(1) NOT NULL,
  `perccomisitrc` decimal(7,3) NOT NULL,
  `idusualt` char(8) NOT NULL,
  `codempvd` int DEFAULT NULL,
  `codfilialvd` smallint DEFAULT NULL,
  `codvend` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vditromaneio`
--

CREATE TABLE `vditromaneio` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codroma` int NOT NULL,
  `coditroma` int NOT NULL,
  `codempva` int NOT NULL,
  `codfilialva` smallint NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `dtprevitroma` date NOT NULL,
  `flag` char(1) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vditvenda`
--

CREATE TABLE `vditvenda` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `coditvenda` int NOT NULL,
  `codempnt` int DEFAULT NULL,
  `codfilialnt` smallint DEFAULT NULL,
  `codnat` char(4) NOT NULL,
  `codemppd` int DEFAULT NULL,
  `codfilialpd` smallint DEFAULT NULL,
  `codprod` int NOT NULL,
  `codemple` int DEFAULT NULL,
  `codfilialle` smallint DEFAULT NULL,
  `codlote` varchar(20) DEFAULT NULL,
  `codempax` int DEFAULT NULL,
  `codfilialax` smallint DEFAULT NULL,
  `codalmox` int NOT NULL,
  `qtditvenda` decimal(15,5) NOT NULL,
  `qtditvendacanc` decimal(15,5) DEFAULT NULL,
  `precoitvenda` decimal(15,5) NOT NULL,
  `percdescitvenda` decimal(15,5) DEFAULT NULL,
  `vlrdescitvenda` decimal(15,5) DEFAULT NULL,
  `percicmsitvenda` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmsitvenda` decimal(15,5) DEFAULT NULL,
  `vlricmsitvenda` decimal(15,5) DEFAULT NULL,
  `percipiitvenda` decimal(15,5) DEFAULT NULL,
  `vlrbaseipiitvenda` decimal(15,5) DEFAULT NULL,
  `vlripiitvenda` decimal(15,5) DEFAULT NULL,
  `vlrliqitvenda` decimal(15,5) DEFAULT NULL,
  `perccomisitvenda` decimal(15,5) DEFAULT NULL,
  `vlrcomisitvenda` decimal(15,5) DEFAULT NULL,
  `vlradicitvenda` decimal(15,5) DEFAULT NULL,
  `percissitvenda` decimal(15,5) DEFAULT NULL,
  `vlrissitvenda` decimal(15,5) DEFAULT NULL,
  `vlrfreteitvenda` decimal(15,5) DEFAULT NULL,
  `vlrproditvenda` decimal(15,5) DEFAULT NULL,
  `vlrisentasitvenda` decimal(15,5) DEFAULT NULL,
  `vlroutrasitvenda` decimal(15,5) DEFAULT NULL,
  `refprod` varchar(20) DEFAULT NULL,
  `vlrbaseissitvenda` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmsbrutitvenda` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmsstitvenda` decimal(15,5) DEFAULT NULL,
  `vlricmsstitvenda` decimal(15,5) DEFAULT NULL,
  `vlrbasecomisitvenda` decimal(15,5) DEFAULT NULL,
  `margemvlagritvenda` decimal(15,5) DEFAULT NULL,
  `obsitvenda` varchar(10000) DEFAULT NULL,
  `origfisc` char(1) DEFAULT NULL,
  `codemptt` int DEFAULT NULL,
  `codfilialtt` int DEFAULT NULL,
  `codtrattrib` char(2) DEFAULT NULL,
  `tipofisc` char(2) DEFAULT NULL,
  `tipost` char(2) DEFAULT NULL,
  `codempme` int DEFAULT NULL,
  `codfilialme` smallint DEFAULT NULL,
  `codmens` int DEFAULT NULL,
  `strdescitvenda` char(50) DEFAULT NULL,
  `qtddevitvenda` decimal(15,5) DEFAULT NULL,
  `codemplg` int DEFAULT NULL,
  `codfiliallg` smallint DEFAULT NULL,
  `codlog` int DEFAULT NULL,
  `cancitvenda` char(1) DEFAULT NULL,
  `codemppe` int DEFAULT NULL,
  `codfilialpe` smallint DEFAULT NULL,
  `codpe` int DEFAULT NULL,
  `diaspe` smallint DEFAULT NULL,
  `codempcv` int DEFAULT NULL,
  `codfilialcv` smallint DEFAULT NULL,
  `codconv` int DEFAULT NULL,
  `codempif` int DEFAULT NULL,
  `codfilialif` int DEFAULT NULL,
  `codfisc` char(13) DEFAULT NULL,
  `coditfisc` int DEFAULT NULL,
  `codempcp` int DEFAULT NULL,
  `codfilialcp` smallint DEFAULT NULL,
  `codcompra` int DEFAULT NULL,
  `coditcompra` int DEFAULT NULL,
  `codempvr` int DEFAULT NULL,
  `codfilialvr` smallint DEFAULT NULL,
  `tipovendavr` char(1) DEFAULT NULL,
  `codvendavr` int DEFAULT NULL,
  `coditvendavr` int DEFAULT NULL,
  `codempns` int DEFAULT NULL,
  `codfilialns` smallint DEFAULT NULL,
  `numserietmp` varchar(30) DEFAULT NULL,
  `vlrbaseicmsstretitvenda` decimal(15,5) DEFAULT NULL,
  `vlricmsstretitvenda` decimal(15,5) DEFAULT NULL,
  `calcstcm` char(1) DEFAULT NULL,
  `emmanut` char(1) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `txtdescitem` varchar(100) DEFAULT NULL,
  `descitem` varchar(100) DEFAULT NULL,
  `solicitante` varchar(100) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vditvendavditcontr`
--

CREATE TABLE `vditvendavditcontr` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `coditvenda` int NOT NULL,
  `codempct` int NOT NULL,
  `codfilialct` smallint NOT NULL,
  `codcontr` int NOT NULL,
  `coditcontr` smallint NOT NULL,
  `dtiniapura` date NOT NULL,
  `dtfinapura` date NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` varchar(128) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdkit`
--

CREATE TABLE `vdkit` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codkit` int NOT NULL,
  `codemppd` int NOT NULL,
  `codfilialpd` smallint NOT NULL,
  `codprod` int NOT NULL,
  `refprod` varchar(20) NOT NULL,
  `qtdkit` decimal(15,5) NOT NULL,
  `precokit` decimal(15,5) NOT NULL,
  `vlrtotkit` decimal(15,5) NOT NULL,
  `emmanut` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdlogsitcontr`
--

CREATE TABLE `vdlogsitcontr` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcontr` int NOT NULL,
  `seqlog` int NOT NULL,
  `sitcontr` char(2) NOT NULL,
  `descsitcontr` varchar(2000) DEFAULT NULL,
  `dtprevfin` date DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdmodcontr`
--

CREATE TABLE `vdmodcontr` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codmodcontr` int NOT NULL,
  `descmodcontr` char(80) NOT NULL,
  `layoutmodcontr` varchar(100) NOT NULL,
  `tpmodcontr` char(1) NOT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `codempcb` int DEFAULT NULL,
  `codfilialcb` smallint DEFAULT NULL,
  `codcartcob` char(3) DEFAULT NULL,
  `texto1` varchar(10000) DEFAULT NULL,
  `texto2` varchar(10000) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdmotorista`
--

CREATE TABLE `vdmotorista` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codmot` int NOT NULL,
  `cnh` char(11) NOT NULL,
  `codpais` smallint DEFAULT NULL,
  `codmunic` char(7) DEFAULT NULL,
  `siglauf` char(2) DEFAULT NULL,
  `nomemot` varchar(100) NOT NULL,
  `cpfmot` char(11) DEFAULT NULL,
  `endmot` char(50) DEFAULT NULL,
  `nummot` int DEFAULT NULL,
  `complmot` char(20) DEFAULT NULL,
  `bairmot` char(30) DEFAULT NULL,
  `cepmot` char(8) DEFAULT NULL,
  `fonemot` char(12) DEFAULT NULL,
  `celmot` varchar(9) DEFAULT NULL,
  `dddmot` char(4) DEFAULT NULL,
  `conjugemot` varchar(100) DEFAULT NULL,
  `nrodependmot` smallint DEFAULT NULL,
  `rgmot` char(13) DEFAULT NULL,
  `sspmot` char(10) DEFAULT NULL,
  `nropismot` varchar(20) DEFAULT NULL,
  `obsmot` varchar(1000) DEFAULT NULL,
  `emailmot` varchar(60) DEFAULT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdobscli`
--

CREATE TABLE `vdobscli` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codcli` int NOT NULL,
  `seqobscli` int NOT NULL,
  `dtobscli` date NOT NULL,
  `hobscli` time NOT NULL,
  `txtobscli` varchar(10000) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdoportunidade`
--

CREATE TABLE `vdoportunidade` (
  `id_vdoportunidade` int NOT NULL,
  `codemp` int NOT NULL,
  `nome` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `sobrenome` varchar(50) NOT NULL,
  `nomecompleto` varchar(80) NOT NULL,
  `fone` varchar(15) NOT NULL,
  `chamou` char(1) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `sms` char(1) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `whatsapp` char(1) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `log_whatsapp` varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `torpedo` char(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdorcamento`
--

CREATE TABLE `vdorcamento` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipoorc` char(1) NOT NULL,
  `codorc` int NOT NULL,
  `codempae` int DEFAULT NULL,
  `codfilialae` smallint DEFAULT NULL,
  `codatend` int DEFAULT NULL,
  `codempcv` int DEFAULT NULL,
  `codfilialcv` smallint DEFAULT NULL,
  `codconv` int DEFAULT NULL,
  `dtorc` date NOT NULL,
  `dtvencorc` date NOT NULL,
  `vlrprodorc` decimal(15,5) DEFAULT NULL,
  `percdescorc` decimal(15,5) DEFAULT NULL,
  `vlrdescorc` decimal(15,5) DEFAULT NULL,
  `percadicorc` decimal(15,5) DEFAULT NULL,
  `vlradicorc` decimal(15,5) DEFAULT NULL,
  `vlrdescitorc` decimal(15,5) DEFAULT NULL,
  `vlrliqorc` decimal(15,5) DEFAULT NULL,
  `statusorc` char(2) NOT NULL,
  `obsorc` varchar(10000) DEFAULT NULL,
  `codplanopag` int DEFAULT NULL,
  `codfilialpg` int DEFAULT NULL,
  `codemppg` int DEFAULT NULL,
  `txt01` char(20) DEFAULT NULL,
  `codempvd` int NOT NULL,
  `codfilialvd` smallint NOT NULL,
  `codvend` int NOT NULL,
  `codempcl` int NOT NULL,
  `codfilialcl` smallint NOT NULL,
  `codcli` int NOT NULL,
  `codtpconv` int DEFAULT NULL,
  `codfilialtc` int DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `prazoentorc` smallint DEFAULT NULL,
  `emmanut` char(1) DEFAULT NULL,
  `codclcomis` int DEFAULT NULL,
  `codempcm` smallint DEFAULT NULL,
  `codfilialcm` int DEFAULT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `tipofrete` char(1) DEFAULT NULL,
  `adicfrete` char(1) DEFAULT NULL,
  `vlrfreteorc` decimal(15,5) DEFAULT NULL,
  `vlrcomisorc` decimal(15,5) DEFAULT NULL,
  `codemptm` int DEFAULT NULL,
  `codfilialtm` smallint DEFAULT NULL,
  `codtipomov` int DEFAULT NULL,
  `dtaprovorc` date DEFAULT NULL,
  `dtpreventorc` date DEFAULT NULL,
  `hpreventorc` time DEFAULT NULL,
  `justificcancorc` varchar(500) DEFAULT NULL,
  `acorc` varchar(80) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdprazoent`
--

CREATE TABLE `vdprazoent` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codpe` int NOT NULL,
  `descpe` char(50) NOT NULL,
  `diaspe` smallint NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time NOT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdprecoprod`
--

CREATE TABLE `vdprecoprod` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codprod` int NOT NULL,
  `codprecoprod` int NOT NULL,
  `codemptb` int NOT NULL,
  `codfilialtb` smallint NOT NULL,
  `codtab` int NOT NULL,
  `codempcc` int DEFAULT NULL,
  `codfilialcc` smallint DEFAULT NULL,
  `codclascli` int DEFAULT NULL,
  `codemppg` int DEFAULT NULL,
  `codfilialpg` smallint DEFAULT NULL,
  `codplanopag` int DEFAULT NULL,
  `precoprod` decimal(15,5) NOT NULL,
  `tipoprecoprod` char(1) DEFAULT NULL,
  `dtaltpreco` date DEFAULT NULL,
  `haltpreco` time DEFAULT NULL,
  `precoant` decimal(15,5) DEFAULT NULL,
  `idusualtpreco` char(8) DEFAULT NULL,
  `ativoprecoprod` char(1) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdprevtribitorc`
--

CREATE TABLE `vdprevtribitorc` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipoorc` char(1) NOT NULL,
  `codorc` int NOT NULL,
  `coditorc` int NOT NULL,
  `vlricmsitorc` decimal(15,5) DEFAULT NULL,
  `vlripiitorc` decimal(15,5) DEFAULT NULL,
  `vlrpisitorc` decimal(15,5) DEFAULT NULL,
  `vlrcofinsitorc` decimal(15,5) DEFAULT NULL,
  `vlriritorc` decimal(15,5) DEFAULT NULL,
  `vlrcsocialitorc` decimal(15,5) DEFAULT NULL,
  `vlrissitorc` decimal(15,5) DEFAULT NULL,
  `vlrsimplesitorc` decimal(15,5) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdreceita`
--

CREATE TABLE `vdreceita` (
  `id` int NOT NULL,
  `codreceita` int NOT NULL,
  `codart` int DEFAULT NULL,
  `dataemissao` date DEFAULT NULL,
  `propriedade` varchar(50) DEFAULT NULL,
  `codcliente` int DEFAULT NULL,
  `codproduto` int DEFAULT NULL,
  `codcultura` int DEFAULT NULL,
  `coddiagnostico` int DEFAULT NULL,
  `docvenda` int DEFAULT NULL,
  `areatratada` float(24,2) DEFAULT NULL,
  `dosagem` float(24,2) DEFAULT NULL,
  `qtd` float(24,2) DEFAULT NULL,
  `unidade` float(24,2) DEFAULT NULL,
  `complemento` varchar(10000) DEFAULT NULL,
  `aplicacoes` int DEFAULT NULL,
  `diasintervalo` int DEFAULT NULL,
  `carencia` int DEFAULT NULL,
  `modalidade` varchar(10000) DEFAULT NULL,
  `manejointegrado` varchar(10000) DEFAULT NULL,
  `epoca` varchar(10000) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdregcomisdesc`
--

CREATE TABLE `vdregcomisdesc` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `codregcomisdesc` smallint NOT NULL,
  `descregcomisdesc` varchar(100) DEFAULT NULL,
  `desconto` decimal(15,2) DEFAULT NULL,
  `comissao` decimal(15,2) DEFAULT NULL,
  `dtins` date DEFAULT NULL,
  `hins` time DEFAULT NULL,
  `idusuins` char(8) DEFAULT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdregracomis`
--

CREATE TABLE `vdregracomis` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codregrcomis` int NOT NULL,
  `descregrcomis` char(50) NOT NULL,
  `idusualt` char(8) NOT NULL,
  `codempsc` int DEFAULT NULL,
  `codfilialsc` smallint DEFAULT NULL,
  `codsecao` varchar(13) DEFAULT NULL,
  `perccomisgeral` decimal(15,5) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdremconsig`
--

CREATE TABLE `vdremconsig` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codconsig` int NOT NULL,
  `codremco` smallint NOT NULL,
  `codemppd` int NOT NULL,
  `codfilialpd` smallint NOT NULL,
  `codprod` int NOT NULL,
  `qtdsaida` decimal(15,5) NOT NULL,
  `qtddevol` decimal(15,5) DEFAULT NULL,
  `qtdtroca` decimal(15,5) DEFAULT NULL,
  `qtdbonif` decimal(15,5) DEFAULT NULL,
  `preco` decimal(15,5) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdromaneio`
--

CREATE TABLE `vdromaneio` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codroma` int NOT NULL,
  `dataroma` date NOT NULL,
  `dtsaidaroma` date NOT NULL,
  `dtprevroma` date NOT NULL,
  `dtentregaroma` date DEFAULT NULL,
  `statusroma` char(2) NOT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `codempex` int DEFAULT NULL,
  `codfilialex` smallint DEFAULT NULL,
  `ticket` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdsetor`
--

CREATE TABLE `vdsetor` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codsetor` int NOT NULL,
  `descsetor` char(40) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdsetorrota`
--

CREATE TABLE `vdsetorrota` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codsetor` int NOT NULL,
  `sequencia` int NOT NULL,
  `codempcl` int NOT NULL,
  `codfilialcl` smallint NOT NULL,
  `codcli` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdstatusorc`
--

CREATE TABLE `vdstatusorc` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipoorc` char(1) NOT NULL,
  `codorc` int NOT NULL,
  `codemptb` int NOT NULL,
  `codfilialtb` smallint NOT NULL,
  `codtb` smallint NOT NULL,
  `codittb` smallint NOT NULL,
  `dtastorc` date NOT NULL,
  `horastorc` time NOT NULL,
  `motivostorc` varchar(10000) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdtabpreco`
--

CREATE TABLE `vdtabpreco` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtab` int NOT NULL,
  `desctab` char(40) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdtef`
--

CREATE TABLE `vdtef` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `nsutef` char(20) NOT NULL,
  `redetef` char(30) DEFAULT NULL,
  `dttranstef` date DEFAULT NULL,
  `vlrtef` decimal(15,3) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdtipocli`
--

CREATE TABLE `vdtipocli` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codtipocli` int NOT NULL,
  `desctipocli` char(40) NOT NULL,
  `cheqtipocli` char(1) NOT NULL,
  `fistipocli` char(1) NOT NULL,
  `jurtipocli` char(1) NOT NULL,
  `filtipocli` char(1) NOT NULL,
  `loctrabtipocli` char(1) NOT NULL,
  `refcomltipocli` char(1) NOT NULL,
  `banctipocli` char(1) NOT NULL,
  `refpestipocli` char(1) NOT NULL,
  `conjtipocli` char(1) NOT NULL,
  `veictipocli` char(1) NOT NULL,
  `imovtipocli` char(1) NOT NULL,
  `terratipocli` char(1) NOT NULL,
  `pesautcptipocli` char(1) NOT NULL,
  `avaltipocli` char(1) NOT NULL,
  `sociotipocli` char(1) NOT NULL,
  `prodruraltipocli` char(1) NOT NULL,
  `web` char(1) NOT NULL,
  `siglatipocli` char(3) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdtipovend`
--

CREATE TABLE `vdtipovend` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `id` int NOT NULL,
  `codtipovend` int NOT NULL,
  `desctipovend` char(50) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` varchar(128) NOT NULL,
  `dtalt` date NOT NULL,
  `halt` time NOT NULL,
  `idusualt` varchar(128) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdtransp`
--

CREATE TABLE `vdtransp` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtran` int NOT NULL,
  `raztran` char(50) NOT NULL,
  `nometran` char(40) NOT NULL,
  `cnpjtran` char(14) DEFAULT NULL,
  `cpftran` char(11) DEFAULT NULL,
  `insctran` varchar(20) DEFAULT NULL,
  `endtran` char(50) DEFAULT NULL,
  `numtran` int DEFAULT NULL,
  `compltran` char(20) DEFAULT NULL,
  `bairtran` char(30) DEFAULT NULL,
  `cidtran` char(30) DEFAULT NULL,
  `ceptran` char(8) DEFAULT NULL,
  `fonetran` char(12) DEFAULT NULL,
  `faxtran` varchar(9) DEFAULT NULL,
  `uftran` char(2) DEFAULT NULL,
  `tipotran` char(1) DEFAULT NULL,
  `celtran` varchar(9) DEFAULT NULL,
  `conttran` char(40) DEFAULT NULL,
  `dddfonetran` char(4) DEFAULT NULL,
  `dddfaxtran` char(4) DEFAULT NULL,
  `dddceltran` char(4) DEFAULT NULL,
  `codmunic` char(7) DEFAULT NULL,
  `siglauf` char(2) DEFAULT NULL,
  `codpais` smallint DEFAULT NULL,
  `codempuc` int DEFAULT NULL,
  `codfilialuc` smallint DEFAULT NULL,
  `codunifcod` int DEFAULT NULL,
  `codempfr` int DEFAULT NULL,
  `codfilialfr` smallint DEFAULT NULL,
  `codfor` int DEFAULT NULL,
  `conjugetran` char(50) DEFAULT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `agenciatran` char(10) DEFAULT NULL,
  `numcontatran` char(10) DEFAULT NULL,
  `placatran` char(7) DEFAULT NULL,
  `nrodependtran` smallint DEFAULT NULL,
  `rgtran` char(13) DEFAULT NULL,
  `ssptran` char(10) DEFAULT NULL,
  `codgps` char(4) DEFAULT NULL,
  `nropistran` varchar(20) DEFAULT NULL,
  `obstran` varchar(10000) DEFAULT NULL,
  `emailtran` varchar(60) DEFAULT NULL,
  `emailnfetran` varchar(60) DEFAULT NULL,
  `rntctran` varchar(20) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdtranspmot`
--

CREATE TABLE `vdtranspmot` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtran` int NOT NULL,
  `codempmt` int NOT NULL,
  `codfilialmt` smallint NOT NULL,
  `codmot` int NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdtranspveic`
--

CREATE TABLE `vdtranspveic` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codtran` int NOT NULL,
  `codempve` int NOT NULL,
  `codfilialve` smallint NOT NULL,
  `codveic` int NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdveiculo`
--

CREATE TABLE `vdveiculo` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codveic` int NOT NULL,
  `placa` char(7) NOT NULL,
  `renavam` char(12) DEFAULT NULL,
  `codpais` smallint DEFAULT NULL,
  `codmunic` char(7) DEFAULT NULL,
  `siglauf` char(2) DEFAULT NULL,
  `fabricante` varchar(100) DEFAULT NULL,
  `modelo` varchar(250) DEFAULT NULL,
  `desccor` char(60) DEFAULT NULL,
  `codcor` int DEFAULT NULL,
  `obs` varchar(1000) DEFAULT NULL,
  `anofabric` int DEFAULT NULL,
  `anomodelo` int DEFAULT NULL,
  `codemptn` int DEFAULT NULL,
  `codfilialtn` smallint DEFAULT NULL,
  `codtran` int DEFAULT NULL,
  `rntc` varchar(20) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `codgrupoveic` int DEFAULT NULL,
  `codfabricante` int DEFAULT NULL,
  `matempr` int DEFAULT NULL,
  `codcc` varchar(10) DEFAULT NULL,
  `ativo` varchar(1) DEFAULT NULL,
  `motorizado` varchar(1) DEFAULT NULL,
  `dtiniciocontrole` date DEFAULT NULL,
  `hodometroinicial` float(24,2) DEFAULT NULL,
  `horimetroinicial` float(24,2) DEFAULT NULL,
  `codtipocomb` varchar(5) DEFAULT NULL,
  `codtipocarroc` varchar(5) DEFAULT NULL,
  `capacidade` float(24,2) DEFAULT NULL,
  `tipoconsumo` varchar(10) DEFAULT NULL,
  `consumopadrao` float(24,2) DEFAULT NULL,
  `tara` float(24,2) DEFAULT NULL,
  `dtcompra` date DEFAULT NULL,
  `hodometrovcto` float(24,2) DEFAULT NULL,
  `dtvctogarantia` date DEFAULT NULL,
  `dtvenda` date DEFAULT NULL,
  `dtvcgarantia` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdvenda`
--

CREATE TABLE `vdvenda` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `subtipovenda` char(2) NOT NULL,
  `codempvd` int DEFAULT NULL,
  `codfilialvd` smallint DEFAULT NULL,
  `codvend` int DEFAULT NULL,
  `codempcl` int NOT NULL,
  `codfilialcl` smallint NOT NULL,
  `codcli` int NOT NULL,
  `codemppg` int NOT NULL,
  `codfilialpg` smallint NOT NULL,
  `codplanopag` int NOT NULL,
  `codempse` int NOT NULL,
  `codfilialse` smallint NOT NULL,
  `serie` char(4) NOT NULL,
  `codemptm` int NOT NULL,
  `codfilialtm` smallint NOT NULL,
  `codtipomov` int NOT NULL,
  `codempcx` int DEFAULT NULL,
  `codfilialcx` smallint DEFAULT NULL,
  `codcaixa` int DEFAULT NULL,
  `docvenda` int NOT NULL,
  `dtsaidavenda` date NOT NULL,
  `dtemitvenda` date NOT NULL,
  `datavenda` date DEFAULT NULL,
  `diavence` int DEFAULT NULL,
  `dtcompvenda` date NOT NULL,
  `codemprm` int DEFAULT NULL,
  `codfilialrm` smallint DEFAULT NULL,
  `ticket` int DEFAULT NULL,
  `vlrprodvenda` decimal(15,5) DEFAULT NULL,
  `percdescvenda` decimal(15,5) DEFAULT NULL,
  `vlrdescvenda` decimal(15,5) DEFAULT NULL,
  `vlrdescitvenda` decimal(15,5) DEFAULT NULL,
  `vlrvenda` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmsvenda` decimal(15,5) DEFAULT NULL,
  `vlricmsvenda` decimal(15,5) DEFAULT NULL,
  `calcicmsvenda` char(1) DEFAULT NULL,
  `impicmsvenda` char(1) DEFAULT NULL,
  `vlrisentasvenda` decimal(15,5) DEFAULT NULL,
  `vlroutrasvenda` decimal(15,5) DEFAULT NULL,
  `vlrbaseipivenda` decimal(15,5) DEFAULT NULL,
  `vlrliqvenda` decimal(15,5) DEFAULT NULL,
  `perccomisvenda` decimal(9,2) DEFAULT NULL,
  `vlrcomisvenda` decimal(15,5) DEFAULT NULL,
  `statusvenda` char(2) NOT NULL,
  `vlrfretevenda` decimal(15,5) DEFAULT NULL,
  `vlradicvenda` decimal(15,5) DEFAULT NULL,
  `vlripivenda` decimal(15,5) DEFAULT NULL,
  `calcipivenda` char(1) DEFAULT NULL,
  `impipivenda` char(1) DEFAULT NULL,
  `obsvenda` varchar(10000) DEFAULT NULL,
  `codempbo` int DEFAULT NULL,
  `codfilialbo` smallint DEFAULT NULL,
  `codbanco` char(3) DEFAULT NULL,
  `codemptc` int DEFAULT NULL,
  `codfilialtc` smallint DEFAULT NULL,
  `codtipocob` int DEFAULT NULL,
  `vlrbaseissvenda` decimal(15,5) DEFAULT NULL,
  `vlrissvenda` decimal(15,5) DEFAULT NULL,
  `calcissvenda` char(1) DEFAULT NULL,
  `impiissvenda` char(1) DEFAULT NULL,
  `impnotavenda` varchar(10000) DEFAULT NULL,
  `flag` char(1) DEFAULT NULL,
  `codclascomis` char(1) DEFAULT NULL,
  `vlrpisvenda` decimal(15,5) DEFAULT NULL,
  `calcpisvenda` char(1) DEFAULT NULL,
  `imppisvenda` char(1) DEFAULT NULL,
  `vlrcofinsvenda` decimal(15,5) DEFAULT NULL,
  `calccofinsvenda` char(1) DEFAULT NULL,
  `impcofinsvenda` char(1) DEFAULT NULL,
  `vlrirvenda` decimal(15,5) DEFAULT NULL,
  `calcirvenda` char(1) DEFAULT NULL,
  `impirvenda` char(1) DEFAULT NULL,
  `vlrcsocialvenda` decimal(15,5) DEFAULT NULL,
  `calccsocialvenda` char(1) DEFAULT NULL,
  `impcsocialvenda` char(1) DEFAULT NULL,
  `percmcomisvenda` decimal(7,3) DEFAULT NULL,
  `codempcm` int DEFAULT NULL,
  `codfilialcm` int DEFAULT NULL,
  `codclcomis` int DEFAULT NULL,
  `codempcb` int DEFAULT NULL,
  `codfilialcb` smallint DEFAULT NULL,
  `codcartcob` char(3) DEFAULT NULL,
  `pedclivenda` char(10) DEFAULT NULL,
  `vlricmsstvenda` decimal(15,5) DEFAULT NULL,
  `vlrbaseicmsstvenda` decimal(15,5) DEFAULT NULL,
  `emmanut` char(1) DEFAULT NULL,
  `bloqvenda` char(1) NOT NULL,
  `vlricmssimples` decimal(15,5) DEFAULT NULL,
  `percicmssimples` decimal(5,2) DEFAULT NULL,
  `vlrbasepisvenda` decimal(15,5) DEFAULT NULL,
  `vlrbasecofinsvenda` decimal(15,5) DEFAULT NULL,
  `vlrbasecomis` decimal(15,5) DEFAULT NULL,
  `chavenfevenda` char(44) DEFAULT NULL,
  `codempca` int DEFAULT NULL,
  `codfilialca` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `obsrec` varchar(250) DEFAULT NULL,
  `infcompl` varchar(10000) DEFAULT NULL,
  `sitdoc` char(2) DEFAULT NULL,
  `obsnfe` varchar(10000) DEFAULT NULL,
  `descipivenda` char(1) DEFAULT NULL,
  `codempop` int DEFAULT NULL,
  `codfilialop` smallint DEFAULT NULL,
  `seqop` smallint DEFAULT NULL,
  `codop` int DEFAULT NULL,
  `localserv` char(1) NOT NULL,
  `nroatualizado` char(1) NOT NULL,
  `cnf` bigint DEFAULT NULL,
  `sitcomplvenda` char(1) NOT NULL,
  `motivocancvenda` varchar(250) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `vlrsimples` double DEFAULT NULL,
  `tipoenvio` varchar(10) DEFAULT NULL,
  `codmot` int DEFAULT NULL,
  `codveic` int DEFAULT NULL,
  `obsentrega` varchar(100) DEFAULT NULL,
  `nomemot` varchar(50) DEFAULT NULL,
  `placa` varchar(7) DEFAULT NULL,
  `requermontagem` char(1) DEFAULT NULL,
  `pontoreferencia` varchar(150) DEFAULT NULL,
  `codatend` int DEFAULT NULL,
  `codempat` int DEFAULT NULL,
  `codfilialat` smallint DEFAULT NULL,
  `vdcomercial` char(1) DEFAULT NULL,
  `vdvendexterno` char(1) DEFAULT NULL,
  `vdcommerce` char(1) DEFAULT NULL,
  `entregue` char(1) DEFAULT NULL,
  `idfastsale` int DEFAULT NULL,
  `nomecli` varchar(50) DEFAULT NULL,
  `caminho` varchar(255) DEFAULT NULL,
  `protocolo` varchar(15) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdvendacomis`
--

CREATE TABLE `vdvendacomis` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `seqvc` smallint NOT NULL,
  `codemprc` int NOT NULL,
  `codfilialrc` smallint NOT NULL,
  `codregrcomis` int NOT NULL,
  `seqitrc` int NOT NULL,
  `codempvd` int DEFAULT NULL,
  `codfilialvd` smallint DEFAULT NULL,
  `codvend` int DEFAULT NULL,
  `percvc` decimal(6,3) NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdvendaconsig`
--

CREATE TABLE `vdvendaconsig` (
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codconsig` int NOT NULL,
  `codvendaco` smallint NOT NULL,
  `codempcl` int NOT NULL,
  `codfilialcl` smallint NOT NULL,
  `codcli` int NOT NULL,
  `codemppd` int NOT NULL,
  `codfilialpd` smallint NOT NULL,
  `codprod` int NOT NULL,
  `preco` decimal(15,5) NOT NULL,
  `precovenda` decimal(15,5) DEFAULT NULL,
  `qtdvendaco` decimal(15,5) NOT NULL,
  `qtdtroca` decimal(15,5) NOT NULL,
  `qtdbonif` decimal(15,5) NOT NULL,
  `desconto` decimal(15,5) DEFAULT NULL,
  `recebido` char(1) NOT NULL,
  `codemppg` int NOT NULL,
  `codfilialpg` smallint NOT NULL,
  `codplanopag` int NOT NULL,
  `codempvd` int DEFAULT NULL,
  `codfilialvd` smallint DEFAULT NULL,
  `tipovenda` char(1) DEFAULT NULL,
  `codvenda` int DEFAULT NULL,
  `coditvenda` int DEFAULT NULL,
  `codempsl` int DEFAULT NULL,
  `codfilialsl` smallint DEFAULT NULL,
  `codlanca` int DEFAULT NULL,
  `codsublanca` int DEFAULT NULL,
  `codempsc` int DEFAULT NULL,
  `codfilialsc` smallint DEFAULT NULL,
  `codlancasc` int DEFAULT NULL,
  `codsublancasc` int DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdvendaentrega`
--

CREATE TABLE `vdvendaentrega` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `dtentrega` date NOT NULL,
  `obsentrega` varchar(1000) DEFAULT NULL,
  `recebedor` varchar(200) DEFAULT NULL,
  `entregador` varchar(200) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdvendaorc`
--

CREATE TABLE `vdvendaorc` (
  `codemp` int NOT NULL,
  `codfilial` int NOT NULL,
  `tipovenda` char(1) NOT NULL,
  `codvenda` int NOT NULL,
  `coditvenda` int NOT NULL,
  `codempor` int NOT NULL,
  `codfilialor` int NOT NULL,
  `tipoorc` char(1) NOT NULL,
  `codorc` int NOT NULL,
  `coditorc` int NOT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `vdvendedor`
--

CREATE TABLE `vdvendedor` (
  `id` int NOT NULL,
  `codemp` int NOT NULL,
  `codfilial` smallint NOT NULL,
  `codvend` int NOT NULL,
  `nomevend` char(40) DEFAULT NULL,
  `endvend` char(50) DEFAULT NULL,
  `numvend` int DEFAULT NULL,
  `complvend` char(20) DEFAULT NULL,
  `bairvend` char(30) DEFAULT NULL,
  `cidvend` char(30) DEFAULT NULL,
  `cepvend` char(8) DEFAULT NULL,
  `ufvend` char(2) DEFAULT NULL,
  `ibgevend` varchar(7) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `fonevend` char(12) DEFAULT NULL,
  `faxvend` char(8) DEFAULT NULL,
  `emailvend` char(50) DEFAULT NULL,
  `perccomvend` decimal(7,3) DEFAULT NULL,
  `comipivend` char(1) DEFAULT NULL,
  `codemppn` int DEFAULT NULL,
  `codfilialpn` smallint DEFAULT NULL,
  `codplan` char(13) DEFAULT NULL,
  `pessoavend` char(1) DEFAULT NULL,
  `cpfvend` char(11) DEFAULT NULL,
  `rgvend` char(13) DEFAULT NULL,
  `cnpjvend` char(14) DEFAULT NULL,
  `inscvend` varchar(20) DEFAULT NULL,
  `celvend` varchar(12) DEFAULT NULL,
  `codempse` int DEFAULT NULL,
  `codfilialse` int DEFAULT NULL,
  `codsetor` int DEFAULT NULL,
  `codempcm` int DEFAULT NULL,
  `codfilialcm` int DEFAULT NULL,
  `codclcomis` int DEFAULT NULL,
  `codfornvend` char(13) DEFAULT NULL,
  `codfunc` int DEFAULT NULL,
  `codempfu` int DEFAULT NULL,
  `codfilialfu` smallint DEFAULT NULL,
  `codemptv` int DEFAULT NULL,
  `codfilialtv` smallint DEFAULT NULL,
  `codtipovend` int DEFAULT NULL,
  `dddfonevend` char(4) DEFAULT NULL,
  `dddfaxvend` char(4) DEFAULT NULL,
  `dddcelvend` char(4) DEFAULT NULL,
  `sspvend` char(10) DEFAULT NULL,
  `obsvend` varchar(500) DEFAULT NULL,
  `ativocomis` char(1) NOT NULL,
  `codempca` int DEFAULT NULL,
  `codfilialca` smallint DEFAULT NULL,
  `numconta` char(10) DEFAULT NULL,
  `codempsc` int DEFAULT NULL,
  `codfilialsc` smallint DEFAULT NULL,
  `codsecao` varchar(13) DEFAULT NULL,
  `dtins` date NOT NULL,
  `hins` time NOT NULL,
  `idusuins` char(8) NOT NULL,
  `dtalt` date DEFAULT NULL,
  `halt` time DEFAULT NULL,
  `idusualt` char(8) DEFAULT NULL,
  `percomvend` double DEFAULT NULL,
  `vlrabono` decimal(15,5) DEFAULT NULL,
  `vlrdesconto` decimal(15,5) DEFAULT NULL,
  `metavend` decimal(15,5) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

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

--
-- Estrutura para tabela `veentrevista`
--

CREATE TABLE `veentrevista` (
  `COL1` varchar(20) DEFAULT NULL,
  `COL2` varchar(38) DEFAULT NULL,
  `COL3` varchar(18) DEFAULT NULL,
  `COL4` varchar(9) DEFAULT NULL,
  `COL5` varchar(78) DEFAULT NULL,
  `COL6` varchar(11) DEFAULT NULL,
  `COL7` varchar(9) DEFAULT NULL,
  `COL8` varchar(24) DEFAULT NULL,
  `COL9` varchar(16) DEFAULT NULL,
  `COL10` varchar(19) DEFAULT NULL,
  `COL11` varchar(27) DEFAULT NULL,
  `COL12` varchar(79) DEFAULT NULL,
  `COL13` varchar(736) DEFAULT NULL,
  `COL14` varchar(77) DEFAULT NULL,
  `COL15` varchar(33) DEFAULT NULL,
  `COL16` varchar(34) DEFAULT NULL,
  `COL17` varchar(24) DEFAULT NULL,
  `COL18` varchar(315) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb3;

--
-- Índices para tabelas despejadas
--

--
-- Índices de tabela `atatendente`
--
ALTER TABLE `atatendente`
  ADD PRIMARY KEY (`id`),
  ADD KEY `atatendentepk` (`codatend`,`codfilial`,`codemp`),
  ADD KEY `atatendentefkrhempr` (`matempr`,`codfilialep`,`codempep`),
  ADD KEY `atatendentefksgfil` (`codfilial`,`codemp`),
  ADD KEY `atatendentefksgusu` (`idusu`,`codfilialus`,`codempus`),
  ADD KEY `atatendentefkvdven` (`codvend`,`codfilialve`,`codempve`);

--
-- Índices de tabela `atsetor`
--
ALTER TABLE `atsetor`
  ADD KEY `atsetorpk` (`codsetat`,`codfilial`,`codemp`),
  ADD KEY `atsetorfksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `atsetoratendente`
--
ALTER TABLE `atsetoratendente`
  ADD KEY `atsetoratendentepk` (`codsetat`,`codfilial`,`codemp`,`codatend`,`codfilialae`,`codempae`),
  ADD KEY `atsetoratendfkatat` (`codatend`,`codfilialae`,`codempae`),
  ADD KEY `atsetoratendfkatse` (`codsetat`,`codfilial`,`codemp`);

--
-- Índices de tabela `attarefa`
--
ALTER TABLE `attarefa`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `attipoatend`
--
ALTER TABLE `attipoatend`
  ADD PRIMARY KEY (`id`),
  ADD KEY `attipoatendpk` (`codtpatend`,`codfilial`,`codemp`),
  ADD KEY `attipoatendfksgfil` (`codfilial`,`codemp`);

--
-- Índices de tabela `attipoatendo`
--
ALTER TABLE `attipoatendo`
  ADD KEY `attipoatendopk` (`codtpatendo`,`codfilial`,`codemp`),
  ADD KEY `attipoatendofksgfi` (`codfilial`,`codemp`),
  ADD KEY `attipoatendofluxo` (`codfluxo`,`codfilialfx`,`codempfx`);

--
-- Índices de tabela `attipoatendosetor`
--
ALTER TABLE `attipoatendosetor`
  ADD KEY `attipoatendosetopk` (`codsetat`,`codfilialst`,`codempst`,`codtpatendo`,`codfilial`,`codemp`),
  ADD KEY `attipoatdosetfkats` (`codsetat`,`codfilialst`,`codempst`),
  ADD KEY `attipoatdosetfkatt` (`codtpatendo`,`codfilial`,`codemp`);

--
-- Índices de tabela `cpcentral`
--
ALTER TABLE `cpcentral`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `cpcompra`
--
ALTER TABLE `cpcompra`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cpcomprapk` (`codcompra`,`codfilial`,`codemp`),
  ADD KEY `cpcomprafkcpfornec` (`codfor`,`codfilialfr`,`codempfr`),
  ADD KEY `cpcomprafkcpimportacao` (`codimp`,`codfilialim`,`codempim`),
  ADD KEY `cpcomprafkcpsolici` (`codsol`,`codfilialsol`,`codempsol`),
  ADD KEY `cpcomprafkeqrecmerc` (`ticket`,`codfilialrm`,`codemprm`),
  ADD KEY `cpcomprafkeqtipomo` (`codtipomov`,`codfilialtm`,`codemptm`),
  ADD KEY `cpcomprafkfnbanco` (`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `cpcomprafkfncc` (`codcc`,`anocc`,`codfilialcc`,`codempcc`),
  ADD KEY `cpcomprafkfnconta` (`numconta`,`codfilialct`,`codempct`),
  ADD KEY `cpcomprafkfnplanejamento` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `cpcomprafkfnplanop` (`codplanopag`,`codfilialpg`,`codemppg`),
  ADD KEY `cpcomprafkfntipocob` (`codtipocob`,`codfilialtc`,`codemptc`),
  ADD KEY `cpcomprafkordcompra` (`codempoc`,`codfilialoc`,`codordcp`),
  ADD KEY `cpcomprafkppop` (`codop`,`seqop`,`codfilialop`,`codempop`),
  ADD KEY `cpcomprafksgfilial` (`codfilial`,`codemp`),
  ADD KEY `cpcomprafkvdtrans` (`codtran`,`codfilialtn`,`codemptn`);

--
-- Índices de tabela `cpcotacao`
--
ALTER TABLE `cpcotacao`
  ADD KEY `cpcotacaopk` (`codsol`,`coditsol`,`codcot`,`codfilial`,`codemp`),
  ADD KEY `cpcotacaofkfnplanopag` (`codplanopag`,`codfilialpp`,`codemppp`);

--
-- Índices de tabela `cpdevolucao`
--
ALTER TABLE `cpdevolucao`
  ADD KEY `cpdevolucaopk` (`coditcompra`,`codcompra`,`codfilial`,`codemp`,`codvenda`,`coditvenda`,`tipovenda`,`codfilialvd`,`codempvd`),
  ADD KEY `cpdevolucaofkitcompra` (`codcompra`,`coditcompra`,`codfilialvd`,`codempvd`),
  ADD KEY `cpdevolucaofkitvenda` (`codvenda`,`coditvenda`,`tipovenda`,`codfilial`,`codemp`);

--
-- Índices de tabela `cpforneced`
--
ALTER TABLE `cpforneced`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cpfornecedpk` (`codfor`,`codfilial`,`codemp`),
  ADD KEY `cpfornecedidx01` (`razfor`),
  ADD KEY `cpfornecedfkcptipo` (`codtipofor`,`codfilialtf`,`codemptf`),
  ADD KEY `cpfornecedfkfnbanc` (`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `cpfornecedfkfnhist` (`codhist`,`codfilialhp`,`codemphp`),
  ADD KEY `cpfornecedfklftipofisc` (`codfiscfor`,`codfilialff`,`codempff`),
  ADD KEY `cpfornecedfksgfili` (`codfilial`,`codemp`),
  ADD KEY `cpfornecedfksgmunic` (`codmunic`,`siglauf`,`codpais`),
  ADD KEY `cpfornecedfksgunifcod` (`codunifcod`,`codfilialuc`,`codempuc`);

--
-- Índices de tabela `cpfretecp`
--
ALTER TABLE `cpfretecp`
  ADD KEY `cpfretecppk` (`codcompra`,`codfilial`,`codemp`),
  ADD KEY `cpfretecpfkvdtrans` (`codtran`,`codfilialtn`,`codemptn`);

--
-- Índices de tabela `cpitcentral`
--
ALTER TABLE `cpitcentral`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `cpitcompra`
--
ALTER TABLE `cpitcompra`
  ADD KEY `cpitcomprapk` (`codcompra`,`coditcompra`,`codfilial`,`codemp`),
  ADD KEY `cpitcomprafkcpcomp` (`codcompra`,`codfilial`,`codemp`),
  ADD KEY `cpitcomprafkeqalmo` (`codalmox`,`codfilialax`,`codempax`),
  ADD KEY `cpitcomprafkeqlote` (`codlote`,`codprod`,`codfilialle`,`codemple`),
  ADD KEY `cpitcomprafkeqprod` (`codprod`,`codfilialpd`,`codemppd`),
  ADD KEY `cpitcomprafkeqserietmp` (`numserietmp`,`codprod`,`codfilialns`,`codempns`),
  ADD KEY `cpitcomprafklfitclfiscal` (`codempif`,`codfilialif`,`codfisc`,`coditfisc`),
  ADD KEY `cpitcomprafklfnato` (`codnat`,`codfilialnt`,`codempnt`);

--
-- Índices de tabela `cpitordcomprape`
--
ALTER TABLE `cpitordcomprape`
  ADD KEY `cpitordcomprapepk` (`codemp`,`codfilial`,`codordcp`,`coditordcp`,`seqitordcppe`),
  ADD KEY `cpitordcomprapecpitordcompra` (`codemp`,`codfilial`,`codordcp`,`coditordcp`);

--
-- Índices de tabela `cpparc`
--
ALTER TABLE `cpparc`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `cptipofor`
--
ALTER TABLE `cptipofor`
  ADD PRIMARY KEY (`id`),
  ADD KEY `cptipoforpk` (`codtipofor`,`codfilial`,`codemp`),
  ADD KEY `cptipoforicx01` (`desctipofor`),
  ADD KEY `cptipoforfksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `eqalmox`
--
ALTER TABLE `eqalmox`
  ADD PRIMARY KEY (`id`),
  ADD KEY `eqalmoxpk` (`codalmox`,`codfilial`,`codemp`),
  ADD KEY `eqalmoxfksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `eqalmoxfilial`
--
ALTER TABLE `eqalmoxfilial`
  ADD KEY `eqalmoxfilialpk` (`codalmox`,`codfilial`,`codemp`,`codfilialaf`,`codempaf`),
  ADD KEY `eqalmoxfilialfkeqa` (`codalmox`,`codfilial`,`codemp`),
  ADD KEY `eqalmoxfilialfksgf` (`codfilialaf`,`codempaf`);

--
-- Índices de tabela `eqcultura`
--
ALTER TABLE `eqcultura`
  ADD KEY `pk_eqcultura` (`codcultura`);

--
-- Índices de tabela `eqdepos`
--
ALTER TABLE `eqdepos`
  ADD KEY `pk_eqdepos` (`coddepos`);

--
-- Índices de tabela `eqgrupo`
--
ALTER TABLE `eqgrupo`
  ADD PRIMARY KEY (`id`),
  ADD KEY `eqgrupopk` (`codgrup`,`codfilial`,`codemp`),
  ADD KEY `eqgrupofkeqgrupo` (`codsubgrup`,`codfilial`,`codemp`),
  ADD KEY `eqgrupofksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `eqinvprod`
--
ALTER TABLE `eqinvprod`
  ADD PRIMARY KEY (`id`),
  ADD KEY `eqinvprodpk` (`codinvprod`,`codfilial`,`codemp`),
  ADD KEY `eqinvprodfkeqalmox` (`codalmox`,`codfilialax`,`codempax`),
  ADD KEY `eqinvprodfkeqlote` (`codlote`,`codprod`,`codfilialle`,`codemple`),
  ADD KEY `eqinvprodfkeqprodu` (`codprod`,`codfilialpd`,`codemppd`),
  ADD KEY `eqinvprodfkeqtipom` (`codtipomov`,`codfilialtm`,`codemptm`),
  ADD KEY `eqinvprodfksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `eqlote`
--
ALTER TABLE `eqlote`
  ADD KEY `eqlotepk` (`codlote`,`codprod`,`codfilial`,`codemp`),
  ADD KEY `eqlotefkeqproduto` (`codprod`,`codfilial`,`codemp`),
  ADD KEY `eqlotefksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `eqmarca`
--
ALTER TABLE `eqmarca`
  ADD PRIMARY KEY (`id`),
  ADD KEY `eqmarcapk` (`codmarca`,`codfilial`,`codemp`),
  ADD KEY `eqmarcafksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `eqmovprod`
--
ALTER TABLE `eqmovprod`
  ADD KEY `eqmovprodpk` (`codmovprod`,`codfilial`,`codemp`),
  ADD KEY `eqmovprodidx01` (`codlote`,`codprod`),
  ADD KEY `eqmovprodidx02` (`codprod`,`dtmovprod`),
  ADD KEY `eqmovprodfkcpitcom` (`codcompra`,`coditcompra`,`codfilialcp`,`codempcp`),
  ADD KEY `eqmovprodfkeqalmox` (`codalmox`,`codfilialax`,`codempax`),
  ADD KEY `eqmovprodfkeqinvpr` (`codinvprod`,`codfilialiv`,`codempiv`),
  ADD KEY `eqmovprodfkeqitrma` (`codrma`,`coditrma`,`codfilialrm`,`codemprm`),
  ADD KEY `eqmovprodfkeqlote` (`codlote`,`codprod`,`codfilialle`,`codemple`),
  ADD KEY `eqmovprodfkeqop` (`codop`,`seqop`,`codfilialop`,`codempop`),
  ADD KEY `eqmovprodfkeqprodu` (`codprod`,`codfilialpd`,`codemppd`),
  ADD KEY `eqmovprodfkeqtipom` (`codtipomov`,`codfilialtm`,`codemptm`),
  ADD KEY `eqmovprodfksgfilia` (`codfilial`,`codemp`),
  ADD KEY `eqmovprodfkvditven` (`codvenda`,`coditvenda`,`tipovenda`,`codfilialvd`,`codempvd`);

--
-- Índices de tabela `eqproced`
--
ALTER TABLE `eqproced`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `eqproduto`
--
ALTER TABLE `eqproduto`
  ADD PRIMARY KEY (`id`),
  ADD KEY `eqprodutoidxrefprod` (`refprod`,`codemp`,`codfilial`),
  ADD KEY `eqprodutopk` (`codprod`,`codfilial`,`codemp`),
  ADD KEY `eqprodutoidx02` (`descprod`),
  ADD KEY `eqprodutofkcrtipochamado` (`codtpchamado`,`codfilialtc`,`codemptc`),
  ADD KEY `eqprodutofkeqalmox` (`codalmox`,`codfilialax`,`codempax`),
  ADD KEY `eqprodutofkeqgrupo` (`codgrup`,`codfilialgp`,`codempgp`),
  ADD KEY `eqprodutofkeqmarca` (`codmarca`,`codfilialmc`,`codempmc`),
  ADD KEY `eqprodutofkequnida` (`codunid`,`codfilialud`,`codempud`),
  ADD KEY `eqprodutofkfncc` (`codcc`,`anocc`,`codfilialcc`,`codempcc`),
  ADD KEY `eqprodutofkfnmoeda` (`codmoeda`,`codfilialma`,`codempma`),
  ADD KEY `eqprodutofklfclfis` (`codfisc`,`codfilialfc`,`codempfc`),
  ADD KEY `eqprodutofksecao` (`codsecao`,`codfilialsc`,`codempsc`),
  ADD KEY `eqprodutofksgfilia` (`codfilial`,`codemp`),
  ADD KEY `eqprodutofkvdprazo` (`codpe`,`codfilialpe`,`codemppe`);

--
-- Índices de tabela `eqsaldodepos`
--
ALTER TABLE `eqsaldodepos`
  ADD KEY `pk_eqsaldodepos` (`codtrandepos`);

--
-- Índices de tabela `eqsaldolote`
--
ALTER TABLE `eqsaldolote`
  ADD KEY `eqsaldolotepk` (`codlote`,`codprod`,`codfilial`,`codemp`,`codalmox`,`codfilialax`,`codempax`),
  ADD KEY `eqsaldolotefkeqalm` (`codalmox`,`codfilialax`,`codempax`);

--
-- Índices de tabela `eqsaldoprod`
--
ALTER TABLE `eqsaldoprod`
  ADD KEY `eqsaldoprodpk` (`codprod`,`codfilial`,`codemp`,`codalmox`,`codfilialax`,`codempax`),
  ADD KEY `eqsoldoprodfkeqalm` (`codalmox`,`codfilialax`,`codempax`),
  ADD KEY `eqsoldoprodfkeqpro` (`codprod`,`codfilial`,`codemp`);

--
-- Índices de tabela `eqsecao`
--
ALTER TABLE `eqsecao`
  ADD KEY `eqsecaopk` (`codsecao`,`codfilial`,`codemp`);

--
-- Índices de tabela `eqserie`
--
ALTER TABLE `eqserie`
  ADD KEY `eqseriepk` (`numserie`,`codprod`,`codfilial`,`codemp`),
  ADD KEY `eqseriefkeqproduto` (`codprod`,`codfilial`,`codemp`),
  ADD KEY `eqseriefksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `eqtipomov`
--
ALTER TABLE `eqtipomov`
  ADD PRIMARY KEY (`id`),
  ADD KEY `eqtipomovpk` (`codtipomov`,`codfilial`,`codemp`),
  ADD KEY `eqtipomovfkeqtipoc` (`codtipomovtc`,`codfilialtc`,`codemptc`),
  ADD KEY `eqtipomovfkeqtipom` (`codtipomovtm`,`codfilialtm`,`codemptm`),
  ADD KEY `eqtipomovfkfnplanopag` (`codplanopag`,`codfilialpp`,`codemppp`),
  ADD KEY `eqtipomovfklfmensa` (`codmens`,`codfilialmc`,`codempmc`),
  ADD KEY `eqtipomovfklfmodno` (`codmodnota`,`codfilialmn`,`codempmn`),
  ADD KEY `eqtipomovfkmoddocfisc` (`codmoddocfisc`,`codfilialdf`,`codempdf`),
  ADD KEY `eqtipomovfklfserie` (`serie`,`codfilialse`,`codempse`),
  ADD KEY `eqtipomovfksgfilia` (`codfilial`,`codemp`),
  ADD KEY `eqtipomovfkvdregra` (`codregrcomis`,`codfilialrc`,`codemprc`),
  ADD KEY `eqtipomovfkvdtabpr` (`codtab`,`codfilialtb`,`codemptb`),
  ADD KEY `eqtipomovfkvdtrans` (`codtran`,`codfilialtn`,`codemptn`);

--
-- Índices de tabela `eqtipomovusu`
--
ALTER TABLE `eqtipomovusu`
  ADD KEY `eqtipomovusupk` (`codtipomov`,`codfilial`,`codemp`,`idusu`,`codfilialus`,`codempus`),
  ADD KEY `eqtipomovusufkeqti` (`codtipomov`,`codfilial`,`codemp`),
  ADD KEY `eqtipomovusufksgus` (`idusu`,`codfilialus`,`codempus`);

--
-- Índices de tabela `eqtipoprod`
--
ALTER TABLE `eqtipoprod`
  ADD PRIMARY KEY (`codtipoprod`,`codfilial`,`codemp`),
  ADD KEY `EQTIPOPRODFKSGFILIAL` (`codfilial`,`codemp`);

--
-- Índices de tabela `eqtrocarefprod`
--
ALTER TABLE `eqtrocarefprod`
  ADD KEY `eqtrocarefprodpk` (`id`),
  ADD KEY `eqtrocarefprodfksgfi` (`codfilial`,`codemp`);

--
-- Índices de tabela `equnidade`
--
ALTER TABLE `equnidade`
  ADD PRIMARY KEY (`id`),
  ADD KEY `equnidadepk` (`codunid`,`codfilial`,`codemp`),
  ADD KEY `equnidadeidx01` (`descunid`),
  ADD KEY `equnidadefksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `fnbanco`
--
ALTER TABLE `fnbanco`
  ADD KEY `fnbancopk` (`codbanco`,`codfilial`,`codemp`),
  ADD KEY `fnbancoidx01` (`nomebanco`),
  ADD KEY `fnbancofkfnmodbole` (`codmodbol`,`codfilialmb`,`codempmb`),
  ADD KEY `fnbancofksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `fncartcob`
--
ALTER TABLE `fncartcob`
  ADD KEY `fncartcobpk` (`codcartcob`,`codfilial`,`codemp`,`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `fncartcobfkfnbanco` (`codbanco`,`codfilialbo`,`codempbo`);

--
-- Índices de tabela `fncc`
--
ALTER TABLE `fncc`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fnccpk` (`codcc`,`anocc`,`codfilial`,`codemp`),
  ADD KEY `fnccidx01` (`desccc`),
  ADD KEY `fnccidx02` (`codredcc`,`codemp`,`codfilial`),
  ADD KEY `fnccfkfncc` (`codsubcc`,`anoscc`,`codfilial`,`codemp`),
  ADD KEY `fnccfksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `fnconta`
--
ALTER TABLE `fnconta`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fncontapk` (`numconta`,`codfilial`,`codemp`),
  ADD KEY `fncontauniqfnplaneja` (`codemppn`,`codfilialpn`,`codplan`),
  ADD KEY `fncontafkfnbanco` (`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `fncontafkfnhistpad` (`codhist`,`codfilialhp`,`codemphp`),
  ADD KEY `fncontafkfnmoeda` (`codmoeda`,`codfilialma`,`codempma`),
  ADD KEY `fncontafkfnplaneja` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `fncontafksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `fncotmoeda`
--
ALTER TABLE `fncotmoeda`
  ADD KEY `fncotmoedapk` (`datacot`,`codmoeda`,`codfilial`,`codemp`),
  ADD KEY `fncotmoedafkfnmoed` (`codmoeda`,`codfilial`,`codemp`),
  ADD KEY `fncotmoedafksgfili` (`codfilial`,`codemp`);

--
-- Índices de tabela `fnfinalidade`
--
ALTER TABLE `fnfinalidade`
  ADD KEY `fnfinalidadepk` (`codfin`);

--
-- Índices de tabela `fnhistpad`
--
ALTER TABLE `fnhistpad`
  ADD KEY `fnhistpadpk` (`codhist`,`codfilial`,`codemp`);

--
-- Índices de tabela `fnitmodboleto`
--
ALTER TABLE `fnitmodboleto`
  ADD KEY `fnitmodboletopk` (`codmodbol`,`codfilial`,`codemp`,`codbanco`,`codfilialbo`,`codempbo`,`codcartcob`,`codfilialcb`,`codempcb`),
  ADD KEY `fnitmodboletofkcar` (`codcartcob`,`codfilialcb`,`codempcb`,`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `fnitmodboletofkfnconta` (`numconta`,`codfilialct`,`codempct`),
  ADD KEY `fnitmodboletofkmod` (`codmodbol`,`codfilial`,`codemp`);

--
-- Índices de tabela `fnitpagar`
--
ALTER TABLE `fnitpagar`
  ADD KEY `fnitpagarpk` (`codpag`,`nparcpag`,`codfilial`,`codemp`),
  ADD KEY `fnitpagarfkcontrat` (`codcontr`,`coditcontr`,`codfilialct`,`codempct`),
  ADD KEY `fnitpagarfkfnconta` (`numconta`,`codfilialca`,`codempca`),
  ADD KEY `fnitpagarfkfnpagar` (`codpag`,`codfilial`,`codemp`),
  ADD KEY `fnitpagarfkfnplane` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `fnitpagarfkfntpcob` (`codtipocob`,`codfilialtc`,`codemptc`),
  ADD KEY `fnitpagarfksinal` (`codsinal`,`codempsn`,`codfilialsn`);

--
-- Índices de tabela `fnitreceber`
--
ALTER TABLE `fnitreceber`
  ADD PRIMARY KEY (`codemp`,`codfilial`,`codrec`,`nparcitrec`),
  ADD KEY `fnitreceberpk` (`codrec`,`nparcitrec`,`codfilial`,`codemp`),
  ADD KEY `fnitreceberfkcartc` (`codcartcob`,`codfilialcb`,`codempcb`,`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `fnitreceberfkcontr` (`codcontr`,`coditcontr`,`codfilialct`,`codempct`),
  ADD KEY `fnitreceberfkfnban` (`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `fnitreceberfkfncon` (`numconta`,`codfilialca`,`codempca`),
  ADD KEY `fnitreceberfkfnpla` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `fnitreceberfkfnrec` (`codrec`,`codfilial`,`codemp`),
  ADD KEY `fnitreceberfkfntip` (`codtipocob`,`codfilialtc`,`codemptc`),
  ADD KEY `fnitreceberfksinal` (`codsinal`,`codempsn`,`codfilialsn`);

--
-- Índices de tabela `fnlanca`
--
ALTER TABLE `fnlanca`
  ADD KEY `fnlancapk` (`codlanca`,`codfilial`,`codemp`),
  ADD KEY `fnlancadata` (`datalanca`,`codrec`),
  ADD KEY `fnlancaidx01` (`datalanca`,`codfilial`,`codemp`),
  ADD KEY `fnlancafkcpfornece` (`codfor`,`codfilialfr`,`codempfr`),
  ADD KEY `fnlancafkfnitpagar` (`codpag`,`nparcpag`,`codfilialpg`,`codemppg`),
  ADD KEY `fnlancafkfnitreceb` (`codrec`,`nparcitrec`,`codfilialrc`,`codemprc`),
  ADD KEY `fnlancafkfnpagtoco` (`codpcomi`,`codfilialci`,`codempci`),
  ADD KEY `fnlancafkfnplaneja` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `fnlancafkfnsinal` (`codsinal`,`codempsn`,`codfilialsn`),
  ADD KEY `fnlancafksgfilial` (`codfilial`,`codemp`),
  ADD KEY `fnlancafkvdcliente` (`codcli`,`codfilialcl`,`codempcl`),
  ADD KEY `fnlancafkvdcomissa` (`codcomi`,`codfilial`,`codemp`);

--
-- Índices de tabela `fnlibcred`
--
ALTER TABLE `fnlibcred`
  ADD KEY `fnlibcredpk` (`codlcred`,`codfilial`,`codemp`),
  ADD KEY `fnlibcredfksgfilia` (`codfilial`,`codemp`),
  ADD KEY `fnlibcredfksgusuar` (`idusu`,`codfilialus`,`codempus`),
  ADD KEY `fnlibcredfkvdclien` (`codcli`,`codfilialcl`,`codempcl`),
  ADD KEY `vdlibcredfkvdvenda` (`codvenda`,`tipovenda`,`codfilialvd`,`codempvd`);

--
-- Índices de tabela `fnmodboleto`
--
ALTER TABLE `fnmodboleto`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fnmodboletopk` (`codmodbol`,`codfilial`,`codemp`),
  ADD KEY `fnmodboletofkfncon` (`numconta`,`codfilialcc`,`codempcc`);

--
-- Índices de tabela `fnmoeda`
--
ALTER TABLE `fnmoeda`
  ADD KEY `fnmoedapk` (`codmoeda`,`codfilial`,`codemp`),
  ADD KEY `fnmoedafksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `fnmovimento`
--
ALTER TABLE `fnmovimento`
  ADD KEY `fnmovimentopk` (`id`),
  ADD KEY `fnmovimentofkfnitpag` (`codpag`,`nparcpag`,`codfilialpg`,`codemppg`),
  ADD KEY `fnmovimentofkfnitrec` (`codrec`,`nparcitrec`,`codfilialrc`,`codemprc`);

--
-- Índices de tabela `fnpagar`
--
ALTER TABLE `fnpagar`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fnpagarpk` (`codpag`,`codfilial`,`codemp`),
  ADD KEY `fnpagarfkcpcompra` (`codcompra`,`codfilialcp`,`codempcp`),
  ADD KEY `fnpagarfkcpfornece` (`codfor`,`codfilialfr`,`codempfr`),
  ADD KEY `fnpagarfkfnbanco` (`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `fnpagarfkfncc` (`codcc`,`anocc`,`codfilialcc`,`codempcc`),
  ADD KEY `fnpagarfkfnconta` (`numconta`,`codfilialca`,`codempca`),
  ADD KEY `fnpagarfkfnplanej` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `fnpagarfkfnplanopa` (`codplanopag`,`codfilialpg`,`codemppg`),
  ADD KEY `fnpagarfkfntipoc` (`codtipocob`,`codfilialtc`,`codemptc`),
  ADD KEY `fnpagarfkordcompra` (`codempoc`,`codfilialoc`,`codordcp`),
  ADD KEY `fnpagarfksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `fnparcpag`
--
ALTER TABLE `fnparcpag`
  ADD PRIMARY KEY (`codplanopag`,`nroparcpag`);

--
-- Índices de tabela `fnplanejamento`
--
ALTER TABLE `fnplanejamento`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fnplanejamentopk` (`codplan`,`codfilial`,`codemp`),
  ADD KEY `fnplanejamentoidx01` (`descplan`),
  ADD KEY `fnplanejamentoidxcodred` (`codredplan`,`codfilial`,`codemp`),
  ADD KEY `fnplanejamfkfnhist` (`codhist`,`codfilialhp`,`codemphp`),
  ADD KEY `fnplanejamfkfnplan` (`codsubplan`,`codfilial`,`codemp`),
  ADD KEY `fnplanejamfksgfili` (`codfilial`,`codemp`);

--
-- Índices de tabela `fnplanopag`
--
ALTER TABLE `fnplanopag`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fnplanopagpk` (`codplanopag`,`codfilial`,`codemp`),
  ADD KEY `fnplanopagidx01` (`descplanopag`),
  ADD KEY `fnplanopagfkfncc` (`codcc`,`anocc`,`codfilialcc`,`codempcc`),
  ADD KEY `fnplanopagfkfncont` (`numconta`,`codfilialca`,`codempca`),
  ADD KEY `fnplanopagfkfnplan` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `fnplanopagfkfntbju` (`codtbj`,`codfilialtbj`,`codemptbj`),
  ADD KEY `fnplanopagfksgfili` (`codfilial`,`codemp`);

--
-- Índices de tabela `fnreceber`
--
ALTER TABLE `fnreceber`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fnreceberpk` (`codrec`,`codfilial`,`codemp`),
  ADD KEY `fnreceberdatarec` (`datarec`),
  ADD KEY `fnreceberfkfnbanco` (`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `fnreceberfkfncartc` (`codcartcob`,`codfilialcb`,`codempcb`,`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `fnreceberfkfncc` (`codcc`,`anocc`,`codfilialcc`,`codempcc`),
  ADD KEY `fnreceberfkfnconta` (`numconta`,`codfilialca`,`codempca`),
  ADD KEY `fnreceberfkfnplanej` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `fnreceberfkfnplano` (`codplanopag`,`codfilialpg`,`codemppg`),
  ADD KEY `fnreceberfkfnrenegrec` (`codrenegrec`,`codfilialrr`,`codemprr`),
  ADD KEY `fnreceberfkfntipoc` (`codtipocob`,`codfilialtc`,`codemptc`),
  ADD KEY `fnreceberfksgfilia` (`codfilial`,`codemp`),
  ADD KEY `fnreceberfkvdclien` (`codcli`,`codfilialcl`,`codempcl`),
  ADD KEY `fnreceberfkvdvenda` (`codvenda`,`tipovenda`,`codfilialva`,`codempva`),
  ADD KEY `fnreceberfkvdvende` (`codvend`,`codfilialvd`,`codempvd`);

--
-- Índices de tabela `fnrenegrec`
--
ALTER TABLE `fnrenegrec`
  ADD KEY `fnrenegrecpk` (`codrenegrec`,`codfilial`,`codemp`),
  ADD KEY `fnrenegrecfkfnplanopag` (`codplanopag`,`codfilialpg`,`codemppg`);

--
-- Índices de tabela `fnrestricao`
--
ALTER TABLE `fnrestricao`
  ADD KEY `fnrestricaopk` (`codcli`,`seqrestr`,`codfilial`,`codemp`),
  ADD KEY `fnrestricaofkfntip` (`codtprestr`,`codfilial`,`codemp`),
  ADD KEY `fnrestricaofkvdcli` (`codcli`,`codfilial`,`codemp`);

--
-- Índices de tabela `fnretboleto`
--
ALTER TABLE `fnretboleto`
  ADD KEY `pk_fnretboleto` (`codretorno`);

--
-- Índices de tabela `fnsaldolanca`
--
ALTER TABLE `fnsaldolanca`
  ADD KEY `fnsaldolancapk` (`datasl`,`codfilialpn`,`codemppn`,`codplan`,`codfilial`,`codemp`),
  ADD KEY `fnsaldolancafkfnpl` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `fnsaldolancafksgfi` (`codfilial`,`codemp`);

--
-- Índices de tabela `fnsinal`
--
ALTER TABLE `fnsinal`
  ADD KEY `fnsinalpk` (`codsinal`,`codemp`,`codfilial`);

--
-- Índices de tabela `fnsublanca`
--
ALTER TABLE `fnsublanca`
  ADD KEY `fnsublancapk` (`codsublanca`,`codlanca`,`codfilial`,`codemp`),
  ADD KEY `fnsublancaidx01` (`datasublanca`,`codsublanca`,`codlanca`,`codfilial`,`codemp`),
  ADD KEY `fnsublancaidxdtcomp` (`dtcompsublanca`),
  ADD KEY `fnsublancaidxdtsublanca` (`codplan`,`datasublanca`,`codlanca`,`codfilial`,`codemp`),
  ADD KEY `fnsublancafkcpforn` (`codfor`,`codfilialfr`,`codempfr`),
  ADD KEY `fnsublancafkctr` (`codcontr`,`coditcontr`,`codfilialct`,`codempct`),
  ADD KEY `fnsublancafkfncc` (`codcc`,`anocc`,`codfilialcc`,`codempcc`),
  ADD KEY `fnsublancafkfnitpa` (`codpag`,`nparcpag`,`codfilialpg`,`codemppg`),
  ADD KEY `fnsublancafkfnitre` (`codrec`,`nparcitrec`,`codfilialrc`,`codemprc`),
  ADD KEY `fnsublancafkfnlanc` (`codlanca`,`codfilial`,`codemp`),
  ADD KEY `fnsublancafkfnplan` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `fnsublancafkvdclie` (`codcli`,`codfilialcl`,`codempcl`);

--
-- Índices de tabela `fntalaocheq`
--
ALTER TABLE `fntalaocheq`
  ADD KEY `fntalaocheqpk` (`numconta`,`seqtalao`,`codfilial`,`codemp`);

--
-- Índices de tabela `fntbjuros`
--
ALTER TABLE `fntbjuros`
  ADD KEY `fntbjurospk` (`codtbj`,`codfilial`,`codemp`),
  ADD KEY `fntbjurosfksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `fntipocob`
--
ALTER TABLE `fntipocob`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fntipocobpk` (`codtipocob`,`codfilial`,`codemp`),
  ADD KEY `fntipocobidx01` (`desctipocob`),
  ADD KEY `fntipocobfkfntalon` (`numconta`,`seqtalao`,`codfilial`,`codemp`),
  ADD KEY `fntipocobfksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `fntipocred`
--
ALTER TABLE `fntipocred`
  ADD KEY `fntipocredpk` (`codtpcred`,`codfilial`,`codemp`);

--
-- Índices de tabela `fntiporestr`
--
ALTER TABLE `fntiporestr`
  ADD PRIMARY KEY (`id`),
  ADD KEY `fntiporestrpk` (`codtprestr`,`codfilial`,`codemp`);

--
-- Índices de tabela `lfcalccusto`
--
ALTER TABLE `lfcalccusto`
  ADD KEY `lfcalccustopk` (`codcalc`,`codfilial`,`codemp`);

--
-- Índices de tabela `lfclfiscal`
--
ALTER TABLE `lfclfiscal`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lfclfiscalfklfnatoper` (`codigo`,`cst`),
  ADD KEY `lfclfiscalpk` (`codfisc`,`codfilial`,`codemp`),
  ADD KEY `lfclfiscalfklfncm` (`codncm`,`codnbm`),
  ADD KEY `lfclfiscalfklfregr` (`codregra`,`codfilialra`,`codempra`),
  ADD KEY `lfclfiscalfklfservico` (`codserv`),
  ADD KEY `lfclfiscalfksgfili` (`codfilial`,`codemp`);

--
-- Índices de tabela `lfcsosn`
--
ALTER TABLE `lfcsosn`
  ADD KEY `lfcsosnpk` (`csosn`,`codfilial`,`codemp`),
  ADD KEY `lfcsosnfksgfili` (`codfilial`,`codemp`);

--
-- Índices de tabela `lffrete`
--
ALTER TABLE `lffrete`
  ADD KEY `vdfretepk` (`codfrete`,`codfilial`,`codemp`),
  ADD KEY `lffretefkeqexpedicao` (`ticketex`,`codfilialex`,`codempex`),
  ADD KEY `lffretefkeqrecmerc` (`ticket`,`codfilialrm`,`codemprm`),
  ADD KEY `lffretefkeqtipomov` (`codtipomov`,`codfilialtm`,`codemptm`),
  ADD KEY `lffretefkfnpagar` (`codpag`,`codfilialpa`,`codemppa`),
  ADD KEY `lffretefklfnatop` (`codnat`,`codfilialnt`,`codempnt`),
  ADD KEY `lffretefksgunifcodd` (`coddestinat`,`codfilialde`,`codempde`),
  ADD KEY `lffretefksgunifcodr` (`codremet`,`codfilialre`,`codempre`),
  ADD KEY `lffretefktrattrib` (`codtrattrib`,`codfilialtt`,`codemptt`),
  ADD KEY `lffretefkvdtrans` (`codtran`,`codfilialtn`,`codemptn`);

--
-- Índices de tabela `lffretecompra`
--
ALTER TABLE `lffretecompra`
  ADD KEY `lffretecppk` (`codfrete`,`codcompra`,`codfilial`,`codemp`),
  ADD KEY `cpfretefkcpcompra` (`codcompra`,`codfilial`,`codemp`),
  ADD KEY `cpfretefklffrete` (`codfrete`,`codfilial`,`codemp`);

--
-- Índices de tabela `lffretevenda`
--
ALTER TABLE `lffretevenda`
  ADD KEY `lffretevdpk` (`codfrete`,`codvenda`,`tipovenda`,`codfilial`,`codemp`),
  ADD KEY `lffretefklffrete` (`codfrete`,`codfilial`,`codemp`),
  ADD KEY `vdfretevefkvdvenda` (`codvenda`,`tipovenda`,`codfilial`,`codemp`);

--
-- Índices de tabela `lfitcalccusto`
--
ALTER TABLE `lfitcalccusto`
  ADD KEY `lfitcalccustopk` (`codcalc`,`seqitcalc`,`codfilial`,`codemp`),
  ADD KEY `lfitcalccfklfcalcc` (`codcalc`,`codfilial`,`codemp`);

--
-- Índices de tabela `lfitclfiscal`
--
ALTER TABLE `lfitclfiscal`
  ADD KEY `lfitclfiscal1` (`codemp`,`codfilial`,`codfisc`,`coditfisc`),
  ADD KEY `lfitclfiscalfkcsosn` (`csosn`,`codfilialcn`,`codempcn`),
  ADD KEY `lfitclfiscalfkeqtipomov` (`codtipomov`,`codfilialtm`,`codemptm`),
  ADD KEY `lfitclfiscalfklfcl` (`codfisc`,`codfilial`,`codemp`),
  ADD KEY `lfitclfiscalfklfme` (`codmens`,`codfilialme`,`codempme`),
  ADD KEY `lfitclfiscalfklfregrafiscal` (`codregra`,`codfilialra`,`codempra`),
  ADD KEY `lfitclfiscalfklfti` (`codfisccli`,`codfilialfc`,`codempfc`),
  ADD KEY `lfitclfiscalfklftr` (`codtrattrib`,`codfilialtt`,`codemptt`),
  ADD KEY `lfitclfiscalfksguf` (`siglauf`,`codpais`),
  ADD KEY `lfitclsfiscalfklfcalccusto` (`codcalc`,`codfilialcc`,`codempcc`),
  ADD KEY `lfitclsfiscalfklfsittribcof` (`codsittribcof`,`impsittribcof`,`codfilialsc`,`codempsc`),
  ADD KEY `lfitclsfiscalfklfsittribipi` (`codsittribipi`,`impsittribipi`,`codfilialsi`,`codempsi`),
  ADD KEY `lfitclsfiscalfklfsittribiss` (`codsittribiss`,`impsittribiss`,`codfilialis`,`codempis`),
  ADD KEY `lfitclsfiscalfklfsittribpis` (`codsittribpis`,`impsittribpis`,`codfilialsp`,`codempsp`);

--
-- Índices de tabela `lfitcompra`
--
ALTER TABLE `lfitcompra`
  ADD KEY `lfitcompra1` (`codcompra`,`coditcompra`,`codfilial`,`codemp`);

--
-- Índices de tabela `lfitnatoper`
--
ALTER TABLE `lfitnatoper`
  ADD KEY `lfitnatoper1` (`coditnatoper`,`codnat`,`codfilial`,`codemp`),
  ADD KEY `lfitnatoperfklftab` (`ufti`,`codfilialti`,`codempti`);

--
-- Índices de tabela `lfitregrafiscal`
--
ALTER TABLE `lfitregrafiscal`
  ADD KEY `lfitregrafiscalpk` (`codnat`,`codregra`,`codfilial`,`codemp`),
  ADD KEY `lfitregrafisfkeqti` (`codtipomov`,`codfilialtm`,`codemptm`),
  ADD KEY `lfitregrafisfklfna` (`codnat`,`codfilial`,`codemp`),
  ADD KEY `lfitregrafisfklfre` (`codregra`,`codfilial`,`codemp`);

--
-- Índices de tabela `lflivrofiscal`
--
ALTER TABLE `lflivrofiscal`
  ADD KEY `lflivrofiscalpk` (`codlf`,`anomeslf`,`tipolf`,`codfilial`,`codemp`),
  ADD KEY `lflivrofiscalidxemit` (`codemitlf`,`codfilialet`,`codempet`),
  ADD KEY `lflivrofiscalfklfn` (`codnat`,`codfilialnt`,`codempnt`),
  ADD KEY `lflivrofiscalfksgf` (`codfilial`,`codemp`);

--
-- Índices de tabela `lfmensagem`
--
ALTER TABLE `lfmensagem`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lfmensagempk` (`codmens`,`codfilial`,`codemp`);

--
-- Índices de tabela `lfmoddocfisc`
--
ALTER TABLE `lfmoddocfisc`
  ADD KEY `lfmoddocfiscpk` (`codmoddocfisc`,`codfilial`,`codemp`),
  ADD KEY `lfmoddocfiscfksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `lfmodnota`
--
ALTER TABLE `lfmodnota`
  ADD KEY `lfmodnotapk` (`codmodnota`,`codfilial`,`codemp`),
  ADD KEY `lfmodnotafksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `lfnatoper`
--
ALTER TABLE `lfnatoper`
  ADD KEY `lfnatoperpk` (`codnat`,`codfilial`,`codemp`),
  ADD KEY `lfnatoperfksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `lfncm`
--
ALTER TABLE `lfncm`
  ADD KEY `lfncmpk` (`codncm`),
  ADD KEY `lfncmidx001` (`descncm`);

--
-- Índices de tabela `lfregrafiscal`
--
ALTER TABLE `lfregrafiscal`
  ADD PRIMARY KEY (`id`),
  ADD KEY `lfregrafiscalpk` (`codregra`,`codfilial`,`codemp`),
  ADD KEY `lfregrafiscalfksgf` (`codfilial`,`codemp`);

--
-- Índices de tabela `lfseqserie`
--
ALTER TABLE `lfseqserie`
  ADD KEY `lfseqseriepk` (`serie`,`codfilial`,`codemp`,`seqserie`,`codfilialss`,`codempss`);

--
-- Índices de tabela `lfserie`
--
ALTER TABLE `lfserie`
  ADD KEY `lfseriepk` (`serie`,`codfilial`,`codemp`),
  ADD KEY `lfseriefksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `lfservico`
--
ALTER TABLE `lfservico`
  ADD KEY `lfservicospk` (`codserv`);

--
-- Índices de tabela `lfsittrib`
--
ALTER TABLE `lfsittrib`
  ADD KEY `lfsittribpk` (`codsittrib`,`impsittrib`,`codfilial`,`codemp`),
  ADD KEY `lfsittribfksgfili` (`codfilial`,`codemp`);

--
-- Índices de tabela `lftabicms`
--
ALTER TABLE `lftabicms`
  ADD KEY `lftabicmspk` (`ufti`,`codfilial`,`codemp`);

--
-- Índices de tabela `lftipofisccli`
--
ALTER TABLE `lftipofisccli`
  ADD KEY `lftipofiscclipk` (`codfisccli`,`codfilial`,`codemp`),
  ADD KEY `lftipofiscclifkeqtipomov` (`codtipomovoc`,`codfilialoc`,`codempoc`);

--
-- Índices de tabela `lftrattrib`
--
ALTER TABLE `lftrattrib`
  ADD KEY `lftrattribpk` (`codtrattrib`,`codfilial`,`codemp`),
  ADD KEY `lftrattribfksgfili` (`codfilial`,`codemp`);

--
-- Índices de tabela `pvcaixa`
--
ALTER TABLE `pvcaixa`
  ADD KEY `pvcaixapk` (`codcaixa`,`codfilial`,`codemp`),
  ADD KEY `pvcaixafksgestacao` (`codest`,`codfilialet`,`codempet`);

--
-- Índices de tabela `pvcaixaimp`
--
ALTER TABLE `pvcaixaimp`
  ADD KEY `pvcaixaimppk` (`codimp`,`codcaixa`,`codfilial`,`codemp`),
  ADD KEY `pvcaixaimpfkpvcaix` (`codcaixa`,`codfilial`,`codemp`),
  ADD KEY `pvcaixaimpfksgimpr` (`codimp`,`codfilial`,`codemp`);

--
-- Índices de tabela `pvmovcaixa`
--
ALTER TABLE `pvmovcaixa`
  ADD KEY `pvmovcaixapk` (`nromov`,`dtamov`,`codcaixa`,`codfilial`,`codemp`),
  ADD KEY `pvmovcaixafksgusua` (`idusu`,`codfilialus`,`codempus`);

--
-- Índices de tabela `pvseqmovcaixa`
--
ALTER TABLE `pvseqmovcaixa`
  ADD KEY `pvseqmovcaixa1` (`dtamov`,`codcaixa`,`codfilial`,`codemp`);

--
-- Índices de tabela `pvsequencia`
--
ALTER TABLE `pvsequencia`
  ADD KEY `pk_pvsequencia` (`codemp`,`codfilial`,`codcaixa`),
  ADD KEY `pvsequenciafkpvcai` (`codcaixa`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgacessoeu`
--
ALTER TABLE `sgacessoeu`
  ADD KEY `sgacessoeupk` (`codfilialfl`,`codempfl`,`idusu`,`codemp`,`codfilial`),
  ADD KEY `sgacessoeufksgfili` (`codfilialfl`,`codempfl`),
  ADD KEY `sgacessoeufksgusua` (`idusu`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgacessomg`
--
ALTER TABLE `sgacessomg`
  ADD KEY `sgacessomgfksgfili` (`codfilial`,`codemp`),
  ADD KEY `sgacessomgpk` (`codmenu`,`codmodu`,`codsis`,`idgrpusu`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgacessomu`
--
ALTER TABLE `sgacessomu`
  ADD KEY `sgacessomupk` (`codmenu`,`codmodu`,`codsis`,`idusu`,`codfilial`,`codemp`),
  ADD KEY `sgacessomufksgfili` (`codfilial`,`codemp`);

--
-- Índices de tabela `sgagente`
--
ALTER TABLE `sgagente`
  ADD KEY `sgagentepk` (`codage`,`tipoage`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgatribuicao`
--
ALTER TABLE `sgatribuicao`
  ADD KEY `sgatribuicaopk` (`idatrib`,`codfilial`,`codemp`),
  ADD KEY `sgatribuicaofksgfi` (`codfilial`,`codemp`);

--
-- Índices de tabela `sgatribusu`
--
ALTER TABLE `sgatribusu`
  ADD KEY `sgatribusupk` (`idusu`,`codfilialuu`,`codempuu`,`idatrib`,`codfilial`,`codemp`),
  ADD KEY `sgatribusufksgatri` (`idatrib`,`codfilial`,`codemp`),
  ADD KEY `sgatribususgusuari` (`idusu`,`codfilialuu`,`codempuu`);

--
-- Índices de tabela `sgconexao`
--
ALTER TABLE `sgconexao`
  ADD KEY `sgconexaopk` (`nrconexao`),
  ADD KEY `sgconexaofksgfilia` (`codfilial`,`codemp`),
  ADD KEY `sgconexaofksgusuar` (`idusu`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgempresa`
--
ALTER TABLE `sgempresa`
  ADD PRIMARY KEY (`codemp`),
  ADD KEY `sgempresapk` (`codemp`),
  ADD KEY `sgempresafksgmunic` (`codmunic`,`siglauf`,`codpais`);

--
-- Índices de tabela `sgeqvclifor`
--
ALTER TABLE `sgeqvclifor`
  ADD KEY `sgeqvcliforpk` (`codcli`,`codfilialcl`,`codempcl`,`codfor`,`codfilialfr`,`codempfr`),
  ADD KEY `sgeqvcliforfkcpfor` (`codfor`,`codfilialfr`,`codempfr`),
  ADD KEY `sgeqvcliforfkvdcli` (`codcli`,`codfilialcl`,`codempcl`);

--
-- Índices de tabela `sgestacao`
--
ALTER TABLE `sgestacao`
  ADD KEY `sgestacaopk` (`codest`,`codfilial`,`codemp`),
  ADD KEY `sgestacaofksgproxy` (`codproxy`,`codfilialpx`,`codemppx`);

--
-- Índices de tabela `sgestacaobal`
--
ALTER TABLE `sgestacaobal`
  ADD KEY `sgestacaobalpk` (`codest`,`nrobal`,`codfilial`,`codemp`),
  ADD KEY `sgestacaobalfksges` (`codest`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgestacaoimp`
--
ALTER TABLE `sgestacaoimp`
  ADD KEY `sgestacaoimppk` (`codest`,`nroimp`,`codfilial`,`codemp`),
  ADD KEY `sgestacaoimpfksges` (`codest`,`codfilial`,`codemp`),
  ADD KEY `sgestacaoimpfksgim` (`codimp`,`codfilialip`,`codempip`),
  ADD KEY `sgestacaoimpfksgpa` (`codpapel`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgestcivil`
--
ALTER TABLE `sgestcivil`
  ADD KEY `sgestcivilpk` (`codestcivil`,`codfilial`,`codemp`),
  ADD KEY `sgestcivilfksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `sgferiado`
--
ALTER TABLE `sgferiado`
  ADD KEY `sgferiadopk` (`datafer`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgfilial`
--
ALTER TABLE `sgfilial`
  ADD PRIMARY KEY (`codemp`),
  ADD KEY `sgfilialpk` (`codfilial`,`codemp`),
  ADD KEY `sgfilialfkcpforneced` (`codfor`,`codfilialco`,`codempco`),
  ADD KEY `sgfilialfksgmunic` (`codmunic`,`siglauf`,`codpais`),
  ADD KEY `sgfilialfksgunifcod` (`codunifcod`,`codfilialuc`,`codempuc`);

--
-- Índices de tabela `sggatilho`
--
ALTER TABLE `sggatilho`
  ADD KEY `sggatilhopk` (`codobj`,`dispgat`,`codemp`);

--
-- Índices de tabela `sgimagem`
--
ALTER TABLE `sgimagem`
  ADD KEY `sgimagempk` (`codimg`,`codfilial`,`codemp`),
  ADD KEY `sgimagemfksgcatimg` (`codcatimg`,`codfilialci`,`codempci`);

--
-- Índices de tabela `sgimpressora`
--
ALTER TABLE `sgimpressora`
  ADD KEY `sgimpressorapk` (`codimp`,`codfilial`,`codemp`),
  ADD KEY `sgimpressorafksgfi` (`codfilial`,`codemp`);

--
-- Índices de tabela `sgitfluxo`
--
ALTER TABLE `sgitfluxo`
  ADD KEY `sgitfluxopk` (`codfluxo`,`seqitfluxo`,`codfilial`,`codemp`),
  ADD KEY `sgitfluxofksgfluxo` (`codfluxo`,`codfilial`,`codemp`),
  ADD KEY `sgitfluxofksgproce` (`codproc`,`codfilialpc`,`codemppc`);

--
-- Índices de tabela `sglicenca`
--
ALTER TABLE `sglicenca`
  ADD PRIMARY KEY (`codlicenca`),
  ADD KEY `codemp` (`codemp`),
  ADD KEY `cnpjcpfcli` (`cnpjcpfcli`);

--
-- Índices de tabela `sglog`
--
ALTER TABLE `sglog`
  ADD KEY `sglogidx01` (`datalog`),
  ADD KEY `sglogpk` (`codlog`,`codfilial`,`codemp`),
  ADD KEY `sglogidx02` (`tipolog`),
  ADD KEY `sglogfkpvcaixa` (`codcaixa`,`codfilialcx`,`codempcx`),
  ADD KEY `sglogfksgusuario` (`idusu`,`codfilialus`,`codempus`);

--
-- Índices de tabela `sglogcrud`
--
ALTER TABLE `sglogcrud`
  ADD KEY `sglogcrudpk` (`id`);

--
-- Índices de tabela `sgmenu`
--
ALTER TABLE `sgmenu`
  ADD KEY `sgmenupk` (`codmenu`,`codmodu`,`codsis`),
  ADD KEY `sgmenufksgmodulo` (`codmodu`,`codsis`);

--
-- Índices de tabela `sgmenuobj`
--
ALTER TABLE `sgmenuobj`
  ADD KEY `sgmenuobjok` (`codmenu`,`codmodu`,`codsis`,`idobj`,`codemp`),
  ADD KEY `sgmenuobjfksgmenu` (`codmenu`,`codmodu`,`codsis`),
  ADD KEY `sgmenuobjfksgobjet` (`idobj`,`codemp`);

--
-- Índices de tabela `sgmodetiqueta`
--
ALTER TABLE `sgmodetiqueta`
  ADD KEY `sgmodetiquetapk` (`codmodetiq`,`codfilial`,`codemp`),
  ADD KEY `sgmodetiquetafksgp` (`codpapel`,`codfilialpl`,`codemppl`);

--
-- Índices de tabela `sgmodulo`
--
ALTER TABLE `sgmodulo`
  ADD KEY `sgmodulopk` (`codmodu`,`codsis`);

--
-- Índices de tabela `sgnf`
--
ALTER TABLE `sgnf`
  ADD KEY `pk_sgnf` (`codigo`);

--
-- Índices de tabela `sgnfcce`
--
ALTER TABLE `sgnfcce`
  ADD KEY `pk_sgnfcce` (`numnf`,`modnf`,`seqnf`);

--
-- Índices de tabela `sgnfcstat`
--
ALTER TABLE `sgnfcstat`
  ADD KEY `pk_sgnfcstat` (`cstat`);

--
-- Índices de tabela `sgnflog`
--
ALTER TABLE `sgnflog`
  ADD KEY `pk_sgnflog` (`numnf`,`modnf`,`seqnf`);

--
-- Índices de tabela `sgobjeto`
--
ALTER TABLE `sgobjeto`
  ADD KEY `sgobjetopk` (`idobj`,`codemp`),
  ADD KEY `sgobjetofksgempres` (`codemp`);

--
-- Índices de tabela `sgobjetotb`
--
ALTER TABLE `sgobjetotb`
  ADD KEY `sgobjetotbfksgobje` (`idobj`,`codemp`),
  ADD KEY `sgobjetotbpk` (`codtb`,`codfilialtb`,`codemptb`,`idobj`,`codemp`),
  ADD KEY `sgobjetotbfksgtabe` (`codtb`,`codfilialtb`,`codemptb`);

--
-- Índices de tabela `sgpais`
--
ALTER TABLE `sgpais`
  ADD KEY `sgpaispk` (`codpais`);

--
-- Índices de tabela `sgpapel`
--
ALTER TABLE `sgpapel`
  ADD KEY `sgpapelpk` (`codpapel`,`codfilial`,`codemp`),
  ADD KEY `sgpapelfksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `sgpermissao`
--
ALTER TABLE `sgpermissao`
  ADD PRIMARY KEY (`nivelusu`);

--
-- Índices de tabela `sgprefere`
--
ALTER TABLE `sgprefere`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sgprefere1pk` (`codfilial`,`codemp`),
  ADD KEY `sgprefere1fkvdtabp` (`codtab`,`codfilialtb`,`codemptb`),
  ADD KEY `sgprefere1fkvdclas` (`codclascli`,`codfilialce`,`codempce`),
  ADD KEY `sgprefere1fktpmovic` (`codtipomovic`,`codfilialic`,`codempic`),
  ADD KEY `sgprefere1fktipomovorcserv` (`codtipomovs`,`codfilialts`,`codempts`),
  ADD KEY `sgprefere1fktipomovim` (`codtipomovim`,`codfilialim`,`codempim`),
  ADD KEY `sgprefere1fksgimag` (`codimg`,`codfilialig`,`codempig`),
  ADD KEY `sgprefere1fkplanopagsv` (`codplanopagsv`,`codfilialsv`,`codempsv`),
  ADD KEY `sgprefere1fkplanjr` (`codplanjr`,`codfilialjr`,`codempjr`),
  ADD KEY `sgprefere1fkplanjp` (`codplanjp`,`codfilialjp`,`codempjp`),
  ADD KEY `sgprefere1fkplandr` (`codplandr`,`codfilialdr`,`codempdr`),
  ADD KEY `sgprefere1fkplandc` (`codplandc`,`codfilialdc`,`codempdc`),
  ADD KEY `sgprefere1fkplancheque` (`codplanpc`,`codfilialpc`,`codemppc`),
  ADD KEY `sgprefere1fklfmens3` (`codmensvenda`,`codfilialme`,`codempme`),
  ADD KEY `sgprefere1fklfmens2` (`codmensicmssimples`,`codfilialms`,`codempms`),
  ADD KEY `sgprefere1fklfmens` (`codmensorc`,`codfilialmensorc`,`codempmensorc`),
  ADD KEY `sgprefere1fkfntbju` (`codtbj`,`codfilialtj`,`codemptj`),
  ADD KEY `sgprefere1fk2eqtip` (`codtipomov2`,`codfilialt2`,`codempt2`),
  ADD KEY `sgprefere1fk3eqtip` (`codtipomov3`,`codfilialt3`,`codempt3`),
  ADD KEY `sgprefere1fk4eqtip` (`codtipomov4`,`codfilialt4`,`codempt4`),
  ADD KEY `sgprefere1fk5eqtip` (`codtipomov5`,`codfilialt5`,`codempt5`),
  ADD KEY `sgprefere1fk6eqtip` (`codtipomov6`,`codfilialt6`,`codempt6`),
  ADD KEY `sgprefere1fk8eqtip` (`codtipomov8`,`codfilialt8`,`codempt8`),
  ADD KEY `sgprefere1fkvdtipc` (`codtipocli`,`codfilialtc`,`codemptc`),
  ADD KEY `sgprefere1fkcpforn` (`codfor`,`codfilialfr`,`codempfr`),
  ADD KEY `sgprefere1fkeqgrup` (`codgrup`,`codfilialgp`,`codempgp`),
  ADD KEY `sgprefere1fkeqmarc` (`codmarca`,`codfilialmc`,`codempmc`),
  ADD KEY `sgprefere1fkfnhistp` (`codhistpag`,`codfilialhistpag`,`codemphistpag`),
  ADD KEY `sgprefere1fkfnhistr` (`codhistrec`,`codfilialhistrec`,`codemphistrec`),
  ADD KEY `sgprefere1fkfnmoed` (`codmoeda`,`codfilialmo`,`codempmo`),
  ADD KEY `sgprefere1fkfnplan` (`codplanopag`,`codfilialpg`,`codemppg`),
  ADD KEY `sgprefere1fkcptipo` (`codtipofor`,`codfilialtf`,`codemptf`),
  ADD KEY `sgprefere1fkvdtran` (`codtran`,`codfilialtn`,`codemptn`);

--
-- Índices de tabela `sgprocesso`
--
ALTER TABLE `sgprocesso`
  ADD KEY `sgprocessopk` (`codproc`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgrastro`
--
ALTER TABLE `sgrastro`
  ADD PRIMARY KEY (`codrastro`);

--
-- Índices de tabela `sgrecado`
--
ALTER TABLE `sgrecado`
  ADD PRIMARY KEY (`codrecado`),
  ADD KEY `pk_sgrecado` (`codrecado`);

--
-- Índices de tabela `sgregistro`
--
ALTER TABLE `sgregistro`
  ADD PRIMARY KEY (`id_sgregistro`);

--
-- Índices de tabela `sgrevenda`
--
ALTER TABLE `sgrevenda`
  ADD PRIMARY KEY (`codrev`),
  ADD KEY `pk_sgrevenda` (`codrev`);

--
-- Índices de tabela `sgsequence_id`
--
ALTER TABLE `sgsequence_id`
  ADD KEY `sgsequence_idpk` (`table_name`);

--
-- Índices de tabela `sgsequencia`
--
ALTER TABLE `sgsequencia`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sgsequenciapk` (`sgtab`,`codfilial`,`codemp`),
  ADD KEY `sgsequenciafksgfil` (`codfilial`,`codemp`);

--
-- Índices de tabela `sgsistema`
--
ALTER TABLE `sgsistema`
  ADD PRIMARY KEY (`id`),
  ADD KEY `sgsistemapk` (`codsis`);

--
-- Índices de tabela `sgtabela`
--
ALTER TABLE `sgtabela`
  ADD KEY `sgtabelapk` (`codtb`,`codfilial`,`codemp`),
  ADD KEY `sgtabelafksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `sgtarefa`
--
ALTER TABLE `sgtarefa`
  ADD KEY `sgtarefapk` (`codtarefa`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgtipoagenda`
--
ALTER TABLE `sgtipoagenda`
  ADD KEY `pk_sgtipoagenda` (`codemp`,`codfilial`,`codtipoagd`);

--
-- Índices de tabela `sgtrataret`
--
ALTER TABLE `sgtrataret`
  ADD KEY `sgtrataretpk` (`codproc`,`codtratret`,`seqitproc`,`codfilial`,`codemp`),
  ADD KEY `sgtrataretfksgitp2` (`codprocgt`,`seqitprocgt`,`codfilialgt`,`codempgt`),
  ADD KEY `sgtrataretfksgitpr` (`codproc`,`seqitproc`,`codfilial`,`codemp`);

--
-- Índices de tabela `sguf`
--
ALTER TABLE `sguf`
  ADD KEY `sgufpk` (`siglauf`,`codpais`),
  ADD KEY `sgufidx01` (`nomeuf`),
  ADD KEY `sgufidx02` (`nomecurto`),
  ADD KEY `sguffksgpais` (`codpais`);

--
-- Índices de tabela `sgunifcod`
--
ALTER TABLE `sgunifcod`
  ADD KEY `sgunifcodpk` (`codunifcod`,`codfilial`,`codemp`);

--
-- Índices de tabela `sgusuario`
--
ALTER TABLE `sgusuario`
  ADD PRIMARY KEY (`idusu`,`codemp`,`codfilial`,`nomeusu`) USING BTREE,
  ADD KEY `sgusuariopk` (`idusu`,`codfilial`,`codemp`),
  ADD KEY `sgusuariofksgfilia` (`codfilial`,`codemp`),
  ADD KEY `emailusu` (`emailusu`);

--
-- Índices de tabela `sgversao`
--
ALTER TABLE `sgversao`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `spnatoper`
--
ALTER TABLE `spnatoper`
  ADD KEY `spnatoperlpk` (`codigo`,`cst`);

--
-- Índices de tabela `tai_empresas`
--
ALTER TABLE `tai_empresas`
  ADD PRIMARY KEY (`codacesso`);

--
-- Índices de tabela `tai_emp_servicos`
--
ALTER TABLE `tai_emp_servicos`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `tai_it_tickets`
--
ALTER TABLE `tai_it_tickets`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idticket` (`idticket`);

--
-- Índices de tabela `tai_tickets`
--
ALTER TABLE `tai_tickets`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `tai_tipos`
--
ALTER TABLE `tai_tipos`
  ADD PRIMARY KEY (`id`);

--
-- Índices de tabela `tai_whats`
--
ALTER TABLE `tai_whats`
  ADD PRIMARY KEY (`id_tai_whats`);

--
-- Índices de tabela `vdauxvenda`
--
ALTER TABLE `vdauxvenda`
  ADD KEY `vdauxvendapk` (`codvenda`,`codauxv`,`tipovenda`,`codfilial`,`codemp`),
  ADD KEY `vdauxvendafkvdvend` (`codvenda`,`tipovenda`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdclascli`
--
ALTER TABLE `vdclascli`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdclasclifksgfilia` (`codfilial`,`codemp`),
  ADD KEY `vdclasclipk` (`codclascli`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdclcomis`
--
ALTER TABLE `vdclcomis`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdclcomispk` (`codclcomis`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdcliente`
--
ALTER TABLE `vdcliente`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdclientepk` (`codcli`,`codfilial`,`codemp`),
  ADD KEY `vdclientefkvdtipoc` (`codtipocli`,`codfilialti`,`codempti`),
  ADD KEY `vdclientefkvdsetor` (`codsetor`,`codfilialsr`,`codempsr`),
  ADD KEY `vdclientefkvdclasc` (`codclascli`,`codfilialcc`,`codempcc`),
  ADD KEY `vdclientefksgunifcod` (`codunifcod`,`codfilialuc`,`codempuc`),
  ADD KEY `vdclientefksgmunicent` (`codmunicent`,`siglaufent`,`codpaisent`),
  ADD KEY `vdclientefksgmuniccob` (`codmuniccob`,`siglaufcob`,`codpaiscob`),
  ADD KEY `vdclientefksgmunic` (`codmunic`,`siglauf`,`codpais`),
  ADD KEY `vdclientefksgittab` (`codittbec`,`codtbec`,`codfilialec`,`codempec`),
  ADD KEY `vdclientefksgfilia` (`codfilial`,`codemp`),
  ADD KEY `vdclientefklftipof` (`codfisccli`,`codfilialfc`,`codempfc`),
  ADD KEY `vdclientefkfntipod` (`codtpcred`,`codfilialtr`,`codemptr`),
  ADD KEY `vdclientefkfntipob` (`codtipocob`,`codfilialtc`,`codemptc`),
  ADD KEY `vdclientefkfnplano` (`codplanopag`,`codfilialpg`,`codemppg`),
  ADD KEY `vdclientefkfnhistp` (`codhist`,`codfilialhp`,`codemphp`),
  ADD KEY `vdclientefkfncartc` (`codcartcob`,`codfilialcb`,`codempcb`,`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `vdclientefkfnbanco` (`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `vdclienteidx03` (`codpesq`,`codemppq`,`codfilialpq`),
  ADD KEY `vdclienteidx02` (`razcli`),
  ADD KEY `vdclienteidx01` (`nomecli`),
  ADD KEY `vdclientefkvdtrans` (`codtran`,`codfilialtn`,`codemptn`),
  ADD KEY `vdclientefkvdvende` (`codvend`,`codfilialvd`,`codempvd`);

--
-- Índices de tabela `vddepvenda`
--
ALTER TABLE `vddepvenda`
  ADD PRIMARY KEY (`codvenda`,`item`,`coddependente`);

--
-- Índices de tabela `vdfretevd`
--
ALTER TABLE `vdfretevd`
  ADD KEY `vdfretevdpk` (`codvenda`,`tipovenda`,`codfilial`,`codemp`),
  ADD KEY `vdfretevdfkvdtrans` (`codtran`,`codfilialtn`,`codemptn`);

--
-- Índices de tabela `vditorcamento`
--
ALTER TABLE `vditorcamento`
  ADD KEY `vditorcamentoidxstitorc` (`statusitorc`),
  ADD KEY `vditorcamentopk` (`codorc`,`coditorc`,`tipoorc`,`codfilial`,`codemp`),
  ADD KEY `vditorcamentovencaut` (`vencautorizorc`),
  ADD KEY `vditorcamentofkeqa` (`codalmox`,`codfilialax`,`codempax`),
  ADD KEY `vditorcamentofkeql` (`codlote`,`codprod`,`codfilialle`,`codemple`),
  ADD KEY `vditorcamentofkeqp` (`codprod`,`codfilialpd`,`codemppd`),
  ADD KEY `vditorcamentofksgl` (`codlog`,`codfiliallg`,`codemplg`),
  ADD KEY `vditorcamentofkvdo` (`codorc`,`tipoorc`,`codfilial`,`codemp`),
  ADD KEY `vditorcamentofkvdp` (`codpe`,`codfilialpe`,`codemppe`);

--
-- Índices de tabela `vditregracomis`
--
ALTER TABLE `vditregracomis`
  ADD KEY `vditregracomispk` (`codregrcomis`,`seqitrc`,`codfilial`,`codemp`),
  ADD KEY `vditregracomisfkre` (`codregrcomis`,`codfilial`,`codemp`),
  ADD KEY `vditregracomisfktv` (`codtipovend`,`codfilialtv`,`codemptv`),
  ADD KEY `vditregracomisfkvendedor` (`codvend`,`codfilialvd`,`codempvd`);

--
-- Índices de tabela `vditromaneio`
--
ALTER TABLE `vditromaneio`
  ADD KEY `vditromaneio1` (`coditroma`,`codroma`,`codfilial`,`codemp`),
  ADD KEY `vditromaneiofkvdro` (`codroma`,`codfilial`,`codemp`),
  ADD KEY `vditromaneiofkvdve` (`codvenda`,`tipovenda`,`codfilialva`,`codempva`);

--
-- Índices de tabela `vditvenda`
--
ALTER TABLE `vditvenda`
  ADD PRIMARY KEY (`codvenda`,`coditvenda`),
  ADD KEY `vditvendapk` (`codvenda`,`coditvenda`,`tipovenda`,`codfilial`,`codemp`),
  ADD KEY `vditvendaidx01` (`codvendavr`,`coditvendavr`,`tipovendavr`,`codfilial`,`codemp`),
  ADD KEY `vditvendafkatconve` (`codconv`,`codfilialcv`,`codempcv`),
  ADD KEY `vditvendafkcpitcompra` (`codcompra`,`coditcompra`,`codfilialcp`,`codempcp`),
  ADD KEY `vditvendafkeqalmox` (`codalmox`,`codfilialax`,`codempax`),
  ADD KEY `vditvendafkeqlote` (`codlote`,`codprod`,`codfilialle`,`codemple`),
  ADD KEY `vditvendafkeqprodu` (`codprod`,`codfilialpd`,`codemppd`),
  ADD KEY `vditvendafkeqserietmp` (`numserietmp`,`codprod`,`codfilial`,`codemp`),
  ADD KEY `vditvendafklfitclfiscal` (`codempif`,`codfilialif`,`codfisc`,`coditfisc`),
  ADD KEY `vditvendafklfmensa` (`codmens`,`codfilialme`,`codempme`),
  ADD KEY `vditvendafklfnatop` (`codnat`,`codfilialnt`,`codempnt`),
  ADD KEY `vditvendafklftratt` (`codtrattrib`,`codfilialtt`,`codemptt`),
  ADD KEY `vditvendafksglog` (`codlog`,`codfiliallg`,`codemplg`),
  ADD KEY `vditvendafkvdprazo` (`codpe`,`codfilialpe`,`codemppe`),
  ADD KEY `vditvendafkvdvenda` (`codvenda`,`tipovenda`,`codfilial`,`codemp`);

--
-- Índices de tabela `vditvendavditcontr`
--
ALTER TABLE `vditvendavditcontr`
  ADD KEY `vditvendavditconpk` (`codvenda`,`coditvenda`,`tipovenda`,`codfilial`,`codemp`),
  ADD KEY `vditvendactfkvdct` (`codcontr`,`codfilialct`,`codempct`);

--
-- Índices de tabela `vdkit`
--
ALTER TABLE `vdkit`
  ADD KEY `vdkitpk` (`codkit`,`codfilial`,`codemp`),
  ADD KEY `vdkitfkeqproduto` (`codprod`,`codfilialpd`,`codemppd`);

--
-- Índices de tabela `vdlogsitcontr`
--
ALTER TABLE `vdlogsitcontr`
  ADD KEY `vdlogsitcontrpk` (`codcontr`,`seqlog`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdmodcontr`
--
ALTER TABLE `vdmodcontr`
  ADD KEY `vdmodcontrpk` (`codmodcontr`,`codfilial`,`codemp`),
  ADD KEY `vdmodcontrfkcartc` (`codcartcob`,`codfilialcb`,`codempcb`,`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `vdmodcontrfkfnbco` (`codbanco`,`codfilialbo`,`codempbo`);

--
-- Índices de tabela `vdmotorista`
--
ALTER TABLE `vdmotorista`
  ADD KEY `vdmotoristapk` (`codmot`,`codfilial`,`codemp`),
  ADD KEY `vdmotoristafksgmunic` (`codmunic`,`siglauf`,`codpais`),
  ADD KEY `vdmotoristafkvdtransp` (`codtran`,`codfilialtn`,`codemptn`);

--
-- Índices de tabela `vdobscli`
--
ALTER TABLE `vdobscli`
  ADD KEY `vdobsclipk` (`codcli`,`seqobscli`,`codfilial`,`codemp`),
  ADD KEY `vdobsclifkvdclient` (`codcli`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdoportunidade`
--
ALTER TABLE `vdoportunidade`
  ADD PRIMARY KEY (`id_vdoportunidade`);

--
-- Índices de tabela `vdorcamento`
--
ALTER TABLE `vdorcamento`
  ADD KEY `vdorcamentopk` (`codorc`,`tipoorc`,`codfilial`,`codemp`),
  ADD KEY `vdorcamentoidxstorc` (`statusorc`),
  ADD KEY `vdorcamentfkvdtran` (`codtran`,`codfilialtn`,`codemptn`),
  ADD KEY `vdorcamentofkatate` (`codatend`,`codfilialae`,`codempae`),
  ADD KEY `vdorcamentofkatcon` (`codconv`,`codfilialcv`,`codempcv`),
  ADD KEY `vdorcamentofkattip` (`codtpconv`,`codfilialtc`,`codemptc`),
  ADD KEY `vdorcamentofkeqtipomov` (`codtipomov`,`codfilialtm`,`codemptm`),
  ADD KEY `vdorcamentofkfnpla` (`codplanopag`,`codfilialpg`,`codemppg`),
  ADD KEY `vdorcamentofkvdclc` (`codclcomis`,`codfilialcm`,`codempcm`),
  ADD KEY `vdorcamentofkvdcli` (`codcli`,`codfilialcl`,`codempcl`),
  ADD KEY `vdorcamentofkvdven` (`codvend`,`codfilialvd`,`codempvd`);

--
-- Índices de tabela `vdprazoent`
--
ALTER TABLE `vdprazoent`
  ADD KEY `vdprazoentpk` (`codpe`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdprecoprod`
--
ALTER TABLE `vdprecoprod`
  ADD KEY `vdprecoprodpk` (`codprecoprod`,`codprod`,`codfilial`,`codemp`),
  ADD KEY `vdprecoprodfkeqpro` (`codprod`,`codfilial`,`codemp`),
  ADD KEY `vdprecoprodfkfnpla` (`codplanopag`,`codfilialpg`,`codemppg`),
  ADD KEY `vdprecoprodfkvdcla` (`codclascli`,`codfilialcc`,`codempcc`),
  ADD KEY `vdprecoprodfkvdtab` (`codtab`,`codfilialtb`,`codemptb`);

--
-- Índices de tabela `vdprevtribitorc`
--
ALTER TABLE `vdprevtribitorc`
  ADD KEY `vdprevtribitorcpk` (`codorc`,`coditorc`,`tipoorc`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdreceita`
--
ALTER TABLE `vdreceita`
  ADD PRIMARY KEY (`id`),
  ADD KEY `pk_vdreceita` (`codreceita`);

--
-- Índices de tabela `vdregcomisdesc`
--
ALTER TABLE `vdregcomisdesc`
  ADD KEY `vdregcomisdescpk` (`codemp`,`codfilial`,`codregcomisdesc`),
  ADD KEY `vdregcomisdescfkfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `vdregracomis`
--
ALTER TABLE `vdregracomis`
  ADD KEY `vdregracomispk` (`codregrcomis`,`codfilial`,`codemp`),
  ADD KEY `vdregracomisfkeqsecao` (`codsecao`,`codfilialsc`,`codempsc`);

--
-- Índices de tabela `vdremconsig`
--
ALTER TABLE `vdremconsig`
  ADD KEY `vdremconsigpk` (`codconsig`,`codremco`,`codfilial`,`codemp`),
  ADD KEY `vdremconsigfkeqpd` (`codprod`,`codfilialpd`,`codemppd`),
  ADD KEY `vdremconsigfkvdconsig` (`codconsig`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdromaneio`
--
ALTER TABLE `vdromaneio`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdromaneiopk` (`codroma`,`codfilial`,`codemp`),
  ADD KEY `vdromaneiofkeqexpedicao` (`ticket`,`codfilialex`,`codempex`),
  ADD KEY `vdromaneiofksgfili` (`codfilial`,`codemp`),
  ADD KEY `vdromaneiofkvdtrans` (`codtran`,`codfilialtn`,`codemptn`);

--
-- Índices de tabela `vdsetor`
--
ALTER TABLE `vdsetor`
  ADD KEY `vdsetorpk` (`codsetor`,`codfilial`,`codemp`),
  ADD KEY `vdsetoridx01` (`descsetor`),
  ADD KEY `vdsetorfksgfilial` (`codfilial`,`codemp`);

--
-- Índices de tabela `vdsetorrota`
--
ALTER TABLE `vdsetorrota`
  ADD KEY `vdsetorrotapk` (`codemp`,`codfilial`,`codsetor`,`sequencia`),
  ADD KEY `vdsetorrotafkcliente` (`codcli`,`codfilialcl`,`codempcl`);

--
-- Índices de tabela `vdstatusorc`
--
ALTER TABLE `vdstatusorc`
  ADD KEY `vdstatusorcpk` (`codorc`,`tipoorc`,`codfilial`,`codemp`,`codittb`,`codtb`,`codfilialtb`,`codemptb`),
  ADD KEY `vdstatusorcfksgitt` (`codittb`,`codtb`,`codfilialtb`,`codemptb`),
  ADD KEY `vdstatusorcfkvdorc` (`codorc`,`tipoorc`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdtabpreco`
--
ALTER TABLE `vdtabpreco`
  ADD KEY `vdtabprecopk` (`codtab`,`codfilial`,`codemp`),
  ADD KEY `vdtabprecofksgfili` (`codfilial`,`codemp`);

--
-- Índices de tabela `vdtef`
--
ALTER TABLE `vdtef`
  ADD KEY `vdtefpk` (`codvenda`,`nsutef`,`tipovenda`,`codfilial`,`codemp`),
  ADD KEY `vdteffkvdvenda` (`codvenda`,`tipovenda`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdtipocli`
--
ALTER TABLE `vdtipocli`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdtipoclipk` (`codtipocli`,`codfilial`,`codemp`),
  ADD KEY `vdtipocliidx01` (`desctipocli`),
  ADD KEY `vdtipoclifksgfilia` (`codfilial`,`codemp`);

--
-- Índices de tabela `vdtipovend`
--
ALTER TABLE `vdtipovend`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdtipovendpk` (`codtipovend`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdtransp`
--
ALTER TABLE `vdtransp`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdtransppk` (`codtran`,`codfilial`,`codemp`),
  ADD KEY `vdtranspidx01` (`raztran`),
  ADD KEY `vdtranspfkcpfornece` (`codfor`,`codfilialfr`,`codempfr`),
  ADD KEY `vdtranspfkrhcodgps` (`codgps`),
  ADD KEY `vdtranspfksgfilial` (`codfilial`,`codemp`),
  ADD KEY `vdtranspfksgmunic` (`codmunic`,`siglauf`,`codpais`),
  ADD KEY `vdtranspfksgunifcod` (`codunifcod`,`codfilialuc`,`codempuc`);

--
-- Índices de tabela `vdtranspmot`
--
ALTER TABLE `vdtranspmot`
  ADD KEY `vdtranspmotpk` (`codtran`,`codfilial`,`codemp`,`codmot`,`codfilialmt`,`codempmt`),
  ADD KEY `vdtranspmotfkmot` (`codmot`,`codfilialmt`,`codempmt`),
  ADD KEY `vdtranspmotfktransp` (`codtran`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdtranspveic`
--
ALTER TABLE `vdtranspveic`
  ADD KEY `vdtranspveicpk` (`codtran`,`codfilial`,`codemp`,`codveic`,`codfilialve`,`codempve`),
  ADD KEY `vdtranspveicfktransp` (`codtran`,`codfilial`,`codemp`),
  ADD KEY `vdtranspveicfkveiculo` (`codveic`,`codfilialve`,`codempve`);

--
-- Índices de tabela `vdveiculo`
--
ALTER TABLE `vdveiculo`
  ADD KEY `vdveiculopk` (`codveic`,`codfilial`,`codemp`),
  ADD KEY `vdveiculofksgmunic` (`codmunic`,`siglauf`,`codpais`),
  ADD KEY `vdveiculofkvdtransp` (`codtran`,`codfilialtn`,`codemptn`);

--
-- Índices de tabela `vdvenda`
--
ALTER TABLE `vdvenda`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdvendapk` (`codvenda`,`tipovenda`,`codfilial`,`codemp`),
  ADD KEY `vdvendafkvdclcomis` (`codclcomis`,`codfilialcm`,`codempcm`),
  ADD KEY `vdvendafksgfilial` (`codfilial`,`codemp`),
  ADD KEY `vdvendafkpvcaixa` (`codcaixa`,`codfilialcx`,`codempcx`),
  ADD KEY `vdvendafkppop` (`codop`,`seqop`,`codfilialop`,`codempop`),
  ADD KEY `vdvendafklfserie` (`serie`,`codfilialse`,`codempse`),
  ADD KEY `vdvendafkfntipocob` (`codtipocob`,`codfilialtc`,`codemptc`),
  ADD KEY `vdvendafkvdcliente` (`codcli`,`codfilialcl`,`codempcl`),
  ADD KEY `vdvendafkfnplanopa` (`codplanopag`,`codfilialpg`,`codemppg`),
  ADD KEY `vdvendafkfnbanco` (`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `vdvendafkeqtipomov` (`codtipomov`,`codfilialtm`,`codemptm`),
  ADD KEY `vdvendafkeqrecmer` (`ticket`,`codfilialrm`,`codemprm`),
  ADD KEY `vdvendafkcartcob` (`codcartcob`,`codfilialcb`,`codempcb`,`codbanco`,`codfilialbo`,`codempbo`),
  ADD KEY `vdvendaidx02` (`dtsaidavenda`),
  ADD KEY `vdvendaidx01` (`dtemitvenda`),
  ADD KEY `vdvendafkfnconta` (`numconta`,`codfilialca`,`codempca`),
  ADD KEY `vdvendafkvdvendedo` (`codvend`,`codfilialvd`,`codempvd`);

--
-- Índices de tabela `vdvendacomis`
--
ALTER TABLE `vdvendacomis`
  ADD KEY `vdvendacomispk` (`codvenda`,`tipovenda`,`seqvc`,`codfilial`,`codemp`),
  ADD KEY `vdvendacomisfkvdit` (`codregrcomis`,`seqitrc`,`codfilialrc`,`codemprc`),
  ADD KEY `vdvendacomisfkveda` (`codvenda`,`tipovenda`,`codfilial`,`codemp`),
  ADD KEY `vdvendacomisfkvedo` (`codvend`,`codfilialvd`,`codempvd`);

--
-- Índices de tabela `vdvendaconsig`
--
ALTER TABLE `vdvendaconsig`
  ADD KEY `vdvendaconsigpk` (`codconsig`,`codvendaco`,`codfilial`,`codemp`),
  ADD KEY `vdvendaconsigfkeqpd` (`codprod`,`codfilialpd`,`codemppd`),
  ADD KEY `vdvendaconsigfkfnplp` (`codplanopag`,`codfilialpg`,`codemppg`),
  ADD KEY `vdvendaconsigfkfnsublanca` (`codsublanca`,`codlanca`,`codfilialsl`,`codempsl`),
  ADD KEY `vdvendaconsigfkfnsublancasc` (`codsublancasc`,`codlancasc`,`codfilialsc`,`codempsc`),
  ADD KEY `vdvendaconsigfkvdcl` (`codcli`,`codfilialcl`,`codempcl`),
  ADD KEY `vdvendaconsigfkvdco` (`codconsig`,`codfilial`,`codemp`),
  ADD KEY `vdvendaconsigfkvditvenda` (`codvenda`,`coditvenda`,`tipovenda`,`codfilialvd`,`codempvd`);

--
-- Índices de tabela `vdvendaentrega`
--
ALTER TABLE `vdvendaentrega`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdvendaentregapk` (`codvenda`,`tipovenda`,`codfilial`,`codemp`);

--
-- Índices de tabela `vdvendaorc`
--
ALTER TABLE `vdvendaorc`
  ADD KEY `vdvendaorcpk` (`codvenda`,`coditvenda`,`tipovenda`,`codfilial`,`codemp`,`codorc`,`coditorc`,`tipoorc`,`codfilialor`,`codempor`),
  ADD KEY `vdvendaorcfkvditve` (`codvenda`,`coditvenda`,`tipovenda`,`codfilial`,`codemp`),
  ADD KEY `vdvendaorcfkvdorca` (`codorc`,`coditorc`,`tipoorc`,`codfilialor`,`codempor`);

--
-- Índices de tabela `vdvendedor`
--
ALTER TABLE `vdvendedor`
  ADD PRIMARY KEY (`id`),
  ADD KEY `vdvendedorpk` (`codvend`,`codfilial`,`codemp`),
  ADD KEY `vdvendedoridx01` (`nomevend`),
  ADD KEY `vdvendedorfkeqsetor` (`codsecao`,`codfilialsc`,`codempsc`),
  ADD KEY `vdvendedorfkfncont` (`numconta`,`codfilialca`,`codempca`),
  ADD KEY `vdvendedorfkfnplan` (`codplan`,`codfilialpn`,`codemppn`),
  ADD KEY `vdvendedorfkrhfunc` (`codfunc`,`codfilialfu`,`codempfu`),
  ADD KEY `vdvendedorfksgfili` (`codfilial`,`codemp`),
  ADD KEY `vdvendedorfkvdclco` (`codclcomis`,`codfilialcm`,`codempcm`),
  ADD KEY `vdvendedorfkvdseto` (`codsetor`,`codfilialse`,`codempse`),
  ADD KEY `vdvendedorfkvdtipo` (`codtipovend`,`codfilialtv`,`codemptv`);

--
-- AUTO_INCREMENT para tabelas despejadas
--

--
-- AUTO_INCREMENT de tabela `atatendente`
--
ALTER TABLE `atatendente`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `attarefa`
--
ALTER TABLE `attarefa`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `attipoatend`
--
ALTER TABLE `attipoatend`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `cpcentral`
--
ALTER TABLE `cpcentral`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `cpcompra`
--
ALTER TABLE `cpcompra`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `cpforneced`
--
ALTER TABLE `cpforneced`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `cpitcentral`
--
ALTER TABLE `cpitcentral`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `cpparc`
--
ALTER TABLE `cpparc`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `cptipofor`
--
ALTER TABLE `cptipofor`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `eqalmox`
--
ALTER TABLE `eqalmox`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `eqgrupo`
--
ALTER TABLE `eqgrupo`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `eqinvprod`
--
ALTER TABLE `eqinvprod`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `eqmarca`
--
ALTER TABLE `eqmarca`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `eqproced`
--
ALTER TABLE `eqproced`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `eqproduto`
--
ALTER TABLE `eqproduto`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `eqtipomov`
--
ALTER TABLE `eqtipomov`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `equnidade`
--
ALTER TABLE `equnidade`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `fncc`
--
ALTER TABLE `fncc`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `fnconta`
--
ALTER TABLE `fnconta`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `fnmodboleto`
--
ALTER TABLE `fnmodboleto`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `fnpagar`
--
ALTER TABLE `fnpagar`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `fnplanejamento`
--
ALTER TABLE `fnplanejamento`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `fnplanopag`
--
ALTER TABLE `fnplanopag`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `fnreceber`
--
ALTER TABLE `fnreceber`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `fntipocob`
--
ALTER TABLE `fntipocob`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `fntiporestr`
--
ALTER TABLE `fntiporestr`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `lfclfiscal`
--
ALTER TABLE `lfclfiscal`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `lfmensagem`
--
ALTER TABLE `lfmensagem`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `lfregrafiscal`
--
ALTER TABLE `lfregrafiscal`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sglicenca`
--
ALTER TABLE `sglicenca`
  MODIFY `codlicenca` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sgprefere`
--
ALTER TABLE `sgprefere`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sgrastro`
--
ALTER TABLE `sgrastro`
  MODIFY `codrastro` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sgrecado`
--
ALTER TABLE `sgrecado`
  MODIFY `codrecado` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sgregistro`
--
ALTER TABLE `sgregistro`
  MODIFY `id_sgregistro` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sgrevenda`
--
ALTER TABLE `sgrevenda`
  MODIFY `codrev` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sgsequencia`
--
ALTER TABLE `sgsequencia`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sgsistema`
--
ALTER TABLE `sgsistema`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sgusuario`
--
ALTER TABLE `sgusuario`
  MODIFY `idusu` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `sgversao`
--
ALTER TABLE `sgversao`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `tai_emp_servicos`
--
ALTER TABLE `tai_emp_servicos`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `tai_it_tickets`
--
ALTER TABLE `tai_it_tickets`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `tai_tickets`
--
ALTER TABLE `tai_tickets`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `tai_tipos`
--
ALTER TABLE `tai_tipos`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `tai_whats`
--
ALTER TABLE `tai_whats`
  MODIFY `id_tai_whats` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdclascli`
--
ALTER TABLE `vdclascli`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdclcomis`
--
ALTER TABLE `vdclcomis`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdcliente`
--
ALTER TABLE `vdcliente`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdoportunidade`
--
ALTER TABLE `vdoportunidade`
  MODIFY `id_vdoportunidade` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdreceita`
--
ALTER TABLE `vdreceita`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdromaneio`
--
ALTER TABLE `vdromaneio`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdtipocli`
--
ALTER TABLE `vdtipocli`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdtipovend`
--
ALTER TABLE `vdtipovend`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdtransp`
--
ALTER TABLE `vdtransp`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdvenda`
--
ALTER TABLE `vdvenda`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdvendaentrega`
--
ALTER TABLE `vdvendaentrega`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT de tabela `vdvendedor`
--
ALTER TABLE `vdvendedor`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;
COMMIT;

/*!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 */;
