diff options
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Financeiro')
14 files changed, 1187 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/BancosContas.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/BancosContas.cs new file mode 100644 index 0000000..13994ab --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/BancosContas.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class BancosContas : DomainBase, IDomain +{ + private string _descricao; + + private string _agencia; + + private string _conta; + + private string _observacao; + + public bool Selecionado { get; set; } + + public long IdEmpresa { get; set; } = 1L; + + + [Log(true)] + public Banco Banco { get; set; } + + [Log(true)] + [Name(true)] + [Description("DESCRIÇÃO")] + public string Descricao + { + get + { + return _descricao?.ToUpper(); + } + set + { + _descricao = value; + } + } + + [Log(true)] + [Description("AGÊNCIA")] + public string Agencia + { + get + { + return _agencia?.ToUpper().Trim(); + } + set + { + _agencia = value; + } + } + + [Log(true)] + public string Conta + { + get + { + return _conta?.ToUpper().Trim(); + } + set + { + _conta = value; + } + } + + [Log(true)] + [Description("OBSERVAÇÃO")] + public string Observacao + { + get + { + return _observacao?.ToUpper(); + } + set + { + _observacao = value; + } + } + + [Log(true)] + public bool Ativo { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>(); + if (string.IsNullOrWhiteSpace(Descricao)) + { + list.AddValue("Descricao|DESCRIÇÃO", Messages.Obrigatorio); + } + if (Banco == null) + { + list.AddValue("Banco", Messages.Obrigatorio); + } + if (string.IsNullOrWhiteSpace(Agencia)) + { + list.AddValue("Agencia|AGÊNCIA", Messages.Obrigatorio); + } + if (string.IsNullOrWhiteSpace(Conta)) + { + list.AddValue("Conta", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("DESCRIÇÃO", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, ""), + new Tuple<string, string, string>("AGÊNCIA", string.IsNullOrWhiteSpace(Agencia) ? "" : Agencia, ""), + new Tuple<string, string, string>("BANCO", (Banco == null) ? "" : Banco?.Nome, ""), + new Tuple<string, string, string>("CONTA CORRENTE/POUPANÇA", string.IsNullOrWhiteSpace(Conta) ? "" : Conta, ""), + new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", ""), + new Tuple<string, string, string>("OBSERVAÇÕES", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao, "") + } + } + }; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/Centro.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/Centro.cs new file mode 100644 index 0000000..34c11b1 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/Centro.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class Centro : DomainBase, IDomain +{ + private string _descricao; + + public bool Selecionado { get; set; } + + [Log(true)] + [Name(true)] + [Description("DESCRIÇÃO")] + public string Descricao + { + get + { + return _descricao?.ToUpper(); + } + set + { + _descricao = value; + } + } + + [Log(true)] + public bool Ativo { get; set; } + + public long IdEmpresa { get; set; } = 1L; + + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Descricao)) + { + list.AddValue("Descricao", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + return new List<TupleList> + { + new TupleList + { + Tuples = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Descricao) ? "" : Descricao, ""), + new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "") + } + } + }; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/ControleFinanceiro.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/ControleFinanceiro.cs new file mode 100644 index 0000000..585cf40 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/ControleFinanceiro.cs @@ -0,0 +1,82 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class ControleFinanceiro : DomainBase, IDomain +{ + private string _historico; + + [Log(true)] + [Name(true)] + [Description("FORNECEDOR")] + public Fornecedor Fornecedor { get; set; } + + [Log(true)] + [Name(true)] + [Description("PLANO DE CONTAS")] + public Planos Plano { get; set; } + + [Log(true)] + [Name(true)] + [Description("CENTRO DE CUSTO")] + public Centro Centro { get; set; } + + public string Historico + { + get + { + return _historico?.ToUpper(); + } + set + { + _historico = value; + } + } + + [Log(true)] + [Description("QUANTIDADE DE PARCELAS")] + public int Parcelas { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (Fornecedor == null) + { + list.AddValue("Fornecedor", Messages.Obrigatorio); + } + Fornecedor fornecedor = Fornecedor; + if (fornecedor != null && fornecedor.Id == 0) + { + list.AddValue("Fornecedor|FORNECEDOR", Messages.Obrigatorio + "\nPROVAVELMENTE NÃO HÁ NENHUM FORNECEDOR INCLUÍDO\nACESSE A TELA DE CADASTRO DE FORNECEDORES PARA INCLUIR"); + } + if (Plano == null) + { + list.AddValue("Plano|PLANO DE CONTAS", Messages.Obrigatorio + "\nPROVAVELMENTE NÃO HÁ NENHUM PLANO DE CONTAS INCLUÍDO\nACESSE A TELA PLANO DE CONTAS PARA INCLUIR"); + } + Planos plano = Plano; + if (plano != null && plano.Id == 0) + { + list.AddValue("Plano|PLANO DE CONTAS", Messages.Obrigatorio + "\nPROVAVELMENTE NÃO HÁ NENHUM PLANO DE CONTAS INCLUÍDO\nACESSE A TELA PLANO DE CONTAS PARA INCLUIR"); + } + if (Centro == null) + { + list.AddValue("Centro|CENTRO DE CUSTOS", Messages.Obrigatorio + "\nPROVAVELMENTE NÃO HÁ NENHUM CENTRO DE CUSTOS INCLUÍDO\nACESSE A TELA CENTRO DE CUSTOS PARA INCLUIR"); + } + Centro centro = Centro; + if (centro != null && centro.Id == 0) + { + list.AddValue("Centro|CENTRO DE CUSTOS", Messages.Obrigatorio + "\nPROVAVELMENTE NÃO HÁ NENHUM CENTRO DE CUSTOS INCLUÍDO\nACESSE A TELA CENTRO DE CUSTOS PARA INCLUIR"); + } + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/ExtratoConta.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/ExtratoConta.cs new file mode 100644 index 0000000..15ae942 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/ExtratoConta.cs @@ -0,0 +1,57 @@ +using System; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Common; + +namespace Gestor.Model.Domain.Financeiro; + +public class ExtratoConta +{ + private string _fornecedor; + + private string _historico; + + public bool Bold { get; set; } + + public long IdLancamento { get; set; } + + public Sinal Sinal { get; set; } + + [Tipo("DATA?")] + [Description("DATA BAIXA")] + public DateTime? Baixa { get; set; } + + [Description("FORNECEDOR")] + public string Fornecedor + { + get + { + return _fornecedor?.ToUpper(); + } + set + { + _fornecedor = value; + } + } + + [Description("HISTÓRICO")] + public string Historico + { + get + { + return _historico?.ToUpper(); + } + set + { + _historico = value; + } + } + + [Tipo("ENUM")] + [Description("TIPO PAGAMENTO")] + public TipoPagamento? TipoPagamento { get; set; } + + [Tipo("VALOR?")] + [Description("VALOR")] + public decimal? Valor { get; set; } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/FiltroPersonalizado.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/FiltroPersonalizado.cs new file mode 100644 index 0000000..789e97a --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/FiltroPersonalizado.cs @@ -0,0 +1,35 @@ +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Common; + +namespace Gestor.Model.Domain.Financeiro; + +public class FiltroPersonalizado +{ + private string _descricao; + + public long Id { get; set; } + + public string Icone { get; set; } + + [Description("DESCRIÇÃO DO FILTRO")] + public string Descricao + { + get + { + return _descricao; + } + set + { + _descricao = value; + if (!string.IsNullOrWhiteSpace(value)) + { + Icone = value.Substring(0, 1); + } + } + } + + [Tipo("ENUM")] + [Description("TIPO DO FILTRO")] + public TipoFiltroFinanceiro Tipo { get; set; } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/Fornecedor.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/Fornecedor.cs new file mode 100644 index 0000000..aeef0de --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/Fornecedor.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class Fornecedor : EnderecoBase, IDomain +{ + private string _nome; + + private string _documento; + + private string _email; + + private string _observacao; + + public new long Id { get; set; } + + public long IdEmpresa { get; set; } + + public long? IdConta { get; set; } + + public long? IdCentro { get; set; } + + public long? IdPlano { get; set; } + + public TipoPagamento? TipoPagamento { get; set; } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + return _nome?.ToUpper(); + } + set + { + _nome = value; + NomeSocial = $"{value?.ToUpper()} - {Id}"; + } + } + + [Log(true)] + [Description("NOME SOCIAL")] + public string NomeSocial { get; set; } + + [Log(true)] + public string Documento + { + get + { + return _documento?.ToUpper().Trim(); + } + set + { + _documento = value; + } + } + + [Log(true)] + [Description("TIPO TELEFONE")] + public TipoTelefone? TipoTelefone1 { get; set; } + + [Log(true)] + [Description("PREFIXO 1")] + public string Prefixo1 { get; set; } + + [Log(true)] + [Description("TELEFONE 1")] + public string Telefone1 { get; set; } + + [Log(true)] + [Description("TIPO TELEFONE 2")] + public TipoTelefone? TipoTelefone2 { get; set; } + + [Log(true)] + [Description("PREFIXO 2")] + public string Prefixo2 { get; set; } + + [Log(true)] + [Description("TELEFONE 2")] + public string Telefone2 { get; set; } + + [Log(true)] + [Description("E-MAIL")] + public string Email + { + get + { + return _email?.ToLower(); + } + set + { + _email = value; + } + } + + [Log(true)] + [Description("OBSERVAÇÃO")] + public string Observacao + { + get + { + return _observacao?.ToUpper(); + } + set + { + _observacao = value; + } + } + + [Log(true)] + [Description("ATIVO")] + public bool Ativo { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + int? num = Nome?.Trim().Split(new char[1] { ' ' }).Length; + if (!num.HasValue) + { + list.AddValue("Nome", Messages.Obrigatorio); + } + else if (num <= 1) + { + list.AddValue("Nome", Messages.NomeInvalido); + } + if (!string.IsNullOrWhiteSpace(Nome) && Nome.Length > 60) + { + list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 60)); + } + if (!string.IsNullOrWhiteSpace(Documento) && !Documento.ValidacaoDocumento()) + { + list.AddValue("Documento", Messages.Invalido); + } + if (!string.IsNullOrWhiteSpace(Prefixo1) && !Prefixo1.ValidacaoPrefixo()) + { + list.AddValue("Prefixo1", Messages.Obrigatorio); + } + if (!string.IsNullOrWhiteSpace(Telefone1) && !Telefone1.ValidacaoTelefone()) + { + list.AddValue("Telefone1", Messages.Obrigatorio); + } + if (!string.IsNullOrWhiteSpace(Email) && !Email.ValidacaoEmail()) + { + list.AddValue("Email", Messages.Obrigatorio); + } + if (!string.IsNullOrWhiteSpace(base.Cidade) && base.Cidade.Length > 30) + { + list.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 30)); + } + if (!string.IsNullOrWhiteSpace(base.Bairro) && base.Bairro.Length > 60) + { + list.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 60)); + } + if (!string.IsNullOrWhiteSpace(base.Complemento) && base.Complemento.Length > 40) + { + list.AddValue("Complemento", string.Format(Messages.MaiorQueLimite, 40)); + } + return list; + } + + public List<TupleList> Log() + { + List<TupleList> list = new List<TupleList>(); + TupleList tupleList = new TupleList(); + ObservableCollection<Tuple<string, string, string>> obj = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("NOME DO FORNECEDOR", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""), + new Tuple<string, string, string>("DOCUMENTO", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, ""), + new Tuple<string, string, string>("CEP", string.IsNullOrWhiteSpace(base.Cep) ? "" : base.Cep, ""), + new Tuple<string, string, string>("ENDEREÇO", string.IsNullOrWhiteSpace(base.Endereco) ? "" : base.Endereco, ""), + new Tuple<string, string, string>("NÚMERO", string.IsNullOrWhiteSpace(base.Numero) ? "" : base.Numero, ""), + new Tuple<string, string, string>("COMPLEMENTO", string.IsNullOrWhiteSpace(base.Complemento) ? "" : base.Complemento, ""), + new Tuple<string, string, string>("BAIRRO", string.IsNullOrWhiteSpace(base.Bairro) ? "" : base.Bairro, ""), + new Tuple<string, string, string>("CIDADE", string.IsNullOrWhiteSpace(base.Cidade) ? "" : base.Cidade, ""), + new Tuple<string, string, string>("ESTADO", string.IsNullOrWhiteSpace(base.Estado) ? "" : base.Estado, "") + }; + object item; + if (TipoTelefone1.HasValue) + { + TipoTelefone? tipoTelefone = TipoTelefone1; + item = (tipoTelefone.HasValue ? tipoTelefone.GetValueOrDefault().GetDescription() : null); + } + else + { + item = ""; + } + obj.Add(new Tuple<string, string, string>("TIPO DO PRIMEIRO TELEFONE", (string)item, "")); + obj.Add(new Tuple<string, string, string>("PRIMEIRO PREFIXO", string.IsNullOrWhiteSpace(Prefixo1) ? "" : Prefixo1, "")); + obj.Add(new Tuple<string, string, string>("PRIMEIRO TELEFONE", string.IsNullOrWhiteSpace(Telefone1) ? "" : Telefone1, "")); + object item2; + if (TipoTelefone2.HasValue) + { + TipoTelefone? tipoTelefone = TipoTelefone2; + item2 = (tipoTelefone.HasValue ? tipoTelefone.GetValueOrDefault().GetDescription() : null); + } + else + { + item2 = ""; + } + obj.Add(new Tuple<string, string, string>("TIPO DO SEGUNDO TELEFONE", (string)item2, "")); + obj.Add(new Tuple<string, string, string>("SEGUNDO PREFIXO", string.IsNullOrWhiteSpace(Prefixo2) ? "" : Prefixo2, "")); + obj.Add(new Tuple<string, string, string>("SEGUNDO TELEFONE", string.IsNullOrWhiteSpace(Telefone2) ? "" : Telefone2, "")); + obj.Add(new Tuple<string, string, string>("E-MAIL", string.IsNullOrWhiteSpace(Email) ? "" : Email, "")); + obj.Add(new Tuple<string, string, string>("PLANO DE CONTAS", (!IdPlano.HasValue) ? "" : IdPlano?.ToString(), "")); + obj.Add(new Tuple<string, string, string>("CENTRO DE CUSTO", (!IdCentro.HasValue) ? "" : IdCentro?.ToString(), "")); + obj.Add(new Tuple<string, string, string>("CONTA CORRENTE", (!IdConta.HasValue) ? "" : IdConta?.ToString(), "")); + object item3; + if (TipoPagamento.HasValue) + { + TipoPagamento? tipoPagamento = TipoPagamento; + item3 = (tipoPagamento.HasValue ? tipoPagamento.GetValueOrDefault().GetDescription() : null); + } + else + { + item3 = ""; + } + obj.Add(new Tuple<string, string, string>("TIPO DE PAGAMENTO", (string)item3, "")); + obj.Add(new Tuple<string, string, string>("OBSERVAÇÕES", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao, "")); + tupleList.Tuples = obj; + list.Add(tupleList); + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/Lancamento.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/Lancamento.cs new file mode 100644 index 0000000..7608cb9 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/Lancamento.cs @@ -0,0 +1,195 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class Lancamento : DomainBase, IDomain +{ + private decimal? _valorPago; + + private string _historico; + + private string _documento; + + private string _complemento; + + private string _competencia; + + public bool Selecionado { get; set; } + + public ControleFinanceiro Controle { get; set; } + + [Log(true)] + public BancosContas Conta { get; set; } + + [Log(true)] + [Description("TIPO PAGAMENTO")] + public TipoPagamento TipoPagamento { get; set; } + + [Log(true)] + [Description("HISTÓRICO")] + public string Historico + { + get + { + return _historico?.ToUpper(); + } + set + { + _historico = value; + } + } + + [Log(true)] + public string Documento + { + get + { + return _documento?.ToUpper(); + } + set + { + _documento = value; + } + } + + [Log(true)] + public string Complemento + { + get + { + return _complemento?.ToUpper(); + } + set + { + _complemento = value; + } + } + + [Log(true)] + [Description("COMPETÊNCIA")] + public string Competencia + { + get + { + return _competencia?.ToUpper(); + } + set + { + _competencia = value; + } + } + + [Log(true)] + public int Parcela { get; set; } + + [Log(true)] + public DateTime Vencimento { get; set; } + + [Log(true)] + public decimal Valor { get; set; } + + [Log(true)] + [Description("DATA DA BAIXA")] + public DateTime? Baixa { get; set; } + + [Log(true)] + [Description("VALOR PAGO")] + public decimal? ValorPago + { + get + { + return _valorPago.GetValueOrDefault(); + } + set + { + _valorPago = value; + } + } + + [Log(true)] + public DateTime? Pagamento { get; set; } + + [Log(true)] + public Sinal Sinal { get; set; } + + [Log(true)] + [Description("OBSERVAÇÃO")] + public string Observacao { get; set; } + + public bool Baixado { get; set; } + + [Log(true)] + [Description("CÓDIGO BANCO")] + public string CodigoBanco { get; set; } + + [Log(true)] + [Description("DATA LANÇAMENTO")] + public DateTime? DataLancamento { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + list.AddRange(Controle.Validate()); + if (string.IsNullOrWhiteSpace(Historico)) + { + list.AddValue("Historico", Messages.Obrigatorio); + } + else if (Historico.Length > 100) + { + list.AddValue("Historico", string.Format(Messages.MaiorQueLimite, 100)); + } + if (Valor <= 0m) + { + list.AddValue("Valor", Messages.Obrigatorio); + } + decimal? valorPago = ValorPago; + if ((valorPago.GetValueOrDefault() < default(decimal)) & valorPago.HasValue) + { + list.AddValue("ValorPago", Messages.Obrigatorio); + } + if (Conta == null) + { + list.AddValue("Conta|CONTA CORRENTE", Messages.Obrigatorio + "\nSE NÃO HOUVER NENHUMA CONTA CORRENTE CADASTRADA\nACESSE A TELA BANCOS E CONTAS PARA INCLUIR"); + } + if (!string.IsNullOrWhiteSpace(Documento) && Documento.Length > 50) + { + list.AddValue("Documento", string.Format(Messages.MaiorQueLimite, 50)); + } + if (!string.IsNullOrWhiteSpace(Competencia) && Competencia.Length > 8) + { + list.AddValue("Competencia|COMPETÊNCIA", string.Format(Messages.MaiorQueLimite, 8)); + } + if (!string.IsNullOrWhiteSpace(Complemento) && Complemento.Length > 50) + { + list.AddValue("Complemento", string.Format(Messages.MaiorQueLimite, 50)); + } + if (Baixa.HasValue && (DateTime.Compare(Baixa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Baixa.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("Baixa", string.Format(Messages.DataInvalida)); + } + if (DateTime.Compare(Vencimento, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Vencimento, new DateTime(9999, 12, 31)) > 0) + { + list.AddValue("Vencimento", string.Format(Messages.DataInvalida)); + } + if (Pagamento.HasValue && (DateTime.Compare(Pagamento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Pagamento.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("Pagamento", string.Format(Messages.DataInvalida)); + } + if (!Baixa.HasValue && Baixado) + { + list.AddValue("Baixa", "NÃO É POSSÍVEL SALVAR UM DOCUMENTO SEM DATA DE BAIXA QUANDO O LANÇAMENTO POSSUÍ BAIXA"); + } + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/Plano.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/Plano.cs new file mode 100644 index 0000000..7a3ed22 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/Plano.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class Plano : DomainBase, IDomain +{ + private string _descricao; + + public bool Selecionado { get; set; } + + public string Descricao + { + get + { + return _descricao?.ToUpper(); + } + set + { + _descricao = value; + } + } + + public bool Ativo { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Descricao)) + { + list.AddValue("Descricao", Messages.Obrigatorio); + } + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/Planos.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/Planos.cs new file mode 100644 index 0000000..adefad5 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/Planos.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class Planos : DomainBase, IDomain +{ + private string _descricao; + + private Sinal _sinal; + + private string _nome; + + public bool Selecionado { get; set; } + + [Log(true)] + [Name(true)] + [Description("DESCRIÇÃO")] + public string Descricao + { + get + { + return _descricao?.ToUpper(); + } + set + { + _descricao = value; + string text = ((Sinal == Sinal.Credito) ? "(+)" : "(-)"); + Nome = value.ToUpper() + " " + text; + } + } + + [Log(true)] + public string Nome + { + get + { + return _nome.ToUpper(); + } + set + { + _nome = value; + } + } + + [Log(true)] + [Description("TIPO CONTA")] + public TipoConta TipoConta { get; set; } + + [Log(true)] + public bool Ativo { get; set; } + + [Log(true)] + public Sinal Sinal + { + get + { + return _sinal; + } + set + { + _sinal = value; + string text = ((value == Sinal.Credito) ? "(+)" : "(-)"); + Nome = Descricao + " " + text; + } + } + + [Log(true)] + public Plano Plano { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Descricao)) + { + list.AddValue("Descricao", Messages.Obrigatorio); + } + if (Plano == null) + { + list.AddValue("Plano", Messages.Obrigatorio); + } + return list; + } + + public List<TupleList> Log() + { + List<TupleList> list = new List<TupleList>(); + TupleList tupleList = new TupleList(); + ObservableCollection<Tuple<string, string, string>> obj = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("NOME", string.IsNullOrWhiteSpace(Nome) ? "" : Nome, ""), + new Tuple<string, string, string>("PLANO", (Plano == null) ? "" : Plano?.Descricao, ""), + new Tuple<string, string, string>("ATIVO", Ativo ? "SIM" : "NÃO", "") + }; + _ = Sinal; + obj.Add(new Tuple<string, string, string>("SINAL", Sinal.GetDescription(), "")); + tupleList.Tuples = obj; + list.Add(tupleList); + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/RelatorioLancamentos.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/RelatorioLancamentos.cs new file mode 100644 index 0000000..00b32ea --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/RelatorioLancamentos.cs @@ -0,0 +1,62 @@ +using System; +using System.ComponentModel; +using Gestor.Model.Attributes; + +namespace Gestor.Model.Domain.Financeiro; + +public class RelatorioLancamentos +{ + [Description("FORNECEDOR")] + public string Fornecedor { get; set; } + + [Description("HISTORICO")] + public string Historico { get; set; } + + [Description("DOCUMENTO")] + public string Documento { get; set; } + + [Tipo("QUANTIDADE")] + [Description("PARCELA")] + public int Parcela { get; set; } + + [Tipo("DATA")] + [Description("VENCIMENTO")] + public DateTime Vencimento { get; set; } + + [Tipo("VALOR")] + [Description("VALOR")] + public decimal Valor { get; set; } + + [Tipo("DATA?")] + [Description("DATA BAIXA")] + public DateTime? Baixa { get; set; } + + [Tipo("VALOR")] + [Description("VALOR PAGO")] + public decimal? ValorPago { get; set; } + + [Tipo("DATA?")] + [Description("PAGAMENTO")] + public DateTime? Pagamento { get; set; } + + [Description("PLANO DE CONTAS")] + public string Plano { get; set; } + + [Description("PLANOS")] + public string Planos { get; set; } + + [Description("CENTRO DE CUSTO")] + public string Centro { get; set; } + + [Description("CONTA")] + public string Conta { get; set; } + + [Description("SINAL")] + public string Sinal { get; set; } + + [Description("OBSERVAÇÃO")] + public string Observacao { get; set; } + + [Description("COMPETÊNCIA")] + public string Competencia { get; set; } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/Saldo.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/Saldo.cs new file mode 100644 index 0000000..7ef9ab1 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/Saldo.cs @@ -0,0 +1,52 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class Saldo : DomainBase, IDomain +{ + [Log(true)] + public BancosContas Conta { get; set; } + + [Log(true)] + [Description("VALOR INÍCIO")] + public decimal ValorInicio { get; set; } + + [Log(true)] + [Description("DATA INÍCIO")] + public DateTime? DataInicio { get; set; } + + [Log(true)] + [Description("VALOR FINAL")] + public decimal? ValorFinal { get; set; } + + [Log(true)] + [Description("DATA FINAL")] + public DateTime? DataFinal { get; set; } + + [Log(true)] + public string Extrato { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (DataInicio.HasValue && (DateTime.Compare(DataInicio.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataInicio.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("DataInicio|ABERTURA", string.Format(Messages.DataInvalida)); + } + if (DataFinal.HasValue && (DateTime.Compare(DataFinal.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataFinal.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("DataFinal|FECHAMENTO", string.Format(Messages.DataInvalida)); + } + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/SinteticoFinanceiro.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/SinteticoFinanceiro.cs new file mode 100644 index 0000000..d19f191 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/SinteticoFinanceiro.cs @@ -0,0 +1,20 @@ +namespace Gestor.Model.Domain.Financeiro; + +public class SinteticoFinanceiro +{ + public BancosContas Conta { get; set; } + + public int Selecionados { get; set; } + + public decimal Credito { get; set; } + + public decimal Debito { get; set; } + + public decimal Liquido { get; set; } + + public decimal LiquidoPago { get; set; } + + public int Filtrados { get; set; } + + public decimal LiquidoSelecionados { get; set; } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/TipoConta.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/TipoConta.cs new file mode 100644 index 0000000..40052a4 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/TipoConta.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class TipoConta : DomainBase, IDomain +{ + private string _descricao; + + public string Descricao + { + get + { + return _descricao?.ToUpper(); + } + set + { + _descricao = value; + } + } + + public bool Ativo { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Descricao)) + { + list.AddValue("Descricao", Messages.Obrigatorio); + } + return list; + } +} diff --git a/Gestor.Model/Gestor.Model.Domain.Financeiro/Transferencia.cs b/Gestor.Model/Gestor.Model.Domain.Financeiro/Transferencia.cs new file mode 100644 index 0000000..35f816e --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Financeiro/Transferencia.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Financeiro; + +public class Transferencia +{ + public BancosContas Origem { get; set; } + + public decimal Valor { get; set; } + + public DateTime Data { get; set; } + + public BancosContas Destino { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (Origem == null) + { + list.AddValue("Origem", Messages.Obrigatorio); + } + if (Destino == null) + { + list.AddValue("Destino", Messages.Obrigatorio); + } + if (Origem != null && Destino != null && Origem.Id == Destino.Id) + { + list.AddValue("CONTAS", "A CONTA DE ORIGEM NÃO PODE SER A MESMA QUE A DESTINO."); + } + if (DateTime.Compare(Data, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Data, new DateTime(9999, 12, 31)) > 0) + { + list.AddValue("Data", string.Format(Messages.DataInvalida)); + } + if (Valor <= 0m) + { + list.AddValue("Valor", Messages.Obrigatorio); + } + return list; + } +} |