-- generated by export_tables.php on 2025-12-02 16:02:03
-- source: ip.sysfar.com.br/gtsyscon_gtsys -> table: gtsys_ncm_reftrib

create table gtsys_ncm_reftrib
(
  `codigo` int(11) NOT NULL AUTO_INCREMENT,
  `codigo_ncm` int(11) NOT NULL,
  `perc_icms` float(5,2) DEFAULT NULL,
  `codigo_ibs_cbs_class` int(11) DEFAULT NULL,
  `codigo_ibs_cbs` char(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `cbs_aliquota` double(5,2) DEFAULT NULL,
  `cbs_reducao` double(5,2) DEFAULT NULL,
  `ibs_aliquota` double(5,2) DEFAULT NULL,
  `ibs_reducao` double(5,2) DEFAULT NULL,
  `aliq_imposto` double(5,2) DEFAULT NULL,
  `red_imposto` double(5,2) DEFAULT NULL,
  `ano` int(11) DEFAULT NULL,
  `anexo` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`codigo`),
  CONSTRAINT `fk_reftrib_cbs` FOREIGN KEY (`codigo_ibs_cbs`) REFERENCES `gtsys_ibs_cbs` (`codigo`),
  CONSTRAINT `gtsys_ncm_reftrib_gtsys_ibs_cbs_class_codigo_fk` FOREIGN KEY (`codigo_ibs_cbs_class`) REFERENCES `gtsys_ibs_cbs_class` (`codigo`),
  CONSTRAINT `gtsys_ncm_reftrib_gtsys_ibs_cbs_codigo_fk` FOREIGN KEY (`codigo_ncm`) REFERENCES `gtsys_ncm` (`codigo`)
)ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

create unique index unique_codigo_ncm
    on gtsys_ncm_reftrib (codigo_ncm);

create index gtsys_ncm_reftrib_gtsys_ibs_cbs_class_codigo_fk
    on gtsys_ncm_reftrib (codigo_ibs_cbs_class);

create index fk_reftrib_cbs
    on gtsys_ncm_reftrib (codigo_ibs_cbs);

