133 lines
4.9 KiB
C#
133 lines
4.9 KiB
C#
using CPM;
|
|
using MLL;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using UI;
|
|
|
|
namespace UI
|
|
{
|
|
public partial class ItensEntradaCadastroPanel : FormularioModelo
|
|
{
|
|
private ModeloItensEntrada _entrada = new ModeloItensEntrada();
|
|
|
|
// Controles - Identificação e Item
|
|
private LV_TEXTBOX1 txtId, txtCodigo, txtCodItem, txtNomeItem;
|
|
private Button btnBuscaItem;
|
|
|
|
// Controles - Dados da Entrada
|
|
private LV_TEXTBOX1 txtQtdNovos, txtTotal, txtDataInc;
|
|
|
|
// Controles - Documentação
|
|
private LV_TEXTBOX1 txtNota, txtPedNum, txtFornecedor, txtFuncionario;
|
|
private Button btnBuscaFornecedor;
|
|
|
|
// Controles - Notas
|
|
private LV_TEXTBOX1 txtObs;
|
|
|
|
public ItensEntradaCadastroPanel()
|
|
{
|
|
this.Titulo = "Lançamento de Entrada de Estoque";
|
|
MontarInterface();
|
|
}
|
|
|
|
private void MontarInterface()
|
|
{
|
|
// --- SEÇÃO 1: Item e Referência ---
|
|
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO DO ITEM", 20));
|
|
|
|
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
|
txtCodigo = AddInput(content, "CÓD. ENTRADA", 100, 50, 110, 30);
|
|
|
|
txtCodItem = AddInput(content, "CÓD. ITEM", 220, 50, 90, 30);
|
|
btnBuscaItem = CriarBotaoLupa(315, 66, OnBuscaItem);
|
|
txtNomeItem = AddInput(content, "DESCRIÇÃO DO PRODUTO", 355, 50, 480, 30, true);
|
|
|
|
// --- SEÇÃO 2: Valores e Quantidades ---
|
|
content.Controls.Add(CreateSectionHeader("QUANTIDADES E VALORES", 115));
|
|
|
|
txtQtdNovos = AddInput(content, "QTD. ENTRADA", 20, 145, 150, 30);
|
|
txtQtdNovos.BackColor = Color.FromArgb(240, 255, 240); // Destaque para entrada de estoque
|
|
|
|
txtTotal = AddInput(content, "VALOR TOTAL (R$)", 180, 145, 180, 30);
|
|
txtDataInc = AddInput(content, "DATA ENTRADA", 370, 145, 150, 30);
|
|
txtFuncionario = AddInput(content, "OPERADOR/RESP.", 530, 145, 305, 30);
|
|
|
|
// --- SEÇÃO 3: Documentação e Origem ---
|
|
content.Controls.Add(CreateSectionHeader("DOCUMENTAÇÃO E FORNECEDOR", 210));
|
|
|
|
txtNota = AddInput(content, "Nº NOTA FISCAL", 20, 240, 150, 30);
|
|
txtPedNum = AddInput(content, "Nº PEDIDO COMPRA", 180, 240, 150, 30);
|
|
|
|
txtFornecedor = AddInput(content, "FORNECEDOR", 340, 240, 460, 30);
|
|
btnBuscaFornecedor = CriarBotaoLupa(805, 256, OnBuscaFornecedor);
|
|
|
|
// --- SEÇÃO 4: Observações ---
|
|
content.Controls.Add(CreateSectionHeader("OBSERVAÇÕES DO MOVIMENTO", 305));
|
|
txtObs = AddInput(content, "HISTÓRICO OU MOTIVO DA ENTRADA", 20, 335, 815, 60);
|
|
|
|
content.Height = 430;
|
|
}
|
|
|
|
private Button CriarBotaoLupa(int x, int y, EventHandler clickEvent)
|
|
{
|
|
var btn = new Button
|
|
{
|
|
Text = "🔍",
|
|
Location = new Point(x, y),
|
|
Size = new Size(32, 30),
|
|
BackColor = AccentBlue,
|
|
ForeColor = Color.White,
|
|
FlatStyle = FlatStyle.Flat,
|
|
Cursor = Cursors.Hand
|
|
};
|
|
btn.FlatAppearance.BorderSize = 0;
|
|
btn.Click += clickEvent;
|
|
content.Controls.Add(btn);
|
|
return btn;
|
|
}
|
|
|
|
private void OnBuscaItem(object sender, EventArgs e) => MessageBox.Show("Busca de Itens");
|
|
private void OnBuscaFornecedor(object sender, EventArgs e) => MessageBox.Show("Busca de Fornecedores");
|
|
|
|
private void PreencherModel()
|
|
{
|
|
_entrada.CODIGO = txtCodigo.Text;
|
|
_entrada.COD_ITEM = txtCodItem.Text;
|
|
_entrada.NOVOS = txtQtdNovos.Text;
|
|
_entrada.NOTA = txtNota.Text;
|
|
_entrada.TOTAL = txtTotal.Text;
|
|
_entrada.DATA_INC = txtDataInc.Text;
|
|
_entrada.FUNCIONARIO = txtFuncionario.Text;
|
|
_entrada.FORNECEDOR = txtFornecedor.Text;
|
|
_entrada.PED_NUM = txtPedNum.Text;
|
|
_entrada.OBSERVACAO = txtObs.Text;
|
|
}
|
|
|
|
protected override void OnNovo()
|
|
{
|
|
_entrada = new ModeloItensEntrada();
|
|
txtDataInc.Text = DateTime.Now.ToString("dd/MM/yyyy");
|
|
txtCodItem.Focus();
|
|
}
|
|
|
|
protected override void OnSalvar()
|
|
{
|
|
try
|
|
{
|
|
PreencherModel();
|
|
// BLL.Salvar(_entrada);
|
|
MessageBox.Show("Entrada de estoque processada com sucesso!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("Erro ao salvar entrada: " + ex.Message);
|
|
}
|
|
}
|
|
|
|
protected override void OnAlterar() { }
|
|
protected override void OnExcluir() { }
|
|
protected override void OnLocalizar() { }
|
|
protected override void OnCancelar() { OnNovo(); }
|
|
}
|
|
} |