123 lines
4.1 KiB
C#
123 lines
4.1 KiB
C#
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();
|
|
}
|
|
}
|
|
} |