178 lines
7.1 KiB
C#
178 lines
7.1 KiB
C#
using CPM;
|
|
using MLL;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
using UI;
|
|
|
|
namespace UI
|
|
{
|
|
public partial class ItensCadastroPanel : FormularioModelo
|
|
{
|
|
private ModeloItens _item = new ModeloItens();
|
|
|
|
// --- CONTROLES DA INTERFACE ---
|
|
// Identificação e Básicos
|
|
private LV_TEXTBOX1 txtId, txtCodigo, txtNumero, txtGtin, txtNome, txtNomeCurto;
|
|
|
|
// Categorização e Marcas
|
|
private LV_TEXTBOX1 txtGrupo, txtSubGrupo, txtTipo, txtUnidade, txtNumFab, txtFabricante, txtFornecedor;
|
|
|
|
// Financeiro e Preços
|
|
private LV_TEXTBOX1 txtCusto, txtLucro, txtVenda, txtPreco1, txtPreco2;
|
|
|
|
// Estoque e Logística
|
|
private LV_TEXTBOX1 txtEstMin, txtEstIdeal, txtEstDisp, txtLocal, txtGaveta;
|
|
|
|
// Fiscal e Datas
|
|
private LV_TEXTBOX1 txtNcm, txtCst, txtIcms, txtIpi, txtValidade, txtUltimaVenda, txtUltimaCompra;
|
|
|
|
// Notas e Imagem
|
|
private LV_TEXTBOX1 txtObs;
|
|
private PictureBox picProduto;
|
|
private Button btnUploadFoto;
|
|
|
|
public ItensCadastroPanel()
|
|
{
|
|
this.Titulo = "Cadastro Geral de Itens";
|
|
MontarInterface();
|
|
}
|
|
|
|
private void MontarInterface()
|
|
{
|
|
// --- SEÇÃO 1: Identificação Técnica ---
|
|
content.Controls.Add(CreateSectionHeader("IDENTIFICAÇÃO E REFERÊNCIAS", 20));
|
|
|
|
txtId = AddInput(content, "ID", 20, 50, 70, 30, true);
|
|
txtCodigo = AddInput(content, "CÓD. INTERNO", 100, 50, 110, 30);
|
|
txtNumero = AddInput(content, "Nº REF/PART", 220, 50, 150, 30);
|
|
txtGtin = AddInput(content, "GTIN/EAN (BARRAS)", 380, 50, 180, 30);
|
|
|
|
txtNome = AddInput(content, "DESCRIÇÃO DO ITEM", 20, 105, 450, 30);
|
|
txtNomeCurto = AddInput(content, "NOME REDUZIDO / PDV", 480, 105, 230, 30);
|
|
|
|
// Container para Imagem
|
|
picProduto = new PictureBox
|
|
{
|
|
Location = new Point(730, 45),
|
|
Size = new Size(180, 160),
|
|
BorderStyle = BorderStyle.FixedSingle,
|
|
SizeMode = PictureBoxSizeMode.Zoom,
|
|
BackColor = Color.WhiteSmoke
|
|
};
|
|
btnUploadFoto = new Button
|
|
{
|
|
Text = "ADICIONAR FOTO",
|
|
Location = new Point(730, 210),
|
|
Size = new Size(180, 25),
|
|
FlatStyle = FlatStyle.Flat,
|
|
Cursor = Cursors.Hand
|
|
};
|
|
content.Controls.Add(picProduto);
|
|
content.Controls.Add(btnUploadFoto);
|
|
|
|
// --- SEÇÃO 2: Classificação e Suprimentos ---
|
|
content.Controls.Add(CreateSectionHeader("CLASSIFICAÇÃO E ORIGEM", 175));
|
|
|
|
txtGrupo = AddInput(content, "GRUPO", 20, 205, 130, 30);
|
|
txtSubGrupo = AddInput(content, "SUBGRUPO", 160, 205, 130, 30);
|
|
txtTipo = AddInput(content, "TIPO", 300, 205, 100, 30);
|
|
txtUnidade = AddInput(content, "UNIDADE", 410, 205, 80, 30);
|
|
|
|
txtNumFab = AddInput(content, "Nº FABRICANTE", 20, 260, 130, 30);
|
|
txtFabricante = AddInput(content, "MARCA/FABRICANTE", 160, 260, 260, 30);
|
|
txtFornecedor = AddInput(content, "FORNECEDOR PADRÃO", 430, 260, 280, 30);
|
|
|
|
// --- SEÇÃO 3: Gestão de Preços ---
|
|
content.Controls.Add(CreateSectionHeader("FINANCEIRO E PRECIFICAÇÃO", 330));
|
|
|
|
txtCusto = AddInput(content, "CUSTO (R$)", 20, 360, 130, 30);
|
|
txtLucro = AddInput(content, "LUCRO (%)", 160, 360, 90, 30);
|
|
txtVenda = AddInput(content, "VENDA BASE (R$)", 260, 360, 140, 30);
|
|
txtVenda.BackColor = Color.FromArgb(235, 245, 255); // Azul claro para destaque
|
|
|
|
txtPreco1 = AddInput(content, "PREÇO ATACADO", 410, 360, 140, 30);
|
|
txtPreco2 = AddInput(content, "PREÇO ESPECIAL", 560, 360, 150, 30);
|
|
|
|
// --- SEÇÃO 4: Controle de Inventário e Fiscal ---
|
|
content.Controls.Add(CreateSectionHeader("ESTOQUE E DADOS FISCAIS", 430));
|
|
|
|
txtEstDisp = AddInput(content, "SALDO ATUAL", 20, 460, 100, 30, true);
|
|
txtEstMin = AddInput(content, "EST. MÍN.", 130, 460, 100, 30);
|
|
txtLocal = AddInput(content, "LOCALIZAÇÃO", 240, 460, 120, 30);
|
|
txtGaveta = AddInput(content, "GAVETA/BOX", 370, 460, 90, 30);
|
|
|
|
txtNcm = AddInput(content, "NCM", 480, 460, 120, 30);
|
|
txtCst = AddInput(content, "CST/CSOSN", 610, 460, 90, 30);
|
|
txtIcms = AddInput(content, "ICMS %", 710, 460, 80, 30);
|
|
txtIpi = AddInput(content, "IPI %", 800, 460, 80, 30);
|
|
|
|
// --- SEÇÃO 5: Datas e Notas ---
|
|
content.Controls.Add(CreateSectionHeader("HISTÓRICO E OBSERVAÇÕES", 530));
|
|
|
|
txtUltimaCompra = AddInput(content, "ÚLT. COMPRA", 20, 560, 120, 30, true);
|
|
txtUltimaVenda = AddInput(content, "ÚLT. VENDA", 150, 560, 120, 30, true);
|
|
txtValidade = AddInput(content, "VALIDADE", 280, 560, 120, 30);
|
|
|
|
txtObs = AddInput(content, "OBSERVAÇÕES ADICIONAIS", 420, 560, 490, 50);
|
|
|
|
content.Height = 650;
|
|
}
|
|
|
|
private void PreencherModel()
|
|
{
|
|
_item.CODIGO = txtCodigo.Text;
|
|
_item.NUMERO = txtNumero.Text;
|
|
_item.NOME = txtNome.Text;
|
|
_item.NOMECURTO = txtNomeCurto.Text;
|
|
_item.GTIN = txtGtin.Text;
|
|
_item.GRUPO = txtGrupo.Text;
|
|
_item.SUBGRUPO = txtSubGrupo.Text;
|
|
_item.TIPO = txtTipo.Text;
|
|
_item.UNIDADE = txtUnidade.Text;
|
|
_item.NUMERO_FAB = txtNumFab.Text;
|
|
_item.FABRICANTE = txtFabricante.Text;
|
|
_item.FORNECEDOR = txtFornecedor.Text;
|
|
_item.CUSTO = txtCusto.Text;
|
|
_item.LUCRO = txtLucro.Text;
|
|
_item.VENDA = txtVenda.Text;
|
|
_item.PRECO_1 = txtPreco1.Text;
|
|
_item.PRECO_2 = txtPreco2.Text;
|
|
_item.ESTOQUE_MIN = txtEstMin.Text;
|
|
_item.ESTOQUE_IDEAL = txtEstIdeal.Text;
|
|
_item.ESTOQUE_DISP = txtEstDisp.Text;
|
|
_item.LOCAL = txtLocal.Text;
|
|
_item.GAVETA = txtGaveta.Text;
|
|
_item.NC_MERCOSUL = txtNcm.Text;
|
|
_item.C_CST = txtCst.Text;
|
|
_item.C_ICMS = txtIcms.Text;
|
|
_item.C_IPI = txtIpi.Text;
|
|
_item.VALIDADE = txtValidade.Text;
|
|
_item.OBSERVACOES = txtObs.Text;
|
|
}
|
|
|
|
protected override void OnNovo()
|
|
{
|
|
_item = new ModeloItens();
|
|
txtNome.Focus();
|
|
}
|
|
|
|
protected override void OnSalvar()
|
|
{
|
|
try
|
|
{
|
|
PreencherModel();
|
|
MessageBox.Show("Item salvo com sucesso na base de dados!", "LevelOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("Erro ao processar item: " + ex.Message);
|
|
}
|
|
}
|
|
|
|
protected override void OnAlterar() { }
|
|
protected override void OnExcluir() { }
|
|
protected override void OnLocalizar() { }
|
|
protected override void OnCancelar() { OnNovo(); }
|
|
}
|
|
} |