using CPM; using MLL; using System; using System.Drawing; using System.Windows.Forms; using UI; namespace UI { public partial class NotasRetencoesPanel : FormularioModelo { private ModeloNotasRetencoes _retencao = new ModeloNotasRetencoes(); public NotasRetencoesPanel() { this.Titulo = "Retenções de Tributos Federais (Deduções)"; this.Size = new Size(650, 550); MontarInterface(); } private void MontarInterface() { // IDs de Vinculação AddInput(content, "ID RETENÇÃO", 20, 20, 100, 30, true); AddInput(content, "CÓD. NOTA", 130, 20, 100, 30, true); // Seção de Imposto de Renda (IRRF) content.Controls.Add(CreateSectionHeader("IMPOSTO DE RENDA (IRRF)", 70)); AddInput(content, "BASE DE CÁLCULO IRRF", 20, 100, 180, 30); var txtIrrf = AddInput(content, "VALOR RETIDO IRRF", 210, 100, 180, 30); txtIrrf.ForeColor = Color.Red; // Seção de Previdência (INSS) content.Controls.Add(CreateSectionHeader("RETENÇÃO PREVIDENCIÁRIA (INSS)", 160)); AddInput(content, "BASE RET. PREV.", 20, 190, 180, 30); var txtPrev = AddInput(content, "VALOR RET. PREV.", 210, 190, 180, 30); txtPrev.ForeColor = Color.Red; // Seção de CSRF (PIS/COFINS/CSLL) - Famosos 4,65% content.Controls.Add(CreateSectionHeader("CONTRIBUIÇÕES SOCIAIS (CSRF)", 250)); AddInput(content, "RETENÇÃO PIS", 20, 280, 120, 30); AddInput(content, "RETENÇÃO COFINS", 150, 280, 120, 30); AddInput(content, "RETENÇÃO CSLL", 280, 280, 120, 30); // Informativo de Totalizador Label lblAviso = new Label { Text = "* Estes valores serão subtraídos do valor total bruto para gerar o Valor Líquido da Fatura.", Location = new Point(20, 330), AutoSize = true, Font = new Font("Segoe UI", 8, FontStyle.Italic), ForeColor = Color.DarkSlateBlue }; content.Controls.Add(lblAviso); content.Height = 380; } protected override void OnSalvar() { // Lógica: No LevelOS, salvar aqui deve atualizar o "Valor Líquido" na tela principal da Nota MessageBox.Show("Retenções calculadas e aplicadas ao documento.", "LevelOS Fiscal"); } protected override void OnNovo() => LimparCamposRecursivo(content); protected override void OnCancelar() { } protected override void OnExcluir() { } protected override void OnAlterar() { } protected override void OnLocalizar() { throw new NotImplementedException(); } private void LimparCamposRecursivo(Control container) { foreach (Control c in container.Controls) { if (c is LV_TEXTBOX1 t) t.Text = string.Empty; if (c.HasChildren) LimparCamposRecursivo(c); } } } }