90 lines
3.0 KiB
C#
90 lines
3.0 KiB
C#
using CPM;
|
|
using MLL;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using UI;
|
|
|
|
namespace UI
|
|
{
|
|
public partial class NotasRefNFPPanel : FormularioModelo
|
|
{
|
|
private ModeloNotasRefNFP _refNfp = new ModeloNotasRefNFP();
|
|
|
|
public NotasRefNFPPanel()
|
|
{
|
|
this.Titulo = "Referenciar Nota Fiscal de Produtor Rural";
|
|
this.Size = new Size(750, 500);
|
|
MontarInterface();
|
|
}
|
|
|
|
private void MontarInterface()
|
|
{
|
|
// Vinculação com a Nota Atual
|
|
AddInput(content, "ID REF", 20, 20, 80, 30, true);
|
|
AddInput(content, "CÓD. NOTA PRINCIPAL", 110, 20, 150, 30, true);
|
|
|
|
content.Controls.Add(CreateSectionHeader("LOCALIZAÇÃO E PERÍODO", 70));
|
|
|
|
// UF e Período (AAMM)
|
|
AddInput(content, "UF (CÓDIGO)", 20, 100, 100, 30); // Ex: 35 para SP
|
|
var txtPeriodo = AddInput(content, "MÊS/ANO (AAMM)", 130, 100, 120, 30);
|
|
Label lblDica = new Label
|
|
{
|
|
Text = "Formato: YYMM (Ex: 2605)",
|
|
Location = new Point(130, 135),
|
|
Font = new Font("Segoe UI", 7, FontStyle.Italic),
|
|
AutoSize = true
|
|
};
|
|
content.Controls.Add(lblDica);
|
|
|
|
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DO PRODUTOR", 170));
|
|
|
|
AddInput(content, "CNPJ / CPF", 20, 200, 200, 30);
|
|
AddInput(content, "INSCRIÇÃO ESTADUAL", 230, 200, 200, 30);
|
|
AddInput(content, "NOME DO PRODUTOR", 20, 250, 410, 30);
|
|
|
|
content.Controls.Add(CreateSectionHeader("DADOS DO DOCUMENTO", 300));
|
|
|
|
AddInput(content, "MODELO", 20, 330, 80, 30); // Geralmente 04 ou 55
|
|
AddInput(content, "SÉRIE", 110, 330, 80, 30);
|
|
AddInput(content, "Nº DA NOTA (NNF)", 200, 330, 150, 30);
|
|
|
|
content.Height = 420;
|
|
}
|
|
|
|
// --- MÉTODOS DE AÇÃO ---
|
|
|
|
protected override void OnSalvar()
|
|
{
|
|
// Validação Básica de NFP
|
|
if (string.IsNullOrEmpty(_refNfp.NNF))
|
|
{
|
|
MessageBox.Show("O número da nota referenciada é obrigatório para a SEFAZ.", "Validação LevelOS");
|
|
return;
|
|
}
|
|
|
|
MessageBox.Show("Nota de Produtor Rural referenciada com sucesso!", "Financeiro/Fiscal");
|
|
|
|
}
|
|
|
|
protected override void OnNovo() => LimparCamposRecursivo(content);
|
|
protected override void OnExcluir() { }
|
|
protected override void OnLocalizar() { }
|
|
protected override void OnAlterar()
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
protected override void OnCancelar() { }
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
} |