From b7a285004ee0ecf15354332e52a3ca78ab0596ea Mon Sep 17 00:00:00 2001 From: Nicolas Felipe Date: Sat, 25 Apr 2026 23:24:49 -0300 Subject: [PATCH] 25/04/2026 - Implementando classe MLL e UI --- MLL/ModeloFtpCliente.cs | 62 ++++++ MLL/ModeloSmtp.cs | 65 +++++++ MLL/ModeloSshCliente.cs | 75 ++++++++ .../Cadastros/ConfigIBPTCadastroPanel.cs | 105 +++++++++++ .../ConfigIcmsMatrizCadastroPanel.cs | 119 ++++++++++++ .../Cadastros/IcmsItemUfCadastroPanel.cs | 121 ++++++++++++ UI/Dashboards/Cadastros/ItensCadastroPanel.cs | 178 ++++++++++++++++++ .../Cadastros/ItensEntradaCadastroPanel.cs | 133 +++++++++++++ .../Cadastros/ItensFabricaCadastroPanel.cs | 129 +++++++++++++ .../Cadastros/ItensFotosGaleriaPanel.cs | 150 +++++++++++++++ .../Cadastros/ItensNotaCadastroPanel.cs | 147 +++++++++++++++ .../Cadastros/ItensOrcamentoCadastroPanel.cs | 135 +++++++++++++ .../Cadastros/ItensPedidoCadastroPanel.cs | 148 +++++++++++++++ 13 files changed, 1567 insertions(+) create mode 100644 MLL/ModeloFtpCliente.cs create mode 100644 MLL/ModeloSmtp.cs create mode 100644 MLL/ModeloSshCliente.cs create mode 100644 UI/Dashboards/Cadastros/ConfigIBPTCadastroPanel.cs create mode 100644 UI/Dashboards/Cadastros/ConfigIcmsMatrizCadastroPanel.cs create mode 100644 UI/Dashboards/Cadastros/IcmsItemUfCadastroPanel.cs create mode 100644 UI/Dashboards/Cadastros/ItensCadastroPanel.cs create mode 100644 UI/Dashboards/Cadastros/ItensEntradaCadastroPanel.cs create mode 100644 UI/Dashboards/Cadastros/ItensFabricaCadastroPanel.cs create mode 100644 UI/Dashboards/Cadastros/ItensFotosGaleriaPanel.cs create mode 100644 UI/Dashboards/Cadastros/ItensNotaCadastroPanel.cs create mode 100644 UI/Dashboards/Cadastros/ItensOrcamentoCadastroPanel.cs create mode 100644 UI/Dashboards/Cadastros/ItensPedidoCadastroPanel.cs diff --git a/MLL/ModeloFtpCliente.cs b/MLL/ModeloFtpCliente.cs new file mode 100644 index 0000000..40c55c5 --- /dev/null +++ b/MLL/ModeloFtpCliente.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MLL +{ + public class ModeloFtpCliente + { + public ModeloFtpCliente() + { + Id = 0; + Nome = ""; + Host = ""; + Porta = 0; + Usuario = ""; + Senha = ""; + UsarSsl = false; + ModoPassivo = false; + DiretorioRaiz = ""; + Ativo = false; + CriadoEm = DateTime.MinValue; + AtualizadoEm = DateTime.MinValue; + } + public ModeloFtpCliente(int id, string nome, string host, int porta, string usuario, string senha, bool usarSsl, bool modoPassivo, string diretorioRaiz, bool ativo, DateTime criadoEm, DateTime? atualizadoEm) + { + Id = id; + Nome = nome; + Host = host; + Porta = porta; + Usuario = usuario; + Senha = senha; + UsarSsl = usarSsl; + ModoPassivo = modoPassivo; + DiretorioRaiz = diretorioRaiz; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + + public string Nome { get; set; } + + public string Host { get; set; } + public int Porta { get; set; } + + public string Usuario { get; set; } + public string Senha { get; set; } + + public bool UsarSsl { get; set; } + public bool ModoPassivo { get; set; } + + public string DiretorioRaiz { get; set; } + + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime? AtualizadoEm { get; set; } + } +} diff --git a/MLL/ModeloSmtp.cs b/MLL/ModeloSmtp.cs new file mode 100644 index 0000000..289260c --- /dev/null +++ b/MLL/ModeloSmtp.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MLL +{ + public class ModeloSmtpCliente + { + public ModeloSmtpCliente() + { + Id = 0; + Nome = ""; + ServidorSmtp = ""; + Porta = 0; + Usuario = ""; + Senha = ""; + UsarSsl = false; + UsarTls = false; + EmailRemetente = ""; + NomeRemetente = ""; + Ativo = false; + CriadoEm = DateTime.MinValue; + AtualizadoEm = DateTime.MinValue; + } + public ModeloSmtpCliente(int id, string nome, string servidorSmtp, int porta, string usuario, string senha, bool usarSsl, bool usarTls, string emailRemetente, string nomeRemetente, bool ativo, DateTime criadoEm, DateTime? atualizadoEm) + { + Id = id; + Nome = nome; + ServidorSmtp = servidorSmtp; + Porta = porta; + Usuario = usuario; + Senha = senha; + UsarSsl = usarSsl; + UsarTls = usarTls; + EmailRemetente = emailRemetente; + NomeRemetente = nomeRemetente; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + + public string Nome { get; set; } + + public string ServidorSmtp { get; set; } + public int Porta { get; set; } + + public string Usuario { get; set; } + public string Senha { get; set; } + + public bool UsarSsl { get; set; } + public bool UsarTls { get; set; } + + public string EmailRemetente { get; set; } + public string NomeRemetente { get; set; } + + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime? AtualizadoEm { get; set; } + } +} diff --git a/MLL/ModeloSshCliente.cs b/MLL/ModeloSshCliente.cs new file mode 100644 index 0000000..f5c34de --- /dev/null +++ b/MLL/ModeloSshCliente.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MLL +{ + internal class ModeloSshCliente + { + public ModeloSshCliente() + { + Id = 0; + Nome = ""; + Host = ""; + Porta = 0; + Usuario = ""; + TipoAutenticacao = ""; + Senha = ""; + ChavePrivada = ""; + CaminhoChave = ""; + Passphrase = ""; + UsarChave = false; + Fingerprint = ""; + Ativo = false; + CriadoEm = DateTime.MinValue; + AtualizadoEm = DateTime.MinValue; + } + public ModeloSshCliente(int id, string nome, string host, int porta, string usuario, string tipoAutenticacao, string senha, string chavePrivada, string caminhoChave, string passphrase, bool usarChave, string fingerprint, bool ativo, DateTime criadoEm, DateTime? atualizadoEm) + { + Id = id; + Nome = nome; + Host = host; + Porta = porta; + Usuario = usuario; + TipoAutenticacao = tipoAutenticacao; + Senha = senha; + ChavePrivada = chavePrivada; + CaminhoChave = caminhoChave; + Passphrase = passphrase; + UsarChave = usarChave; + Fingerprint = fingerprint; + Ativo = ativo; + CriadoEm = criadoEm; + AtualizadoEm = atualizadoEm; + } + + public int Id { get; set; } + + public string Nome { get; set; } + + public string Host { get; set; } + public int Porta { get; set; } + + public string Usuario { get; set; } + + public string TipoAutenticacao { get; set; } // "senha" ou "chave" + + public string Senha { get; set; } + + public string ChavePrivada { get; set; } + public string CaminhoChave { get; set; } + + public string Passphrase { get; set; } + + public bool UsarChave { get; set; } + + public string Fingerprint { get; set; } + + public bool Ativo { get; set; } + + public DateTime CriadoEm { get; set; } + public DateTime? AtualizadoEm { get; set; } + } +} diff --git a/UI/Dashboards/Cadastros/ConfigIBPTCadastroPanel.cs b/UI/Dashboards/Cadastros/ConfigIBPTCadastroPanel.cs new file mode 100644 index 0000000..56997f7 --- /dev/null +++ b/UI/Dashboards/Cadastros/ConfigIBPTCadastroPanel.cs @@ -0,0 +1,105 @@ +using CPM; +using MLL; +using System; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class ConfigIBPTCadastroPanel : FormularioModelo + { + private ModeloIBPT _ibpt = new ModeloIBPT(); + + // Controles - Identificação + private LV_TEXTBOX1 txtId, txtCodigo, txtNcm, txtTipo; + + // Controles - Alíquotas Federais + private LV_TEXTBOX1 txtNacionalFederal, txtImportadosFederal; + + // Controles - Alíquotas Regional/Local + private LV_TEXTBOX1 txtEstadual, txtMunicipal; + + public ConfigIBPTCadastroPanel() + { + this.Titulo = "Tabela IBPT (Carga Tributária por NCM)"; + MontarInterface(); + } + + private void MontarInterface() + { + // --- SEÇÃO 1: Identificação do NCM --- + content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO FISCAL", 20)); + + txtId = AddInput(content, "ID", 20, 50, 70, 30, true); + txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 110, 30); + + // O NCM (Nomenclatura Comum do Mercosul) é a chave principal aqui + txtNcm = AddInput(content, "NCM (8 DÍGITOS)", 220, 50, 180, 30); + + // Tipo: Geralmente 0 para Nacional e 1 para Importado (ou texto descritivo) + txtTipo = AddInput(content, "TIPO / EXCEÇÃO", 410, 50, 150, 30); + + // --- SEÇÃO 2: Esfera Federal --- + content.Controls.Add(CreateSectionHeader("IMPOSTOS FEDERAIS (%)", 110)); + + txtNacionalFederal = AddInput(content, "NACIONAL FEDERAL", 20, 140, 200, 30); + txtImportadosFederal = AddInput(content, "IMPORTADOS FEDERAL", 230, 140, 200, 30); + + // --- SEÇÃO 3: Esfera Estadual e Municipal --- + content.Controls.Add(CreateSectionHeader("IMPOSTOS ESTADUAIS E MUNICIPAIS (%)", 205)); + + txtEstadual = AddInput(content, "ALÍQUOTA ESTADUAL", 20, 235, 200, 30); + txtMunicipal = AddInput(content, "ALÍQUOTA MUNICIPAL", 230, 235, 200, 30); + + // Nota informativa para o usuário + Label lblInfo = new Label + { + Text = "* Estes valores são utilizados para o cálculo da Lei da Transparência nas Notas Fiscais.", + Location = new Point(20, 280), + AutoSize = true, + ForeColor = Color.Gray, + Font = new Font("Segoe UI", 8, FontStyle.Italic) + }; + content.Controls.Add(lblInfo); + + content.Height = 350; + } + + private void PreencherModel() + { + _ibpt.CODIGO = txtCodigo.Text; + _ibpt.NCM = txtNcm.Text; + _ibpt.NacionalFederal = txtNacionalFederal.Text; + _ibpt.ImportadosFederal = txtImportadosFederal.Text; + _ibpt.Estadual = txtEstadual.Text; + _ibpt.Municipal = txtMunicipal.Text; + _ibpt.Tipo = txtTipo.Text; + } + + protected override void OnNovo() + { + _ibpt = new ModeloIBPT(); + txtNcm.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + // BLL.Salvar(_ibpt); + MessageBox.Show("Dados do IBPT salvos com sucesso!", "Fiscal", 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(); } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ConfigIcmsMatrizCadastroPanel.cs b/UI/Dashboards/Cadastros/ConfigIcmsMatrizCadastroPanel.cs new file mode 100644 index 0000000..0585d52 --- /dev/null +++ b/UI/Dashboards/Cadastros/ConfigIcmsMatrizCadastroPanel.cs @@ -0,0 +1,119 @@ +using CPM; +using MLL; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class ConfigIcmsMatrizCadastroPanel : FormularioModelo + { + private ModeloIcmsEmp _matriz = new ModeloIcmsEmp(); + private Dictionary _txtUFs = new Dictionary(); + + // Controles fixos + private LV_TEXTBOX1 txtId, txtCodigo, txtUfOrigem, txtIcmsInterno, txtFcp; + + public ConfigIcmsMatrizCadastroPanel() + { + this.Titulo = "Matriz de Alíquotas ICMS Interestadual"; + MontarInterface(); + } + + private void MontarInterface() + { + // --- SEÇÃO 1: Configuração Base --- + content.Controls.Add(CreateSectionHeader("ESTADO DE ORIGEM E ALÍQUOTA INTERNA", 20)); + + txtId = AddInput(content, "ID", 20, 50, 70, 30, true); + txtCodigo = AddInput(content, "CÓDIGO", 100, 50, 100, 30); + txtUfOrigem = AddInput(content, "UF ORIGEM", 210, 50, 80, 30); + txtIcmsInterno = AddInput(content, "ICMS INTERNO %", 300, 50, 130, 30); + txtFcp = AddInput(content, "FCP % (Fundo Comb. Pobreza)", 440, 50, 180, 30); + + // --- SEÇÃO 2: Matriz por Regiões --- + // Vou agrupar para facilitar a digitação + int startY = 120; + + // Região Nordeste (Onde estamos em Alagoas!) + content.Controls.Add(CreateSectionHeader("REGIÃO NORDESTE", startY)); + _txtUFs["AL"] = AddInput(content, "AL", 20, startY + 30, 60, 30); + _txtUFs["BA"] = AddInput(content, "BA", 90, startY + 30, 60, 30); + _txtUFs["CE"] = AddInput(content, "CE", 160, startY + 30, 60, 30); + _txtUFs["MA"] = AddInput(content, "MA", 230, startY + 30, 60, 30); + _txtUFs["PB"] = AddInput(content, "PB", 300, startY + 30, 60, 30); + _txtUFs["PE"] = AddInput(content, "PE", 370, startY + 30, 60, 30); + _txtUFs["PI"] = AddInput(content, "PI", 440, startY + 30, 60, 30); + _txtUFs["RN"] = AddInput(content, "RN", 510, startY + 30, 60, 30); + _txtUFs["SE"] = AddInput(content, "SE", 580, startY + 30, 60, 30); + + // Região Sudeste + content.Controls.Add(CreateSectionHeader("REGIÃO SUDESTE", startY + 80)); + _txtUFs["SP"] = AddInput(content, "SP", 20, startY + 110, 60, 30); + _txtUFs["RJ"] = AddInput(content, "RJ", 90, startY + 110, 60, 30); + _txtUFs["MG"] = AddInput(content, "MG", 160, startY + 110, 60, 30); + _txtUFs["ES"] = AddInput(content, "ES", 230, startY + 110, 60, 30); + + // Região Sul + content.Controls.Add(CreateSectionHeader("REGIÃO SUL", startY + 160)); + _txtUFs["PR"] = AddInput(content, "PR", 20, startY + 190, 60, 30); + _txtUFs["RS"] = AddInput(content, "RS", 90, startY + 190, 60, 30); + _txtUFs["SC"] = AddInput(content, "SC", 160, startY + 190, 60, 30); + + // Centro-Oeste e Norte (Resumido para o exemplo) + content.Controls.Add(CreateSectionHeader("DEMAIS ESTADOS (CO/NO)", startY + 240)); + _txtUFs["DF"] = AddInput(content, "DF", 20, startY + 270, 60, 30); + _txtUFs["GO"] = AddInput(content, "GO", 90, startY + 270, 60, 30); + _txtUFs["MT"] = AddInput(content, "MT", 160, startY + 270, 60, 30); + _txtUFs["MS"] = AddInput(content, "MS", 230, startY + 270, 60, 30); + _txtUFs["AM"] = AddInput(content, "AM", 300, startY + 270, 60, 30); + _txtUFs["PA"] = AddInput(content, "PA", 370, startY + 270, 60, 30); + // ... (Continuaria para AC, AP, RO, RR, TO) + + content.Height = 600; + } + + private void PreencherModel() + { + _matriz.CODIGO = txtCodigo.Text; + _matriz.UF = txtUfOrigem.Text; + _matriz.ICMS = txtIcmsInterno.Text; + _matriz.FCP = txtFcp.Text; + + // Mapeamento dinâmico para as propriedades da Model + _matriz.UF_AL = _txtUFs["AL"].Text; + _matriz.UF_SP = _txtUFs["SP"].Text; + _matriz.UF_RJ = _txtUFs["RJ"].Text; + _matriz.UF_BA = _txtUFs["BA"].Text; + _matriz.UF_MG = _txtUFs["MG"].Text; + // ... Mapear todos os campos aqui + } + + protected override void OnNovo() + { + _matriz = new ModeloIcmsEmp(); + txtUfOrigem.Text = "AL"; // Default para sua região + txtUfOrigem.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + MessageBox.Show("Matriz de ICMS atualizada 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(); } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/IcmsItemUfCadastroPanel.cs b/UI/Dashboards/Cadastros/IcmsItemUfCadastroPanel.cs new file mode 100644 index 0000000..ff6585b --- /dev/null +++ b/UI/Dashboards/Cadastros/IcmsItemUfCadastroPanel.cs @@ -0,0 +1,121 @@ +using CPM; +using MLL; +using System; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class IcmsItemUfCadastroPanel : FormularioModelo + { + private ModeloIcmsUf _icmsUf = new ModeloIcmsUf(); + + // Controles - Identificação + private LV_TEXTBOX1 txtId, txtCodigo; + + // Controles - Vinculo de Produto + private LV_TEXTBOX1 txtCodItem, txtNomeItem; + private Button btnBuscaItem; + + // Controles - Regra Fiscal + private LV_TEXTBOX1 txtUF, txtIcms; + + public IcmsItemUfCadastroPanel() + { + this.Titulo = "Exceção de ICMS por Produto e UF"; + 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: Produto (O alvo da exceção) --- + content.Controls.Add(CreateSectionHeader("PRODUTO / ITEM", 110)); + + txtCodItem = AddInput(content, "CÓD. ITEM", 20, 140, 90, 30); + btnBuscaItem = CriarBotaoLupa(115, 156, OnBuscaItem); + txtNomeItem = AddInput(content, "DESCRIÇÃO DO PRODUTO", 155, 140, 450, 30, true); + + // --- SEÇÃO 3: Regra por Estado --- + content.Controls.Add(CreateSectionHeader("ALÍQUOTA DIFERENCIADA POR ESTADO", 205)); + + // Sigla do Estado (Ex: SP, RJ, MG) + txtUF = AddInput(content, "UF DESTINO", 20, 235, 120, 30); + + // Valor da Alíquota (Ex: 7.00, 12.00) + txtIcms = AddInput(content, "ICMS ESPECÍFICO (%)", 150, 235, 180, 30); + + // Informativo para o usuário + Label lblAviso = new Label + { + Text = "* Esta configuração sobrescreve a matriz geral para este item específico.", + Location = new Point(20, 280), + AutoSize = true, + ForeColor = Color.DarkOrange, + Font = new Font("Segoe UI", 8, FontStyle.Bold) + }; + content.Controls.Add(lblAviso); + + content.Height = 350; + } + + 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 OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Busca de Produtos"); + + private void PreencherModel() + { + _icmsUf.CODIGO = txtCodigo.Text; + _icmsUf.COD_ITEM = txtCodItem.Text; + _icmsUf.UF = txtUF.Text.ToUpper(); + _icmsUf.ICMS = txtIcms.Text; + } + + protected override void OnNovo() + { + _icmsUf = new ModeloIcmsUf(); + txtCodItem.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + // BLL.Salvar(_icmsUf); + MessageBox.Show("Regra de ICMS por item salva!", "Fiscal", 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(); } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ItensCadastroPanel.cs b/UI/Dashboards/Cadastros/ItensCadastroPanel.cs new file mode 100644 index 0000000..adff2ca --- /dev/null +++ b/UI/Dashboards/Cadastros/ItensCadastroPanel.cs @@ -0,0 +1,178 @@ +using CPM; +using MLL; +using System; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class ItensCadastroPanel : FormularioModelo + { + private ModeloItens _item = new ModeloItens(); + + // --- CONTROLES DA INTERFACE --- + // Identificação e Básicos + private LV_TEXTBOX1 txtId, txtCodigo, txtNumero, txtGtin, txtNome, txtNomeCurto; + + // Categorização e Marcas + private LV_TEXTBOX1 txtGrupo, txtSubGrupo, txtTipo, txtUnidade, txtNumFab, txtFabricante, txtFornecedor; + + // Financeiro e Preços + private LV_TEXTBOX1 txtCusto, txtLucro, txtVenda, txtPreco1, txtPreco2; + + // Estoque e Logística + private LV_TEXTBOX1 txtEstMin, txtEstIdeal, txtEstDisp, txtLocal, txtGaveta; + + // Fiscal e Datas + private LV_TEXTBOX1 txtNcm, txtCst, txtIcms, txtIpi, txtValidade, txtUltimaVenda, txtUltimaCompra; + + // Notas e Imagem + private LV_TEXTBOX1 txtObs; + private PictureBox picProduto; + private Button btnUploadFoto; + + public ItensCadastroPanel() + { + this.Titulo = "Cadastro Geral de Itens"; + MontarInterface(); + } + + private void MontarInterface() + { + // --- SEÇÃO 1: Identificação Técnica --- + content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO E REFERÊNCIAS", 20)); + + txtId = AddInput(content, "ID", 20, 50, 70, 30, true); + txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 110, 30); + txtNumero = AddInput(content, "Nº REF/PART", 220, 50, 150, 30); + txtGtin = AddInput(content, "GTIN/EAN (BARRAS)", 380, 50, 180, 30); + + txtNome = AddInput(content, "DESCRIÇÃO DO ITEM", 20, 105, 450, 30); + txtNomeCurto = AddInput(content, "NOME REDUZIDO / PDV", 480, 105, 230, 30); + + // Container para Imagem + picProduto = new PictureBox + { + Location = new Point(730, 45), + Size = new Size(180, 160), + BorderStyle = BorderStyle.FixedSingle, + SizeMode = PictureBoxSizeMode.Zoom, + BackColor = Color.WhiteSmoke + }; + btnUploadFoto = new Button + { + Text = "ADICIONAR FOTO", + Location = new Point(730, 210), + Size = new Size(180, 25), + FlatStyle = FlatStyle.Flat, + Cursor = Cursors.Hand + }; + content.Controls.Add(picProduto); + content.Controls.Add(btnUploadFoto); + + // --- SEÇÃO 2: Classificação e Suprimentos --- + content.Controls.Add(CreateSectionHeader("CLASSIFICAÇÃO E ORIGEM", 175)); + + txtGrupo = AddInput(content, "GRUPO", 20, 205, 130, 30); + txtSubGrupo = AddInput(content, "SUBGRUPO", 160, 205, 130, 30); + txtTipo = AddInput(content, "TIPO", 300, 205, 100, 30); + txtUnidade = AddInput(content, "UNIDADE", 410, 205, 80, 30); + + txtNumFab = AddInput(content, "Nº FABRICANTE", 20, 260, 130, 30); + txtFabricante = AddInput(content, "MARCA/FABRICANTE", 160, 260, 260, 30); + txtFornecedor = AddInput(content, "FORNECEDOR PADRÃO", 430, 260, 280, 30); + + // --- SEÇÃO 3: Gestão de Preços --- + content.Controls.Add(CreateSectionHeader("FINANCEIRO E PRECIFICAÇÃO", 330)); + + txtCusto = AddInput(content, "CUSTO (R$)", 20, 360, 130, 30); + txtLucro = AddInput(content, "LUCRO (%)", 160, 360, 90, 30); + txtVenda = AddInput(content, "VENDA BASE (R$)", 260, 360, 140, 30); + txtVenda.BackColor = Color.FromArgb(235, 245, 255); // Azul claro para destaque + + txtPreco1 = AddInput(content, "PREÇO ATACADO", 410, 360, 140, 30); + txtPreco2 = AddInput(content, "PREÇO ESPECIAL", 560, 360, 150, 30); + + // --- SEÇÃO 4: Controle de Inventário e Fiscal --- + content.Controls.Add(CreateSectionHeader("ESTOQUE E DADOS FISCAIS", 430)); + + txtEstDisp = AddInput(content, "SALDO ATUAL", 20, 460, 100, 30, true); + txtEstMin = AddInput(content, "EST. MÍN.", 130, 460, 100, 30); + txtLocal = AddInput(content, "LOCALIZAÇÃO", 240, 460, 120, 30); + txtGaveta = AddInput(content, "GAVETA/BOX", 370, 460, 90, 30); + + txtNcm = AddInput(content, "NCM", 480, 460, 120, 30); + txtCst = AddInput(content, "CST/CSOSN", 610, 460, 90, 30); + txtIcms = AddInput(content, "ICMS %", 710, 460, 80, 30); + txtIpi = AddInput(content, "IPI %", 800, 460, 80, 30); + + // --- SEÇÃO 5: Datas e Notas --- + content.Controls.Add(CreateSectionHeader("HISTÓRICO E OBSERVAÇÕES", 530)); + + txtUltimaCompra = AddInput(content, "ÚLT. COMPRA", 20, 560, 120, 30, true); + txtUltimaVenda = AddInput(content, "ÚLT. VENDA", 150, 560, 120, 30, true); + txtValidade = AddInput(content, "VALIDADE", 280, 560, 120, 30); + + txtObs = AddInput(content, "OBSERVAÇÕES ADICIONAIS", 420, 560, 490, 50); + + content.Height = 650; + } + + private void PreencherModel() + { + _item.CODIGO = txtCodigo.Text; + _item.NUMERO = txtNumero.Text; + _item.NOME = txtNome.Text; + _item.NOMECURTO = txtNomeCurto.Text; + _item.GTIN = txtGtin.Text; + _item.GRUPO = txtGrupo.Text; + _item.SUBGRUPO = txtSubGrupo.Text; + _item.TIPO = txtTipo.Text; + _item.UNIDADE = txtUnidade.Text; + _item.NUMERO_FAB = txtNumFab.Text; + _item.FABRICANTE = txtFabricante.Text; + _item.FORNECEDOR = txtFornecedor.Text; + _item.CUSTO = txtCusto.Text; + _item.LUCRO = txtLucro.Text; + _item.VENDA = txtVenda.Text; + _item.PRECO_1 = txtPreco1.Text; + _item.PRECO_2 = txtPreco2.Text; + _item.ESTOQUE_MIN = txtEstMin.Text; + _item.ESTOQUE_IDEAL = txtEstIdeal.Text; + _item.ESTOQUE_DISP = txtEstDisp.Text; + _item.LOCAL = txtLocal.Text; + _item.GAVETA = txtGaveta.Text; + _item.NC_MERCOSUL = txtNcm.Text; + _item.C_CST = txtCst.Text; + _item.C_ICMS = txtIcms.Text; + _item.C_IPI = txtIpi.Text; + _item.VALIDADE = txtValidade.Text; + _item.OBSERVACOES = txtObs.Text; + } + + protected override void OnNovo() + { + _item = new ModeloItens(); + txtNome.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + MessageBox.Show("Item salvo com sucesso na base de dados!", "LevelOS", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("Erro ao processar item: " + ex.Message); + } + } + + protected override void OnAlterar() { } + protected override void OnExcluir() { } + protected override void OnLocalizar() { } + protected override void OnCancelar() { OnNovo(); } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ItensEntradaCadastroPanel.cs b/UI/Dashboards/Cadastros/ItensEntradaCadastroPanel.cs new file mode 100644 index 0000000..7efc0ac --- /dev/null +++ b/UI/Dashboards/Cadastros/ItensEntradaCadastroPanel.cs @@ -0,0 +1,133 @@ +using CPM; +using MLL; +using System; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class ItensEntradaCadastroPanel : FormularioModelo + { + private ModeloItensEntrada _entrada = new ModeloItensEntrada(); + + // Controles - Identificação e Item + private LV_TEXTBOX1 txtId, txtCodigo, txtCodItem, txtNomeItem; + private Button btnBuscaItem; + + // Controles - Dados da Entrada + private LV_TEXTBOX1 txtQtdNovos, txtTotal, txtDataInc; + + // Controles - Documentação + private LV_TEXTBOX1 txtNota, txtPedNum, txtFornecedor, txtFuncionario; + private Button btnBuscaFornecedor; + + // Controles - Notas + private LV_TEXTBOX1 txtObs; + + public ItensEntradaCadastroPanel() + { + this.Titulo = "Lançamento de Entrada de Estoque"; + MontarInterface(); + } + + private void MontarInterface() + { + // --- SEÇÃO 1: Item e Referência --- + content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DO ITEM", 20)); + + txtId = AddInput(content, "ID", 20, 50, 70, 30, true); + txtCodigo = AddInput(content, "CÓD. ENTRADA", 100, 50, 110, 30); + + txtCodItem = AddInput(content, "CÓD. ITEM", 220, 50, 90, 30); + btnBuscaItem = CriarBotaoLupa(315, 66, OnBuscaItem); + txtNomeItem = AddInput(content, "DESCRIÇÃO DO PRODUTO", 355, 50, 480, 30, true); + + // --- SEÇÃO 2: Valores e Quantidades --- + content.Controls.Add(CreateSectionHeader("QUANTIDADES E VALORES", 115)); + + txtQtdNovos = AddInput(content, "QTD. ENTRADA", 20, 145, 150, 30); + txtQtdNovos.BackColor = Color.FromArgb(240, 255, 240); // Destaque para entrada de estoque + + txtTotal = AddInput(content, "VALOR TOTAL (R$)", 180, 145, 180, 30); + txtDataInc = AddInput(content, "DATA ENTRADA", 370, 145, 150, 30); + txtFuncionario = AddInput(content, "OPERADOR/RESP.", 530, 145, 305, 30); + + // --- SEÇÃO 3: Documentação e Origem --- + content.Controls.Add(CreateSectionHeader("DOCUMENTAÇÃO E FORNECEDOR", 210)); + + txtNota = AddInput(content, "Nº NOTA FISCAL", 20, 240, 150, 30); + txtPedNum = AddInput(content, "Nº PEDIDO COMPRA", 180, 240, 150, 30); + + txtFornecedor = AddInput(content, "FORNECEDOR", 340, 240, 460, 30); + btnBuscaFornecedor = CriarBotaoLupa(805, 256, OnBuscaFornecedor); + + // --- SEÇÃO 4: Observações --- + content.Controls.Add(CreateSectionHeader("OBSERVAÇÕES DO MOVIMENTO", 305)); + txtObs = AddInput(content, "HISTÓRICO OU MOTIVO DA ENTRADA", 20, 335, 815, 60); + + content.Height = 430; + } + + 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 OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Busca de Itens"); + private void OnBuscaFornecedor(object sender, EventArgs e) => MessageBox.Show("Busca de Fornecedores"); + + private void PreencherModel() + { + _entrada.CODIGO = txtCodigo.Text; + _entrada.COD_ITEM = txtCodItem.Text; + _entrada.NOVOS = txtQtdNovos.Text; + _entrada.NOTA = txtNota.Text; + _entrada.TOTAL = txtTotal.Text; + _entrada.DATA_INC = txtDataInc.Text; + _entrada.FUNCIONARIO = txtFuncionario.Text; + _entrada.FORNECEDOR = txtFornecedor.Text; + _entrada.PED_NUM = txtPedNum.Text; + _entrada.OBSERVACAO = txtObs.Text; + } + + protected override void OnNovo() + { + _entrada = new ModeloItensEntrada(); + txtDataInc.Text = DateTime.Now.ToString("dd/MM/yyyy"); + txtCodItem.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + // BLL.Salvar(_entrada); + MessageBox.Show("Entrada de estoque processada com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + catch (Exception ex) + { + MessageBox.Show("Erro ao salvar entrada: " + ex.Message); + } + } + + protected override void OnAlterar() { } + protected override void OnExcluir() { } + protected override void OnLocalizar() { } + protected override void OnCancelar() { OnNovo(); } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ItensFabricaCadastroPanel.cs b/UI/Dashboards/Cadastros/ItensFabricaCadastroPanel.cs new file mode 100644 index 0000000..b9c5f38 --- /dev/null +++ b/UI/Dashboards/Cadastros/ItensFabricaCadastroPanel.cs @@ -0,0 +1,129 @@ +using CPM; +using MLL; +using System; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class ItensFabricaCadastroPanel : FormularioModelo + { + private ModeloItensFabrica _composicao = new ModeloItensFabrica(); + + // Controles - Identificação do Kit/Pai + private LV_TEXTBOX1 txtId, txtCodigo, txtKitCodigo, txtKitDescricao; + private Button btnBuscaKit; + + // Controles - Item Componente (Filho) + private LV_TEXTBOX1 txtItemCodigo, txtBarcode, txtItemDescricao; + private Button btnBuscaItem; + + // Controles - Quantidade e Valores + private LV_TEXTBOX1 txtQtd, txtCusto, txtVenda; + + // Controles - Serviço Associado + private LV_TEXTBOX1 txtServico; + + public ItensFabricaCadastroPanel() + { + this.Titulo = "Composição de Kits e Fabricação"; + MontarInterface(); + } + + private void MontarInterface() + { + // --- SEÇÃO 1: Produto Principal (O Kit ou Produto Final) --- + content.Controls.Add(CreateSectionHeader("PRODUTO PAI / KIT DE MONTAGEM", 20)); + + txtId = AddInput(content, "ID", 20, 50, 70, 30, true); + txtCodigo = AddInput(content, "CÓD. VÍNCULO", 100, 50, 110, 30); + + txtKitCodigo = AddInput(content, "CÓD. KIT", 220, 50, 100, 30); + btnBuscaKit = CriarBotaoLupa(325, 66, OnBuscaKit); + txtKitDescricao = AddInput(content, "DESCRIÇÃO DO PRODUTO FINAL", 365, 50, 470, 30, true); + + // --- SEÇÃO 2: Componente / Insumo --- + content.Controls.Add(CreateSectionHeader("COMPONENTE (ITEM DA COMPOSIÇÃO)", 115)); + + txtItemCodigo = AddInput(content, "CÓD. COMPONENTE", 20, 145, 130, 30); + btnBuscaItem = CriarBotaoLupa(155, 161, OnBuscaItem); + + txtBarcode = AddInput(content, "BARRAS/GTIN", 200, 145, 180, 30); + txtItemDescricao = AddInput(content, "DESCRIÇÃO DO COMPONENTE", 390, 145, 445, 30, true); + + // --- SEÇÃO 3: Quantidades e Financeiro do Componente --- + content.Controls.Add(CreateSectionHeader("ESTRUTURA DE CUSTOS E QTD.", 210)); + + txtQtd = AddInput(content, "QTD. NECESSÁRIA", 20, 240, 150, 30); + txtQtd.BackColor = Color.LightYellow; // Destaque para campo de ajuste + + txtCusto = AddInput(content, "CUSTO UNIT.", 180, 240, 150, 30); + txtVenda = AddInput(content, "VENDA UNIT.", 340, 240, 150, 30); + + // --- SEÇÃO 4: Mão de Obra / Serviço --- + content.Controls.Add(CreateSectionHeader("MÃO DE OBRA ASSOCIADA", 305)); + txtServico = AddInput(content, "SERVIÇO DE MONTAGEM / TÉCNICO", 20, 335, 815, 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 OnBuscaKit(object sender, EventArgs e) => MessageBox.Show("Selecionar Produto Pai"); + private void OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Selecionar Componente"); + + private void PreencherModel() + { + _composicao.CODIGO = txtCodigo.Text; + _composicao.KIT_CODIGO = txtKitCodigo.Text; + _composicao.ITEM_CODIGO = txtItemCodigo.Text; + _composicao.BARCODE = txtBarcode.Text; + _composicao.DESCRICAO = txtItemDescricao.Text; + _composicao.QTD = txtQtd.Text; + _composicao.CUSTO = txtCusto.Text; + _composicao.VENDA = txtVenda.Text; + _composicao.SERVICO = txtServico.Text; + } + + protected override void OnNovo() + { + _composicao = new ModeloItensFabrica(); + txtKitCodigo.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + MessageBox.Show("Componente vinculado à fabricação com sucesso!", "LevelOS - Fábrica", 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(); } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ItensFotosGaleriaPanel.cs b/UI/Dashboards/Cadastros/ItensFotosGaleriaPanel.cs new file mode 100644 index 0000000..0a21a75 --- /dev/null +++ b/UI/Dashboards/Cadastros/ItensFotosGaleriaPanel.cs @@ -0,0 +1,150 @@ +using CPM; +using MLL; +using System; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class ItensFotosGaleriaPanel : FormularioModelo + { + private ModeloItensFotosML _fotoItem = new ModeloItensFotosML(); + + // Controles - Identificação + private LV_TEXTBOX1 txtId, txtCodigo, txtCodItem, txtNomeItem; + private Button btnBuscaItem; + + // Controles - Galeria e Links + private LV_TEXTBOX1 txtLinkFoto; + private PictureBox picPreview; + private Button btnTestarLink; + + public ItensFotosGaleriaPanel() + { + this.Titulo = "Galeria de Fotos (Integração E-commerce)"; + MontarInterface(); + } + + private void MontarInterface() + { + // --- SEÇÃO 1: Vínculo do Produto --- + content.Controls.Add(CreateSectionHeader("PRODUTO VINCULADO", 20)); + + txtId = AddInput(content, "ID", 20, 50, 70, 30, true); + txtCodigo = AddInput(content, "CÓD. VÍNCULO", 100, 50, 120, 30); + + txtCodItem = AddInput(content, "CÓD. ITEM", 230, 50, 100, 30); + btnBuscaItem = CriarBotaoLupa(335, 66, OnBuscaItem); + txtNomeItem = AddInput(content, "DESCRIÇÃO DO PRODUTO", 375, 50, 460, 30, true); + + // --- SEÇÃO 2: Gerenciamento da Imagem --- + content.Controls.Add(CreateSectionHeader("LINK DA IMAGEM E PREVIEW", 115)); + + // Link da Foto (URL do Mercado Livre ou Servidor) + txtLinkFoto = AddInput(content, "URL DA FOTO (LINK_FOTO)", 20, 145, 650, 30); + + btnTestarLink = new Button + { + Text = "VISUALIZAR", + Location = new Point(680, 161), + Size = new Size(155, 30), + BackColor = Color.FromArgb(0, 120, 215), + ForeColor = Color.White, + FlatStyle = FlatStyle.Flat, + Cursor = Cursors.Hand + }; + btnTestarLink.Click += OnTestarLink; + content.Controls.Add(btnTestarLink); + + // Preview Box + picPreview = new PictureBox + { + Location = new Point(20, 200), + Size = new Size(815, 200), + BorderStyle = BorderStyle.FixedSingle, + SizeMode = PictureBoxSizeMode.Zoom, + BackColor = Color.WhiteSmoke + }; + content.Controls.Add(picPreview); + + Label lblDica = new Label + { + Text = "* Cole o link da imagem acima para validar a visualização antes de salvar.", + Location = new Point(20, 410), + AutoSize = true, + ForeColor = Color.Gray, + Font = new Font("Segoe UI", 8, FontStyle.Italic) + }; + content.Controls.Add(lblDica); + + content.Height = 460; + } + + 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 OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Selecionar Produto"); + + private void OnTestarLink(object sender, EventArgs e) + { + try + { + if (!string.IsNullOrEmpty(txtLinkFoto.Text)) + picPreview.Load(txtLinkFoto.Text); + } + catch + { + MessageBox.Show("Não foi possível carregar a imagem do link informado.", "Erro de Link", MessageBoxButtons.OK, MessageBoxIcon.Warning); + } + } + + private void PreencherModel() + { + _fotoItem.CODIGO = txtCodigo.Text; + _fotoItem.COD_ITEM = txtCodItem.Text; + _fotoItem.LINK_FOTO = txtLinkFoto.Text; + } + + protected override void OnNovo() + { + _fotoItem = new ModeloItensFotosML(); + txtLinkFoto.Text = string.Empty; + picPreview.Image = null; + txtCodItem.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + MessageBox.Show("Link de imagem salvo com sucesso!", "Galeria ML", 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(); } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ItensNotaCadastroPanel.cs b/UI/Dashboards/Cadastros/ItensNotaCadastroPanel.cs new file mode 100644 index 0000000..65a878f --- /dev/null +++ b/UI/Dashboards/Cadastros/ItensNotaCadastroPanel.cs @@ -0,0 +1,147 @@ +using CPM; +using MLL; +using System; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class ItensNotaCadastroPanel : FormularioModelo + { + private ModeloItensNota _itemNota = new ModeloItensNota(); + + // Controles - Vínculos + private LV_TEXTBOX1 txtId, txtCodigo, txtCodNota, txtCodVendedor; + + // Controles - Dados do Item + private LV_TEXTBOX1 txtCodItem, txtGtin, txtDescricao, txtUnidade, txtTipo; + private Button btnBuscaItem; + + // Controles - Valores e Quantidades + private LV_TEXTBOX1 txtQtd, txtPreco, txtDesconto, txtTotal; + + // Controles - Impostos e Fiscal + private LV_TEXTBOX1 txtIcms, txtIpi, txtIss, txtCfop, txtCst; + + // Informações Adicionais + private LV_TEXTBOX1 txtInfAdic; + + public ItensNotaCadastroPanel() + { + this.Titulo = "Detalhamento do Item na Nota Fiscal"; + MontarInterface(); + } + + private void MontarInterface() + { + // --- SEÇÃO 1: Referência da Nota e Vendedor --- + content.Controls.Add(CreateSectionHeader("DADOS DA NOTA E ORIGEM", 20)); + + txtId = AddInput(content, "ID", 20, 50, 70, 30, true); + txtCodigo = AddInput(content, "CÓD. LANÇ.", 100, 50, 100, 30); + txtCodNota = AddInput(content, "Nº CONTROLE NOTA", 210, 50, 160, 30); + txtCodVendedor = AddInput(content, "CÓD. VENDEDOR", 380, 50, 130, 30); + txtTipo = AddInput(content, "TIPO (V/S)", 520, 50, 80, 30); + + // --- SEÇÃO 2: Dados do Produto/Serviço --- + content.Controls.Add(CreateSectionHeader("ITEM SELECIONADO", 115)); + + txtCodItem = AddInput(content, "CÓD. ITEM", 20, 145, 100, 30); + btnBuscaItem = CriarBotaoLupa(125, 161, OnBuscaItem); + txtGtin = AddInput(content, "GTIN/EAN", 165, 145, 150, 30); + txtDescricao = AddInput(content, "DESCRIÇÃO NA NOTA", 325, 145, 380, 30); + txtUnidade = AddInput(content, "UN", 715, 145, 60, 30); + + // --- SEÇÃO 3: Comercial (Valores) --- + content.Controls.Add(CreateSectionHeader("QUANTIDADES E VALORES COMERCIAIS", 210)); + + txtQtd = AddInput(content, "QUANTIDADE", 20, 240, 120, 30); + txtPreco = AddInput(content, "PREÇO UNIT. (R$)", 150, 240, 140, 30); + txtDesconto = AddInput(content, "DESCONTO (R$)", 300, 240, 140, 30); + txtTotal = AddInput(content, "TOTAL LÍQUIDO", 450, 240, 150, 30, true); + txtTotal.BackColor = Color.FromArgb(255, 250, 240); // Destaque para o resultado + + // --- SEÇÃO 4: Tributação Aplicada --- + content.Controls.Add(CreateSectionHeader("IMPOSTOS E REGRAS FISCAIS", 305)); + + txtCfop = AddInput(content, "CFOP", 20, 335, 90, 30); + txtCst = AddInput(content, "CST/CSOSN", 120, 335, 90, 30); + txtIcms = AddInput(content, "ICMS (%)", 220, 335, 90, 30); + txtIpi = AddInput(content, "IPI (%)", 320, 335, 90, 30); + txtIss = AddInput(content, "ISS (%)", 420, 335, 90, 30); + + // --- SEÇÃO 5: Observações Adicionais --- + content.Controls.Add(CreateSectionHeader("INFORMAÇÕES ADICIONAIS DO ITEM", 400)); + txtInfAdic = AddInput(content, "DETALHES ADICIONAIS (TEXTO FISCAL)", 20, 430, 755, 50); + + content.Height = 520; + } + + 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 OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Busca de Itens para Nota"); + + private void PreencherModel() + { + _itemNota.CODIGO = txtCodigo.Text; + _itemNota.COD_NOTA = txtCodNota.Text; + _itemNota.TIPO = txtTipo.Text; + _itemNota.COD_VENDEDOR = txtCodVendedor.Text; + _itemNota.COD_ITEM = txtCodItem.Text; + _itemNota.DESCRICAO = txtDescricao.Text; + _itemNota.UNIDADE = txtUnidade.Text; + _itemNota.QTD = txtQtd.Text; + _itemNota.PRECO = txtPreco.Text; + _itemNota.ICMS = txtIcms.Text; + _itemNota.IPI = txtIpi.Text; + _itemNota.ISS = txtIss.Text; + _itemNota.DESCONTO = txtDesconto.Text; + _itemNota.TOTAL = txtTotal.Text; + _itemNota.CFOP = txtCfop.Text; + _itemNota.CST = txtCst.Text; + _itemNota.GTIN = txtGtin.Text; + _itemNota.INF_ADIC = txtInfAdic.Text; + } + + protected override void OnNovo() + { + _itemNota = new ModeloItensNota(); + txtCodItem.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + MessageBox.Show("Item da nota fiscal atualizado!", "LevelOS", 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(); } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ItensOrcamentoCadastroPanel.cs b/UI/Dashboards/Cadastros/ItensOrcamentoCadastroPanel.cs new file mode 100644 index 0000000..3f8b68b --- /dev/null +++ b/UI/Dashboards/Cadastros/ItensOrcamentoCadastroPanel.cs @@ -0,0 +1,135 @@ +using CPM; +using MLL; +using System; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class ItensOrcamentoCadastroPanel : FormularioModelo + { + private ModeloItensOrca _itemOrca = new ModeloItensOrca(); + + // Controles - Referências e Identificação + private LV_TEXTBOX1 txtId, txtCodigo, txtBarcode; + private Button btnBuscaItem; + + // Controles - Descrição e Tipo + private LV_TEXTBOX1 txtDescricao, txtUn, txtServico; + + // Controles - Valores e Negociação + private LV_TEXTBOX1 txtQtd, txtVlrUn, txtVendaOriginal, txtDesconto, txtVlrTotal; + + public ItensOrcamentoCadastroPanel() + { + this.Titulo = "Item do Orçamento / Cotação"; + MontarInterface(); + } + + private void MontarInterface() + { + // --- SEÇÃO 1: Identificação do Item --- + content.Controls.Add(CreateSectionHeader("REFERÊNCIA DO ITEM", 20)); + + txtId = AddInput(content, "ID", 20, 50, 70, 30, true); + txtCodigo = AddInput(content, "CÓD. ORÇAMENTO", 100, 50, 130, 30); + txtBarcode = AddInput(content, "BARRAS / GTIN", 240, 50, 180, 30); + + btnBuscaItem = CriarBotaoLupa(425, 66, OnBuscaItem); + + // --- SEÇÃO 2: Detalhes do Produto/Serviço --- + content.Controls.Add(CreateSectionHeader("DESCRIÇÃO E CLASSIFICAÇÃO", 115)); + + txtDescricao = AddInput(content, "DESCRIÇÃO DO ITEM NO ORÇAMENTO", 20, 145, 500, 30); + txtUn = AddInput(content, "UN", 530, 145, 60, 30); + txtServico = AddInput(content, "TIPO/SERVIÇO", 600, 145, 215, 30); + + // --- SEÇÃO 3: Comercial e Negociação --- + content.Controls.Add(CreateSectionHeader("CÁLCULO DE VALORES", 210)); + + txtQtd = AddInput(content, "QUANTIDADE", 20, 240, 120, 30); + txtVendaOriginal = AddInput(content, "PREÇO TABELA (R$)", 150, 240, 140, 30, true); // Campo VENDA + + txtVlrUn = AddInput(content, "PREÇO PRATICADO", 300, 240, 140, 30); + txtVlrUn.BackColor = Color.LightYellow; + + txtDesconto = AddInput(content, "DESCONTO UNIT.", 450, 240, 130, 30); + + txtVlrTotal = AddInput(content, "TOTAL DO ITEM", 590, 240, 225, 30, true); + txtVlrTotal.BackColor = Color.FromArgb(230, 245, 230); // Verde suave para o total + txtVlrTotal.Font = new Font("Segoe UI", 10, FontStyle.Bold); + + // Informativo de rodapé + Label lblAviso = new Label + { + Text = "* Alterações nestes valores afetam apenas este orçamento específico.", + Location = new Point(20, 290), + AutoSize = true, + ForeColor = Color.DimGray, + Font = new Font("Segoe UI", 8, FontStyle.Italic) + }; + content.Controls.Add(lblAviso); + + content.Height = 350; + } + + 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 OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Busca de Itens/Serviços"); + + private void PreencherModel() + { + _itemOrca.CODIGO = txtCodigo.Text; + _itemOrca.BARCODE = txtBarcode.Text; + _itemOrca.DESCRICAO = txtDescricao.Text; + _itemOrca.SERVICO = txtServico.Text; + _itemOrca.QTD = txtQtd.Text; + _itemOrca.VRL_UN = txtVlrUn.Text; + _itemOrca.VENDA = txtVendaOriginal.Text; + _itemOrca.DESCONTO = txtDesconto.Text; + _itemOrca.VLR_TOTAL = txtVlrTotal.Text; + _itemOrca.UN = txtUn.Text; + } + + protected override void OnNovo() + { + _itemOrca = new ModeloItensOrca(); + txtBarcode.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + MessageBox.Show("Item adicionado ao orçamento!", "LevelOS", 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(); } + } +} \ No newline at end of file diff --git a/UI/Dashboards/Cadastros/ItensPedidoCadastroPanel.cs b/UI/Dashboards/Cadastros/ItensPedidoCadastroPanel.cs new file mode 100644 index 0000000..ba54ee7 --- /dev/null +++ b/UI/Dashboards/Cadastros/ItensPedidoCadastroPanel.cs @@ -0,0 +1,148 @@ +using CPM; +using MLL; +using System; +using System.Drawing; +using System.Windows.Forms; +using UI; + +namespace UI +{ + public partial class ItensPedidoCadastroPanel : FormularioModelo + { + private ModeloItensPedido _itemPedido = new ModeloItensPedido(); + + // Controles - Vínculos e Cabeçalho + private LV_TEXTBOX1 txtId, txtCodigo, txtPedido, txtItemSequencial; + + // Controles - Dados do Produto + private LV_TEXTBOX1 txtCodItem, txtCodFab, txtNome, txtUn; + private Button btnBuscaItem; + + // Controles - Quantidades e Valores Base + private LV_TEXTBOX1 txtQtd, txtVlrUnitario, txtValorTotal; + + // Controles - Impostos e Rateios (Logística) + private LV_TEXTBOX1 txtIpi, txtIcms, txtVFrete, txtVSeguro, txtVDesconto, txtVOutros; + + // Controles - Rastreabilidade + private LV_TEXTBOX1 txtSeriais; + + public ItensPedidoCadastroPanel() + { + this.Titulo = "Gestão de Itens do Pedido"; + MontarInterface(); + } + + private void MontarInterface() + { + // --- SEÇÃO 1: Referências do Pedido --- + content.Controls.Add(CreateSectionHeader("VÍNCULO DO PEDIDO", 20)); + + txtId = AddInput(content, "ID", 20, 50, 70, 30, true); + txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 110, 30); + txtPedido = AddInput(content, "Nº PEDIDO", 220, 50, 150, 30); + txtItemSequencial = AddInput(content, "ITEM Nº", 380, 50, 80, 30); + + // --- SEÇÃO 2: Dados do Produto --- + content.Controls.Add(CreateSectionHeader("PRODUTO E REFERÊNCIA DE FÁBRICA", 115)); + + txtCodItem = AddInput(content, "CÓD. ITEM", 20, 145, 110, 30); + btnBuscaItem = CriarBotaoLupa(135, 161, OnBuscaItem); + + txtCodFab = AddInput(content, "REF. FABRICANTE", 175, 145, 150, 30); + txtNome = AddInput(content, "DESCRIÇÃO DO PRODUTO", 335, 145, 410, 30); + txtUn = AddInput(content, "UN", 755, 145, 60, 30); + + // --- SEÇÃO 3: Valores, Impostos e Rateios --- + content.Controls.Add(CreateSectionHeader("FINANCEIRO E COMPOSIÇÃO DE CUSTO", 210)); + + txtQtd = AddInput(content, "QUANTIDADE", 20, 240, 110, 30); + txtVlrUnitario = AddInput(content, "VLR. UNITÁRIO", 140, 240, 130, 30); + + txtIpi = AddInput(content, "IPI (%)", 280, 240, 80, 30); + txtIcms = AddInput(content, "ICMS (%)", 370, 240, 80, 30); + + txtVDesconto = AddInput(content, "(-) DESCONTO", 460, 240, 120, 30); + txtVDesconto.ForeColor = Color.Red; + + txtValorTotal = AddInput(content, "TOTAL LÍQUIDO", 590, 240, 225, 30, true); + txtValorTotal.BackColor = Color.FromArgb(240, 248, 255); + + // Linha de custos logísticos + txtVFrete = AddInput(content, "(+) FRETE", 20, 295, 120, 30); + txtVSeguro = AddInput(content, "(+) SEGURO", 150, 295, 120, 30); + txtVOutros = AddInput(content, "(+) OUTROS", 280, 295, 120, 30); + + // --- SEÇÃO 4: Rastreabilidade (Seriais) --- + content.Controls.Add(CreateSectionHeader("CONTROLE DE SERIAIS / GARANTIA", 365)); + txtSeriais = AddInput(content, "NÚMEROS DE SÉRIE (SEPARE POR VÍRGULA OU SCANNER)", 20, 395, 795, 50); + + content.Height = 480; + } + + 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 OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Busca de Itens"); + + private void PreencherModel() + { + _itemPedido.CODIGO = txtCodigo.Text; + _itemPedido.ITEM = txtItemSequencial.Text; + _itemPedido.PEDIDO = txtPedido.Text; + _itemPedido.COD_ITEM = txtCodItem.Text; + _itemPedido.NOME = txtNome.Text; + _itemPedido.UN = txtUn.Text; + _itemPedido.QTD = txtQtd.Text; + _itemPedido.VLR = txtVlrUnitario.Text; + _itemPedido.IPI = txtIpi.Text; + _itemPedido.ICMS = txtIcms.Text; + _itemPedido.VALOR = txtValorTotal.Text; + _itemPedido.COD_FAB = txtCodFab.Text; + _itemPedido.VFrete = txtVFrete.Text; + _itemPedido.VSeguro = txtVSeguro.Text; + _itemPedido.VDesconto = txtVDesconto.Text; + _itemPedido.VOutros = txtVOutros.Text; + _itemPedido.SERIAIS_IN = txtSeriais.Text; + } + + protected override void OnNovo() + { + _itemPedido = new ModeloItensPedido(); + txtCodItem.Focus(); + } + + protected override void OnSalvar() + { + try + { + PreencherModel(); + MessageBox.Show("Item do pedido processado!", "LevelOS", 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(); } + } +} \ No newline at end of file