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(); } } }