01/05/2026 - Implementando UI/UX
This commit is contained in:
parent
9666cc0565
commit
cd6c4165cb
102
UI/Dashboards/Cadastros/NfeCfopCadastroPanel.cs
Normal file
102
UI/Dashboards/Cadastros/NfeCfopCadastroPanel.cs
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NfeCfopCadastroPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasCFOP _cfop = new ModeloNotasCFOP();
|
||||||
|
|
||||||
|
// Controles - Identificação
|
||||||
|
private LV_TEXTBOX1 txtId, txtCodigoCfop, txtDescricao;
|
||||||
|
|
||||||
|
// Controles - Flags de Comportamento (Sim/Não)
|
||||||
|
private CheckBox chkEstoque, chkContas, chkIcms, chkIcmsSt;
|
||||||
|
|
||||||
|
// Controles - Observações/Base Legal
|
||||||
|
private LV_TEXTBOX1 txtBaseLegal;
|
||||||
|
|
||||||
|
public NfeCfopCadastroPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Configuração de CFOP (Regras Fiscais)";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- SEÇÃO 1: Identificação ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO FISCAL", 20));
|
||||||
|
|
||||||
|
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
||||||
|
txtCodigoCfop = AddInput(content, "CÓDIGO CFOP (EX: 5102)", 100, 50, 150, 30);
|
||||||
|
txtDescricao = AddInput(content, "DESCRIÇÃO DA OPERAÇÃO", 260, 50, 540, 30);
|
||||||
|
|
||||||
|
// --- SEÇÃO 2: Automação e Comportamento ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("REGRAS DE AUTOMAÇÃO", 115));
|
||||||
|
|
||||||
|
// Estilizando os Checkboxes como chaves seletoras
|
||||||
|
chkEstoque = new CheckBox { Text = "MOVIMENTAR ESTOQUE", Location = new Point(25, 145), AutoSize = true, Font = new Font("Segoe UI", 9, FontStyle.Bold) };
|
||||||
|
chkContas = new CheckBox { Text = "GERAR FINANCEIRO (PAG/REC)", Location = new Point(200, 145), AutoSize = true, Font = new Font("Segoe UI", 9, FontStyle.Bold) };
|
||||||
|
chkIcms = new CheckBox { Text = "CALCULAR ICMS", Location = new Point(420, 145), AutoSize = true, Font = new Font("Segoe UI", 9, FontStyle.Bold) };
|
||||||
|
chkIcmsSt = new CheckBox { Text = "CALCULAR ICMS ST", Location = new Point(570, 145), AutoSize = true, Font = new Font("Segoe UI", 9, FontStyle.Bold) };
|
||||||
|
|
||||||
|
content.Controls.Add(chkEstoque);
|
||||||
|
content.Controls.Add(chkContas);
|
||||||
|
content.Controls.Add(chkIcms);
|
||||||
|
content.Controls.Add(chkIcmsSt);
|
||||||
|
|
||||||
|
// --- SEÇÃO 3: Textos Legais ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("INFORMAÇÕES COMPLEMENTARES (BASE LEGAL)", 200));
|
||||||
|
txtBaseLegal = AddInput(content, "TEXTO PADRÃO PARA OBSERVAÇÕES DA NOTA", 20, 230, 780, 60);
|
||||||
|
txtBaseLegal.Multiline = true;
|
||||||
|
|
||||||
|
content.Height = 320;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreencherModel()
|
||||||
|
{
|
||||||
|
_cfop.CFOP = txtCodigoCfop.Text;
|
||||||
|
_cfop.DESCRICAO = txtDescricao.Text;
|
||||||
|
_cfop.BESTOQUE = chkEstoque.Checked ? "S" : "N";
|
||||||
|
_cfop.BCONTAS = chkContas.Checked ? "S" : "N";
|
||||||
|
_cfop.BICMS = chkIcms.Checked ? "S" : "N";
|
||||||
|
_cfop.BICMS_ST = chkIcmsSt.Checked ? "S" : "N";
|
||||||
|
_cfop.BASE = txtBaseLegal.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_cfop = new ModeloNotasCFOP();
|
||||||
|
txtCodigoCfop.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
if (txtCodigoCfop.Text.Length < 4)
|
||||||
|
{
|
||||||
|
MessageBox.Show("CFOP inválido!", "Aviso");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PreencherModel();
|
||||||
|
MessageBox.Show("Regra de CFOP salva com sucesso!", "LevelOS Fiscal");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar() { }
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
83
UI/Dashboards/Cadastros/NotasComprasCadastroPanel.cs
Normal file
83
UI/Dashboards/Cadastros/NotasComprasCadastroPanel.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using MLL;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasComprasCadastroPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasCompras _compra = new ModeloNotasCompras();
|
||||||
|
private TabControl tabPrincipal;
|
||||||
|
private TabPage tabDados, tabEmitente, tabValores, tabTransporte;
|
||||||
|
|
||||||
|
public NotasComprasCadastroPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Entrada de Nota Fiscal (Compras)";
|
||||||
|
this.Size = new Size(900, 650);
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
content.Controls.Clear();
|
||||||
|
|
||||||
|
tabPrincipal = new TabControl { Dock = DockStyle.Fill, Font = new Font("Segoe UI", 9) };
|
||||||
|
|
||||||
|
tabDados = new TabPage("1. Identificação");
|
||||||
|
tabEmitente = new TabPage("2. Fornecedor (Emitente)");
|
||||||
|
tabValores = new TabPage("3. Totais e Impostos");
|
||||||
|
tabTransporte = new TabPage("4. Transporte");
|
||||||
|
|
||||||
|
tabPrincipal.TabPages.AddRange(new[] { tabDados, tabEmitente, tabValores, tabTransporte });
|
||||||
|
content.Controls.Add(tabPrincipal);
|
||||||
|
|
||||||
|
ConfigurarAbaDados();
|
||||||
|
ConfigurarAbaEmitente();
|
||||||
|
ConfigurarAbaValores();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaDados()
|
||||||
|
{
|
||||||
|
AddInput(tabDados, "CHAVE DE ACESSO (44 DÍGITOS)", 20, 20, 450, 30).Name = "IDE_CHNFE";
|
||||||
|
AddInput(tabDados, "NÚMERO NF", 20, 80, 120, 30).Name = "IDE_NNF";
|
||||||
|
AddInput(tabDados, "SÉRIE", 150, 80, 60, 30).Name = "IDE_SERIE";
|
||||||
|
AddInput(tabDados, "DATA EMISSÃO", 220, 80, 150, 30).Name = "IDE_DEMI";
|
||||||
|
AddInput(tabDados, "NATUREZA DA OPERAÇÃO", 20, 140, 450, 30).Name = "IDE_NATOP";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaEmitente()
|
||||||
|
{
|
||||||
|
AddInput(tabEmitente, "CNPJ / CPF", 20, 20, 200, 30).Name = "DESTEMIT_CNPJCPF";
|
||||||
|
AddInput(tabEmitente, "RAZÃO SOCIAL", 230, 20, 400, 30).Name = "DESTEMIT_XNOME";
|
||||||
|
AddInput(tabEmitente, "INSCRIÇÃO ESTADUAL", 20, 80, 200, 30).Name = "DESTEMIT_IE";
|
||||||
|
AddInput(tabEmitente, "CIDADE (IBGE)", 230, 80, 250, 30).Name = "DESTEMIT_XMUN";
|
||||||
|
AddInput(tabEmitente, "UF", 490, 80, 50, 30).Name = "DESTEMIT_UF";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaValores()
|
||||||
|
{
|
||||||
|
// Cards de resumo no topo da aba de valores
|
||||||
|
var pnlResumo = new Panel { BackColor = Color.FromArgb(240, 240, 240), Dock = DockStyle.Top, Height = 80 };
|
||||||
|
tabValores.Controls.Add(pnlResumo);
|
||||||
|
|
||||||
|
AddInput(tabValores, "VLR TOTAL PRODUTOS", 20, 100, 180, 30).ForeColor = Color.Blue;
|
||||||
|
AddInput(tabValores, "VLR FRETE", 210, 100, 150, 30);
|
||||||
|
AddInput(tabValores, "VLR DESCONTO", 370, 100, 150, 30).ForeColor = Color.Red;
|
||||||
|
AddInput(tabValores, "VLR TOTAL DA NOTA (VNF)", 20, 160, 250, 40).Font = new Font("Segoe UI", 12, FontStyle.Bold);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNovo() { /* Limpar campos */ }
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
MessageBox.Show("Nota de Compra registrada! Estoque atualizado via CFOP.", "LevelOS Cloud");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar() { }
|
||||||
|
protected override void OnAlterar() { }
|
||||||
|
protected override void OnLocalizar() { }
|
||||||
|
protected override void OnExcluir() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
124
UI/Dashboards/Cadastros/NotasComprasCorelPanel.cs
Normal file
124
UI/Dashboards/Cadastros/NotasComprasCorelPanel.cs
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasComprasCorelPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasComprasCorel _corel = new ModeloNotasComprasCorel();
|
||||||
|
|
||||||
|
// Controles
|
||||||
|
private LV_TEXTBOX1 txtId, txtCnpjFornecedor, txtCodFornecedor, txtMeuCodigo;
|
||||||
|
private Label lblPreviewRelacao;
|
||||||
|
|
||||||
|
public NotasComprasCorelPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Correlação de Produtos (De/Para Fornecedor)";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- SEÇÃO 1: Origem (O que vem na Nota) ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("DADOS DO FORNECEDOR", 20));
|
||||||
|
|
||||||
|
txtCnpjFornecedor = AddInput(content, "CNPJ DO FORNECEDOR", 20, 50, 250, 30);
|
||||||
|
txtCodFornecedor = AddInput(content, "CÓD. PRODUTO NO FORNECEDOR", 280, 50, 250, 30);
|
||||||
|
|
||||||
|
// --- SEÇÃO 2: Destino (Como está no seu Sistema) ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("MEU CADASTRO INTERNO", 115));
|
||||||
|
|
||||||
|
txtMeuCodigo = AddInput(content, "MEU CÓDIGO DE ESTOQUE (SKU)", 20, 145, 250, 30);
|
||||||
|
|
||||||
|
// Preview Visual
|
||||||
|
lblPreviewRelacao = new Label
|
||||||
|
{
|
||||||
|
Text = "Vínculo: [Produto Fornecedor] ➔ [Meu Estoque]",
|
||||||
|
Location = new Point(20, 195),
|
||||||
|
Size = new Size(500, 20),
|
||||||
|
ForeColor = Color.DimGray,
|
||||||
|
Font = new Font("Segoe UI", 9, FontStyle.Italic)
|
||||||
|
};
|
||||||
|
content.Controls.Add(lblPreviewRelacao);
|
||||||
|
|
||||||
|
// Botão auxiliar para busca
|
||||||
|
Button btnBuscarProduto = new Button
|
||||||
|
{
|
||||||
|
Text = "🔍 Buscar no Meu Estoque",
|
||||||
|
Location = new Point(280, 142),
|
||||||
|
Size = new Size(180, 35),
|
||||||
|
FlatStyle = FlatStyle.Flat
|
||||||
|
};
|
||||||
|
content.Controls.Add(btnBuscarProduto);
|
||||||
|
|
||||||
|
content.Height = 240;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreencherModel()
|
||||||
|
{
|
||||||
|
_corel.FORNEC_CNPJ = txtCnpjFornecedor.Text;
|
||||||
|
_corel.FORNEC_cProd = txtCodFornecedor.Text;
|
||||||
|
_corel.MEU_cProd = txtMeuCodigo.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- IMPLEMENTAÇÃO DOS MEMBROS OBRIGATÓRIOS ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_corel = new ModeloNotasComprasCorel();
|
||||||
|
txtId.Text = "0";
|
||||||
|
txtCnpjFornecedor.Text = "";
|
||||||
|
txtCodFornecedor.Text = "";
|
||||||
|
txtMeuCodigo.Text = "";
|
||||||
|
txtCnpjFornecedor.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(txtCnpjFornecedor.Text)) return;
|
||||||
|
|
||||||
|
PreencherModel();
|
||||||
|
// Lógica de persistência no Banco de Dados viria aqui
|
||||||
|
MessageBox.Show("Vínculo de produto salvo com sucesso!", "LevelOS");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (_corel.ID_NOTAS_COMP_COREL == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Selecione um registro primeiro para alterar.", "Aviso");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PreencherModel();
|
||||||
|
MessageBox.Show("Registro atualizado!", "LevelOS");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Deseja realmente excluir este vínculo?", "Confirmar", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
OnNovo();
|
||||||
|
MessageBox.Show("Vínculo removido.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
// Aqui você abriria o seu formulário de busca padrão (Grid)
|
||||||
|
// Exemplo hipotético:
|
||||||
|
// var busca = new FormBuscaGenerica("NotasComprasCorel");
|
||||||
|
// if (busca.ShowDialog() == DialogResult.OK) { MapModelParaTela(busca.ObjetoSelecionado); }
|
||||||
|
|
||||||
|
MessageBox.Show("Abrindo tela de consulta de correlações...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
146
UI/Dashboards/Cadastros/NotasComprasDFEPanel.cs
Normal file
146
UI/Dashboards/Cadastros/NotasComprasDFEPanel.cs
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasComprasDFEPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasComprasDFE _dfe = new ModeloNotasComprasDFE();
|
||||||
|
|
||||||
|
// Controles de UI
|
||||||
|
private LV_TEXTBOX1 txtId, txtCodigo, txtChave;
|
||||||
|
private ComboBox cbManifesto;
|
||||||
|
private Label lblStatusSefaz;
|
||||||
|
|
||||||
|
public NotasComprasDFEPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Monitoramento de Notas da SEFAZ (DF-e)";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- Área de Dados ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("DADOS DO DOCUMENTO LOCALIZADO", 20));
|
||||||
|
|
||||||
|
txtId = AddInput(content, "ID", 20, 50, 60, 30, true);
|
||||||
|
txtCodigo = AddInput(content, "CÓDIGO INTERNO", 90, 50, 150, 30);
|
||||||
|
|
||||||
|
txtChave = AddInput(content, "CHAVE DE ACESSO (44 DÍGITOS)", 20, 110, 540, 30);
|
||||||
|
txtChave.ForeColor = Color.DarkBlue;
|
||||||
|
|
||||||
|
// --- Status da Manifestação ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("AÇÃO DE MANIFESTAÇÃO", 175));
|
||||||
|
|
||||||
|
cbManifesto = new ComboBox
|
||||||
|
{
|
||||||
|
Location = new Point(25, 205),
|
||||||
|
Size = new Size(300, 30),
|
||||||
|
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||||
|
Font = new Font("Segoe UI", 10)
|
||||||
|
};
|
||||||
|
cbManifesto.Items.AddRange(new object[] {
|
||||||
|
"0 - Sem Manifestação",
|
||||||
|
"1 - Ciência da Operação",
|
||||||
|
"2 - Confirmação da Operação",
|
||||||
|
"3 - Desconhecimento da Operação",
|
||||||
|
"4 - Operação não Realizada"
|
||||||
|
});
|
||||||
|
content.Controls.Add(cbManifesto);
|
||||||
|
|
||||||
|
lblStatusSefaz = new Label
|
||||||
|
{
|
||||||
|
Text = "● Aguardando interação com SEFAZ",
|
||||||
|
Location = new Point(340, 210),
|
||||||
|
AutoSize = true,
|
||||||
|
ForeColor = Color.Gray,
|
||||||
|
Font = new Font("Segoe UI", 9, FontStyle.Bold)
|
||||||
|
};
|
||||||
|
content.Controls.Add(lblStatusSefaz);
|
||||||
|
|
||||||
|
content.Height = 280;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreencherModel()
|
||||||
|
{
|
||||||
|
_dfe.CODIGO = txtCodigo.Text;
|
||||||
|
_dfe.CHAVE = txtChave.Text;
|
||||||
|
_dfe.MANIFESTADO = cbManifesto.SelectedIndex.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MapModelParaTela(ModeloNotasComprasDFE model)
|
||||||
|
{
|
||||||
|
txtId.Text = model.ID_NOTAS_COMPRAS_DFE.ToString();
|
||||||
|
txtCodigo.Text = model.CODIGO;
|
||||||
|
txtChave.Text = model.CHAVE;
|
||||||
|
|
||||||
|
int index;
|
||||||
|
if (int.TryParse(model.MANIFESTADO, out index) && index < cbManifesto.Items.Count)
|
||||||
|
cbManifesto.SelectedIndex = index;
|
||||||
|
else
|
||||||
|
cbManifesto.SelectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- MÉTODOS OBRIGATÓRIOS DA CLASSE FormularioModelo ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_dfe = new ModeloNotasComprasDFE();
|
||||||
|
txtId.Text = "0";
|
||||||
|
txtCodigo.Text = "";
|
||||||
|
txtChave.Text = "";
|
||||||
|
cbManifesto.SelectedIndex = 0;
|
||||||
|
txtChave.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
if (txtChave.Text.Length < 44)
|
||||||
|
{
|
||||||
|
MessageBox.Show("A chave de acesso deve conter 44 caracteres.", "Erro de Validação");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PreencherModel();
|
||||||
|
// Aqui entraria a chamada para a DLL de transmissão (ex: ACBr ou Zeus)
|
||||||
|
lblStatusSefaz.Text = "● Manifesto enviado com sucesso!";
|
||||||
|
lblStatusSefaz.ForeColor = Color.Green;
|
||||||
|
|
||||||
|
MessageBox.Show("Evento registrado no banco e enviado para a SEFAZ.", "LevelOS Fiscal");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(txtId.Text) || txtId.Text == "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("Localize uma nota antes de tentar alterar.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PreencherModel();
|
||||||
|
MessageBox.Show("Registro de manifesto atualizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Deseja remover este registro de DF-e local?", "Confirmação", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
OnNovo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
// Simulação de busca na tabela de documentos baixados
|
||||||
|
MessageBox.Show("Abrindo lista de notas detectadas via Certificado Digital...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
117
UI/Dashboards/Cadastros/NotasComprasFaturasPanel.cs
Normal file
117
UI/Dashboards/Cadastros/NotasComprasFaturasPanel.cs
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasComprasFaturasPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasComprasFaturas _fatura = new ModeloNotasComprasFaturas();
|
||||||
|
|
||||||
|
// Controles
|
||||||
|
private LV_TEXTBOX1 txtId, txtNotaId, txtNumeroParcela, txtVencimento, txtValor;
|
||||||
|
|
||||||
|
public NotasComprasFaturasPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Detalhamento de Parcelas / Fatura de Compra";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- SEÇÃO: Identificação da Origem ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("VÍNCULO COM A NOTA FISCAL", 20));
|
||||||
|
|
||||||
|
txtId = AddInput(content, "ID", 20, 50, 60, 30, true);
|
||||||
|
txtNotaId = AddInput(content, "ID DA NOTA (FK)", 90, 50, 150, 30);
|
||||||
|
|
||||||
|
// --- SEÇÃO: Dados da Parcela ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("DADOS DO VENCIMENTO", 115));
|
||||||
|
|
||||||
|
txtNumeroParcela = AddInput(content, "Nº PARCELA (EX: 001)", 20, 145, 150, 30);
|
||||||
|
txtVencimento = AddInput(content, "DATA VENCIMENTO (AAAA-MM-DD)", 185, 145, 200, 30);
|
||||||
|
txtValor = AddInput(content, "VALOR DA PARCELA", 400, 145, 160, 30);
|
||||||
|
txtValor.ForeColor = Color.DarkRed;
|
||||||
|
|
||||||
|
content.Height = 220;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreencherModel()
|
||||||
|
{
|
||||||
|
_fatura.NOTA_ID = txtNotaId.Text;
|
||||||
|
_fatura.NPARC = txtNumeroParcela.Text;
|
||||||
|
_fatura.DVENC = txtVencimento.Text;
|
||||||
|
_fatura.VPARC = txtValor.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MapModelParaTela(ModeloNotasComprasFaturas model)
|
||||||
|
{
|
||||||
|
txtId.Text = model.ID_NOTAS_COMP_FATURAS.ToString();
|
||||||
|
txtNotaId.Text = model.NOTA_ID;
|
||||||
|
txtNumeroParcela.Text = model.NPARC;
|
||||||
|
txtVencimento.Text = model.DVENC;
|
||||||
|
txtValor.Text = model.VPARC;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- IMPLEMENTAÇÃO DOS MÉTODOS ABSTRATOS (Obrigatórios) ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_fatura = new ModeloNotasComprasFaturas();
|
||||||
|
txtId.Text = "0";
|
||||||
|
txtNotaId.Text = "";
|
||||||
|
txtNumeroParcela.Text = "";
|
||||||
|
txtVencimento.Text = "";
|
||||||
|
txtValor.Text = "";
|
||||||
|
txtNotaId.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(txtValor.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("O valor da parcela é obrigatório.", "Aviso LevelOS");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PreencherModel();
|
||||||
|
// Lógica: Aqui o sistema enviaria para a tabela NOTAS_COMPRAS_FATURAS
|
||||||
|
MessageBox.Show($"Parcela {txtNumeroParcela.Text} salva com sucesso!", "Financeiro");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (txtId.Text == "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("Selecione uma fatura para alterar.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PreencherModel();
|
||||||
|
MessageBox.Show("Dados da fatura atualizados.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Deseja remover esta parcela do financeiro?", "Confirmar", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
// Lógica de delete
|
||||||
|
OnNovo();
|
||||||
|
MessageBox.Show("Parcela excluída.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
// Exemplo: Abrir busca filtrada pelo ID da nota
|
||||||
|
MessageBox.Show("Localizando parcelas da nota fiscal...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
122
UI/Dashboards/Cadastros/NotasComprasItensPanel.cs
Normal file
122
UI/Dashboards/Cadastros/NotasComprasItensPanel.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 NotasComprasItensPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasComprasItens _item = new ModeloNotasComprasItens();
|
||||||
|
private TabControl tabDetalhes;
|
||||||
|
private TabPage tpGeral, tpImpostos, tpImportacao;
|
||||||
|
|
||||||
|
public NotasComprasItensPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Itens da Nota de Compra";
|
||||||
|
this.Size = new Size(850, 600);
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
tabDetalhes = new TabControl { Dock = DockStyle.Fill, Font = new Font("Segoe UI", 9) };
|
||||||
|
tpGeral = new TabPage("Dados Gerais");
|
||||||
|
tpImpostos = new TabPage("Impostos (ICMS/IPI/PIS)");
|
||||||
|
tpImportacao = new TabPage("Importação (DI)");
|
||||||
|
|
||||||
|
tabDetalhes.TabPages.AddRange(new[] { tpGeral, tpImpostos, tpImportacao });
|
||||||
|
content.Controls.Add(tabDetalhes);
|
||||||
|
|
||||||
|
ConfigurarAbaGeral();
|
||||||
|
ConfigurarAbaImpostos();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaGeral()
|
||||||
|
{
|
||||||
|
AddInput(tpGeral, "ID ITEM", 20, 20, 80, 30, true).Name = "txtId";
|
||||||
|
AddInput(tpGeral, "DESCRIÇÃO DO PRODUTO", 110, 20, 450, 30).Name = "txtXProd";
|
||||||
|
AddInput(tpGeral, "CÓD. FORNECEDOR", 20, 80, 150, 30);
|
||||||
|
AddInput(tpGeral, "EAN / GTIN", 180, 80, 180, 30);
|
||||||
|
AddInput(tpGeral, "NCM", 370, 80, 120, 30);
|
||||||
|
|
||||||
|
AddInput(tpGeral, "QTD COMPRADA", 20, 140, 120, 30).ForeColor = Color.Blue;
|
||||||
|
AddInput(tpGeral, "UNIDADE", 150, 140, 80, 30);
|
||||||
|
AddInput(tpGeral, "VLR UNITÁRIO", 240, 140, 120, 30);
|
||||||
|
AddInput(tpGeral, "VLR TOTAL PROD", 370, 140, 150, 30).BackColor = Color.LightYellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaImpostos()
|
||||||
|
{
|
||||||
|
AddInput(tpImpostos, "CST ICMS", 20, 20, 80, 30);
|
||||||
|
AddInput(tpImpostos, "BASE CÁLC. ICMS", 110, 20, 120, 30);
|
||||||
|
AddInput(tpImpostos, "VLR ICMS", 240, 20, 120, 30);
|
||||||
|
|
||||||
|
AddInput(tpImpostos, "CST PIS", 20, 80, 80, 30);
|
||||||
|
AddInput(tpImpostos, "CST COFINS", 110, 80, 80, 30);
|
||||||
|
AddInput(tpImpostos, "VLR IPI", 200, 80, 120, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- MÉTODOS OBRIGATÓRIOS (IMPLEMENTAÇÃO) ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_item = new ModeloNotasComprasItens();
|
||||||
|
LimparCampos(tpGeral);
|
||||||
|
LimparCampos(tpImpostos);
|
||||||
|
LimparCampos(tpImportacao);
|
||||||
|
MessageBox.Show("Pronto para adicionar um novo item.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
// Validação mínima
|
||||||
|
if (string.IsNullOrEmpty(_item.XPROD))
|
||||||
|
{
|
||||||
|
// Aqui você capturaria dos inputs antes de salvar
|
||||||
|
// PreencherModel();
|
||||||
|
}
|
||||||
|
MessageBox.Show("Item da nota salvo com sucesso!", "LevelOS");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (_item.ID_NOTAS_COMP_ITENS == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Selecione um item na lista para alterar.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MessageBox.Show("Alterações no item registradas.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Remover este item da nota fiscal?", "Excluir", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
OnNovo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
// Geralmente itens são listados em um Grid, mas o método é obrigatório
|
||||||
|
MessageBox.Show("Localizando itens vinculados à nota...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LimparCampos(Control pai)
|
||||||
|
{
|
||||||
|
foreach (Control c in pai.Controls)
|
||||||
|
{
|
||||||
|
if (c is LV_TEXTBOX1 t) t.Text = "";
|
||||||
|
if (c.HasChildren) LimparCampos(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
123
UI/Dashboards/Cadastros/NotasConsumidorFormasPanel.cs
Normal file
123
UI/Dashboards/Cadastros/NotasConsumidorFormasPanel.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 NotasConsumidorFormasPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasConsumidorFormas _formaPgto = new ModeloNotasConsumidorFormas();
|
||||||
|
|
||||||
|
// Controles de UI
|
||||||
|
private LV_TEXTBOX1 txtId, txtCodNfce, txtValor, txtCnpjCartao, txtCnpjOperadora;
|
||||||
|
private ComboBox cbMeioPagamento, cbBandeira;
|
||||||
|
|
||||||
|
public NotasConsumidorFormasPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Formas de Pagamento (NFC-e)";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- Cabeçalho de Vínculo ---
|
||||||
|
txtId = AddInput(content, "ID", 20, 30, 60, 30, true);
|
||||||
|
txtCodNfce = AddInput(content, "CÓDIGO NFC-e", 90, 30, 150, 30);
|
||||||
|
|
||||||
|
// --- Dados do Pagamento ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("DETALHES DO PAGAMENTO", 85));
|
||||||
|
|
||||||
|
cbMeioPagamento = new ComboBox
|
||||||
|
{
|
||||||
|
Location = new Point(25, 115),
|
||||||
|
Size = new Size(200, 30),
|
||||||
|
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||||
|
Font = new Font("Segoe UI", 10)
|
||||||
|
};
|
||||||
|
cbMeioPagamento.Items.AddRange(new object[] { "01-Dinheiro", "03-Cartão de Crédito", "04-Cartão de Débito", "15-Boleto", "17-PIX" });
|
||||||
|
content.Controls.Add(cbMeioPagamento);
|
||||||
|
|
||||||
|
txtValor = AddInput(content, "VALOR (R$)", 240, 115, 150, 30);
|
||||||
|
txtValor.ForeColor = Color.DarkGreen;
|
||||||
|
txtValor.Font = new Font("Segoe UI", 11, FontStyle.Bold);
|
||||||
|
|
||||||
|
// --- Dados de Cartão (Se houver) ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("DADOS DO CARTÃO / TEF", 170));
|
||||||
|
|
||||||
|
txtCnpjOperadora = AddInput(content, "CNPJ DA OPERADORA", 20, 200, 250, 30);
|
||||||
|
|
||||||
|
cbBandeira = new ComboBox
|
||||||
|
{
|
||||||
|
Location = new Point(280, 200),
|
||||||
|
Size = new Size(200, 30),
|
||||||
|
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||||
|
Font = new Font("Segoe UI", 10)
|
||||||
|
};
|
||||||
|
cbBandeira.Items.AddRange(new object[] { "01-Visa", "02-Mastercard", "03-American Express", "99-Outros" });
|
||||||
|
content.Controls.Add(cbBandeira);
|
||||||
|
|
||||||
|
content.Height = 280;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- MÉTODOS OBRIGATÓRIOS (Não esquecidos!) ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_formaPgto = new ModeloNotasConsumidorFormas();
|
||||||
|
txtId.Text = "0";
|
||||||
|
txtCodNfce.Text = "";
|
||||||
|
txtValor.Text = "";
|
||||||
|
txtCnpjOperadora.Text = "";
|
||||||
|
cbMeioPagamento.SelectedIndex = -1;
|
||||||
|
cbBandeira.SelectedIndex = -1;
|
||||||
|
cbMeioPagamento.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(txtValor.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Informe o valor do pagamento.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mapear campos para o Model
|
||||||
|
_formaPgto.VALOR = txtValor.Text;
|
||||||
|
_formaPgto.COD_NFCE = txtCodNfce.Text;
|
||||||
|
_formaPgto.FORMA = cbMeioPagamento.Text;
|
||||||
|
_formaPgto.CNPJ_OPERADORA = txtCnpjOperadora.Text;
|
||||||
|
_formaPgto.TBAND = cbBandeira.SelectedIndex.ToString();
|
||||||
|
_formaPgto.DATA_CADASTRO = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
MessageBox.Show("Forma de pagamento vinculada com sucesso!", "LevelOS - PDV");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (txtId.Text == "0") return;
|
||||||
|
// Lógica de update
|
||||||
|
MessageBox.Show("Pagamento atualizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Excluir esta forma de pagamento da nota?", "Confirmação", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
OnNovo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
MessageBox.Show("Buscando pagamentos desta nota...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
//this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
124
UI/Dashboards/Cadastros/NotasConsumidorItensPanel.cs
Normal file
124
UI/Dashboards/Cadastros/NotasConsumidorItensPanel.cs
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasConsumidorItensPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasConsumidorItens _item = new ModeloNotasConsumidorItens();
|
||||||
|
private TabControl tabFiscal;
|
||||||
|
private TabPage tpProduto, tpIcms, tpPisCofins, tpFcp;
|
||||||
|
|
||||||
|
public NotasConsumidorItensPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Itens da NFC-e (Venda ao Consumidor)";
|
||||||
|
this.Size = new Size(900, 650);
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
tabFiscal = new TabControl { Dock = DockStyle.Fill, Font = new Font("Segoe UI", 9) };
|
||||||
|
|
||||||
|
tpProduto = new TabPage("1. Produto/Valores");
|
||||||
|
tpIcms = new TabPage("2. ICMS/ST");
|
||||||
|
tpPisCofins = new TabPage("3. PIS/COFINS");
|
||||||
|
tpFcp = new TabPage("4. FCP/Efetivo");
|
||||||
|
|
||||||
|
tabFiscal.TabPages.AddRange(new[] { tpProduto, tpIcms, tpPisCofins, tpFcp });
|
||||||
|
content.Controls.Add(tabFiscal);
|
||||||
|
|
||||||
|
ConfigurarAbaProduto();
|
||||||
|
ConfigurarAbaIcms();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaProduto()
|
||||||
|
{
|
||||||
|
AddInput(tpProduto, "DESCRIÇÃO DO ITEM", 20, 20, 500, 30).Name = "ITEM_XPROD";
|
||||||
|
AddInput(tpProduto, "CÓD. INTERNO", 20, 80, 150, 30);
|
||||||
|
AddInput(tpProduto, "NCM", 180, 80, 120, 30);
|
||||||
|
AddInput(tpProduto, "CFOP", 310, 80, 80, 30);
|
||||||
|
|
||||||
|
AddInput(tpProduto, "QUANTIDADE", 20, 140, 120, 30).ForeColor = Color.Blue;
|
||||||
|
AddInput(tpProduto, "VLR UNITÁRIO", 150, 140, 120, 30);
|
||||||
|
AddInput(tpProduto, "DESCONTO (-)", 280, 140, 120, 30).ForeColor = Color.Red;
|
||||||
|
AddInput(tpProduto, "TOTAL ITEM", 410, 140, 150, 30).Font = new Font("Segoe UI", 10, FontStyle.Bold);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaIcms()
|
||||||
|
{
|
||||||
|
AddInput(tpIcms, "CST/CSOSN", 20, 20, 100, 30);
|
||||||
|
AddInput(tpIcms, "ORIGEM", 130, 20, 60, 30);
|
||||||
|
|
||||||
|
AddInput(tpIcms, "BASE CÁLC. ICMS", 20, 80, 150, 30);
|
||||||
|
AddInput(tpIcms, "ALÍQUOTA %", 180, 80, 100, 30);
|
||||||
|
AddInput(tpIcms, "VALOR ICMS", 290, 80, 150, 30);
|
||||||
|
|
||||||
|
AddInput(tpIcms, "MVA ST %", 20, 140, 100, 30);
|
||||||
|
AddInput(tpIcms, "BASE ICMS ST", 130, 140, 150, 30);
|
||||||
|
AddInput(tpIcms, "VALOR ICMS ST", 290, 140, 150, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- IMPLEMENTAÇÃO DOS MÉTODOS OBRIGATÓRIOS ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_item = new ModeloNotasConsumidorItens();
|
||||||
|
LimparInterfaceRecursiva(tabFiscal);
|
||||||
|
tabFiscal.SelectedTab = tpProduto;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(_item.ITEM_XPROD) && string.IsNullOrWhiteSpace(tabFiscal.TabPages[0].Controls[0].Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("A descrição do produto é obrigatória.", "Validação LevelOS");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Lógica para persistir _item no banco...
|
||||||
|
MessageBox.Show("Dados fiscais do item salvos com sucesso.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (_item.ID_NOTAS_CONSU_ITENS == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Localize um item antes de alterar.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MessageBox.Show("Registro atualizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Remover este item e seus tributos?", "Confirmar", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
OnNovo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
// Chamada para grid de busca de itens da nota
|
||||||
|
MessageBox.Show("Localizando itens da NFC-e...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LimparInterfaceRecursiva(Control content)
|
||||||
|
{
|
||||||
|
foreach (Control c in content.Controls)
|
||||||
|
{
|
||||||
|
if (c is LV_TEXTBOX1 t) t.Text = "";
|
||||||
|
if (c.HasChildren) LimparInterfaceRecursiva(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
118
UI/Dashboards/Cadastros/NotasConsumidorPanel.cs
Normal file
118
UI/Dashboards/Cadastros/NotasConsumidorPanel.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 NotasConsumidorPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasFiscaisConsumidor _nfce = new ModeloNotasFiscaisConsumidor();
|
||||||
|
|
||||||
|
// Controles de destaque para o PDV
|
||||||
|
private LV_TEXTBOX1 txtTotalNF, txtStatus, txtChave, txtCpfDest;
|
||||||
|
|
||||||
|
public NotasConsumidorPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Emissão de Cupom Fiscal (NFC-e)";
|
||||||
|
this.Size = new Size(900, 600);
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- Cabeçalho de Venda ---
|
||||||
|
AddInput(content, "ID", 20, 30, 60, 30, true);
|
||||||
|
AddInput(content, "SÉRIE", 90, 30, 60, 30).Text = "1";
|
||||||
|
AddInput(content, "NATUREZA", 160, 30, 250, 30).Text = "VENDA CONSUMIDOR";
|
||||||
|
|
||||||
|
txtStatus = AddInput(content, "SITUAÇÃO", 420, 30, 150, 30, true);
|
||||||
|
txtStatus.BackColor = Color.Gold;
|
||||||
|
|
||||||
|
// --- Dados do Consumidor (Muitas vezes em branco para "Consumidor não identificado") ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DO CONSUMIDOR", 80));
|
||||||
|
txtCpfDest = AddInput(content, "CPF / CNPJ", 20, 110, 180, 30);
|
||||||
|
AddInput(content, "NOME (OPCIONAL)", 210, 110, 350, 30);
|
||||||
|
|
||||||
|
// --- Totais (O que importa no balcão) ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("TOTAIS DO CUPOM", 160));
|
||||||
|
|
||||||
|
var vProd = AddInput(content, "VALOR PRODUTOS", 20, 190, 150, 30);
|
||||||
|
var vDesc = AddInput(content, "DESCONTO", 180, 190, 100, 30);
|
||||||
|
|
||||||
|
txtTotalNF = AddInput(content, "TOTAL A PAGAR", 290, 190, 200, 40);
|
||||||
|
txtTotalNF.Font = new Font("Segoe UI", 14, FontStyle.Bold);
|
||||||
|
txtTotalNF.ForeColor = Color.DarkGreen;
|
||||||
|
|
||||||
|
// --- Dados Fiscais / SEFAZ ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("COMUNICAÇÃO SEFAZ", 260));
|
||||||
|
txtChave = AddInput(content, "CHAVE DE ACESSO", 20, 290, 500, 30, true);
|
||||||
|
AddInput(content, "PROTOCOLO", 20, 340, 250, 30, true);
|
||||||
|
|
||||||
|
content.Height = 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- MÉTODOS OBRIGATÓRIOS ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_nfce = new ModeloNotasFiscaisConsumidor();
|
||||||
|
LimparFormulario();
|
||||||
|
txtStatus.Text = "PENDENTE";
|
||||||
|
txtCpfDest.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
// Lógica: Em NFC-e, "Salvar" geralmente significa "Transmitir"
|
||||||
|
if (string.IsNullOrWhiteSpace(txtTotalNF.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Não é possível emitir cupom sem valor total.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("Transmitindo para a SEFAZ... Aguardando Protocolo.", "LevelOS PDV");
|
||||||
|
|
||||||
|
// Simulação de retorno com sucesso
|
||||||
|
txtStatus.Text = "AUTORIZADA";
|
||||||
|
txtStatus.BackColor = Color.LightGreen;
|
||||||
|
_nfce.SITUACAO = "AUTORIZADA";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
MessageBox.Show("Cupom fiscal não permite alteração após emitido. Use o Cancelamento.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Deseja CANCELAR este cupom fiscal?", "Fiscal", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
_nfce.SITUACAO = "CANCELADA";
|
||||||
|
txtStatus.Text = "CANCELADA";
|
||||||
|
txtStatus.BackColor = Color.Salmon;
|
||||||
|
MessageBox.Show("Cupom cancelado com sucesso.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
MessageBox.Show("Pesquisando cupons emitidos por data ou terminal...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LimparFormulario()
|
||||||
|
{
|
||||||
|
foreach (Control c in content.Controls)
|
||||||
|
{
|
||||||
|
if (c is LV_TEXTBOX1 t) t.Text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
122
UI/Dashboards/Cadastros/NotasContadorPanel.cs
Normal file
122
UI/Dashboards/Cadastros/NotasContadorPanel.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 NotasContadorPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasContador _contador = new ModeloNotasContador();
|
||||||
|
|
||||||
|
// Controles de UI
|
||||||
|
private LV_TEXTBOX1 txtId, txtCnpjCpf, txtNome, txtEmail, txtTelefone, txtContadorId;
|
||||||
|
|
||||||
|
public NotasContadorPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Cadastro de Contador Responsável";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- Identificação ---
|
||||||
|
txtId = AddInput(content, "ID", 20, 30, 60, 30, true);
|
||||||
|
txtContadorId = AddInput(content, "CÓD. CONTADOR (CRC)", 90, 30, 150, 30);
|
||||||
|
|
||||||
|
// --- Dados Principais ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("DADOS PROFISSIONAIS", 85));
|
||||||
|
|
||||||
|
txtCnpjCpf = AddInput(content, "CNPJ / CPF", 20, 115, 200, 30);
|
||||||
|
txtNome = AddInput(content, "NOME DO CONTADOR / ESCRITÓRIO", 230, 115, 410, 30);
|
||||||
|
|
||||||
|
// --- Contato ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("CONTATO E COMUNICAÇÃO", 180));
|
||||||
|
|
||||||
|
txtEmail = AddInput(content, "E-MAIL (PARA ENVIO DE XMLS)", 20, 210, 350, 30);
|
||||||
|
txtTelefone = AddInput(content, "TELEFONE", 380, 210, 200, 30);
|
||||||
|
|
||||||
|
content.Height = 280;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreencherModel()
|
||||||
|
{
|
||||||
|
_contador.CNPJ_CPF = txtCnpjCpf.Text;
|
||||||
|
_contador.NOME = txtNome.Text;
|
||||||
|
_contador.EMAIL = txtEmail.Text;
|
||||||
|
_contador.TELEFONE = txtTelefone.Text;
|
||||||
|
_contador.CONTADOR_ID = txtContadorId.Text;
|
||||||
|
_contador.DATA_CADASTRO = DateTime.Now.ToString("dd/MM/yyyy HH:mm");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MapModelParaTela(ModeloNotasContador model)
|
||||||
|
{
|
||||||
|
txtId.Text = model.ID_NOTAS_CONTADOR.ToString();
|
||||||
|
txtCnpjCpf.Text = model.CNPJ_CPF;
|
||||||
|
txtNome.Text = model.NOME;
|
||||||
|
txtEmail.Text = model.EMAIL;
|
||||||
|
txtTelefone.Text = model.TELEFONE;
|
||||||
|
txtContadorId.Text = model.CONTADOR_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- IMPLEMENTAÇÃO OBRIGATÓRIA DOS MÉTODOS ABSTRATOS ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_contador = new ModeloNotasContador();
|
||||||
|
txtId.Text = "0";
|
||||||
|
txtCnpjCpf.Text = "";
|
||||||
|
txtNome.Text = "";
|
||||||
|
txtEmail.Text = "";
|
||||||
|
txtTelefone.Text = "";
|
||||||
|
txtContadorId.Text = "";
|
||||||
|
txtCnpjCpf.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(txtNome.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("O nome do contador é obrigatório para fins fiscais.", "LevelOS Cloud");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PreencherModel();
|
||||||
|
// Lógica de Salvamento no Banco (DAO/BLL)
|
||||||
|
MessageBox.Show("Dados do contador salvos! O envio automático de XML agora está ativo.", "Sucesso");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (txtId.Text == "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("Selecione um contador para alterar.", "Aviso");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PreencherModel();
|
||||||
|
MessageBox.Show("Cadastro de contador atualizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Deseja remover este contador do sistema?", "Confirmar Exclusão", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
OnNovo();
|
||||||
|
MessageBox.Show("Contador removido.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
// Chamada para a tela de busca ou consulta no banco
|
||||||
|
MessageBox.Show("Pesquisando contadores cadastrados...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
135
UI/Dashboards/Cadastros/NotasDeServicosPanel.cs
Normal file
135
UI/Dashboards/Cadastros/NotasDeServicosPanel.cs
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasDeServicosPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasDeServicos _servico = new ModeloNotasDeServicos();
|
||||||
|
private TabControl tabNfse;
|
||||||
|
private TabPage tpGeral, tpTomador, tpValores, tpFiscal;
|
||||||
|
|
||||||
|
public NotasDeServicosPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Emissão de Nota Fiscal de Serviço (NFS-e / RPS)";
|
||||||
|
this.Size = new Size(950, 700);
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
tabNfse = new TabControl { Dock = DockStyle.Fill, Font = new Font("Segoe UI", 9) };
|
||||||
|
|
||||||
|
tpGeral = new TabPage("1. Identificação/RPS");
|
||||||
|
tpTomador = new TabPage("2. Tomador (Cliente)");
|
||||||
|
tpValores = new TabPage("3. Valores e Retenções");
|
||||||
|
tpFiscal = new TabPage("4. Códigos Fiscais/Obra");
|
||||||
|
|
||||||
|
tabNfse.TabPages.AddRange(new[] { tpGeral, tpTomador, tpValores, tpFiscal });
|
||||||
|
content.Controls.Add(tabNfse);
|
||||||
|
|
||||||
|
ConfigurarAbaGeral();
|
||||||
|
ConfigurarAbaTomador();
|
||||||
|
ConfigurarAbaValores();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaGeral()
|
||||||
|
{
|
||||||
|
AddInput(tpGeral, "ID SISTEMA", 20, 20, 80, 30, true);
|
||||||
|
AddInput(tpGeral, "NÚMERO RPS", 110, 20, 150, 30).Name = "IDE_RPS";
|
||||||
|
AddInput(tpGeral, "SÉRIE", 270, 20, 80, 30);
|
||||||
|
AddInput(tpGeral, "DATA EMISSÃO", 360, 20, 150, 30);
|
||||||
|
|
||||||
|
var txtDisc = AddInput(tpGeral, "DISCRIMINAÇÃO DOS SERVIÇOS", 20, 80, 500, 100);
|
||||||
|
txtDisc.Multiline = true;
|
||||||
|
txtDisc.Height = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaTomador()
|
||||||
|
{
|
||||||
|
AddInput(tpTomador, "CNPJ / CPF", 20, 20, 200, 30);
|
||||||
|
AddInput(tpTomador, "RAZÃO SOCIAL", 230, 20, 400, 30);
|
||||||
|
AddInput(tpTomador, "E-MAIL", 20, 80, 300, 30);
|
||||||
|
AddInput(tpTomador, "ENDEREÇO", 20, 140, 400, 30);
|
||||||
|
AddInput(tpTomador, "CIDADE (CÓD. MUNICIPIO)", 430, 140, 200, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaValores()
|
||||||
|
{
|
||||||
|
AddInput(tpValores, "VALOR TOTAL SERVIÇOS", 20, 20, 180, 30).ForeColor = Color.Blue;
|
||||||
|
AddInput(tpValores, "BASE DE CÁLCULO", 210, 20, 180, 30);
|
||||||
|
AddInput(tpValores, "ALÍQUOTA (%)", 400, 20, 100, 30);
|
||||||
|
|
||||||
|
// Seção de Retenções
|
||||||
|
content.Controls.Add(CreateSectionHeader("RETENÇÕES FEDERAIS", 80));
|
||||||
|
AddInput(tpValores, "PIS", 20, 110, 120, 30);
|
||||||
|
AddInput(tpValores, "COFINS", 150, 110, 120, 30);
|
||||||
|
AddInput(tpValores, "INSS", 280, 110, 120, 30);
|
||||||
|
AddInput(tpValores, "IR", 410, 110, 120, 30);
|
||||||
|
AddInput(tpValores, "CSLL", 540, 110, 120, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- IMPLEMENTAÇÃO DOS MÉTODOS OBRIGATÓRIOS DA CLASSE ABSTRATA ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_servico = new ModeloNotasDeServicos();
|
||||||
|
LimparCamposRecursivo(tabNfse);
|
||||||
|
tabNfse.SelectedTab = tpGeral;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
// Lógica para capturar dados da tela e validar
|
||||||
|
if (string.IsNullOrWhiteSpace(_servico.IDE_RPS))
|
||||||
|
{
|
||||||
|
// Simulação de preenchimento
|
||||||
|
_servico.IDE_RPS = "Auto-Gerado";
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("NFS-e enviada para processamento na Prefeitura!", "LevelOS Fiscal");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (_servico.ID_NOTAS_SERVICOS == 0)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Selecione uma nota emitida para retificar ou alterar.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MessageBox.Show("Dados do RPS atualizados localmente.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Deseja cancelar esta NFS-e? (Isso enviará um evento de cancelamento)", "Confirmar", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Solicitação de cancelamento enviada.");
|
||||||
|
OnNovo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
MessageBox.Show("Pesquisando Notas de Serviço no banco de dados...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LimparCamposRecursivo(Control container)
|
||||||
|
{
|
||||||
|
foreach (Control c in container.Controls)
|
||||||
|
{
|
||||||
|
if (c is LV_TEXTBOX1 t) t.Text = "";
|
||||||
|
if (c.HasChildren) LimparCamposRecursivo(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
135
UI/Dashboards/Cadastros/NotasEnderecosPanel.cs
Normal file
135
UI/Dashboards/Cadastros/NotasEnderecosPanel.cs
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasEnderecosPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasEnderecos _endereco = new ModeloNotasEnderecos();
|
||||||
|
|
||||||
|
// Controles de UI
|
||||||
|
private LV_TEXTBOX1 txtId, txtCodNota, txtCnpj, txtLogradouro, txtNumero, txtBairro, txtCep, txtCidade, txtUf, txtIe;
|
||||||
|
private ComboBox cbTipoEndereco;
|
||||||
|
|
||||||
|
public NotasEnderecosPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Gestão de Endereços da Nota Fiscal";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- Vínculo e Tipo ---
|
||||||
|
txtId = AddInput(content, "ID", 20, 30, 60, 30, true);
|
||||||
|
txtCodNota = AddInput(content, "CÓD. DA NOTA", 90, 30, 150, 30);
|
||||||
|
|
||||||
|
content.Controls.Add(new Label { Text = "TIPO DE ENDEREÇO:", Location = new Point(260, 10), AutoSize = true });
|
||||||
|
cbTipoEndereco = new ComboBox
|
||||||
|
{
|
||||||
|
Location = new Point(260, 30),
|
||||||
|
Size = new Size(200, 30),
|
||||||
|
DropDownStyle = ComboBoxStyle.DropDownList
|
||||||
|
};
|
||||||
|
cbTipoEndereco.Items.AddRange(new object[] { "EMITENTE", "DESTINATÁRIO", "ENTREGA", "RETIRADA" });
|
||||||
|
content.Controls.Add(cbTipoEndereco);
|
||||||
|
|
||||||
|
// --- Dados de Identificação ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO", 75));
|
||||||
|
txtCnpj = AddInput(content, "CNPJ / CPF", 20, 105, 200, 30);
|
||||||
|
txtIe = AddInput(content, "INSCRIÇÃO ESTADUAL", 230, 105, 200, 30);
|
||||||
|
|
||||||
|
// --- Localização ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("LOCALIZAÇÃO", 160));
|
||||||
|
txtCep = AddInput(content, "CEP", 20, 190, 120, 30);
|
||||||
|
txtLogradouro = AddInput(content, "LOGRADOURO (RUA, AV...)", 150, 190, 350, 30);
|
||||||
|
txtNumero = AddInput(content, "Nº", 510, 190, 80, 30);
|
||||||
|
|
||||||
|
txtBairro = AddInput(content, "BAIRRO", 20, 250, 200, 30);
|
||||||
|
txtCidade = AddInput(content, "MUNICÍPIO", 230, 250, 250, 30);
|
||||||
|
txtUf = AddInput(content, "UF", 490, 250, 60, 30);
|
||||||
|
|
||||||
|
content.Height = 330;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreencherModel()
|
||||||
|
{
|
||||||
|
_endereco.COD_NOTA = txtCodNota.Text;
|
||||||
|
_endereco.CNPJ_CPF = txtCnpj.Text;
|
||||||
|
_endereco.IE = txtIe.Text;
|
||||||
|
_endereco.CEP = txtCep.Text;
|
||||||
|
_endereco.XLgr = txtLogradouro.Text;
|
||||||
|
_endereco.Nro = txtNumero.Text;
|
||||||
|
_endereco.XBairro = txtBairro.Text;
|
||||||
|
_endereco.XMun = txtCidade.Text;
|
||||||
|
_endereco.UF = txtUf.Text;
|
||||||
|
_endereco.TIPO = cbTipoEndereco.Text;
|
||||||
|
_endereco.DATA_CADASTRO = DateTime.Now.ToString("dd/MM/yyyy HH:mm");
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- MÉTODOS OBRIGATÓRIOS DA CLASSE FormularioModelo ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_endereco = new ModeloNotasEnderecos();
|
||||||
|
txtId.Text = "0";
|
||||||
|
txtCodNota.Text = "";
|
||||||
|
txtCnpj.Text = "";
|
||||||
|
txtIe.Text = "";
|
||||||
|
txtCep.Text = "";
|
||||||
|
txtLogradouro.Text = "";
|
||||||
|
txtNumero.Text = "";
|
||||||
|
txtBairro.Text = "";
|
||||||
|
txtCidade.Text = "";
|
||||||
|
txtUf.Text = "";
|
||||||
|
cbTipoEndereco.SelectedIndex = -1;
|
||||||
|
txtCodNota.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(txtLogradouro.Text) || cbTipoEndereco.SelectedIndex == -1)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Preencha o tipo de endereço e o logradouro.", "Aviso LevelOS");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PreencherModel();
|
||||||
|
// Aqui você chamaria o seu controlador de banco de dados
|
||||||
|
MessageBox.Show($"Endereço de {cbTipoEndereco.Text} salvo com sucesso!");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (txtId.Text == "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("Selecione um endereço para alterar.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PreencherModel();
|
||||||
|
MessageBox.Show("Alterações gravadas.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Remover este endereço da nota?", "Confirmação", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
OnNovo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
// Simulação de busca na tabela de endereços
|
||||||
|
MessageBox.Show("Abrindo lista de endereços da nota...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
//this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
UI/Dashboards/Cadastros/NotasFaturasPanel.cs
Normal file
120
UI/Dashboards/Cadastros/NotasFaturasPanel.cs
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasFaturasPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasFaturas _fatura = new ModeloNotasFaturas();
|
||||||
|
|
||||||
|
// Controles de UI
|
||||||
|
private LV_TEXTBOX1 txtId, txtCodNota, txtNumero, txtVencimento, txtValor, txtIndice;
|
||||||
|
|
||||||
|
public NotasFaturasPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Duplicatas / Faturas da Nota Fiscal";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- Cabeçalho e Vínculo ---
|
||||||
|
txtId = AddInput(content, "ID", 20, 30, 60, 30, true);
|
||||||
|
txtCodNota = AddInput(content, "ID DA NOTA", 90, 30, 150, 30);
|
||||||
|
txtIndice = AddInput(content, "ÍNDICE/SEQ", 250, 30, 100, 30);
|
||||||
|
|
||||||
|
// --- Dados da Fatura ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("DADOS DA DUPLICATA", 85));
|
||||||
|
|
||||||
|
txtNumero = AddInput(content, "NÚMERO DO TÍTULO", 20, 115, 200, 30);
|
||||||
|
txtVencimento = AddInput(content, "VENCIMENTO (DD/MM/AAAA)", 230, 115, 180, 30);
|
||||||
|
|
||||||
|
txtValor = AddInput(content, "VALOR DA PARCELA (R$)", 420, 115, 150, 30);
|
||||||
|
txtValor.ForeColor = Color.DarkBlue;
|
||||||
|
txtValor.Font = new Font("Segoe UI", 10, FontStyle.Bold);
|
||||||
|
|
||||||
|
content.Height = 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PreencherModel()
|
||||||
|
{
|
||||||
|
_fatura.COD_NOTA = txtCodNota.Text;
|
||||||
|
_fatura.INDICE = txtIndice.Text;
|
||||||
|
_fatura.NUMERO = txtNumero.Text;
|
||||||
|
_fatura.VENCTO = txtVencimento.Text;
|
||||||
|
_fatura.VALOR = txtValor.Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MapModelParaTela(ModeloNotasFaturas model)
|
||||||
|
{
|
||||||
|
txtId.Text = model.ID_NOTAS_FATURAS.ToString();
|
||||||
|
txtCodNota.Text = model.COD_NOTA;
|
||||||
|
txtIndice.Text = model.INDICE;
|
||||||
|
txtNumero.Text = model.NUMERO;
|
||||||
|
txtVencimento.Text = model.VENCTO;
|
||||||
|
txtValor.Text = model.VALOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- IMPLEMENTAÇÃO DOS MÉTODOS ABSTRATOS (O que estava faltando) ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_fatura = new ModeloNotasFaturas();
|
||||||
|
txtId.Text = "0";
|
||||||
|
txtCodNota.Text = "";
|
||||||
|
txtIndice.Text = "";
|
||||||
|
txtNumero.Text = "";
|
||||||
|
txtVencimento.Text = "";
|
||||||
|
txtValor.Text = "";
|
||||||
|
txtCodNota.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(txtValor.Text) || string.IsNullOrWhiteSpace(txtVencimento.Text))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Valor e Vencimento são obrigatórios para gerar o financeiro.", "LevelOS Financeiro");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PreencherModel();
|
||||||
|
// Lógica de banco de dados (Ex: BLL.Salvar(_fatura))
|
||||||
|
MessageBox.Show($"Fatura nº {txtNumero.Text} registrada no contas a receber!", "Sucesso");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (txtId.Text == "0")
|
||||||
|
{
|
||||||
|
MessageBox.Show("Selecione uma fatura para realizar a alteração.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PreencherModel();
|
||||||
|
MessageBox.Show("Dados da duplicata atualizados.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Deseja realmente excluir esta parcela? Isso afetará o financeiro da nota.", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
OnNovo();
|
||||||
|
MessageBox.Show("Parcela removida.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
// Chamada para a Grid de Faturas/Duplicatas
|
||||||
|
MessageBox.Show("Buscando duplicatas cadastradas...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
136
UI/Dashboards/Cadastros/NotasFiscaisPanel.cs
Normal file
136
UI/Dashboards/Cadastros/NotasFiscaisPanel.cs
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasFiscaisPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasFiscais _nfe = new ModeloNotasFiscais();
|
||||||
|
private TabControl tabNfe;
|
||||||
|
private TabPage tpGeral, tpDestinatario, tpTotais, tpTransporte, tpSefaz;
|
||||||
|
|
||||||
|
public NotasFiscaisPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Emissão de Nota Fiscal Eletrônica (NF-e)";
|
||||||
|
this.Size = new Size(1000, 750);
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
tabNfe = new TabControl { Dock = DockStyle.Fill, Font = new Font("Segoe UI", 9) };
|
||||||
|
|
||||||
|
tpGeral = new TabPage("1. Dados Gerais");
|
||||||
|
tpDestinatario = new TabPage("2. Destinatário");
|
||||||
|
tpTotais = new TabPage("3. Totais e Impostos");
|
||||||
|
tpTransporte = new TabPage("4. Transporte");
|
||||||
|
tpSefaz = new TabPage("5. Histórico SEFAZ");
|
||||||
|
|
||||||
|
tabNfe.TabPages.AddRange(new[] { tpGeral, tpDestinatario, tpTotais, tpTransporte, tpSefaz });
|
||||||
|
content.Controls.Add(tabNfe);
|
||||||
|
|
||||||
|
ConfigurarAbaGeral();
|
||||||
|
ConfigurarAbaDestinatario();
|
||||||
|
ConfigurarAbaTotais();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaGeral()
|
||||||
|
{
|
||||||
|
AddInput(tpGeral, "ID SISTEMA", 20, 20, 80, 30, true);
|
||||||
|
AddInput(tpGeral, "SÉRIE", 110, 20, 60, 30);
|
||||||
|
AddInput(tpGeral, "NATUREZA OPERAÇÃO", 180, 20, 350, 30);
|
||||||
|
AddInput(tpGeral, "CFOP", 540, 20, 100, 30);
|
||||||
|
|
||||||
|
var txtObs = AddInput(tpGeral, "OBSERVAÇÕES", 20, 80, 620, 100);
|
||||||
|
txtObs.Multiline = true;
|
||||||
|
txtObs.Height = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaDestinatario()
|
||||||
|
{
|
||||||
|
AddInput(tpDestinatario, "NOME / RAZÃO SOCIAL", 20, 20, 400, 30);
|
||||||
|
AddInput(tpDestinatario, "CNPJ / CPF", 430, 20, 210, 30);
|
||||||
|
AddInput(tpDestinatario, "INSCRIÇÃO ESTADUAL", 20, 80, 200, 30);
|
||||||
|
AddInput(tpDestinatario, "LOGRADOURO", 20, 140, 400, 30);
|
||||||
|
AddInput(tpDestinatario, "CIDADE", 430, 140, 210, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaTotais()
|
||||||
|
{
|
||||||
|
// Totais destacados
|
||||||
|
var tProd = AddInput(tpTotais, "TOTAL PRODUTOS", 20, 20, 150, 30);
|
||||||
|
tProd.BackColor = Color.LightYellow;
|
||||||
|
|
||||||
|
var tNota = AddInput(tpTotais, "TOTAL DA NOTA", 180, 20, 150, 30);
|
||||||
|
tNota.BackColor = Color.LightGreen;
|
||||||
|
tNota.Font = new Font("Segoe UI", 10, FontStyle.Bold);
|
||||||
|
|
||||||
|
content.Controls.Add(CreateSectionHeader("DETALHAMENTO DE IMPOSTOS", 80));
|
||||||
|
AddInput(tpTotais, "BASE ICMS", 20, 110, 120, 30);
|
||||||
|
AddInput(tpTotais, "VALOR ICMS", 150, 110, 120, 30);
|
||||||
|
AddInput(tpTotais, "V. ICMS ST", 280, 110, 120, 30);
|
||||||
|
AddInput(tpTotais, "VALOR IPI", 410, 110, 120, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- MÉTODOS OBRIGATÓRIOS DO FORMULÁRIO MODELO ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_nfe = new ModeloNotasFiscais();
|
||||||
|
LimparCamposRecursivo(tabNfe);
|
||||||
|
tabNfe.SelectedTab = tpGeral;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
// Simulação de validação da Chave de Acesso
|
||||||
|
if (string.IsNullOrEmpty(_nfe.NFE_ID_CHAVE))
|
||||||
|
{
|
||||||
|
MessageBox.Show("A nota será salva como rascunho até a transmissão.", "Aviso LevelOS");
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageBox.Show("NF-e Salva com sucesso no banco de dados.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
if (_nfe.NFE_ENVIADA == "S")
|
||||||
|
{
|
||||||
|
MessageBox.Show("Notas já autorizadas pela SEFAZ não podem ser alteradas. Tente uma Carta de Correção.", "Bloqueio Fiscal");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MessageBox.Show("Rascunho da nota atualizado.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Deseja cancelar esta nota fiscal?", "SEFAZ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Evento de cancelamento enviado para processamento.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
MessageBox.Show("Abrindo monitor de NF-e...");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LimparCamposRecursivo(Control container)
|
||||||
|
{
|
||||||
|
foreach (Control c in container.Controls)
|
||||||
|
{
|
||||||
|
if (c is LV_TEXTBOX1 t) t.Text = "";
|
||||||
|
if (c.HasChildren) LimparCamposRecursivo(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
104
UI/Dashboards/Cadastros/NotasFormasPanel.cs
Normal file
104
UI/Dashboards/Cadastros/NotasFormasPanel.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasFormasPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasFormas _formaPgto = new ModeloNotasFormas();
|
||||||
|
|
||||||
|
public NotasFormasPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Detalhamento de Pagamento / Duplicatas";
|
||||||
|
this.Size = new Size(700, 500);
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// Vinculação com a Nota Principal
|
||||||
|
AddInput(content, "ID PAGTO", 20, 20, 80, 30, true);
|
||||||
|
AddInput(content, "CÓD. NF-e", 110, 20, 100, 30, true);
|
||||||
|
|
||||||
|
// Dados da Parcela/Duplicata
|
||||||
|
content.Controls.Add(CreateSectionHeader("DADOS DA PARCELA", 70));
|
||||||
|
AddInput(content, "Nº DUPLICATA (NDUP)", 20, 100, 150, 30);
|
||||||
|
AddInput(content, "VENCIMENTO", 180, 100, 150, 30);
|
||||||
|
var txtValor = AddInput(content, "VALOR PARCELA", 340, 100, 150, 30);
|
||||||
|
txtValor.ForeColor = Color.Blue;
|
||||||
|
|
||||||
|
// Forma de Pagamento (Dinheiro, Cartão, Boleto, PIX)
|
||||||
|
content.Controls.Add(CreateSectionHeader("MEIO DE PAGAMENTO (SEFAZ)", 160));
|
||||||
|
var comboForma = new ComboBox
|
||||||
|
{
|
||||||
|
Location = new Point(20, 190),
|
||||||
|
Size = new Size(250, 30),
|
||||||
|
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||||
|
Font = new Font("Segoe UI", 10)
|
||||||
|
};
|
||||||
|
comboForma.Items.AddRange(new object[] { "01 - Dinheiro", "03 - Cartão de Crédito", "04 - Cartão de Débito", "15 - Boleto Bancário", "17 - PIX" });
|
||||||
|
content.Controls.Add(comboForma);
|
||||||
|
|
||||||
|
// Dados específicos para Cartão (Exigência NT 2023.004)
|
||||||
|
content.Controls.Add(CreateSectionHeader("INTEGRAÇÃO TEF / CARTÃO", 240));
|
||||||
|
AddInput(content, "CNPJ OPERADORA", 20, 270, 250, 30);
|
||||||
|
|
||||||
|
var txtBand = AddInput(content, "BANDEIRA (TBAND)", 280, 270, 150, 30);
|
||||||
|
Label lblDica = new Label
|
||||||
|
{
|
||||||
|
Text = "Ex: 01-Visa, 02-Mastercard, 99-Outros",
|
||||||
|
Location = new Point(280, 305),
|
||||||
|
AutoSize = true,
|
||||||
|
Font = new Font("Segoe UI", 7, FontStyle.Italic)
|
||||||
|
};
|
||||||
|
content.Controls.Add(lblDica);
|
||||||
|
|
||||||
|
content.Height = 350;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
_formaPgto = new ModeloNotasFormas();
|
||||||
|
LimparCamposRecursivo(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
// Validação Crucial: Se for cartão, CNPJ da operadora é obrigatório
|
||||||
|
MessageBox.Show("Forma de pagamento vinculada à nota com sucesso!", "LevelOS Financeiro");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar()
|
||||||
|
{
|
||||||
|
MessageBox.Show("Parcela alterada.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnExcluir()
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Remover esta forma de pagamento?", "Aviso", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Pagamento removido.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnLocalizar()
|
||||||
|
{
|
||||||
|
// Geralmente usado para buscar duplicatas de uma nota específica
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnCancelar() { }
|
||||||
|
|
||||||
|
private void LimparCamposRecursivo(Control container)
|
||||||
|
{
|
||||||
|
foreach (Control c in container.Controls)
|
||||||
|
{
|
||||||
|
if (c is LV_TEXTBOX1 t) t.Text = "";
|
||||||
|
if (c.HasChildren) LimparCamposRecursivo(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
98
UI/Dashboards/Cadastros/NotasItensDetalhaPanel.cs
Normal file
98
UI/Dashboards/Cadastros/NotasItensDetalhaPanel.cs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using MLL;
|
||||||
|
using UI;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public partial class NotasItensDetalhaPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private ModeloNotasItensDetalha _detalhe = new ModeloNotasItensDetalha();
|
||||||
|
private Panel pnlVeiculo, pnlMedicamento, pnlArma;
|
||||||
|
|
||||||
|
public NotasItensDetalhaPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "Detalhamento Específico do Item";
|
||||||
|
this.Size = new Size(800, 550);
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// Seleção de Tipo (Define qual painel mostrar)
|
||||||
|
Label lblTipo = new Label { Text = "Tipo de Detalhamento:", Location = new Point(20, 25), AutoSize = true };
|
||||||
|
ComboBox cbTipo = new ComboBox
|
||||||
|
{
|
||||||
|
Location = new Point(150, 20),
|
||||||
|
Size = new Size(200, 30),
|
||||||
|
DropDownStyle = ComboBoxStyle.DropDownList
|
||||||
|
};
|
||||||
|
cbTipo.Items.AddRange(new string[] { "NENHUM", "VEÍCULO", "MEDICAMENTO", "ARMAMENTO" });
|
||||||
|
cbTipo.SelectedIndexChanged += (s, e) => AlternarPaineis(cbTipo.Text);
|
||||||
|
|
||||||
|
content.Controls.Add(lblTipo);
|
||||||
|
content.Controls.Add(cbTipo);
|
||||||
|
|
||||||
|
CriarPainelVeiculo();
|
||||||
|
CriarPainelMedicamento();
|
||||||
|
CriarPainelArmamento();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CriarPainelVeiculo()
|
||||||
|
{
|
||||||
|
pnlVeiculo = new Panel { Location = new Point(10, 60), Size = new Size(760, 400), Visible = false };
|
||||||
|
AddInput(pnlVeiculo, "CHASSI", 10, 10, 250, 30);
|
||||||
|
AddInput(pnlVeiculo, "ANO FAB.", 270, 10, 100, 30);
|
||||||
|
AddInput(pnlVeiculo, "ANO MOD.", 380, 10, 100, 30);
|
||||||
|
AddInput(pnlVeiculo, "POTÊNCIA", 10, 60, 100, 30);
|
||||||
|
AddInput(pnlVeiculo, "CILINDRADAS", 120, 60, 120, 30);
|
||||||
|
AddInput(pnlVeiculo, "COR (DENATRAN)", 250, 60, 200, 30);
|
||||||
|
content.Controls.Add(pnlVeiculo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CriarPainelMedicamento()
|
||||||
|
{
|
||||||
|
pnlMedicamento = new Panel { Location = new Point(10, 60), Size = new Size(760, 400), Visible = false };
|
||||||
|
AddInput(pnlMedicamento, "Nº LOTE", 10, 10, 200, 30);
|
||||||
|
AddInput(pnlMedicamento, "QTD LOTE", 220, 10, 100, 30);
|
||||||
|
AddInput(pnlMedicamento, "FABRICAÇÃO", 10, 60, 150, 30);
|
||||||
|
AddInput(pnlMedicamento, "VALIDADE", 170, 60, 150, 30);
|
||||||
|
AddInput(pnlMedicamento, "PREÇO MÁX. CONS. (VPMC)", 330, 60, 150, 30);
|
||||||
|
content.Controls.Add(pnlMedicamento);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CriarPainelArmamento()
|
||||||
|
{
|
||||||
|
pnlArma = new Panel { Location = new Point(10, 60), Size = new Size(760, 400), Visible = false };
|
||||||
|
AddInput(pnlArma, "TIPO ARMA", 10, 10, 150, 30); // 0=Permitido, 1=Restrito
|
||||||
|
AddInput(pnlArma, "SÉRIE ARMA", 170, 10, 200, 30);
|
||||||
|
AddInput(pnlArma, "Nº CANO", 10, 60, 150, 30);
|
||||||
|
var txtDesc = AddInput(pnlArma, "DESCRIÇÃO", 10, 110, 400, 60);
|
||||||
|
txtDesc.Multiline = true;
|
||||||
|
content.Controls.Add(pnlArma);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AlternarPaineis(string tipo)
|
||||||
|
{
|
||||||
|
pnlVeiculo.Visible = (tipo == "VEÍCULO");
|
||||||
|
pnlMedicamento.Visible = (tipo == "MEDICAMENTO");
|
||||||
|
pnlArma.Visible = (tipo == "ARMAMENTO");
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- MÉTODOS DE AÇÃO ---
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
// Aqui os dados seriam validados conforme o tipo escolhido
|
||||||
|
MessageBox.Show("Detalhamento do item vinculado com sucesso!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNovo() { /* Resetar campos */ }
|
||||||
|
protected override void OnAlterar() { /* Habilitar campos */ }
|
||||||
|
protected override void OnExcluir() { /* Limpar detalhe */ }
|
||||||
|
protected override void OnLocalizar() { /* Buscar histórico */ }
|
||||||
|
protected override void OnCancelar() { }
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user