giganet_conecta
Version:
Aplicação com o fim de facilitar conexões com APi's e Banco de Dados (MySql & Mongo).
391 lines (384 loc) • 10.8 kB
JavaScript
const { Model, DataTypes, fn } = require("sequelize");
module.exports = Movimentacao_Financeira
async function Movimentacao_Financeira(sequelize) {
class Model_Movimentacao_Financeira extends Model { }
Model_Movimentacao_Financeira.init({
id: {
autoIncrement: true,
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true
},
data: {
type: DataTypes.DATEONLY,
allowNull: false
},
id_conta: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'planejamento_analitico',
key: 'id'
}
},
documento: {
type: DataTypes.STRING(50),
allowNull: false
},
credito: {
type: DataTypes.DECIMAL(15, 2),
allowNull: false
},
debito: {
type: DataTypes.DECIMAL(15, 2),
allowNull: false
},
historico: {
type: DataTypes.STRING(200),
allowNull: false
},
id_movim_finan: {
type: DataTypes.INTEGER,
allowNull: false
},
pdesconto: {
type: DataTypes.DECIMAL(5, 2),
allowNull: false
},
vdesconto: {
type: DataTypes.DECIMAL(15, 2),
allowNull: false
},
pacrescimo: {
type: DataTypes.DECIMAL(5, 2),
allowNull: false
},
vacrescimo: {
type: DataTypes.DECIMAL(15, 2),
allowNull: false
},
id_receber: {
type: DataTypes.BIGINT,
allowNull: false
},
id_pagar: {
type: DataTypes.INTEGER,
allowNull: false
},
tipo_lanc: {
type: DataTypes.ENUM('M', 'P', 'R', 'D', 'C', 'AC', 'AF', 'T'),
allowNull: false
},
vencimento: {
type: DataTypes.DATEONLY,
allowNull: false
},
data_pagamento: {
type: DataTypes.DATEONLY,
allowNull: false
},
data_recebimento: {
type: DataTypes.DATEONLY,
allowNull: false
},
id_entrada: {
type: DataTypes.INTEGER,
allowNull: true
},
id_saida: {
type: DataTypes.INTEGER,
allowNull: true
},
id_inventario: {
type: DataTypes.INTEGER,
allowNull: true
},
id_baixa_lote: {
type: DataTypes.INTEGER,
allowNull: true
},
sistema_origem: {
type: DataTypes.INTEGER,
allowNull: true
},
id_origem: {
type: DataTypes.INTEGER,
allowNull: true
},
id_adiantamento_cliente: {
type: DataTypes.INTEGER,
allowNull: true
},
id_adiantamento_fornecedor: {
type: DataTypes.INTEGER,
allowNull: true
},
filial_id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: 'filial',
key: 'id'
}
},
conciliado: {
type: DataTypes.ENUM('S', 'N'),
allowNull: true,
defaultValue: "N"
},
conciliado_extrato: {
type: DataTypes.TEXT,
allowNull: true
},
conciliado_fn: {
type: DataTypes.TEXT,
allowNull: true
},
conta_: {
type: DataTypes.INTEGER,
allowNull: true
},
id_fornecedor: {
type: DataTypes.INTEGER,
allowNull: true
},
tipo_recebimento: {
type: DataTypes.ENUM('D', 'H', 'C', 'CD', 'DP', 'T', 'P', 'DC', 'B'),
allowNull: false,
defaultValue: "D"
},
id_cli_aux_rec: {
type: DataTypes.INTEGER,
allowNull: true
},
valor_troco: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
debito_aux_composto: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
id_renegociacao: {
type: DataTypes.INTEGER,
allowNull: true
},
id_movim_cheque: {
type: DataTypes.INTEGER,
allowNull: true
},
id_operador: {
type: DataTypes.INTEGER,
allowNull: true
},
id_ajuste_estoque: {
type: DataTypes.INTEGER,
allowNull: true
},
id_motivo_desconto: {
type: DataTypes.INTEGER,
allowNull: true
},
id_lote_retorno: {
type: DataTypes.INTEGER,
allowNull: true
},
id_classe_finan: {
type: DataTypes.INTEGER,
allowNull: true
},
id_conta_class_finan_a: {
type: DataTypes.INTEGER,
allowNull: true
},
id_conciliacao_lote: {
type: DataTypes.INTEGER,
allowNull: true
},
chave_recebimento: {
type: DataTypes.STRING(70),
allowNull: true
},
ultima_atualizacao: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: fn('current_timestamp')
},
chave_recebimento_unico: {
type: DataTypes.STRING(70),
allowNull: true,
unique: "chave_recebimento_unico"
},
id_grade_contabil: {
type: DataTypes.INTEGER,
allowNull: true
},
cancelamento: {
type: DataTypes.STRING(1),
allowNull: true
},
id_movimento_produto_comodato: {
type: DataTypes.INTEGER,
allowNull: true
},
id_transf_almox: {
type: DataTypes.INTEGER.UNSIGNED,
allowNull: true
},
id_fn_tranferencia_caixa: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0
},
descontos_adicionais: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
},
valor_liquido_recebido: {
type: DataTypes.DECIMAL(15, 2),
allowNull: true
}
}, {
sequelize,
tableName: 'fn_movim_finan',
timestamps: false,
indexes: [
{
name: "PRIMARY",
unique: true,
using: "BTREE",
fields: [
{ name: "id" },
]
},
{
name: "chave_recebimento_unico",
unique: true,
using: "BTREE",
fields: [
{ name: "chave_recebimento_unico" },
]
},
{
name: "id_conta",
using: "BTREE",
fields: [
{ name: "id_conta" },
]
},
{
name: "id_movim_finan",
using: "BTREE",
fields: [
{ name: "id_movim_finan" },
]
},
{
name: "id_receber",
using: "BTREE",
fields: [
{ name: "id_receber" },
]
},
{
name: "id_pagar",
using: "BTREE",
fields: [
{ name: "id_pagar" },
]
},
{
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_renegociacao",
using: "BTREE",
fields: [
{ name: "id_renegociacao" },
]
},
{
name: "id_movim_cheque",
using: "BTREE",
fields: [
{ name: "id_movim_cheque" },
]
},
{
name: "id_lote_retorno",
using: "BTREE",
fields: [
{ name: "id_lote_retorno" },
]
},
{
name: "ultima_atualizacao",
using: "BTREE",
fields: [
{ name: "ultima_atualizacao" },
]
},
{
name: "data",
using: "BTREE",
fields: [
{ name: "data" },
]
},
{
name: "chave_recebimento",
using: "BTREE",
fields: [
{ name: "chave_recebimento" },
]
},
{
name: "id_origem",
using: "BTREE",
fields: [
{ name: "id_origem" },
]
},
{
name: "tipo_lanc",
using: "BTREE",
fields: [
{ name: "tipo_lanc" },
]
},
{
name: "id_conciliacao_lote",
using: "BTREE",
fields: [
{ name: "id_conciliacao_lote" },
]
},
{
name: "id_movimento_produto_comodato",
using: "BTREE",
fields: [
{ name: "id_movimento_produto_comodato" },
]
},
]
});
return Model_Movimentacao_Financeira
}