giganet_conecta
Version:
Aplicação com o fim de facilitar conexões com APi's e Banco de Dados (MySql, Mongo e Elasticsearch).
949 lines (942 loc) • 18.5 kB
JavaScript
const { Model, DataTypes } = require("sequelize");
module.exports = MovimentoProdutos
async function MovimentoProdutos(sequelize) {
class Model_MovimentoProdutos extends Model { }
Model_MovimentoProdutos.init({
id: {
autoIncrement: true,
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true
},
id_produto: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'produtos',
key: 'id'
}
},
valor_unitario: {
type: DataTypes.DECIMAL(18, 9),
allowNull: false
},
quantidade: {
type: DataTypes.DECIMAL(15, 9),
allowNull: false,
defaultValue: 0.000000000
},
valor_ipi: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
},
valor_icm: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
},
valor_total: {
type: DataTypes.DECIMAL(15, 2),
allowNull: false
},
id_entrada: {
type: DataTypes.INTEGER,
allowNull: false
},
id_unidade: {
type: DataTypes.INTEGER,
allowNull: true
},
id_pedido_compra: {
type: DataTypes.INTEGER,
allowNull: false
},
id_pedido_compra_itens: {
type: DataTypes.INTEGER,
allowNull: false
},
pdesconto: {
type: DataTypes.DECIMAL(8, 5),
allowNull: false
},
vdesconto: {
type: DataTypes.DECIMAL(15, 2),
allowNull: false
},
cfop: {
type: DataTypes.INTEGER,
allowNull: true
},
bicms: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
},
picms: {
type: DataTypes.DECIMAL(5, 2),
allowNull: true,
defaultValue: 0.00
},
bipi: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
},
pipi: {
type: DataTypes.DECIMAL(5, 2),
allowNull: true,
defaultValue: 0.00
},
custo: {
type: DataTypes.DECIMAL(15, 2),
allowNull: false
},
tipo: {
type: DataTypes.ENUM('E', 'S', 'I'),
allowNull: false
},
id_saida: {
type: DataTypes.INTEGER,
allowNull: false
},
id_itens_pedido: {
type: DataTypes.INTEGER,
allowNull: false
},
qtde_saida: {
type: DataTypes.DECIMAL(15, 9),
allowNull: true,
defaultValue: 0.000000000
},
id_inventario: {
type: DataTypes.INTEGER,
allowNull: true
},
data: {
type: DataTypes.DATEONLY,
allowNull: true
},
id_baixa_lote: {
type: DataTypes.INTEGER,
allowNull: true
},
id_acabamento: {
type: DataTypes.INTEGER,
allowNull: true
},
descricao: {
type: DataTypes.STRING(200),
allowNull: true
},
estoque: {
type: DataTypes.ENUM('S', 'N', 'L'),
allowNull: true,
defaultValue: "S"
},
filial_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'filial',
key: 'id'
}
},
volumes: {
type: DataTypes.INTEGER,
allowNull: true
},
pcomissao: {
type: DataTypes.DECIMAL(5, 2),
allowNull: true
},
fator_conversao: {
type: DataTypes.DECIMAL(15, 9),
allowNull: true,
defaultValue: 1.000000000
},
tipo_tributacao: {
type: DataTypes.ENUM('ICMS', 'ISSQN'),
allowNull: true
},
icms_regime: {
type: DataTypes.ENUM('1', '2'),
allowNull: true
},
icms_sn_stributaria: {
type: DataTypes.STRING(3),
allowNull: true
},
icms_sn_origem: {
type: DataTypes.INTEGER,
allowNull: true
},
pis_situacao_tributaria: {
type: DataTypes.STRING(10),
allowNull: true
},
cofins_situacao_tributaria: {
type: DataTypes.STRING(10),
allowNull: true
},
iss_tributacao: {
type: DataTypes.STRING(2),
allowNull: true
},
iss_valor_base_calculo: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
iss_aliquota: {
type: DataTypes.DECIMAL(5, 4),
allowNull: true
},
iss_lista_servico: {
type: DataTypes.STRING(9),
allowNull: true
},
iss_uf: {
type: DataTypes.INTEGER,
allowNull: true
},
iss_municipio_ocorencia: {
type: DataTypes.STRING(10),
allowNull: true
},
iss_valor: {
type: DataTypes.DECIMAL(15, 5),
allowNull: true
},
ncm: {
type: DataTypes.STRING(50),
allowNull: true
},
ex_tipi: {
type: DataTypes.STRING(50),
allowNull: true
},
id_classificacao_tributaria: {
type: DataTypes.INTEGER,
allowNull: true
},
pesol: {
type: DataTypes.DECIMAL(15, 3),
allowNull: true,
defaultValue: 0.000
},
pesob: {
type: DataTypes.DECIMAL(15, 3),
allowNull: true,
defaultValue: 0.000
},
unidade_sigla: {
type: DataTypes.STRING(10),
allowNull: true
},
codigo_fornecedor: {
type: DataTypes.STRING(50),
allowNull: true
},
id_lote: {
type: DataTypes.INTEGER,
allowNull: true
},
bicms_st: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
valor_icms_st: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
valor_frete: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
picms_st: {
type: DataTypes.DECIMAL(5, 2),
allowNull: true
},
descricao_fornecedor: {
type: DataTypes.STRING(150),
allowNull: true
},
cst: {
type: DataTypes.STRING(10),
allowNull: true
},
status: {
type: DataTypes.ENUM('N', 'C'),
allowNull: true,
defaultValue: "N"
},
id_class_fiscal: {
type: DataTypes.INTEGER,
allowNull: true
},
icms_modBC: {
type: DataTypes.SMALLINT,
allowNull: true
},
di_adicao: {
type: DataTypes.STRING(3),
allowNull: true
},
di_cod_fabricante: {
type: DataTypes.INTEGER,
allowNull: true
},
di_seqadicao: {
type: DataTypes.INTEGER,
allowNull: true
},
mp_pis_bc: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
mp_pis_alq: {
type: DataTypes.DECIMAL(5, 3),
allowNull: true
},
mp_pis_valor: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
mp_cofins_bc: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
mp_cofins_alq: {
type: DataTypes.DECIMAL(5, 3),
allowNull: true
},
mp_cofins_valor: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
mp_ii_alq: {
type: DataTypes.DECIMAL(5, 3),
allowNull: true
},
mp_ii_valor: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
mp_ii_bc: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
mp_ii_desp_aduaneira: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
mp_ii_iof: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
mp_ipi_sit_tributaria: {
type: DataTypes.STRING(3),
allowNull: true
},
mp_ipi_classe_enguadramento: {
type: DataTypes.STRING(50),
allowNull: true
},
mp_ipi_cnpj_produtor: {
type: DataTypes.STRING(30),
allowNull: true
},
mp_ipi_codigo_enquadramento: {
type: DataTypes.STRING(30),
allowNull: true
},
mp_ipi_codigo_selo_controle: {
type: DataTypes.STRING(100),
allowNull: true
},
mp_ipi_tipo_calculo: {
type: DataTypes.ENUM('P', 'V'),
allowNull: true
},
old_itens_pedido: {
type: DataTypes.INTEGER,
allowNull: true
},
id_contrato: {
type: DataTypes.INTEGER,
allowNull: true
},
id_contrato_servicos: {
type: DataTypes.INTEGER,
allowNull: true
},
patrimonio: {
type: DataTypes.INTEGER,
allowNull: true
},
numero_serie: {
type: DataTypes.STRING(50),
allowNull: true
},
status_comodato: {
type: DataTypes.ENUM('E', 'D', 'B', 'A'),
allowNull: true
},
id_devolucao: {
type: DataTypes.INTEGER,
allowNull: true
},
icms_modBCst: {
type: DataTypes.SMALLINT,
allowNull: true
},
icms_pMVAST: {
type: DataTypes.DECIMAL(10, 2),
allowNull: true,
defaultValue: 0.00
},
id_oss_mensagem: {
type: DataTypes.INTEGER,
allowNull: true
},
id_su_oss_kit_equipamento: {
type: DataTypes.INTEGER,
allowNull: true
},
garantia_oss: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "N"
},
id_terceiro_oss: {
type: DataTypes.INTEGER,
allowNull: true
},
tipo_produto: {
type: DataTypes.ENUM('C', 'S', 'F', 'M', 'P', 'O'),
allowNull: true
},
id_oss_chamado: {
type: DataTypes.INTEGER,
allowNull: true
},
difal_vbcufdest: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
difal_pfcupfdest: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
difal_picmsufdest: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
difal_picmsinter: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
difal_picmsinterpart: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
difal_vfcpufdest: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
difal_vicmsufdest: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
difal_vicmsufremet: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
valor_outros: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
},
iss_aliquota_retido: {
type: DataTypes.DECIMAL(5, 4),
allowNull: true
},
iss_valor_retido: {
type: DataTypes.DECIMAL(15, 5),
allowNull: true
},
ultima_atualizacao: {
type: DataTypes.DATE,
allowNull: true
},
id_negociacao: {
type: DataTypes.INTEGER,
allowNull: true
},
id_almox: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
},
id_transf_almox: {
type: DataTypes.INTEGER,
allowNull: true
},
icms_predbc: {
type: DataTypes.DECIMAL(10, 3),
allowNull: true
},
id_transf_almox_item: {
type: DataTypes.INTEGER,
allowNull: true
},
id_moeda: {
type: DataTypes.INTEGER,
allowNull: true
},
qtde_pedido: {
type: DataTypes.DECIMAL(15, 9),
allowNull: true
},
id_requisacao_material_item: {
type: DataTypes.INTEGER,
allowNull: true
},
irrf_aliquota: {
type: DataTypes.DECIMAL(3, 2),
allowNull: true
},
irrf_valor: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
csll_aliquota: {
type: DataTypes.DECIMAL(3, 2),
allowNull: true
},
csll_valor: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
pis_retido_aliquota: {
type: DataTypes.DECIMAL(3, 2),
allowNull: true
},
pis_retido_valor: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
cofins_retido_aliquota: {
type: DataTypes.DECIMAL(3, 2),
allowNull: true
},
cofins_retido_valor: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
tributacao_digitada: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "N"
},
pacrescimo: {
type: DataTypes.DECIMAL(8, 5),
allowNull: false
},
vacrescimo: {
type: DataTypes.DECIMAL(15, 2),
allowNull: false
},
pdesconto_finan: {
type: DataTypes.DECIMAL(5, 2),
allowNull: false
},
vdesconto_finan: {
type: DataTypes.DECIMAL(15, 2),
allowNull: false
},
valor_isentas_icms: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
valor_outras_icms: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
id_ajuste_estoque: {
type: DataTypes.INTEGER,
allowNull: true
},
id_vd_contratos_produtos: {
type: DataTypes.INTEGER,
allowNull: true
},
id_cliente_contrato_servicos: {
type: DataTypes.INTEGER,
allowNull: true
},
tipo_fiscal_plano: {
type: DataTypes.ENUM('I', 'T', 'S', 'M', 'SVA', 'TV', 'SMP'),
allowNull: false,
defaultValue: "I"
},
id_estrutura: {
type: DataTypes.INTEGER,
allowNull: true
},
imobilizado: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
id_patrimonio: {
type: DataTypes.INTEGER,
allowNull: true
},
descartado: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true
},
id_equipamento_tv: {
type: DataTypes.INTEGER,
allowNull: true
},
status_produto: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 1
},
v_fust: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
v_funttel: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
p_fust: {
type: DataTypes.DECIMAL(3, 2),
allowNull: true
},
p_funttel: {
type: DataTypes.DECIMAL(3, 2),
allowNull: true
},
historico: {
type: DataTypes.STRING(150),
allowNull: true
},
tipo_preenchimento_tributacao: {
type: DataTypes.ENUM('CM', 'CA', 'CX'),
allowNull: false,
defaultValue: "CM"
},
numero_patrimonial: {
type: DataTypes.STRING(25),
allowNull: true
},
importando_dfe: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "N"
},
ultima_situacao_patrimonio: {
type: DataTypes.INTEGER,
allowNull: true
},
nfci: {
type: DataTypes.STRING(250),
allowNull: true
},
tipo_transferencia: {
type: DataTypes.ENUM('AOS'),
allowNull: true
},
mac: {
type: DataTypes.STRING(100),
allowNull: true
},
id_tipo_documento: {
type: DataTypes.INTEGER,
allowNull: true
},
movimento_cancelamento_venda: {
type: DataTypes.ENUM('S', 'N'),
allowNull: false,
defaultValue: "N"
},
id_assinatura_cliente_produto: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0
},
data_cotacao_diaria: {
type: DataTypes.DATEONLY,
allowNull: true
},
valor_cotacao_diaria: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
valor_moeda_original: {
type: DataTypes.DECIMAL(15, 3),
allowNull: true
},
moeda_simbolo: {
type: DataTypes.STRING(5),
allowNull: true
},
bfcp_st: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
pfcp_st: {
type: DataTypes.DECIMAL(5, 2),
allowNull: true
},
valor_fcp_st: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
id_pedido_os: {
type: DataTypes.INTEGER,
allowNull: true
},
id_login: {
type: DataTypes.INTEGER,
allowNull: true
},
aliquota_fcp: {
type: DataTypes.DECIMAL(5, 3),
allowNull: true
},
valor_fcp: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
},
aliquota_fcp_st: {
type: DataTypes.DECIMAL(5, 3),
allowNull: true
},
garantia_ate: {
type: DataTypes.DATEONLY,
allowNull: true
},
motivo_descarte: {
type: DataTypes.STRING(255),
allowNull: true
},
id_usuario_descarte: {
type: DataTypes.INTEGER,
allowNull: true
},
item_nf_anterior: {
type: DataTypes.TEXT,
allowNull: true
},
codigo_especie: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
gera_3020: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true,
defaultValue: 0
},
bfcp: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true,
defaultValue: 0.00
}
}, {
sequelize,
tableName: 'movimento_produtos',
timestamps: false,
indexes: [
{
name: "PRIMARY",
unique: true,
using: "BTREE",
fields: [
{ name: "id" },
]
},
{
name: "id_entrada",
using: "BTREE",
fields: [
{ name: "id_entrada" },
]
},
{
name: "id_saida",
using: "BTREE",
fields: [
{ name: "id_saida" },
]
},
{
name: "filial_id",
using: "BTREE",
fields: [
{ name: "filial_id" },
]
},
{
name: "id_produto_2",
using: "BTREE",
fields: [
{ name: "id_produto" },
]
},
{
name: "id_contrato",
using: "BTREE",
fields: [
{ name: "id_contrato" },
]
},
{
name: "id_oss_chamado",
using: "BTREE",
fields: [
{ name: "id_oss_chamado" },
]
},
{
name: "id_oss_mensagem",
using: "BTREE",
fields: [
{ name: "id_oss_mensagem" },
]
},
{
name: "id_unidade",
using: "BTREE",
fields: [
{ name: "id_unidade" },
]
},
{
name: "id_inventario",
using: "BTREE",
fields: [
{ name: "id_inventario" },
]
},
{
name: "id_ajuste_estoque",
using: "BTREE",
fields: [
{ name: "id_ajuste_estoque" },
]
},
{
name: "id_classificacao_tributaria",
using: "BTREE",
fields: [
{ name: "id_classificacao_tributaria" },
]
},
{
name: "id_class_fiscal",
using: "BTREE",
fields: [
{ name: "id_class_fiscal" },
]
},
{
name: "id_vd_contratos_produtos",
using: "BTREE",
fields: [
{ name: "id_vd_contratos_produtos" },
]
},
{
name: "id_cliente_contrato_servicos",
using: "BTREE",
fields: [
{ name: "id_cliente_contrato_servicos" },
]
},
{
name: "id_almox",
using: "BTREE",
fields: [
{ name: "id_almox" },
]
},
{
name: "id_transf_almox",
using: "BTREE",
fields: [
{ name: "id_transf_almox" },
]
},
{
name: "id_transf_almox_item",
using: "BTREE",
fields: [
{ name: "id_transf_almox_item" },
]
},
{
name: "id_estrutura",
using: "BTREE",
fields: [
{ name: "id_estrutura" },
]
},
{
name: "status_comodato",
using: "BTREE",
fields: [
{ name: "status_comodato" },
]
},
{
name: "tipo_produto",
using: "BTREE",
fields: [
{ name: "tipo_produto" },
]
},
{
name: "tipo_transferencia",
using: "BTREE",
fields: [
{ name: "tipo_transferencia" },
]
},
{
name: "data",
using: "BTREE",
fields: [
{ name: "data" },
]
},
{
name: "id_patrimonio",
using: "BTREE",
fields: [
{ name: "id_patrimonio" },
]
},
{
name: "id_devolucao",
using: "BTREE",
fields: [
{ name: "id_devolucao" },
]
},
{
name: "id_pedido_os",
using: "BTREE",
fields: [
{ name: "id_pedido_os" },
]
},
]
})
return Model_MovimentoProdutos
}