117 lines
3.7 KiB
C#
117 lines
3.7 KiB
C#
using CPM;
|
|
using MLL;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using UI;
|
|
|
|
namespace UI
|
|
{
|
|
public partial class NotasComprasFaturasPanel : FormularioModelo
|
|
{
|
|
private ModeloNotasComprasFaturas _fatura = new ModeloNotasComprasFaturas();
|
|
|
|
// Controles
|
|
private LV_TEXTBOX1 txtId, txtNotaId, txtNumeroParcela, txtVencimento, txtValor;
|
|
|
|
public NotasComprasFaturasPanel()
|
|
{
|
|
this.Titulo = "Detalhamento de Parcelas / Fatura de Compra";
|
|
MontarInterface();
|
|
}
|
|
|
|
private void MontarInterface()
|
|
{
|
|
// --- SEÇÃO: Identificação da Origem ---
|
|
content.Controls.Add(CreateSectionHeader("VÍNCULO COM A NOTA FISCAL", 20));
|
|
|
|
txtId = AddInput(content, "ID", 20, 50, 60, 30, true);
|
|
txtNotaId = AddInput(content, "ID DA NOTA (FK)", 90, 50, 150, 30);
|
|
|
|
// --- SEÇÃO: Dados da Parcela ---
|
|
content.Controls.Add(CreateSectionHeader("DADOS DO VENCIMENTO", 115));
|
|
|
|
txtNumeroParcela = AddInput(content, "Nº PARCELA (EX: 001)", 20, 145, 150, 30);
|
|
txtVencimento = AddInput(content, "DATA VENCIMENTO (AAAA-MM-DD)", 185, 145, 200, 30);
|
|
txtValor = AddInput(content, "VALOR DA PARCELA", 400, 145, 160, 30);
|
|
txtValor.ForeColor = Color.DarkRed;
|
|
|
|
content.Height = 220;
|
|
}
|
|
|
|
private void PreencherModel()
|
|
{
|
|
_fatura.NOTA_ID = txtNotaId.Text;
|
|
_fatura.NPARC = txtNumeroParcela.Text;
|
|
_fatura.DVENC = txtVencimento.Text;
|
|
_fatura.VPARC = txtValor.Text;
|
|
}
|
|
|
|
private void MapModelParaTela(ModeloNotasComprasFaturas model)
|
|
{
|
|
txtId.Text = model.ID_NOTAS_COMP_FATURAS.ToString();
|
|
txtNotaId.Text = model.NOTA_ID;
|
|
txtNumeroParcela.Text = model.NPARC;
|
|
txtVencimento.Text = model.DVENC;
|
|
txtValor.Text = model.VPARC;
|
|
}
|
|
|
|
// --- IMPLEMENTAÇÃO DOS MÉTODOS ABSTRATOS (Obrigatórios) ---
|
|
|
|
protected override void OnNovo()
|
|
{
|
|
_fatura = new ModeloNotasComprasFaturas();
|
|
txtId.Text = "0";
|
|
txtNotaId.Text = "";
|
|
txtNumeroParcela.Text = "";
|
|
txtVencimento.Text = "";
|
|
txtValor.Text = "";
|
|
txtNotaId.Focus();
|
|
}
|
|
|
|
protected override void OnSalvar()
|
|
{
|
|
if (string.IsNullOrEmpty(txtValor.Text))
|
|
{
|
|
MessageBox.Show("O valor da parcela é obrigatório.", "Aviso LevelOS");
|
|
return;
|
|
}
|
|
|
|
PreencherModel();
|
|
// Lógica: Aqui o sistema enviaria para a tabela NOTAS_COMPRAS_FATURAS
|
|
MessageBox.Show($"Parcela {txtNumeroParcela.Text} salva com sucesso!", "Financeiro");
|
|
}
|
|
|
|
protected override void OnAlterar()
|
|
{
|
|
if (txtId.Text == "0")
|
|
{
|
|
MessageBox.Show("Selecione uma fatura para alterar.");
|
|
return;
|
|
}
|
|
PreencherModel();
|
|
MessageBox.Show("Dados da fatura atualizados.");
|
|
}
|
|
|
|
protected override void OnExcluir()
|
|
{
|
|
if (MessageBox.Show("Deseja remover esta parcela do financeiro?", "Confirmar", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
// Lógica de delete
|
|
OnNovo();
|
|
MessageBox.Show("Parcela excluída.");
|
|
}
|
|
}
|
|
|
|
protected override void OnLocalizar()
|
|
{
|
|
// Exemplo: Abrir busca filtrada pelo ID da nota
|
|
MessageBox.Show("Localizando parcelas da nota fiscal...");
|
|
}
|
|
|
|
protected override void OnCancelar()
|
|
{
|
|
|
|
}
|
|
}
|
|
} |