104 lines
3.6 KiB
C#
104 lines
3.6 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|
|
} |