25/04/2026 - implementa formulários de cadastro para o ecossistema LevelOS
- Adicionado ContratoEquipamentosCadastroPanel - Adicionado ConfigBoletosCadastroPanel (Gestão de convênios) - Adicionado ConfigCartoesCadastroPanel (Taxas e operadoras) - Adicionado ConfigImpressaoCadastroPanel (Coordenadas X/Y) - Adicionado DespesasCadastroPanel e DespFixaCadastroPanel - Adicionado ConfigEcfCadastroPanel (Hardware Fiscal) - Adicionado EmpresaCadastroPanel (Emitente e Web3/Crypto) - Adicionado EquipamentosCadastroPanel (Ativos e Garantia) - Adicionado EsquemasTecnicosCadastroPanel (Biblioteca de Manuais) - Adicionado FluxoCaixaCadastroPanel (Tesouraria) - Adicionado FornecedorItemVinculoPanel (Logística de Suprimentos) Padronização de interface utilizando FormularioModelo e LV_TEXTBOX1."
This commit is contained in:
parent
ec818850a4
commit
ae72c2768e
@ -1,62 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace MLL // Ou o namespace de sua preferência
|
||||
{
|
||||
// Opcional: Para Entity Framework, especifica o nome da tabela e o schema
|
||||
// [Table("ContasPagar", Schema = "dbo")]
|
||||
public class ModeloContasPagar
|
||||
{
|
||||
// [Key] // Opcional: Indica que esta é a chave primária
|
||||
// [DatabaseGenerated(DatabaseGeneratedOption.Identity)] // Opcional: Indica que o DB gera o ID
|
||||
public int Id { get; set; }
|
||||
|
||||
public int EmpresaId { get; set; }
|
||||
public int FornecedorId { get; set; }
|
||||
public int PlanoContaId { get; set; }
|
||||
|
||||
// [StringLength(255)] // Opcional: Para validação de tamanho em ORMs como EF
|
||||
public string? Descricao { get; set; } // varchar(255) NULL -> string?
|
||||
|
||||
public decimal Valor { get; set; } // decimal(10, 2) NOT NULL -> decimal
|
||||
|
||||
public DateTime? DataEmissao { get; set; } // date NULL -> DateTime?
|
||||
|
||||
public DateTime DataVencimento { get; set; } // date NOT NULL -> DateTime
|
||||
|
||||
public DateTime? DataPagamento { get; set; } // date NULL -> DateTime?
|
||||
|
||||
// [StringLength(20)] // Opcional: Para validação de tamanho
|
||||
public string Status { get; set; } = "Pendente"; // varchar(20) NOT NULL com DEFAULT -> string. Inicializado com o valor padrão.
|
||||
|
||||
public decimal? ValorPago { get; set; } // decimal(10, 2) NULL -> decimal?
|
||||
|
||||
public decimal? Juros { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão.
|
||||
|
||||
public decimal? Multa { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão.
|
||||
|
||||
public decimal? Desconto { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão.
|
||||
|
||||
public string? Observacoes { get; set; } // varchar(max) NULL -> string?
|
||||
|
||||
public bool Ativo { get; set; } = true; // bit NOT NULL com DEFAULT -> bool. Inicializado com o valor padrão.
|
||||
|
||||
public DateTime? CriadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime?
|
||||
|
||||
public DateTime? AtualizadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime?
|
||||
|
||||
|
||||
// Opcional: Propriedades de navegação para relacionamentos (para ORMs como Entity Framework)
|
||||
/*
|
||||
[ForeignKey("EmpresaId")]
|
||||
public virtual ModeloEmpresa? Empresa { get; set; } // Assumindo que você tem um modelo ModeloEmpresa
|
||||
|
||||
[ForeignKey("FornecedorId")]
|
||||
public virtual ModeloFornecedor? Fornecedor { get; set; } // Assumindo que você tem um modelo ModeloFornecedor
|
||||
|
||||
[ForeignKey("PlanoContaId")]
|
||||
public virtual ModeloPlanoDeContas? PlanoDeContas { get; set; } // Assumindo que você tem um modelo ModeloPlanoDeContas
|
||||
*/
|
||||
}
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace MLL // Ou o namespace de sua preferência
|
||||
{
|
||||
// Opcional: Para Entity Framework, especifica o nome da tabela e o schema
|
||||
// [Table("ContasReceber", Schema = "dbo")]
|
||||
public class ModeloContasReceber
|
||||
{
|
||||
// [Key] // Opcional: Indica que esta é a chave primária
|
||||
// [DatabaseGenerated(DatabaseGeneratedOption.Identity)] // Opcional: Indica que o DB gera o ID
|
||||
public int Id { get; set; }
|
||||
|
||||
public int EmpresaId { get; set; }
|
||||
public int ClienteId { get; set; }
|
||||
public int PlanoContaId { get; set; }
|
||||
public int? ContratoId { get; set; } // int NULL -> int?
|
||||
|
||||
// [StringLength(255)] // Opcional: Para validação de tamanho em ORMs como EF
|
||||
public string? Descricao { get; set; } // varchar(255) NULL -> string?
|
||||
|
||||
public decimal Valor { get; set; } // decimal(10, 2) NOT NULL -> decimal
|
||||
|
||||
public DateTime? DataEmissao { get; set; } // date NULL -> DateTime?
|
||||
|
||||
public DateTime DataVencimento { get; set; } // date NOT NULL -> DateTime
|
||||
|
||||
public DateTime? DataPagamento { get; set; } // date NULL -> DateTime?
|
||||
|
||||
// [StringLength(20)] // Opcional: Para validação de tamanho
|
||||
public string Status { get; set; } = "Pendente"; // varchar(20) NOT NULL com DEFAULT -> string. Inicializado com o valor padrão.
|
||||
|
||||
public decimal? ValorPago { get; set; } // decimal(10, 2) NULL -> decimal?
|
||||
|
||||
public decimal? Juros { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão.
|
||||
|
||||
public decimal? Multa { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão.
|
||||
|
||||
public decimal? Desconto { get; set; } = 0; // decimal(10, 2) NULL com DEFAULT -> decimal?. Inicializado com o valor padrão.
|
||||
|
||||
public string? Observacoes { get; set; } // varchar(max) NULL -> string?
|
||||
|
||||
public bool Ativo { get; set; } = true; // bit NOT NULL com DEFAULT -> bool. Inicializado com o valor padrão.
|
||||
|
||||
public DateTime? CriadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime?
|
||||
|
||||
public DateTime? AtualizadoEm { get; set; } // datetime NULL com DEFAULT -> DateTime?
|
||||
|
||||
|
||||
// Opcional: Propriedades de navegação para relacionamentos (para ORMs como Entity Framework)
|
||||
/*
|
||||
[ForeignKey("EmpresaId")]
|
||||
public virtual ModeloEmpresa? Empresa { get; set; } // Assumindo que você tem um modelo ModeloEmpresa
|
||||
|
||||
[ForeignKey("ClienteId")]
|
||||
public virtual ModeloCliente? Cliente { get; set; } // Assumindo que você tem um modelo ModeloCliente
|
||||
|
||||
[ForeignKey("PlanoContaId")]
|
||||
public virtual ModeloPlanoDeContas? PlanoDeContas { get; set; } // Assumindo que você tem um modelo ModeloPlanoDeContas
|
||||
|
||||
[ForeignKey("ContratoId")]
|
||||
public virtual ModeloContrato? Contrato { get; set; } // Assumindo que você tem um modelo ModeloContrato
|
||||
*/
|
||||
}
|
||||
}
|
||||
123
UI/Dashboards/Cadastros/ConfigBoletosCadastroPanel.cs
Normal file
123
UI/Dashboards/Cadastros/ConfigBoletosCadastroPanel.cs
Normal file
@ -0,0 +1,123 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class ConfigBoletosCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloConvenioBoletos _config = new ModeloConvenioBoletos();
|
||||
|
||||
// Controles - Dados Bancários
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtBanco, txtAgencia, txtConta;
|
||||
private LV_TEXTBOX1 txtCarteira, txtConvenio, txtNomeCedente, txtLocalPgto;
|
||||
|
||||
// Controles - Configurações de Cobrança
|
||||
private LV_TEXTBOX1 txtDiasProtesto, txtTipoDoc, txtEspecieDoc;
|
||||
|
||||
// Controles - Instruções (Array para facilitar o mapeamento)
|
||||
private LV_TEXTBOX1[] txtInstrucoes = new LV_TEXTBOX1[10];
|
||||
|
||||
public ConfigBoletosCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Configuração de Convênios Bancários (Boletos)";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Dados da Conta e Convênio ---
|
||||
content.Controls.Add(CreateSectionHeader("DADOS BANCÁRIOS E CEDENTE", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 100, 30);
|
||||
txtBanco = AddInput(content, "BANCO (NOME/Nº)", 210, 50, 200, 30);
|
||||
txtNomeCedente = AddInput(content, "NOME DO CEDENTE (RAZÃO SOCIAL)", 420, 50, 460, 30);
|
||||
|
||||
txtAgencia = AddInput(content, "AGÊNCIA", 20, 105, 110, 30);
|
||||
txtConta = AddInput(content, "CONTA CORRENTE", 140, 105, 150, 30);
|
||||
txtCarteira = AddInput(content, "CARTEIRA", 300, 105, 100, 30);
|
||||
txtConvenio = AddInput(content, "Nº CONVÊNIO", 410, 105, 180, 30);
|
||||
txtLocalPgto = AddInput(content, "LOCAL DE PAGAMENTO", 600, 105, 280, 30);
|
||||
|
||||
// --- SEÇÃO 2: Regras de Cobrança ---
|
||||
content.Controls.Add(CreateSectionHeader("REGRAS DE PROTESTO E DOCUMENTO", 175));
|
||||
|
||||
txtDiasProtesto = AddInput(content, "DIAS PARA PROTESTO", 20, 205, 150, 30);
|
||||
txtTipoDoc = AddInput(content, "TIPO DOC. COBRANÇA", 180, 205, 180, 30);
|
||||
txtEspecieDoc = AddInput(content, "ESPÉCIE DOC.", 370, 205, 150, 30);
|
||||
|
||||
// --- SEÇÃO 3: Instruções no Boleto ---
|
||||
content.Controls.Add(CreateSectionHeader("INSTRUÇÕES DE CAIXA (MENSAGENS NO BOLETO)", 270));
|
||||
|
||||
// Criando os 10 campos de instrução em 2 colunas para economizar espaço
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
int coluna = i % 2; // 0 ou 1
|
||||
int linha = i / 2; // 0 a 4
|
||||
int posX = 20 + (coluna * 440);
|
||||
int posY = 300 + (linha * 55);
|
||||
|
||||
txtInstrucoes[i] = AddInput(content, $"INSTRUÇÃO {(i + 1):D2}", posX, posY, 420, 30);
|
||||
}
|
||||
|
||||
// Ajuste da altura para acomodar as instruções
|
||||
content.Height = 620;
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_config.CODIGO = txtCodigo.Text;
|
||||
_config.BANCO = txtBanco.Text;
|
||||
_config.AGENCIA = txtAgencia.Text;
|
||||
_config.CONTA = txtConta.Text;
|
||||
_config.CARTEIRA = txtCarteira.Text;
|
||||
_config.CONVENIO = txtConvenio.Text;
|
||||
_config.NOME_CEDENTE = txtNomeCedente.Text;
|
||||
_config.LOCAL_PGTO = txtLocalPgto.Text;
|
||||
_config.DIAS_PROTESTO = txtDiasProtesto.Text;
|
||||
_config.TIPO_DOC_COB = txtTipoDoc.Text;
|
||||
_config.TIPO_ESP_DOC = txtEspecieDoc.Text;
|
||||
|
||||
// Mapeamento das 10 instruções
|
||||
_config.INSTRU_01 = txtInstrucoes[0].Text;
|
||||
_config.INSTRU_02 = txtInstrucoes[1].Text;
|
||||
_config.INSTRU_03 = txtInstrucoes[2].Text;
|
||||
_config.INSTRU_04 = txtInstrucoes[3].Text;
|
||||
_config.INSTRU_05 = txtInstrucoes[4].Text;
|
||||
_config.INSTRU_06 = txtInstrucoes[5].Text;
|
||||
_config.INSTRU_07 = txtInstrucoes[6].Text;
|
||||
_config.INSTRU_08 = txtInstrucoes[7].Text;
|
||||
_config.INSTRU_09 = txtInstrucoes[8].Text;
|
||||
_config.INSTRU_10 = txtInstrucoes[9].Text;
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_config = new ModeloConvenioBoletos();
|
||||
txtBanco.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_config);
|
||||
MessageBox.Show("Configuração de boleto salva com sucesso!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro ao salvar: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
105
UI/Dashboards/Cadastros/ConfigCartoesCadastroPanel.cs
Normal file
105
UI/Dashboards/Cadastros/ConfigCartoesCadastroPanel.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class ConfigCartoesCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloConvenioCartoes _configCartao = new ModeloConvenioCartoes();
|
||||
|
||||
// Controles - Operadora
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtNomeOperadora, txtCnpjOperadora, txtBandeira;
|
||||
|
||||
// Controles - Crédito
|
||||
private LV_TEXTBOX1 txtComisCred, txtOpCred;
|
||||
|
||||
// Controles - Débito
|
||||
private LV_TEXTBOX1 txtComisDebt, txtOpDebt;
|
||||
|
||||
// Controles - Configurações Extras
|
||||
private CheckBox chkLanca30;
|
||||
|
||||
public ConfigCartoesCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Configuração de Operadoras de Cartão";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Identificação da Operadora ---
|
||||
content.Controls.Add(CreateSectionHeader("DADOS DA OPERADORA / BANDEIRA", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 100, 30);
|
||||
txtNomeOperadora = AddInput(content, "NOME DA OPERADORA (Ex: CIELO)", 210, 50, 300, 30);
|
||||
txtBandeira = AddInput(content, "BANDEIRA (Ex: VISA/MASTER)", 520, 50, 180, 30);
|
||||
txtCnpjOperadora = AddInput(content, "CNPJ OPERADORA", 710, 50, 170, 30);
|
||||
|
||||
// --- SEÇÃO 2: Configurações de Crédito vs Débito ---
|
||||
// Colocando lado a lado para facilitar a visualização das taxas
|
||||
content.Controls.Add(CreateSectionHeader("TAXAS E PRAZOS (CRÉDITO)", 110));
|
||||
txtComisCred = AddInput(content, "TAXA COMISSÃO %", 20, 140, 180, 30);
|
||||
txtOpCred = AddInput(content, "PRAZO RECEB. (DIAS)", 210, 140, 180, 30);
|
||||
|
||||
content.Controls.Add(CreateSectionHeader("TAXAS E PRAZOS (DÉBITO)", 195));
|
||||
txtComisDebt = AddInput(content, "TAXA COMISSÃO %", 20, 225, 180, 30);
|
||||
txtOpDebt = AddInput(content, "PRAZO RECEB. (DIAS)", 210, 225, 180, 30);
|
||||
|
||||
// --- SEÇÃO 3: Configurações de Lançamento ---
|
||||
content.Controls.Add(CreateSectionHeader("REGRAS DE CONCILIAÇÃO", 280));
|
||||
|
||||
// Usando o campo LANCA_30 como um CheckBox (S/N)
|
||||
chkLanca30 = CreateCheckBox("LANÇAR AUTOMATICAMENTE PARA 30 DIAS", 20, 315);
|
||||
content.Controls.Add(chkLanca30);
|
||||
|
||||
content.Height = 400;
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_configCartao.CODIGO = txtCodigo.Text;
|
||||
_configCartao.NOME = txtNomeOperadora.Text;
|
||||
_configCartao.TBAND = txtBandeira.Text;
|
||||
_configCartao.CNPJ_OPERADORA = txtCnpjOperadora.Text;
|
||||
|
||||
// Taxas e Operações
|
||||
_configCartao.COMIS_CRED = txtComisCred.Text;
|
||||
_configCartao.OP_CRED = txtOpCred.Text;
|
||||
_configCartao.COMIS_DEBT = txtComisDebt.Text;
|
||||
_configCartao.OP_DEBT = txtOpDebt.Text;
|
||||
|
||||
// Lógica para o campo LANCA_30
|
||||
_configCartao.LANCA_30 = chkLanca30.Checked ? "S" : "N";
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_configCartao = new ModeloConvenioCartoes();
|
||||
txtNomeOperadora.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_configCartao);
|
||||
MessageBox.Show("Configuração de operadora salva com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro ao salvar: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
92
UI/Dashboards/Cadastros/ConfigEcfCadastroPanel.cs
Normal file
92
UI/Dashboards/Cadastros/ConfigEcfCadastroPanel.cs
Normal file
@ -0,0 +1,92 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class ConfigEcfCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloEcfCfg _configEcf = new ModeloEcfCfg();
|
||||
|
||||
// Controles - Identificação e Hardware
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtModelo, txtPorta, txtIndiceServico;
|
||||
|
||||
// Controles - Periféricos
|
||||
private CheckBox chkTemGaveta;
|
||||
|
||||
public ConfigEcfCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Configuração de Impressora Fiscal (ECF)";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Identificação do Equipamento ---
|
||||
content.Controls.Add(CreateSectionHeader("DADOS DO EQUIPAMENTO FISCAL", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 100, 30);
|
||||
|
||||
// Modelo da Impressora (Ex: Bematech, Daruma, Epson)
|
||||
txtModelo = AddInput(content, "MODELO DO ECF", 210, 50, 300, 30);
|
||||
|
||||
// --- SEÇÃO 2: Comunicação e Parâmetros ---
|
||||
content.Controls.Add(CreateSectionHeader("COMUNICAÇÃO E SERVIÇOS", 110));
|
||||
|
||||
// Porta de Comunicação (Ex: COM1, COM2, LPT1, USB)
|
||||
txtPorta = AddInput(content, "PORTA DE COMUNICAÇÃO", 20, 140, 180, 30);
|
||||
|
||||
// Índice Alíquota de Serviço (Comum em ECFs para ISSQN)
|
||||
txtIndiceServico = AddInput(content, "ÍNDICE ALÍQUOTA SERV.", 210, 140, 180, 30);
|
||||
|
||||
// --- SEÇÃO 3: Periféricos ---
|
||||
content.Controls.Add(CreateSectionHeader("CONFIGURAÇÕES ADICIONAIS", 195));
|
||||
|
||||
chkTemGaveta = CreateCheckBox("POSSUI GAVETA DE DINHEIRO CONECTADA", 20, 230);
|
||||
content.Controls.Add(chkTemGaveta);
|
||||
|
||||
content.Height = 320;
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_configEcf.CODIGO = txtCodigo.Text;
|
||||
_configEcf.MODELO = txtModelo.Text;
|
||||
_configEcf.PORTA = txtPorta.Text;
|
||||
_configEcf.INDICE_AL_SERV = txtIndiceServico.Text;
|
||||
|
||||
// Conversão para o padrão string S/N que você utiliza
|
||||
_configEcf.TEM_GAVETA = chkTemGaveta.Checked ? "S" : "N";
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_configEcf = new ModeloEcfCfg();
|
||||
txtPorta.Text = "COM1"; // Sugestão padrão de porta serial
|
||||
txtModelo.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_configEcf);
|
||||
MessageBox.Show("Configuração de hardware salva com sucesso!", "PDV Config", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro ao configurar ECF: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
95
UI/Dashboards/Cadastros/ConfigImpressaoCadastroPanel.cs
Normal file
95
UI/Dashboards/Cadastros/ConfigImpressaoCadastroPanel.cs
Normal file
@ -0,0 +1,95 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class ConfigImpressaoCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloCoordImpres _coord = new ModeloCoordImpres();
|
||||
|
||||
// Controles - Identificação do Modelo e Campo
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtCodModelo, txtNomeCampo, txtCodCampo, txtTipo;
|
||||
|
||||
// Controles - Posicionamento (Coordenadas)
|
||||
private LV_TEXTBOX1 txtCX, txtCY, txtComp;
|
||||
|
||||
private CheckBox chkAtivo;
|
||||
|
||||
public ConfigImpressaoCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Configuração de Coordenadas de Impressão";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Identificação do Campo ---
|
||||
content.Controls.Add(CreateSectionHeader("DEFINIÇÃO DO CAMPO NO RELATÓRIO", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 100, 30);
|
||||
txtCodModelo = AddInput(content, "CÓD. MODELO (DOC)", 210, 50, 150, 30);
|
||||
|
||||
txtNomeCampo = AddInput(content, "NOME EXIBIÇÃO (Ex: Razão Social)", 20, 105, 350, 30);
|
||||
txtCodCampo = AddInput(content, "TAG/VARIÁVEL (Ex: {NOME_CLI})", 380, 105, 250, 30);
|
||||
txtTipo = AddInput(content, "TIPO (Texto/Valor)", 640, 105, 150, 30);
|
||||
|
||||
// --- SEÇÃO 2: Posicionamento e Dimensões ---
|
||||
content.Controls.Add(CreateSectionHeader("COORDENADAS ESPACIAIS (X, Y)", 175));
|
||||
|
||||
// X e Y lado a lado para facilitar a percepção de plano cartesiano
|
||||
txtCX = AddInput(content, "COORDENADA X (Horizontal)", 20, 205, 180, 30);
|
||||
txtCY = AddInput(content, "COORDENADA Y (Vertical)", 210, 205, 180, 30);
|
||||
txtComp = AddInput(content, "COMPRIMENTO/LARGURA", 400, 205, 180, 30);
|
||||
|
||||
chkAtivo = CreateCheckBox("CAMPO ATIVO NA IMPRESSÃO", 600, 223);
|
||||
content.Controls.Add(chkAtivo);
|
||||
|
||||
content.Height = 350;
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_coord.CODIGO = txtCodigo.Text;
|
||||
_coord.COD_MODELO = txtCodModelo.Text;
|
||||
_coord.NOME_CAMPO = txtNomeCampo.Text;
|
||||
_coord.COD_CAMPO = txtCodCampo.Text;
|
||||
_coord.TIPO = txtTipo.Text;
|
||||
_coord.CX = txtCX.Text;
|
||||
_coord.CY = txtCY.Text;
|
||||
_coord.COMP = txtComp.Text;
|
||||
|
||||
// Seguindo o padrão de string para Ativo na sua model
|
||||
_coord.ATIVO = chkAtivo.Checked ? "S" : "N";
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_coord = new ModeloCoordImpres();
|
||||
txtCodModelo.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_coord);
|
||||
MessageBox.Show("Coordenada de impressão configurada!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro ao salvar: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
131
UI/Dashboards/Cadastros/ContasCadastroPanel.cs
Normal file
131
UI/Dashboards/Cadastros/ContasCadastroPanel.cs
Normal file
@ -0,0 +1,131 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class ContasCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloContas _conta = new ModeloContas();
|
||||
|
||||
// Controles - Cabeçalho e Tipo
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtTipo, txtPlanoContas, txtReferencia;
|
||||
|
||||
// Controles - Entidades (Lupa)
|
||||
private LV_TEXTBOX1 txtCodCliente, txtNomeCliente, txtCodFornecedor, txtNomeFornecedor;
|
||||
private Button btnBuscaCliente, btnBuscaFornecedor;
|
||||
|
||||
// Controles - Financeiro
|
||||
private LV_TEXTBOX1 txtValor, txtVencimento, txtDataPgto, txtJuros, txtDesconto, txtParcela, txtFormaCobranca;
|
||||
private CheckBox chkPago;
|
||||
|
||||
// Controles - Fiscais/Extras
|
||||
private LV_TEXTBOX1 txtCfop, txtObservacao;
|
||||
|
||||
public ContasCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Lançamentos Financeiros (Pagar/Receber)";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Dados Básicos do Título ---
|
||||
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DO TÍTULO", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "Nº DOCUMENTO", 100, 50, 130, 30);
|
||||
|
||||
// Aqui você pode trocar para um ComboBox se desejar fixar "Pagar/Receber"
|
||||
txtTipo = AddInput(content, "TIPO (P/R)", 240, 50, 100, 30);
|
||||
txtPlanoContas = AddInput(content, "PLANO DE CONTAS", 350, 50, 250, 30);
|
||||
txtReferencia = AddInput(content, "REFERÊNCIA", 610, 50, 270, 30);
|
||||
|
||||
// --- SEÇÃO 2: Cliente / Fornecedor (Com busca) ---
|
||||
content.Controls.Add(CreateSectionHeader("ENTIDADES ENVOLVIDAS", 110));
|
||||
|
||||
// Cliente
|
||||
txtCodCliente = AddInput(content, "CÓD. CLI", 20, 140, 70, 30);
|
||||
btnBuscaCliente = CriarBotaoLupa(100, 156, OnBuscaCliente);
|
||||
txtNomeCliente = AddInput(content, "NOME DO CLIENTE", 140, 140, 300, 30, true);
|
||||
|
||||
// Fornecedor
|
||||
txtCodFornecedor = AddInput(content, "CÓD. FOR", 460, 140, 70, 30);
|
||||
btnBuscaFornecedor = CriarBotaoLupa(540, 156, OnBuscaFornecedor);
|
||||
txtNomeFornecedor = AddInput(content, "NOME DO FORNECEDOR", 580, 140, 300, 30, true);
|
||||
|
||||
// --- SEÇÃO 3: Valores e Prazos ---
|
||||
content.Controls.Add(CreateSectionHeader("FINANCEIRO E PAGAMENTO", 200));
|
||||
|
||||
txtValor = AddInput(content, "VALOR (R$)", 20, 230, 130, 30);
|
||||
txtVencimento = AddInput(content, "VENCIMENTO", 160, 230, 120, 30);
|
||||
txtDataPgto = AddInput(content, "DATA PGTO", 290, 230, 120, 30);
|
||||
txtJuros = AddInput(content, "JUROS (+)", 420, 230, 100, 30);
|
||||
txtDesconto = AddInput(content, "DESC (-)", 530, 230, 100, 30);
|
||||
|
||||
chkPago = CreateCheckBox("TÍTULO PAGO", 650, 248);
|
||||
content.Controls.Add(chkPago);
|
||||
|
||||
txtParcela = AddInput(content, "PARCELA", 20, 285, 80, 30);
|
||||
txtFormaCobranca = AddInput(content, "FORMA COBRANÇA", 110, 285, 170, 30);
|
||||
txtCfop = AddInput(content, "CFOP", 290, 285, 120, 30);
|
||||
|
||||
// --- SEÇÃO 4: Observações ---
|
||||
content.Controls.Add(CreateSectionHeader("OBSERVAÇÕES", 355));
|
||||
txtObservacao = AddInput(content, "DETALHES DO LANÇAMENTO", 20, 385, 860, 60);
|
||||
|
||||
content.Height = 520;
|
||||
}
|
||||
|
||||
// Helper para criar lupas rapidamente
|
||||
private Button CriarBotaoLupa(int x, int y, EventHandler clickEvent)
|
||||
{
|
||||
var btn = new Button
|
||||
{
|
||||
Text = "🔍",
|
||||
Location = new Point(x, y),
|
||||
Size = new Size(32, 30),
|
||||
BackColor = AccentBlue,
|
||||
ForeColor = Color.White,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Cursor = Cursors.Hand
|
||||
};
|
||||
btn.FlatAppearance.BorderSize = 0;
|
||||
btn.Click += clickEvent;
|
||||
content.Controls.Add(btn);
|
||||
return btn;
|
||||
}
|
||||
|
||||
private void OnBuscaCliente(object sender, EventArgs e) => MessageBox.Show("Busca de Clientes");
|
||||
private void OnBuscaFornecedor(object sender, EventArgs e) => MessageBox.Show("Busca de Fornecedores");
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_conta.CODIGO = txtCodigo.Text;
|
||||
_conta.TIPO = txtTipo.Text;
|
||||
_conta.COD_CLIENTE = txtCodCliente.Text;
|
||||
_conta.COD_FORNECEDOR = txtCodFornecedor.Text;
|
||||
_conta.VALOR = txtValor.Text;
|
||||
_conta.VENCIMENTO = txtVencimento.Text;
|
||||
_conta.DATA_PGTO = txtDataPgto.Text;
|
||||
_conta.PAGO = chkPago.Checked ? "S" : "N"; // Exemplo de conversão Sim/Não
|
||||
_conta.JUROS = txtJuros.Text;
|
||||
_conta.DESCONTO = txtDesconto.Text;
|
||||
_conta.OBSERVACAO = txtObservacao.Text;
|
||||
_conta.PARCELA = txtParcela.Text;
|
||||
_conta.CFOP = txtCfop.Text;
|
||||
_conta.PLANO_CONTAS = txtPlanoContas.Text;
|
||||
_conta.REFERENCIA = txtReferencia.Text;
|
||||
}
|
||||
|
||||
protected override void OnNovo() { _conta = new ModeloContas(); txtCodigo.Focus(); }
|
||||
protected override void OnSalvar() { PreencherModel(); MessageBox.Show("Título financeiro salvo!"); }
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
79
UI/Dashboards/Cadastros/ContasCorrentesCadastroPanel.cs
Normal file
79
UI/Dashboards/Cadastros/ContasCorrentesCadastroPanel.cs
Normal file
@ -0,0 +1,79 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class ContasCorrentesCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloContasContas _contaBancaria = new ModeloContasContas();
|
||||
|
||||
// Controles
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtDescricao, txtSaldoInicial;
|
||||
|
||||
public ContasCorrentesCadastroPanel()
|
||||
{
|
||||
// Nome mais amigável na barra de título
|
||||
this.Titulo = "Cadastro de Contas e Caixas";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO ÚNICA: Dados da Conta ---
|
||||
content.Controls.Add(CreateSectionHeader("INFORMAÇÕES DA CONTA CORRENTE / CAIXA", 20));
|
||||
|
||||
// Linha 1: ID e Código (ex: 001, CTA-01)
|
||||
txtId = AddInput(content, "ID", 20, 50, 80, 30, true);
|
||||
txtCodigo = AddInput(content, "CÓDIGO INTERNO", 110, 50, 150, 30);
|
||||
|
||||
// Linha 2: Descrição (ex: "Banco do Brasil - Ag. 1234", "Caixa Geral", "Cofre")
|
||||
txtDescricao = AddInput(content, "NOME / DESCRIÇÃO DA CONTA", 20, 105, 500, 30);
|
||||
|
||||
// Linha 3: Saldo Inicial
|
||||
// x=20, y=160 (105 + 55 de espaçamento)
|
||||
txtSaldoInicial = AddInput(content, "SALDO INICIAL (R$)", 20, 160, 200, 30);
|
||||
|
||||
// Como é um formulário pequeno, ajustamos o content para não sobrar scroll
|
||||
content.Height = 300;
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_contaBancaria.ID_CONTAS_CONTAS = int.TryParse(txtId.Text, out int id) ? id : 0;
|
||||
_contaBancaria.CODIGO = txtCodigo.Text;
|
||||
_contaBancaria.DESCRICAO = txtDescricao.Text;
|
||||
_contaBancaria.SALDO_INI = txtSaldoInicial.Text;
|
||||
}
|
||||
|
||||
// --- MÉTODOS OBRIGATÓRIOS DA BASE ---
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_contaBancaria = new ModeloContasContas();
|
||||
txtCodigo.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_contaBancaria);
|
||||
MessageBox.Show("Conta/Caixa salvo com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro ao salvar: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
610
UI/Dashboards/Cadastros/ContasReceberCadastroPanel.cs
Normal file
610
UI/Dashboards/Cadastros/ContasReceberCadastroPanel.cs
Normal file
@ -0,0 +1,610 @@
|
||||
using CPM;
|
||||
using DAL;
|
||||
using MLL;
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public class ContaReceberCadastroPanel : FormularioModelo
|
||||
{
|
||||
// ── CAMPOS DO FORMULÁRIO ──────────────────────────────────────────────
|
||||
private LV_TEXTBOX1 txtId = null!;
|
||||
private LV_TEXTBOX1 txtDescricao = null!;
|
||||
private LV_COMBOBOXCUSTOM cmbStatus = null!;
|
||||
private CheckBox chkAtivo = null!;
|
||||
|
||||
// Cliente — busca
|
||||
private LV_TEXTBOX1 txtClienteId = null!;
|
||||
private LV_TEXTBOX1 txtClienteNome = null!;
|
||||
private Button btnBuscarCliente = null!;
|
||||
|
||||
// Plano de Contas — busca
|
||||
private LV_TEXTBOX1 txtPlanoContaId = null!;
|
||||
private LV_TEXTBOX1 txtPlanoContaNome = null!;
|
||||
private Button btnBuscarPlanoConta = null!;
|
||||
|
||||
// Valores
|
||||
private LV_TEXTBOX1 txtValor = null!;
|
||||
private LV_TEXTBOX1 txtValorPago = null!;
|
||||
private LV_TEXTBOX1 txtJuros = null!;
|
||||
private LV_TEXTBOX1 txtMulta = null!;
|
||||
private LV_TEXTBOX1 txtDesconto = null!;
|
||||
|
||||
// Datas
|
||||
private LV_TEXTBOX1 txtDataEmissao = null!;
|
||||
private LV_TEXTBOX1 txtDataVencimento = null!;
|
||||
private LV_TEXTBOX1 txtDataPagamento = null!;
|
||||
|
||||
// Auditoria
|
||||
private LV_TEXTBOX1 txtCriadoEm = null!;
|
||||
private LV_TEXTBOX1 txtAtualizadoEm = null!;
|
||||
|
||||
// Observações
|
||||
private LV_TEXTBOX1 txtObservacoes = null!;
|
||||
|
||||
// ── ESTADO ────────────────────────────────────────────────────────────
|
||||
private enum ModoFormulario { Visualizacao, Novo, Edicao }
|
||||
private ModoFormulario _modo = ModoFormulario.Visualizacao;
|
||||
private int _idAtual = 0;
|
||||
private int _clienteId = 0;
|
||||
private int _planoContaId = 0;
|
||||
private int? _contratoId = null;
|
||||
|
||||
// ── BLL ───────────────────────────────────────────────────────────────
|
||||
// private ContaReceberBLL _bll = null!;
|
||||
|
||||
// ── CONSTRUTOR ────────────────────────────────────────────────────────
|
||||
public ContaReceberCadastroPanel()
|
||||
{
|
||||
Titulo = "Contas a Receber";
|
||||
BuildForm();
|
||||
AplicarModo(ModoFormulario.Visualizacao);
|
||||
}
|
||||
|
||||
// ── CONSTRUÇÃO DOS CAMPOS ─────────────────────────────────────────────
|
||||
private void BuildForm()
|
||||
{
|
||||
// ── SEÇÃO: IDENTIFICAÇÃO ──────────────────────────────────────────
|
||||
content.Controls.Add(CreateSectionHeader("Identificação", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 58, 80, 32, readOnly: true);
|
||||
|
||||
txtDescricao = AddInput(content, "Descrição", 120, 58, 400, 32);
|
||||
txtDescricao.MaxLength = 255;
|
||||
|
||||
// Status
|
||||
var lblStatus = new Label
|
||||
{
|
||||
Text = "Status",
|
||||
Location = new Point(540, 58),
|
||||
Font = new Font("Segoe UI", 7.5f, FontStyle.Bold),
|
||||
ForeColor = TextDark,
|
||||
AutoSize = true
|
||||
};
|
||||
cmbStatus = new LV_COMBOBOXCUSTOM
|
||||
{
|
||||
Location = new Point(540, 74),
|
||||
Size = new Size(160, 32),
|
||||
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||
BorderColor = BorderColor,
|
||||
BackColor = Color.White,
|
||||
ListBackColor = Color.White,
|
||||
ListTextColor = TextDark,
|
||||
IconColor = AccentBlue,
|
||||
Font = new Font("Segoe UI", 9f)
|
||||
};
|
||||
cmbStatus.Items.Add("Pendente");
|
||||
cmbStatus.Items.Add("Pago");
|
||||
cmbStatus.Items.Add("Vencido");
|
||||
cmbStatus.Items.Add("Cancelado");
|
||||
cmbStatus.Items.Add("Parcial");
|
||||
cmbStatus.SelectedIndex = 0;
|
||||
_contratoId = null;
|
||||
content.Controls.Add(lblStatus);
|
||||
content.Controls.Add(cmbStatus);
|
||||
|
||||
chkAtivo = CreateCheckBox("Ativo", 720, 82);
|
||||
chkAtivo.Checked = true;
|
||||
content.Controls.Add(chkAtivo);
|
||||
|
||||
// ── SEÇÃO: FORNECEDOR ─────────────────────────────────────────────
|
||||
content.Controls.Add(CreateSectionHeader("Cliente", 128));
|
||||
|
||||
var lblCliente = new Label
|
||||
{
|
||||
Text = "Cliente",
|
||||
Location = new Point(20, 166),
|
||||
Font = new Font("Segoe UI", 7.5f, FontStyle.Bold),
|
||||
ForeColor = TextDark,
|
||||
AutoSize = true
|
||||
};
|
||||
txtClienteId = new LV_TEXTBOX1
|
||||
{
|
||||
Location = new Point(20, 182),
|
||||
Size = new Size(80, 32),
|
||||
BorderColor = ReadOnlyBorder,
|
||||
BorderFocusColor = AccentBlue,
|
||||
ReadOnly = true,
|
||||
BackColor = ReadOnlyBg
|
||||
};
|
||||
txtClienteNome = new LV_TEXTBOX1
|
||||
{
|
||||
Location = new Point(108, 182),
|
||||
Size = new Size(300, 32),
|
||||
BorderColor = ReadOnlyBorder,
|
||||
BorderFocusColor = AccentBlue,
|
||||
ReadOnly = true,
|
||||
BackColor = ReadOnlyBg
|
||||
};
|
||||
btnBuscarCliente = new Button
|
||||
{
|
||||
Text = "🔍 Buscar",
|
||||
Location = new Point(416, 182),
|
||||
Size = new Size(90, 32),
|
||||
BackColor = AccentBlue,
|
||||
ForeColor = Color.White,
|
||||
Font = new Font("Segoe UI Semibold", 8.5f),
|
||||
Cursor = Cursors.Hand,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Enabled = false
|
||||
};
|
||||
btnBuscarCliente.FlatAppearance.BorderSize = 0;
|
||||
btnBuscarCliente.Click += BtnBuscarCliente_Click;
|
||||
content.Controls.Add(lblCliente);
|
||||
content.Controls.Add(txtClienteId);
|
||||
content.Controls.Add(txtClienteNome);
|
||||
content.Controls.Add(btnBuscarCliente);
|
||||
|
||||
// ── SEÇÃO: PLANO DE CONTAS ────────────────────────────────────────
|
||||
content.Controls.Add(CreateSectionHeader("Plano de Contas", 234));
|
||||
|
||||
var lblPlanoConta = new Label
|
||||
{
|
||||
Text = "Plano de Contas",
|
||||
Location = new Point(20, 272),
|
||||
Font = new Font("Segoe UI", 7.5f, FontStyle.Bold),
|
||||
ForeColor = TextDark,
|
||||
AutoSize = true
|
||||
};
|
||||
txtPlanoContaId = new LV_TEXTBOX1
|
||||
{
|
||||
Location = new Point(20, 288),
|
||||
Size = new Size(80, 32),
|
||||
BorderColor = ReadOnlyBorder,
|
||||
BorderFocusColor = AccentBlue,
|
||||
ReadOnly = true,
|
||||
BackColor = ReadOnlyBg
|
||||
};
|
||||
txtPlanoContaNome = new LV_TEXTBOX1
|
||||
{
|
||||
Location = new Point(108, 288),
|
||||
Size = new Size(300, 32),
|
||||
BorderColor = ReadOnlyBorder,
|
||||
BorderFocusColor = AccentBlue,
|
||||
ReadOnly = true,
|
||||
BackColor = ReadOnlyBg
|
||||
};
|
||||
btnBuscarPlanoConta = new Button
|
||||
{
|
||||
Text = "🔍 Buscar",
|
||||
Location = new Point(416, 288),
|
||||
Size = new Size(90, 32),
|
||||
BackColor = AccentBlue,
|
||||
ForeColor = Color.White,
|
||||
Font = new Font("Segoe UI Semibold", 8.5f),
|
||||
Cursor = Cursors.Hand,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Enabled = false
|
||||
};
|
||||
btnBuscarPlanoConta.FlatAppearance.BorderSize = 0;
|
||||
btnBuscarPlanoConta.Click += BtnBuscarPlanoConta_Click;
|
||||
content.Controls.Add(lblPlanoConta);
|
||||
content.Controls.Add(txtPlanoContaId);
|
||||
content.Controls.Add(txtPlanoContaNome);
|
||||
content.Controls.Add(btnBuscarPlanoConta);
|
||||
|
||||
// Contrato — opcional
|
||||
var lblContrato = new Label
|
||||
{
|
||||
Text = "Contrato (opcional)",
|
||||
Location = new Point(20, 340),
|
||||
Font = new Font("Segoe UI", 7.5f, FontStyle.Bold),
|
||||
ForeColor = TextDark,
|
||||
AutoSize = true
|
||||
};
|
||||
var txtContratoId = new LV_TEXTBOX1
|
||||
{
|
||||
Location = new Point(20, 356),
|
||||
Size = new Size(160, 32),
|
||||
BorderColor = BorderColor,
|
||||
BorderFocusColor = AccentBlue
|
||||
};
|
||||
content.Controls.Add(lblContrato);
|
||||
content.Controls.Add(txtContratoId);
|
||||
|
||||
// ── SEÇÃO: VALORES ────────────────────────────────────────────────────
|
||||
content.Controls.Add(CreateSectionHeader("Valores", 410));
|
||||
|
||||
txtValor = AddInput(content, "Valor (R$)", 20, 448, 150, 32);
|
||||
txtValorPago = AddInput(content, "Valor Pago (R$)", 190, 448, 150, 32);
|
||||
txtJuros = AddInput(content, "Juros (R$)", 360, 448, 130, 32);
|
||||
txtMulta = AddInput(content, "Multa (R$)", 510, 448, 130, 32);
|
||||
txtDesconto = AddInput(content, "Desconto (R$)", 660, 448, 130, 32);
|
||||
|
||||
// ── SEÇÃO: DATAS ──────────────────────────────────────────────────
|
||||
content.Controls.Add(CreateSectionHeader("Datas", 510));
|
||||
|
||||
txtDataEmissao = AddInput(content, "Emissão", 20, 548, 180, 32);
|
||||
txtDataVencimento = AddInput(content, "Vencimento", 220, 548, 180, 32);
|
||||
txtDataPagamento = AddInput(content, "Pagamento", 420, 548, 180, 32);
|
||||
|
||||
// ── SEÇÃO: OBSERVAÇÕES ────────────────────────────────────────────
|
||||
content.Controls.Add(CreateSectionHeader("Observações", 610));
|
||||
|
||||
var lblObs = new Label
|
||||
{
|
||||
Text = "Observações",
|
||||
Location = new Point(20, 648),
|
||||
Font = new Font("Segoe UI", 7.5f, FontStyle.Bold),
|
||||
ForeColor = TextDark,
|
||||
AutoSize = true
|
||||
};
|
||||
txtObservacoes = new LV_TEXTBOX1
|
||||
{
|
||||
Location = new Point(20, 664),
|
||||
Size = new Size(760, 70),
|
||||
BorderColor = BorderColor,
|
||||
BorderFocusColor = AccentBlue,
|
||||
Multiline = true,
|
||||
MaxLength = 500
|
||||
};
|
||||
content.Controls.Add(lblObs);
|
||||
content.Controls.Add(txtObservacoes);
|
||||
|
||||
// ── SEÇÃO: AUDITORIA ──────────────────────────────────────────────
|
||||
content.Controls.Add(CreateSectionHeader("Auditoria", 754));
|
||||
|
||||
txtCriadoEm = AddInput(content, "Criado em", 20, 792, 200, 32, readOnly: true);
|
||||
txtAtualizadoEm = AddInput(content, "Atualizado em", 240, 792, 200, 32, readOnly: true);
|
||||
|
||||
content.Height = 860;
|
||||
}
|
||||
|
||||
// ── CAMPOS EDITÁVEIS ──────────────────────────────────────────────────
|
||||
private LV_TEXTBOX1[] CamposEditaveis() => new[]
|
||||
{
|
||||
txtDescricao, txtValor, txtValorPago, txtJuros,
|
||||
txtMulta, txtDesconto, txtDataEmissao, txtDataVencimento,
|
||||
txtDataPagamento, txtObservacoes
|
||||
};
|
||||
|
||||
// ── MODOS DO FORMULÁRIO ───────────────────────────────────────────────
|
||||
private void AplicarModo(ModoFormulario modo)
|
||||
{
|
||||
_modo = modo;
|
||||
bool editando = modo == ModoFormulario.Novo || modo == ModoFormulario.Edicao;
|
||||
|
||||
foreach (var txt in CamposEditaveis())
|
||||
{
|
||||
txt.ReadOnly = !editando;
|
||||
txt.BackColor = editando ? Color.White : ReadOnlyBg;
|
||||
txt.BorderColor = editando ? BorderColor : ReadOnlyBorder;
|
||||
}
|
||||
|
||||
cmbStatus.Enabled = editando;
|
||||
cmbStatus.BorderColor = editando ? BorderColor : ReadOnlyBorder;
|
||||
cmbStatus.BackColor = editando ? Color.White : ReadOnlyBg;
|
||||
|
||||
chkAtivo.Enabled = editando;
|
||||
|
||||
btnBuscarCliente.Enabled = editando;
|
||||
btnBuscarPlanoConta.Enabled = editando;
|
||||
|
||||
btnNovo.Enabled = !editando;
|
||||
btnAlterar.Enabled = !editando && _idAtual > 0;
|
||||
btnExcluir.Enabled = !editando && _idAtual > 0;
|
||||
btnLocalizar.Enabled = !editando;
|
||||
btnSalvar.Enabled = editando;
|
||||
btnCancelar.Enabled = editando;
|
||||
|
||||
if (modo == ModoFormulario.Novo) LimparCampos();
|
||||
}
|
||||
|
||||
// ── BUSCA DE FORNECEDOR ───────────────────────────────────────────────
|
||||
private void BtnBuscarCliente_Click(object? sender, EventArgs e)
|
||||
{
|
||||
// TODO: abrir formulário de busca de clientees
|
||||
// var frm = new FormularioBuscarCliente();
|
||||
// if (frm.ShowDialog() == DialogResult.OK)
|
||||
// {
|
||||
// _clienteId = frm.ClienteSelecionado.Id;
|
||||
// txtClienteId.Text = _clienteId.ToString();
|
||||
// txtClienteNome.Text = frm.ClienteSelecionado.Nome;
|
||||
// }
|
||||
MessageBox.Show("Implemente o formulário de busca de clientees.",
|
||||
"Buscar Cliente", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
// ── BUSCA DE PLANO DE CONTAS ──────────────────────────────────────────
|
||||
private void BtnBuscarPlanoConta_Click(object? sender, EventArgs e)
|
||||
{
|
||||
// TODO: abrir formulário de busca de plano de contas
|
||||
// var frm = new FormularioBuscarPlanoConta();
|
||||
// if (frm.ShowDialog() == DialogResult.OK)
|
||||
// {
|
||||
// _planoContaId = frm.PlanoContaSelecionado.Id;
|
||||
// txtPlanoContaId.Text = _planoContaId.ToString();
|
||||
// txtPlanoContaNome.Text = frm.PlanoContaSelecionado.Nome;
|
||||
// }
|
||||
MessageBox.Show("Implemente o formulário de busca de plano de contas.",
|
||||
"Buscar Plano de Contas", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
// ── POPULAR / LIMPAR ──────────────────────────────────────────────────
|
||||
private void PopularCampos(ModeloContaReceber m)
|
||||
{
|
||||
_idAtual = m.Id;
|
||||
_clienteId = m.ClienteId;
|
||||
_planoContaId = m.PlanoContaId;
|
||||
|
||||
txtId.Text = m.Id.ToString();
|
||||
txtDescricao.Text = m.Descricao;
|
||||
txtClienteId.Text = m.ClienteId.ToString();
|
||||
_contratoId = m.ContratoId;
|
||||
txtPlanoContaId.Text = m.PlanoContaId.ToString();
|
||||
txtValor.Text = m.Valor.ToString("F2");
|
||||
txtValorPago.Text = m.ValorPago?.ToString("F2") ?? string.Empty;
|
||||
txtJuros.Text = m.Juros.ToString("F2");
|
||||
txtMulta.Text = m.Multa.ToString("F2");
|
||||
txtDesconto.Text = m.Desconto.ToString("F2");
|
||||
txtDataEmissao.Text = m.DataEmissao?.ToString("dd/MM/yyyy") ?? string.Empty;
|
||||
txtDataVencimento.Text = m.DataVencimento.ToString("dd/MM/yyyy");
|
||||
txtDataPagamento.Text = m.DataPagamento?.ToString("dd/MM/yyyy") ?? string.Empty;
|
||||
txtObservacoes.Text = m.Observacoes;
|
||||
chkAtivo.Checked = m.Ativo;
|
||||
txtCriadoEm.Text = m.CriadoEm.ToString("dd/MM/yyyy HH:mm");
|
||||
txtAtualizadoEm.Text = m.AtualizadoEm.ToString("dd/MM/yyyy HH:mm");
|
||||
|
||||
SelecionarCombo(cmbStatus, m.Status);
|
||||
}
|
||||
|
||||
private void LimparCampos()
|
||||
{
|
||||
_idAtual = 0;
|
||||
_clienteId = 0;
|
||||
_planoContaId = 0;
|
||||
|
||||
txtId.Text = string.Empty;
|
||||
txtDescricao.Text = string.Empty;
|
||||
txtClienteId.Text = string.Empty;
|
||||
txtClienteNome.Text = string.Empty;
|
||||
txtPlanoContaId.Text = string.Empty;
|
||||
txtPlanoContaNome.Text = string.Empty;
|
||||
txtValor.Text = string.Empty;
|
||||
txtValorPago.Text = string.Empty;
|
||||
txtJuros.Text = string.Empty;
|
||||
txtMulta.Text = string.Empty;
|
||||
txtDesconto.Text = string.Empty;
|
||||
txtDataEmissao.Text = string.Empty;
|
||||
txtDataVencimento.Text = string.Empty;
|
||||
txtDataPagamento.Text = string.Empty;
|
||||
txtObservacoes.Text = string.Empty;
|
||||
chkAtivo.Checked = true;
|
||||
txtCriadoEm.Text = string.Empty;
|
||||
txtAtualizadoEm.Text = string.Empty;
|
||||
cmbStatus.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
// ── HELPER COMBOBOX ───────────────────────────────────────────────────
|
||||
private static void SelecionarCombo(LV_COMBOBOXCUSTOM cmb, string valor)
|
||||
{
|
||||
for (int i = 0; i < cmb.Items.Count; i++)
|
||||
{
|
||||
if (cmb.Items[i]?.ToString() == valor)
|
||||
{
|
||||
cmb.SelectedIndex = i;
|
||||
return;
|
||||
}
|
||||
}
|
||||
cmb.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
// ── VALIDAÇÃO ─────────────────────────────────────────────────────────
|
||||
private bool Validar()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(txtDescricao.Text))
|
||||
{
|
||||
MessageBox.Show("Informe a descrição.", "Validação",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
txtDescricao.Focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_clienteId == 0)
|
||||
{
|
||||
MessageBox.Show("Selecione um cliente.", "Validação",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
btnBuscarCliente.Focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_planoContaId == 0)
|
||||
{
|
||||
MessageBox.Show("Selecione um plano de contas.", "Validação",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
btnBuscarPlanoConta.Focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!decimal.TryParse(txtValor.Text.Replace(",", "."),
|
||||
System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out _))
|
||||
{
|
||||
MessageBox.Show("Informe um valor válido.", "Validação",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
txtValor.Focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(txtDataVencimento.Text))
|
||||
{
|
||||
MessageBox.Show("Informe a data de vencimento.", "Validação",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
txtDataVencimento.Focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ── MONTAR MODELO ─────────────────────────────────────────────────────
|
||||
private ModeloContaReceber MontarModelo()
|
||||
{
|
||||
decimal.TryParse(txtValor.Text.Replace(",", "."),
|
||||
System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out decimal valor);
|
||||
decimal.TryParse(txtValorPago.Text.Replace(",", "."),
|
||||
System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out decimal valorPago);
|
||||
decimal.TryParse(txtJuros.Text.Replace(",", "."),
|
||||
System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out decimal juros);
|
||||
decimal.TryParse(txtMulta.Text.Replace(",", "."),
|
||||
System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out decimal multa);
|
||||
decimal.TryParse(txtDesconto.Text.Replace(",", "."),
|
||||
System.Globalization.NumberStyles.Any,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out decimal desconto);
|
||||
|
||||
DateTime.TryParseExact(txtDataVencimento.Text, "dd/MM/yyyy",
|
||||
null, System.Globalization.DateTimeStyles.None, out DateTime dataVenc);
|
||||
|
||||
DateTime.TryParseExact(txtDataEmissao.Text, "dd/MM/yyyy",
|
||||
null, System.Globalization.DateTimeStyles.None, out DateTime dataEmissao);
|
||||
DateTime? dataEmissaoNull = string.IsNullOrWhiteSpace(txtDataEmissao.Text) ? null : dataEmissao;
|
||||
|
||||
DateTime.TryParseExact(txtDataPagamento.Text, "dd/MM/yyyy",
|
||||
null, System.Globalization.DateTimeStyles.None, out DateTime dataPag);
|
||||
DateTime? dataPagNull = string.IsNullOrWhiteSpace(txtDataPagamento.Text) ? null : dataPag;
|
||||
|
||||
return new ModeloContaReceber(
|
||||
_idAtual,
|
||||
0, // EmpresaId — preenchido pela BLL via sessão
|
||||
_clienteId,
|
||||
_planoContaId,
|
||||
_contratoId,
|
||||
txtDescricao.Text.Trim(),
|
||||
valor,
|
||||
string.IsNullOrWhiteSpace(txtValorPago.Text) ? null : valorPago,
|
||||
juros,
|
||||
multa,
|
||||
desconto,
|
||||
cmbStatus.SelectedItem?.ToString() ?? "Pendente",
|
||||
dataEmissaoNull,
|
||||
dataVenc,
|
||||
dataPagNull,
|
||||
txtObservacoes.Text.Trim(),
|
||||
chkAtivo.Checked,
|
||||
_modo == ModoFormulario.Novo ? DateTime.Now : DateTime.Parse(txtCriadoEm.Text),
|
||||
DateTime.Now
|
||||
);
|
||||
}
|
||||
|
||||
// ── EVENTOS ABSTRATOS ─────────────────────────────────────────────────
|
||||
protected override void OnNovo()
|
||||
{
|
||||
AplicarModo(ModoFormulario.Novo);
|
||||
txtDescricao.Focus();
|
||||
}
|
||||
|
||||
protected override void OnAlterar()
|
||||
{
|
||||
if (_idAtual == 0) return;
|
||||
AplicarModo(ModoFormulario.Edicao);
|
||||
txtDescricao.Focus();
|
||||
}
|
||||
|
||||
protected override void OnExcluir()
|
||||
{
|
||||
if (_idAtual == 0) return;
|
||||
|
||||
var confirm = MessageBox.Show(
|
||||
$"Deseja realmente excluir a conta \"{txtDescricao.Text}\"?",
|
||||
"Confirmar exclusão",
|
||||
MessageBoxButtons.YesNo,
|
||||
MessageBoxIcon.Warning);
|
||||
|
||||
if (confirm != DialogResult.Yes) return;
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: _bll.Excluir(_idAtual);
|
||||
MessageBox.Show("Conta a receber excluída com sucesso.", "Sucesso",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
LimparCampos();
|
||||
AplicarModo(ModoFormulario.Visualizacao);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Erro ao excluir:\n{ex.Message}", "Erro",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnLocalizar()
|
||||
{
|
||||
// TODO: abrir formulário de busca de contas a receber
|
||||
// var frm = new FormularioBuscarContaReceber();
|
||||
// if (frm.ShowDialog() == DialogResult.OK)
|
||||
// {
|
||||
// PopularCampos(frm.ContaSelecionada);
|
||||
// AplicarModo(ModoFormulario.Visualizacao);
|
||||
// }
|
||||
MessageBox.Show("Implemente o formulário de busca de contas a receber.",
|
||||
"Localizar", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
if (!Validar()) return;
|
||||
|
||||
var modelo = MontarModelo();
|
||||
|
||||
try
|
||||
{
|
||||
if (_modo == ModoFormulario.Novo)
|
||||
{
|
||||
// TODO: _bll.Criar(modelo);
|
||||
MessageBox.Show("Conta a receber cadastrada com sucesso!", "Sucesso",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: _bll.Atualizar(modelo);
|
||||
MessageBox.Show("Conta a receber atualizada com sucesso!", "Sucesso",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
|
||||
AplicarModo(ModoFormulario.Visualizacao);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"Erro ao salvar:\n{ex.Message}", "Erro",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnCancelar()
|
||||
{
|
||||
if (_idAtual > 0)
|
||||
{
|
||||
// TODO: recarregar do banco se necessário
|
||||
}
|
||||
LimparCampos();
|
||||
AplicarModo(ModoFormulario.Visualizacao);
|
||||
}
|
||||
}
|
||||
}
|
||||
122
UI/Dashboards/Cadastros/ContratoEquipamentosCadastroPanel.cs
Normal file
122
UI/Dashboards/Cadastros/ContratoEquipamentosCadastroPanel.cs
Normal file
@ -0,0 +1,122 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class ContratoEquipamentosCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloContratoEquipamentos _itemContrato = new ModeloContratoEquipamentos();
|
||||
|
||||
// Controles - Vínculo e Identificação
|
||||
private LV_TEXTBOX1 txtId, txtContratoId, txtDescricaoContrato;
|
||||
private Button btnBuscaContrato;
|
||||
|
||||
// Controles - Especificações do Equipamento
|
||||
private LV_TEXTBOX1 txtModelo, txtMarca, txtOperadora;
|
||||
private LV_TEXTBOX1 txtSerial, txtPatrimonio, txtObservacoes;
|
||||
|
||||
public ContratoEquipamentosCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Vínculo de Equipamentos ao Contrato";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Vínculo com o Contrato ---
|
||||
content.Controls.Add(CreateSectionHeader("DADOS DO CONTRATO", 20));
|
||||
|
||||
txtId = AddInput(content, "ID VÍNCULO", 20, 50, 90, 30, true);
|
||||
|
||||
txtContratoId = AddInput(content, "ID CONTRATO", 120, 50, 90, 30);
|
||||
btnBuscaContrato = CriarBotaoLupa(215, 66, OnBuscaContrato);
|
||||
|
||||
txtDescricaoContrato = AddInput(content, "DESCRIÇÃO / CLIENTE DO CONTRATO", 255, 50, 400, 30, true);
|
||||
|
||||
// --- SEÇÃO 2: Especificações Técnicas ---
|
||||
content.Controls.Add(CreateSectionHeader("ESPECIFICAÇÕES DO EQUIPAMENTO", 110));
|
||||
|
||||
txtMarca = AddInput(content, "MARCA", 20, 140, 240, 30);
|
||||
txtModelo = AddInput(content, "MODELO", 270, 140, 240, 30);
|
||||
txtOperadora = AddInput(content, "OPERADORA (CHIP/LINK)", 520, 140, 200, 30);
|
||||
|
||||
// --- SEÇÃO 3: Identificação Única ---
|
||||
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO E RASTREABILIDADE", 200));
|
||||
|
||||
txtSerial = AddInput(content, "NÚMERO DE SÉRIE / IMEI", 20, 230, 300, 30);
|
||||
txtPatrimonio = AddInput(content, "Nº PATRIMÔNIO", 330, 230, 200, 30);
|
||||
|
||||
// --- SEÇÃO 4: Observações ---
|
||||
content.Controls.Add(CreateSectionHeader("NOTAS DO ITEM", 290));
|
||||
txtObservacoes = AddInput(content, "OBSERVAÇÕES DE INSTALAÇÃO/ESTADO", 20, 320, 860, 60);
|
||||
|
||||
content.Height = 450;
|
||||
}
|
||||
|
||||
// Helper para criar lupas (reutilizando a lógica do financeiro)
|
||||
private Button CriarBotaoLupa(int x, int y, EventHandler clickEvent)
|
||||
{
|
||||
var btn = new Button
|
||||
{
|
||||
Text = "🔍",
|
||||
Location = new Point(x, y),
|
||||
Size = new Size(32, 30),
|
||||
BackColor = AccentBlue,
|
||||
ForeColor = Color.White,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Cursor = Cursors.Hand
|
||||
};
|
||||
btn.FlatAppearance.BorderSize = 0;
|
||||
btn.Click += clickEvent;
|
||||
content.Controls.Add(btn);
|
||||
return btn;
|
||||
}
|
||||
|
||||
private void OnBuscaContrato(object sender, EventArgs e)
|
||||
{
|
||||
// Abre sua tela de busca de ModeloContrato
|
||||
MessageBox.Show("Abrir busca de Contratos ativos");
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
if (int.TryParse(txtContratoId.Text, out int cId)) _itemContrato.ContratoId = cId;
|
||||
|
||||
_itemContrato.Marca = txtMarca.Text;
|
||||
_itemContrato.Modelo = txtModelo.Text;
|
||||
_itemContrato.Operadora = txtOperadora.Text;
|
||||
_itemContrato.Serial = txtSerial.Text;
|
||||
_itemContrato.NumeroPatrimonio = txtPatrimonio.Text;
|
||||
_itemContrato.Observacoes = txtObservacoes.Text;
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_itemContrato = new ModeloContratoEquipamentos();
|
||||
txtContratoId.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_itemContrato);
|
||||
MessageBox.Show("Equipamento vinculado ao contrato com sucesso!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
103
UI/Dashboards/Cadastros/DepositoCadastroPanel.cs
Normal file
103
UI/Dashboards/Cadastros/DepositoCadastroPanel.cs
Normal file
@ -0,0 +1,103 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class DepositoCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloContasDeposito _deposito = new ModeloContasDeposito();
|
||||
|
||||
// Controles
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtCodCorrente, txtNomeConta, txtCodLancto, txtValor, txtData;
|
||||
private Button btnBuscaConta;
|
||||
|
||||
public DepositoCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Registro de Depósitos / Entradas";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO ÚNICA: Detalhes do Depósito ---
|
||||
content.Controls.Add(CreateSectionHeader("INFORMAÇÕES DO DEPÓSITO", 20));
|
||||
|
||||
// Linha 1: ID e Código do Documento
|
||||
txtId = AddInput(content, "ID", 20, 50, 80, 30, true);
|
||||
txtCodigo = AddInput(content, "Nº DOCUMENTO", 110, 50, 150, 30);
|
||||
txtCodLancto = AddInput(content, "CÓD. LANÇAMENTO", 270, 50, 150, 30);
|
||||
|
||||
// Linha 2: Conta Corrente (com Lupa de busca)
|
||||
txtCodCorrente = AddInput(content, "CÓD. CONTA", 20, 105, 90, 30);
|
||||
|
||||
btnBuscaConta = new Button
|
||||
{
|
||||
Text = "🔍",
|
||||
Location = new Point(115, 121), // Alinhado ao textbox (105 + 16)
|
||||
Size = new Size(32, 30),
|
||||
BackColor = AccentBlue,
|
||||
ForeColor = Color.White,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Cursor = Cursors.Hand
|
||||
};
|
||||
btnBuscaConta.FlatAppearance.BorderSize = 0;
|
||||
btnBuscaConta.Click += (s, e) => OnBuscaContaCorrente();
|
||||
content.Controls.Add(btnBuscaConta);
|
||||
|
||||
txtNomeConta = AddInput(content, "CONTA DESTINO / CAIXA", 155, 105, 350, 30, true);
|
||||
|
||||
// Linha 3: Valor e Data
|
||||
txtValor = AddInput(content, "VALOR DO DEPÓSITO (R$)", 20, 160, 200, 30);
|
||||
txtData = AddInput(content, "DATA DO REGISTRO", 230, 160, 150, 30);
|
||||
|
||||
content.Height = 300;
|
||||
}
|
||||
|
||||
private void OnBuscaContaCorrente()
|
||||
{
|
||||
// Aqui você abriria a busca baseada no ModeloContasContas que fizemos antes
|
||||
MessageBox.Show("Abrir busca de Contas Correntes/Caixas");
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_deposito.CODIGO = txtCodigo.Text;
|
||||
_deposito.COD_CORRENTE = txtCodCorrente.Text;
|
||||
_deposito.COD_LANCTO = txtCodLancto.Text;
|
||||
_deposito.VALOR = txtValor.Text;
|
||||
_deposito.DATA_CADASTRO = txtData.Text;
|
||||
}
|
||||
|
||||
// --- MÉTODOS OBRIGATÓRIOS ---
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_deposito = new ModeloContasDeposito();
|
||||
txtData.Text = DateTime.Now.ToString("dd/mm/yyyy"); // Sugestão de data atual
|
||||
txtCodigo.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_deposito);
|
||||
MessageBox.Show("Depósito registrado com sucesso!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
115
UI/Dashboards/Cadastros/DespFixaCadastroPanel.cs
Normal file
115
UI/Dashboards/Cadastros/DespFixaCadastroPanel.cs
Normal file
@ -0,0 +1,115 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class DespFixaCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloDespFixa _despFixa = new ModeloDespFixa();
|
||||
|
||||
// Controles - Identificação e Vínculo
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtTipo, txtCodCliente, txtNomeCliente;
|
||||
private Button btnBuscaCliente;
|
||||
|
||||
// Controles - Financeiro e Classificação
|
||||
private LV_TEXTBOX1 txtValor, txtVencimento, txtPlanoContas, txtObservacao;
|
||||
|
||||
public DespFixaCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Cadastro de Despesas Fixas (Recorrentes)";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Identificação da Despesa ---
|
||||
content.Controls.Add(CreateSectionHeader("DADOS DA DESPESA RECORRENTE", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 100, 30);
|
||||
txtTipo = AddInput(content, "TIPO (Ex: Fixa/Mensal)", 210, 50, 180, 30);
|
||||
|
||||
// Beneficiário / Fornecedor
|
||||
txtCodCliente = AddInput(content, "CÓD. BENEF.", 20, 105, 90, 30);
|
||||
btnBuscaCliente = CriarBotaoLupa(115, 121, OnBuscaCliente);
|
||||
txtNomeCliente = AddInput(content, "NOME DO BENEFICIÁRIO / FORNECEDOR", 155, 105, 450, 30, true);
|
||||
|
||||
// --- SEÇÃO 2: Configurações Financeiras ---
|
||||
content.Controls.Add(CreateSectionHeader("VALORES E PROGRAMAÇÃO", 175));
|
||||
|
||||
txtValor = AddInput(content, "VALOR MENSAL (R$)", 20, 205, 180, 30);
|
||||
txtVencimento = AddInput(content, "DIA DE VENCIMENTO", 210, 205, 150, 30);
|
||||
txtPlanoContas = AddInput(content, "PLANO DE CONTAS", 370, 205, 235, 30);
|
||||
|
||||
// --- SEÇÃO 3: Notas Adicionais ---
|
||||
content.Controls.Add(CreateSectionHeader("OBSERVAÇÕES", 270));
|
||||
txtObservacao = AddInput(content, "NOTAS SOBRE ESTE CONTRATO/DESPESA", 20, 300, 585, 60);
|
||||
|
||||
content.Height = 420;
|
||||
}
|
||||
|
||||
private Button CriarBotaoLupa(int x, int y, EventHandler clickEvent)
|
||||
{
|
||||
var btn = new Button
|
||||
{
|
||||
Text = "🔍",
|
||||
Location = new Point(x, y),
|
||||
Size = new Size(32, 30),
|
||||
BackColor = AccentBlue,
|
||||
ForeColor = Color.White,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Cursor = Cursors.Hand
|
||||
};
|
||||
btn.FlatAppearance.BorderSize = 0;
|
||||
btn.Click += clickEvent;
|
||||
content.Controls.Add(btn);
|
||||
return btn;
|
||||
}
|
||||
|
||||
private void OnBuscaCliente(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Abrir busca de Fornecedores/Clientes");
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_despFixa.CODIGO = txtCodigo.Text;
|
||||
_despFixa.TIPO = txtTipo.Text;
|
||||
_despFixa.COD_CLIENTE = txtCodCliente.Text;
|
||||
_despFixa.VALOR = txtValor.Text;
|
||||
_despFixa.VENCIMENTO = txtVencimento.Text;
|
||||
_despFixa.PLANO_CONTAS = txtPlanoContas.Text;
|
||||
_despFixa.OBSERVACAO = txtObservacao.Text;
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_despFixa = new ModeloDespFixa();
|
||||
txtTipo.Text = "MENSAL";
|
||||
txtCodigo.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_despFixa);
|
||||
MessageBox.Show("Despesa fixa configurada com sucesso!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
91
UI/Dashboards/Cadastros/DespesasCadastroPanel.cs
Normal file
91
UI/Dashboards/Cadastros/DespesasCadastroPanel.cs
Normal file
@ -0,0 +1,91 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class DespesasCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloDespesas _despesa = new ModeloDespesas();
|
||||
|
||||
// Controles
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtProcesso, txtDescricao, txtValor, txtDia;
|
||||
private CheckBox chkPago;
|
||||
|
||||
public DespesasCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Cadastro de Despesas Operacionais";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Identificação da Despesa ---
|
||||
content.Controls.Add(CreateSectionHeader("DADOS DA DESPESA", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 110, 30);
|
||||
|
||||
// Campo PROCESSO: Útil para vincular a despesa a um projeto ou cliente específico
|
||||
txtProcesso = AddInput(content, "VÍNCULO / PROCESSO", 220, 50, 250, 30);
|
||||
|
||||
// Dia/Data do lançamento
|
||||
txtDia = AddInput(content, "DIA/DATA", 480, 50, 120, 30);
|
||||
|
||||
// Linha 2: Descrição da despesa
|
||||
txtDescricao = AddInput(content, "DESCRIÇÃO DA DESPESA", 20, 105, 580, 30);
|
||||
|
||||
// --- SEÇÃO 2: Financeiro ---
|
||||
content.Controls.Add(CreateSectionHeader("VALORES E STATUS", 175));
|
||||
|
||||
txtValor = AddInput(content, "VALOR DA DESPESA (R$)", 20, 205, 180, 30);
|
||||
|
||||
// Campo PAGO como CheckBox
|
||||
chkPago = CreateCheckBox("DESPESA JÁ QUITADA", 220, 223);
|
||||
content.Controls.Add(chkPago);
|
||||
|
||||
content.Height = 320;
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_despesa.CODIGO = txtCodigo.Text;
|
||||
_despesa.PROCESSO = txtProcesso.Text;
|
||||
_despesa.DESCRICAO = txtDescricao.Text;
|
||||
_despesa.VALOR = txtValor.Text;
|
||||
_despesa.DIA = txtDia.Text;
|
||||
|
||||
// Conversão para o padrão de string S/N que você está usando
|
||||
_despesa.PAGO = chkPago.Checked ? "S" : "N";
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_despesa = new ModeloDespesas();
|
||||
txtDia.Text = DateTime.Now.ToString("dd/MM/yyyy");
|
||||
txtProcesso.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_despesa);
|
||||
MessageBox.Show("Despesa registrada com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro ao salvar: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
118
UI/Dashboards/Cadastros/EsquemasTecnicosCadastroPanel.cs
Normal file
118
UI/Dashboards/Cadastros/EsquemasTecnicosCadastroPanel.cs
Normal file
@ -0,0 +1,118 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class EsquemasTecnicosCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloEsquemas _esquema = new ModeloEsquemas();
|
||||
|
||||
// Controles - Identificação
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtMarca, txtNome;
|
||||
|
||||
// Controles - Localização do Arquivo
|
||||
private LV_TEXTBOX1 txtLocalFisico, txtCaminhoArquivo;
|
||||
private Button btnSelecionarArquivo;
|
||||
|
||||
// Controles - Observações
|
||||
private LV_TEXTBOX1 txtObs;
|
||||
|
||||
public EsquemasTecnicosCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Biblioteca de Esquemas e Manuais";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Identificação Técnica ---
|
||||
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DO ESQUEMA", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 110, 30);
|
||||
txtMarca = AddInput(content, "MARCA / FABRICANTE", 220, 50, 250, 30);
|
||||
|
||||
txtNome = AddInput(content, "NOME DO DIAGRAMA / MODELO", 20, 105, 860, 30);
|
||||
|
||||
// --- SEÇÃO 2: Localização (Digital e Física) ---
|
||||
content.Controls.Add(CreateSectionHeader("LOCALIZAÇÃO DO DOCUMENTO", 175));
|
||||
|
||||
// LOCAL: Pode ser "Gaveta 02", "Prateleira A", ou "Servidor Nuvem"
|
||||
txtLocalFisico = AddInput(content, "LOCALIZAÇÃO FÍSICA / ARQUIVAMENTO", 20, 205, 400, 30);
|
||||
|
||||
// FPATH: Caminho do arquivo no PC ou Rede
|
||||
txtCaminhoArquivo = AddInput(content, "CAMINHO DO ARQUIVO DIGITAL (PDF/IMG)", 20, 260, 780, 30);
|
||||
|
||||
btnSelecionarArquivo = new Button
|
||||
{
|
||||
Text = "📁",
|
||||
Location = new Point(810, 276), // Alinhado ao txtCaminhoArquivo
|
||||
Size = new Size(70, 30),
|
||||
BackColor = AccentBlue,
|
||||
ForeColor = Color.White,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Cursor = Cursors.Hand
|
||||
};
|
||||
btnSelecionarArquivo.FlatAppearance.BorderSize = 0;
|
||||
btnSelecionarArquivo.Click += OnSelecionarArquivo;
|
||||
content.Controls.Add(btnSelecionarArquivo);
|
||||
|
||||
// --- SEÇÃO 3: Observações ---
|
||||
content.Controls.Add(CreateSectionHeader("OBSERVAÇÕES TÉCNICAS", 325));
|
||||
txtObs = AddInput(content, "DETALHES ADICIONAIS", 20, 355, 860, 60);
|
||||
|
||||
content.Height = 450;
|
||||
}
|
||||
|
||||
private void OnSelecionarArquivo(object sender, EventArgs e)
|
||||
{
|
||||
using (OpenFileDialog ofd = new OpenFileDialog())
|
||||
{
|
||||
ofd.Filter = "Arquivos PDF|*.pdf|Imagens|*.jpg;*.png;*.bmp|Todos os Arquivos|*.*";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
txtCaminhoArquivo.Text = ofd.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_esquema.CODIGO = txtCodigo.Text;
|
||||
_esquema.MARCA = txtMarca.Text;
|
||||
_esquema.NOME = txtNome.Text;
|
||||
_esquema.LOCAL = txtLocalFisico.Text;
|
||||
_esquema.FPATH = txtCaminhoArquivo.Text;
|
||||
_esquema.OBS = txtObs.Text;
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_esquema = new ModeloEsquemas();
|
||||
txtMarca.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_esquema);
|
||||
MessageBox.Show("Esquema técnico registrado com sucesso!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro ao salvar: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
129
UI/Dashboards/Cadastros/FluxoCaixaCadastroPanel.cs
Normal file
129
UI/Dashboards/Cadastros/FluxoCaixaCadastroPanel.cs
Normal file
@ -0,0 +1,129 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class FluxoCaixaCadastroPanel : FormularioModelo
|
||||
{
|
||||
private ModeloFcaixa _fluxo = new ModeloFcaixa();
|
||||
|
||||
// Controles - Identificação e Data
|
||||
private LV_TEXTBOX1 txtId, txtCodigo, txtDia;
|
||||
|
||||
// Controles - Classificação
|
||||
private LV_TEXTBOX1 txtPlanoContas, txtCodConta, txtFormaPgto;
|
||||
private Button btnBuscaPlano;
|
||||
|
||||
// Controles - Valores
|
||||
private LV_TEXTBOX1 txtReceita, txtDespesa;
|
||||
|
||||
// Controles - Notas
|
||||
private LV_TEXTBOX1 txtObs;
|
||||
|
||||
public FluxoCaixaCadastroPanel()
|
||||
{
|
||||
this.Titulo = "Lançamento de Fluxo de Caixa";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Identificação do Lançamento ---
|
||||
content.Controls.Add(CreateSectionHeader("DADOS DO MOVIMENTO", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "Nº DOC/CONTROLE", 100, 50, 150, 30);
|
||||
txtDia = AddInput(content, "DATA DO MOVIMENTO", 260, 50, 150, 30);
|
||||
|
||||
// --- SEÇÃO 2: Classificação Financeira ---
|
||||
content.Controls.Add(CreateSectionHeader("CLASSIFICAÇÃO E CONTA", 110));
|
||||
|
||||
// Plano de Contas (Ex: Vendas de Mercadorias, Aluguel, etc.)
|
||||
txtPlanoContas = AddInput(content, "PLANO DE CONTAS / CATEGORIA", 20, 140, 300, 30);
|
||||
btnBuscaPlano = CriarBotaoLupa(325, 156, OnBuscaPlano);
|
||||
|
||||
// Conta Bancária / Caixa de Origem (Vinculado ao ModeloContasContas)
|
||||
txtCodConta = AddInput(content, "CÓD. CONTA/CAIXA", 370, 140, 150, 30);
|
||||
|
||||
// Forma de Movimentação (Ex: Dinheiro, Pix, TED)
|
||||
txtFormaPgto = AddInput(content, "FORMA DE MOVIMENTAÇÃO", 530, 140, 200, 30);
|
||||
|
||||
// --- SEÇÃO 3: Valores (Lado a Lado) ---
|
||||
content.Controls.Add(CreateSectionHeader("VALORES DO LANÇAMENTO", 200));
|
||||
|
||||
txtReceita = AddInput(content, "VALOR ENTRADA (R$)", 20, 230, 200, 30);
|
||||
txtReceita.BackColor = Color.FromArgb(230, 255, 230); // Tom esverdeado para entrada
|
||||
|
||||
txtDespesa = AddInput(content, "VALOR SAÍDA (R$)", 240, 230, 200, 30);
|
||||
txtDespesa.BackColor = Color.FromArgb(255, 230, 230); // Tom avermelhado para saída
|
||||
|
||||
// --- SEÇÃO 4: Observações ---
|
||||
content.Controls.Add(CreateSectionHeader("HISTÓRICO / OBSERVAÇÕES", 295));
|
||||
txtObs = AddInput(content, "DETALHAMENTO DO LANÇAMENTO", 20, 325, 710, 60);
|
||||
|
||||
content.Height = 420;
|
||||
}
|
||||
|
||||
private Button CriarBotaoLupa(int x, int y, EventHandler clickEvent)
|
||||
{
|
||||
var btn = new Button
|
||||
{
|
||||
Text = "🔍",
|
||||
Location = new Point(x, y),
|
||||
Size = new Size(32, 30),
|
||||
BackColor = AccentBlue,
|
||||
ForeColor = Color.White,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Cursor = Cursors.Hand
|
||||
};
|
||||
btn.FlatAppearance.BorderSize = 0;
|
||||
btn.Click += clickEvent;
|
||||
content.Controls.Add(btn);
|
||||
return btn;
|
||||
}
|
||||
|
||||
private void OnBuscaPlano(object sender, EventArgs e) => MessageBox.Show("Busca de Plano de Contas");
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_fluxo.CODIGO = txtCodigo.Text;
|
||||
_fluxo.DIA = txtDia.Text;
|
||||
_fluxo.RECEITA = txtReceita.Text;
|
||||
_fluxo.DESPESA = txtDespesa.Text;
|
||||
_fluxo.PLANO_CONTAS = txtPlanoContas.Text;
|
||||
_fluxo.COD_CONTA = txtCodConta.Text;
|
||||
_fluxo.FORMA = txtFormaPgto.Text;
|
||||
_fluxo.OBS = txtObs.Text;
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_fluxo = new ModeloFcaixa();
|
||||
txtDia.Text = DateTime.Now.ToString("dd/MM/yyyy");
|
||||
txtCodigo.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
// BLL.Salvar(_fluxo);
|
||||
MessageBox.Show("Movimentação de caixa registrada!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
118
UI/Dashboards/Cadastros/FornecedorItemVinculoPanel.cs
Normal file
118
UI/Dashboards/Cadastros/FornecedorItemVinculoPanel.cs
Normal file
@ -0,0 +1,118 @@
|
||||
using CPM;
|
||||
using MLL;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
public partial class FornecedorItemVinculoPanel : FormularioModelo
|
||||
{
|
||||
private ModeloFornecerDE _vinculo = new ModeloFornecerDE();
|
||||
|
||||
// Controles - Identificação
|
||||
private LV_TEXTBOX1 txtId, txtCodigo;
|
||||
|
||||
// Controles - Fornecedor
|
||||
private LV_TEXTBOX1 txtCodFor, txtNomeFornecedor;
|
||||
private Button btnBuscaFornecedor;
|
||||
|
||||
// Controles - Item/Produto
|
||||
private LV_TEXTBOX1 txtCodItem, txtNomeItem;
|
||||
private Button btnBuscaItem;
|
||||
|
||||
// Controles - Histórico
|
||||
private LV_TEXTBOX1 txtUltimaCompra;
|
||||
|
||||
public FornecedorItemVinculoPanel()
|
||||
{
|
||||
this.Titulo = "Vínculo de Fornecimento (Produto x Fornecedor)";
|
||||
MontarInterface();
|
||||
}
|
||||
|
||||
private void MontarInterface()
|
||||
{
|
||||
// --- SEÇÃO 1: Identificação do Registro ---
|
||||
content.Controls.Add(CreateSectionHeader("DADOS DO REGISTRO", 20));
|
||||
|
||||
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||
txtCodigo = AddInput(content, "CÓD. CONTROLE", 100, 50, 150, 30);
|
||||
|
||||
// --- SEÇÃO 2: Fornecedor ---
|
||||
content.Controls.Add(CreateSectionHeader("FORNECEDOR", 110));
|
||||
|
||||
txtCodFor = AddInput(content, "CÓD. FORN.", 20, 140, 90, 30);
|
||||
btnBuscaFornecedor = CriarBotaoLupa(115, 156, OnBuscaFornecedor);
|
||||
txtNomeFornecedor = AddInput(content, "RAZÃO SOCIAL / FORNECEDOR", 155, 140, 450, 30, true);
|
||||
|
||||
// --- SEÇÃO 3: Produto / Item ---
|
||||
content.Controls.Add(CreateSectionHeader("PRODUTO / ITEM VINCULADO", 205));
|
||||
|
||||
txtCodItem = AddInput(content, "CÓD. ITEM", 20, 235, 90, 30);
|
||||
btnBuscaItem = CriarBotaoLupa(115, 251, OnBuscaItem);
|
||||
txtNomeItem = AddInput(content, "DESCRIÇÃO DO PRODUTO", 155, 235, 450, 30, true);
|
||||
|
||||
// --- SEÇÃO 4: Informações de Compra ---
|
||||
content.Controls.Add(CreateSectionHeader("ÚLTIMA MOVIMENTAÇÃO", 300));
|
||||
|
||||
// Aqui o campo 'ULTIMA' pode ser usado para Data ou Valor da última compra
|
||||
txtUltimaCompra = AddInput(content, "DATA OU VALOR DA ÚLTIMA AQUISIÇÃO", 20, 330, 300, 30);
|
||||
|
||||
content.Height = 420;
|
||||
}
|
||||
|
||||
private Button CriarBotaoLupa(int x, int y, EventHandler clickEvent)
|
||||
{
|
||||
var btn = new Button
|
||||
{
|
||||
Text = "🔍",
|
||||
Location = new Point(x, y),
|
||||
Size = new Size(32, 30),
|
||||
BackColor = AccentBlue,
|
||||
ForeColor = Color.White,
|
||||
FlatStyle = FlatStyle.Flat,
|
||||
Cursor = Cursors.Hand
|
||||
};
|
||||
btn.FlatAppearance.BorderSize = 0;
|
||||
btn.Click += clickEvent;
|
||||
content.Controls.Add(btn);
|
||||
return btn;
|
||||
}
|
||||
|
||||
private void OnBuscaFornecedor(object sender, EventArgs e) => MessageBox.Show("Busca de Fornecedores");
|
||||
private void OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Busca de Produtos/Itens");
|
||||
|
||||
private void PreencherModel()
|
||||
{
|
||||
_vinculo.CODIGO = txtCodigo.Text;
|
||||
_vinculo.COD_FOR = txtCodFor.Text;
|
||||
_vinculo.COD_ITEM = txtCodItem.Text;
|
||||
_vinculo.ULTIMA = txtUltimaCompra.Text;
|
||||
}
|
||||
|
||||
protected override void OnNovo()
|
||||
{
|
||||
_vinculo = new ModeloFornecerDE();
|
||||
txtCodFor.Focus();
|
||||
}
|
||||
|
||||
protected override void OnSalvar()
|
||||
{
|
||||
try
|
||||
{
|
||||
PreencherModel();
|
||||
MessageBox.Show("Associação salva com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("Erro: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnAlterar() { }
|
||||
protected override void OnExcluir() { }
|
||||
protected override void OnLocalizar() { }
|
||||
protected override void OnCancelar() { OnNovo(); }
|
||||
}
|
||||
}
|
||||
@ -36,6 +36,8 @@ namespace UI
|
||||
//Painel financeiro
|
||||
private readonly BoletoCadastroPanel _pboletoCadastroPanel;
|
||||
private readonly ContaPagarCadastroPanel _pcontaPagarCadastroPanel;
|
||||
private readonly ContaReceberCadastroPanel _pcontaReceberCadastroPanel;
|
||||
private readonly ContasCadastroPanel _pcontasCadastroPanel;
|
||||
private readonly Panel _pOrdens;
|
||||
private readonly Panel _pProdutos;
|
||||
private readonly Panel _pEstoque;
|
||||
@ -69,6 +71,8 @@ namespace UI
|
||||
_pChamadoCadastroPanel = new ChamadoCadastroPanel { Dock = DockStyle.Fill, Visible = false };
|
||||
_pconfigCadastroPanel = new ConfigCadastroPanel { Dock = DockStyle.Fill, Visible = false };
|
||||
_pcontaPagarCadastroPanel = new ContaPagarCadastroPanel { Dock = DockStyle.Fill, Visible = false };
|
||||
_pcontaReceberCadastroPanel = new ContaReceberCadastroPanel { Dock = DockStyle.Fill, Visible = false };
|
||||
_pcontasCadastroPanel = new ContasCadastroPanel { Dock = DockStyle.Fill, Visible = false };
|
||||
_pOrdens = PlaceholderPanel("Ordens de Serviço", Color.FromArgb(22, 163, 74));
|
||||
_pProdutos = PlaceholderPanel("Catálogo de Produtos", Color.FromArgb(217, 119, 6));
|
||||
_pEstoque = PlaceholderPanel("Controle de Estoque", Color.FromArgb(234, 88, 12));
|
||||
@ -87,6 +91,7 @@ namespace UI
|
||||
mainContainer.Controls.Add(_pUsuarioCadastroPanel);
|
||||
mainContainer.Controls.Add(_pChamadoCadastroPanel);
|
||||
mainContainer.Controls.Add(_pconfigCadastroPanel);
|
||||
mainContainer.Controls.Add(_pcontaReceberCadastroPanel);
|
||||
mainContainer.Controls.Add(_pEstoque);
|
||||
mainContainer.Controls.Add(_pProdutos);
|
||||
mainContainer.Controls.Add(_pOrdens);
|
||||
@ -96,6 +101,7 @@ namespace UI
|
||||
mainContainer.Controls.Add(_dashboard);
|
||||
mainContainer.Controls.Add(_pfuncionariosCadastro);
|
||||
mainContainer.Controls.Add(_pcontaPagarCadastroPanel);
|
||||
mainContainer.Controls.Add(_pcontasCadastroPanel);
|
||||
Controls.Add(mainContainer);
|
||||
Controls.Add(_sidebar);
|
||||
|
||||
@ -138,6 +144,8 @@ namespace UI
|
||||
case 301: ShowPanel(_pAgendaConsulta); break;
|
||||
case 309: ShowPanel(_pChamadoCadastroPanel); break;
|
||||
|
||||
case 400: ShowPanel(_pcontasCadastroPanel); break;
|
||||
case 401: ShowPanel(_pcontaReceberCadastroPanel); break;
|
||||
case 402: ShowPanel(_pcontaPagarCadastroPanel); break;
|
||||
case 500: ShowPanel(_pboletoCadastroPanel); break;
|
||||
|
||||
@ -168,6 +176,8 @@ namespace UI
|
||||
_pChamadoCadastroPanel.Visible = (panelToShow == _pChamadoCadastroPanel);
|
||||
_pconfigCadastroPanel.Visible = (panelToShow == _pconfigCadastroPanel);
|
||||
_pcontaPagarCadastroPanel.Visible = (panelToShow == _pcontaPagarCadastroPanel);
|
||||
_pcontaReceberCadastroPanel.Visible = (panelToShow == _pcontaReceberCadastroPanel);
|
||||
_pcontasCadastroPanel.Visible = (panelToShow == _pcontasCadastroPanel);
|
||||
if (panelToShow.Visible)
|
||||
{
|
||||
panelToShow.BringToFront();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user