13/05/2026 - Criando UI dos modelos.
This commit is contained in:
parent
b61f3a9350
commit
bea1bea54d
85
UI/Dashboards/Cadastros/OSPecasPanel.cs
Normal file
85
UI/Dashboards/Cadastros/OSPecasPanel.cs
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public class OSPecasPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private LV_TEXTBOX1 txtId, txtCodOs, txtCodPeca, txtDescricao, txtQtd;
|
||||||
|
private LV_TEXTBOX1 txtValor, txtCusto, txtTecnico, txtDia;
|
||||||
|
private LV_TEXTBOX1 txtSeriais, txtLotes, txtXPed, txtNItemPed;
|
||||||
|
|
||||||
|
public OSPecasPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "GESTÃO DE PEÇAS E COMPONENTES (O.S.)";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- SEÇÃO 1: IDENTIFICAÇÃO E DESCRIÇÃO ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Dados da Peça / Produto", 20));
|
||||||
|
txtId = AddInput(content, "ID REGISTRO", 20, 55, 100, 28, true);
|
||||||
|
txtCodOs = AddInput(content, "Nº DA O.S.", 130, 55, 120, 28, true);
|
||||||
|
txtCodPeca = AddInput(content, "CÓD. PEÇA", 260, 55, 150, 28);
|
||||||
|
txtDescricao = AddInput(content, "DESCRIÇÃO DA PEÇA", 420, 55, 560, 28);
|
||||||
|
|
||||||
|
// --- SEÇÃO 2: QUANTIDADES, VALORES E TÉCNICO ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Financeiro e Atribuição", 115));
|
||||||
|
txtQtd = AddInput(content, "QTD", 20, 150, 80, 28);
|
||||||
|
txtValor = AddInput(content, "VALOR UNIT.", 110, 150, 120, 28);
|
||||||
|
txtCusto = AddInput(content, "CUSTO UNIT.", 240, 150, 120, 28);
|
||||||
|
txtTecnico = AddInput(content, "TÉCNICO RESP.", 370, 150, 250, 28);
|
||||||
|
txtDia = AddInput(content, "DATA APLICAÇÃO", 630, 150, 150, 28);
|
||||||
|
|
||||||
|
// --- SEÇÃO 3: RASTREABILIDADE (SERIAIS E LOTES) ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Rastreabilidade e Logística", 210));
|
||||||
|
txtSeriais = AddInput(content, "NÚMEROS DE SÉRIE (IN)", 20, 245, 470, 28);
|
||||||
|
txtLotes = AddInput(content, "LOTES", 500, 245, 480, 28);
|
||||||
|
|
||||||
|
// --- SEÇÃO 4: PEDIDO DE COMPRA / IMPORTAÇÃO ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Referência de Pedido (XPED)", 305));
|
||||||
|
txtXPed = AddInput(content, "PEDIDO (XPED)", 20, 340, 200, 28);
|
||||||
|
txtNItemPed = AddInput(content, "Nº ITEM PEDIDO", 230, 340, 150, 28);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
// Limpa os campos iterando pelo content (padrão que você usa)
|
||||||
|
foreach (Control c in content.Controls)
|
||||||
|
{
|
||||||
|
if (c is LV_TEXTBOX1 txt && !txt.ReadOnly) txt.Text = string.Empty;
|
||||||
|
}
|
||||||
|
txtCodPeca.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
var peca = new ModeloOSPecas
|
||||||
|
{
|
||||||
|
COD_OS = txtCodOs.Text,
|
||||||
|
COD_PECA = txtCodPeca.Text,
|
||||||
|
DESCRICAO = txtDescricao.Text,
|
||||||
|
QTD = txtQtd.Text,
|
||||||
|
VALOR = txtValor.Text,
|
||||||
|
CUSTO = txtCusto.Text,
|
||||||
|
TECNICO = txtTecnico.Text,
|
||||||
|
DIA = txtDia.Text,
|
||||||
|
SERIAIS_IN = txtSeriais.Text,
|
||||||
|
LOTES = txtLotes.Text,
|
||||||
|
XPED = txtXPed.Text,
|
||||||
|
NITEMPED = txtNItemPed.Text
|
||||||
|
};
|
||||||
|
|
||||||
|
// Lógica de persistência na DAL...
|
||||||
|
MessageBox.Show("Peça registrada com sucesso na O.S.!", "LevelOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar() { /* Implementar */ }
|
||||||
|
protected override void OnExcluir() { /* Implementar */ }
|
||||||
|
protected override void OnLocalizar() { /* Implementar */ }
|
||||||
|
protected override void OnCancelar() { OnNovo(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
70
UI/Dashboards/Cadastros/OrdensContatoPanel.cs
Normal file
70
UI/Dashboards/Cadastros/OrdensContatoPanel.cs
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
// Herdando do seu modelo abstrato
|
||||||
|
public class OrdensContatoPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private LV_TEXTBOX1 txtId, txtCodOrdem, txtQuem, txtDescricao, txtUsuario, txtData;
|
||||||
|
|
||||||
|
public OrdensContatoPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "HISTÓRICO DE CONTATOS DA O.S.";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// Criando uma seção usando seu método helper
|
||||||
|
var secaoInfo = CreateSectionHeader("Informações do Registro", 20);
|
||||||
|
content.Controls.Add(secaoInfo);
|
||||||
|
|
||||||
|
// Adicionando inputs usando seus helpers protegidos
|
||||||
|
txtId = AddInput(content, "ID CONTATO", 20, 55, 100, 28, true); // ReadOnly
|
||||||
|
txtCodOrdem = AddInput(content, "CÓDIGO O.S.", 130, 55, 120, 28, true);
|
||||||
|
txtData = AddInput(content, "DATA CADASTRO", 260, 55, 180, 28, true);
|
||||||
|
txtUsuario = AddInput(content, "USUÁRIO", 450, 55, 150, 28, true);
|
||||||
|
|
||||||
|
var secaoDetalhes = CreateSectionHeader("Detalhes do Acompanhamento", 120);
|
||||||
|
content.Controls.Add(secaoDetalhes);
|
||||||
|
|
||||||
|
txtQuem = AddInput(content, "QUEM FALOU / CONTATO", 20, 155, 300, 28);
|
||||||
|
|
||||||
|
// Para a descrição, podemos ajustar a altura manualmente após o helper
|
||||||
|
txtDescricao = AddInput(content, "DESCRIÇÃO DA OCORRÊNCIA", 20, 215, 600, 80);
|
||||||
|
// Se o seu LV_TEXTBOX1 suportar multiline:
|
||||||
|
// txtDescricao.Multiline = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- IMPLEMENTAÇÃO OBRIGATÓRIA DOS MÉTODOS DO PAI ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
// Lógica para limpar campos e habilitar edição
|
||||||
|
txtQuem.Text = "";
|
||||||
|
txtDescricao.Text = "";
|
||||||
|
txtQuem.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
// Aqui entra a sua BLL usando o ModeloOrdensContato
|
||||||
|
var contato = new ModeloOrdensContato
|
||||||
|
{
|
||||||
|
DESCRICAO = txtDescricao.Text,
|
||||||
|
QUEM = txtQuem.Text,
|
||||||
|
// ... outros campos
|
||||||
|
};
|
||||||
|
|
||||||
|
MessageBox.Show("Histórico salvo com sucesso!", "LevelOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar() { /* Implementar */ }
|
||||||
|
protected override void OnExcluir() { /* Implementar */ }
|
||||||
|
protected override void OnLocalizar() { /* Implementar */ }
|
||||||
|
protected override void OnCancelar() { /* Implementar */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
95
UI/Dashboards/Cadastros/OrdensDeslocamentoPanel.cs
Normal file
95
UI/Dashboards/Cadastros/OrdensDeslocamentoPanel.cs
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public class OrdensDeslocamentoPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
// Inputs para Saída e Chegada
|
||||||
|
private LV_TEXTBOX1 txtId, txtCodOrdem, txtDia;
|
||||||
|
private LV_TEXTBOX1 txtHoraSai, txtKmSai, txtHoraChega, txtKmChega;
|
||||||
|
|
||||||
|
// Inputs para Volta
|
||||||
|
private LV_TEXTBOX1 txtHoraVoltaSai, txtKmVoltaSai, txtHoraVolta, txtKmVolta;
|
||||||
|
|
||||||
|
// Despesas extras
|
||||||
|
private LV_TEXTBOX1 txtAlimenta, txtHospeda;
|
||||||
|
|
||||||
|
public OrdensDeslocamentoPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "CONTROLE DE DESLOCAMENTO / VIAGEM";
|
||||||
|
MontarInterface();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- SEÇÃO 1: IDENTIFICAÇÃO ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Dados Gerais", 20));
|
||||||
|
txtId = AddInput(content, "ID REGISTRO", 20, 55, 100, 28, true);
|
||||||
|
txtCodOrdem = AddInput(content, "CÓDIGO O.S.", 130, 55, 120, 28, true);
|
||||||
|
txtDia = AddInput(content, "DATA DA VIAGEM", 260, 55, 150, 28);
|
||||||
|
|
||||||
|
// --- SEÇÃO 2: IDA (SAÍDA E CHEGADA NO DESTINO) ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Ida ao Cliente / Destino", 115));
|
||||||
|
txtHoraSai = AddInput(content, "HORA SAÍDA", 20, 150, 120, 28);
|
||||||
|
txtKmSai = AddInput(content, "KM SAÍDA", 150, 150, 120, 28);
|
||||||
|
|
||||||
|
txtHoraChega = AddInput(content, "HORA CHEGADA", 300, 150, 120, 28);
|
||||||
|
txtKmChega = AddInput(content, "KM CHEGADA", 430, 150, 120, 28);
|
||||||
|
|
||||||
|
// --- SEÇÃO 3: VOLTA (SAÍDA DO CLIENTE E CHEGADA NA BASE) ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Retorno à Base", 210));
|
||||||
|
txtHoraVoltaSai = AddInput(content, "HORA VOLTA (SAÍDA)", 20, 245, 120, 28);
|
||||||
|
txtKmVoltaSai = AddInput(content, "KM VOLTA (SAÍDA)", 150, 245, 120, 28);
|
||||||
|
|
||||||
|
txtHoraVolta = AddInput(content, "HORA FINAL", 300, 245, 120, 28);
|
||||||
|
txtKmVolta = AddInput(content, "KM FINAL", 430, 245, 120, 28);
|
||||||
|
|
||||||
|
// --- SEÇÃO 4: DESPESAS ADICIONAIS ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Despesas de Viagem", 305));
|
||||||
|
txtAlimenta = AddInput(content, "ALIMENTAÇÃO (R$)", 20, 340, 150, 28);
|
||||||
|
txtHospeda = AddInput(content, "HOSPEDAGEM (R$)", 180, 340, 150, 28);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- IMPLEMENTAÇÃO DOS MÉTODOS ABSTRATOS ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
// Limpar todos os campos para novo registro
|
||||||
|
foreach (Control c in content.Controls)
|
||||||
|
{
|
||||||
|
if (c is LV_TEXTBOX1 txt && !txt.ReadOnly) txt.Text = string.Empty;
|
||||||
|
}
|
||||||
|
txtDia.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
// Mapeando para o seu ModeloOrdensDeslocamento
|
||||||
|
var deslocamento = new ModeloOrdensDeslocamento
|
||||||
|
{
|
||||||
|
DIA = txtDia.Text,
|
||||||
|
HORA_SAI = txtHoraSai.Text,
|
||||||
|
KM_SAI = txtKmSai.Text,
|
||||||
|
HORA_CHEGA = txtHoraChega.Text,
|
||||||
|
KM_CHEGA = txtKmChega.Text,
|
||||||
|
HORA_VOLTA_SAI = txtHoraVoltaSai.Text,
|
||||||
|
KM_VOLTA_SAI = txtKmVoltaSai.Text,
|
||||||
|
HORA_VOLTA = txtHoraVolta.Text,
|
||||||
|
KM_VOLTA = txtKmVolta.Text,
|
||||||
|
ALIMENTA = txtAlimenta.Text,
|
||||||
|
HOSPEDA = txtHospeda.Text
|
||||||
|
};
|
||||||
|
|
||||||
|
// Aqui você chamaria a sua BLL/DAL para persistir
|
||||||
|
MessageBox.Show("Dados de deslocamento registrados!", "LevelOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar() { /* Lógica de Alteração */ }
|
||||||
|
protected override void OnExcluir() { /* Lógica de Exclusão */ }
|
||||||
|
protected override void OnLocalizar() { /* Abrir tela de busca */ }
|
||||||
|
protected override void OnCancelar() { OnNovo(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
97
UI/Dashboards/Cadastros/OrdensInsumosPanel.cs
Normal file
97
UI/Dashboards/Cadastros/OrdensInsumosPanel.cs
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public class OrdensInsumosPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private LV_TEXTBOX1 txtId, txtCodOs, txtCodItem, txtQtd, txtCustoUnit, txtCustoTotal, txtObs;
|
||||||
|
|
||||||
|
public OrdensInsumosPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "LANÇAMENTO DE INSUMOS E MATERIAIS";
|
||||||
|
MontarInterface();
|
||||||
|
VincularEventosCalculo();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterface()
|
||||||
|
{
|
||||||
|
// --- SEÇÃO 1: IDENTIFICAÇÃO DO ITEM ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Identificação do Insumo", 20));
|
||||||
|
|
||||||
|
txtId = AddInput(content, "ID INSUMO", 20, 55, 100, 28, true);
|
||||||
|
txtCodOs = AddInput(content, "Nº DA O.S.", 130, 55, 120, 28, true);
|
||||||
|
txtCodItem = AddInput(content, "CÓD. PRODUTO", 260, 55, 150, 28);
|
||||||
|
|
||||||
|
// Botão auxiliar para buscar produto (opcional, aproveitando seu estilo)
|
||||||
|
var btnBuscar = CreateToolbarButton("Buscar Item", AccentBlue);
|
||||||
|
btnBuscar.Location = new Point(420, 71);
|
||||||
|
btnBuscar.Size = new Size(100, 28);
|
||||||
|
content.Controls.Add(btnBuscar);
|
||||||
|
|
||||||
|
// --- SEÇÃO 2: VALORES E QUANTIDADES ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Quantidades e Custos", 115));
|
||||||
|
|
||||||
|
txtQtd = AddInput(content, "QUANTIDADE", 20, 150, 100, 28);
|
||||||
|
txtCustoUnit = AddInput(content, "CUSTO UNITÁRIO (R$)", 130, 150, 150, 28);
|
||||||
|
txtCustoTotal = AddInput(content, "CUSTO TOTAL (R$)", 290, 150, 150, 28, true); // Total é calculado
|
||||||
|
|
||||||
|
// --- SEÇÃO 3: OBSERVAÇÕES ---
|
||||||
|
content.Controls.Add(CreateSectionHeader("Observações Adicionais", 210));
|
||||||
|
txtObs = AddInput(content, "DETALHES DO MATERIAL", 20, 245, 550, 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void VincularEventosCalculo()
|
||||||
|
{
|
||||||
|
// Eventos para calcular o custo total automaticamente ao digitar
|
||||||
|
txtQtd.TextChanged += (s, e) => CalcularTotal();
|
||||||
|
txtCustoUnit.TextChanged += (s, e) => CalcularTotal();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CalcularTotal()
|
||||||
|
{
|
||||||
|
decimal.TryParse(txtQtd.Text, out decimal qtd);
|
||||||
|
decimal.TryParse(txtCustoUnit.Text, out decimal unit);
|
||||||
|
|
||||||
|
decimal total = qtd * unit;
|
||||||
|
txtCustoTotal.Text = total.ToString("N2");
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- MÉTODOS DO MODELO ---
|
||||||
|
|
||||||
|
protected override void OnNovo()
|
||||||
|
{
|
||||||
|
txtCodItem.Text = "";
|
||||||
|
txtQtd.Text = "1";
|
||||||
|
txtCustoUnit.Text = "0,00";
|
||||||
|
txtCustoTotal.Text = "0,00";
|
||||||
|
txtObs.Text = "";
|
||||||
|
txtCodItem.Focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
var insumo = new ModeloOrdensInsumos
|
||||||
|
{
|
||||||
|
COD_OS = txtCodOs.Text,
|
||||||
|
COD_ITEM = txtCodItem.Text,
|
||||||
|
QTD = txtQtd.Text,
|
||||||
|
CUSTO_UNIT = txtCustoUnit.Text,
|
||||||
|
CUSTO = txtCustoTotal.Text,
|
||||||
|
OBSERVACOES = txtObs.Text
|
||||||
|
};
|
||||||
|
|
||||||
|
// Chamada para a BLL...
|
||||||
|
MessageBox.Show("Insumo registrado com sucesso!", "LevelOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnAlterar() { /* Implementar busca e edição */ }
|
||||||
|
protected override void OnExcluir() { /* Implementar exclusão */ }
|
||||||
|
protected override void OnLocalizar() { /* Implementar busca */ }
|
||||||
|
protected override void OnCancelar() { OnNovo(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
157
UI/Dashboards/Configurações/OrdemServico/OSConfiguracoesPanel.cs
Normal file
157
UI/Dashboards/Configurações/OrdemServico/OSConfiguracoesPanel.cs
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
using CPM;
|
||||||
|
using MLL;
|
||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace UI
|
||||||
|
{
|
||||||
|
public class OSPersonConfigPanel : FormularioModelo
|
||||||
|
{
|
||||||
|
private TabControl tabPrincipal;
|
||||||
|
private ModeloOSPerson _configAtual;
|
||||||
|
|
||||||
|
// --- CAMPOS DA ABA: GERAL E EQUIPAMENTO ---
|
||||||
|
private LV_TEXTBOX1 txtDesc, txtMarca, txtModelo, txtSerie, txtPat, txtTituloOS, txtEquipam;
|
||||||
|
|
||||||
|
// --- CAMPOS DA ABA: FINANCEIRO E TAXAS ---
|
||||||
|
private LV_TEXTBOX1 txtVDesloca, txtVTerceiros, txtMaxDesc;
|
||||||
|
private CheckBox chkCobraDesloca, chkCobraTerceiros, chkBaixaEstoque;
|
||||||
|
|
||||||
|
// --- CAMPOS DA ABA: GARANTIA E TEXTOS ---
|
||||||
|
private LV_TEXTBOX1 txtPrazoGar, txtTermoGar, txtObsRec1, txtObsRec2, txtObsRec3, txtObsRec4;
|
||||||
|
|
||||||
|
// --- CAMPOS DA ABA: IMPRESSÃO (ESC/P) ---
|
||||||
|
private LV_TEXTBOX1 txtPortaPrn, txtSaltos, txtCopiasRec, txtCopiasEnt;
|
||||||
|
private CheckBox chkNoEpson, chk40Colunas;
|
||||||
|
|
||||||
|
// --- CAMPOS DA ABA: WEB E E-MAIL ---
|
||||||
|
private LV_TEXTBOX1 txtEmailAbrir, txtEmailFechar, txtWeb1, txtWeb2, txtWeb3, txtWeb4, txtWeb5;
|
||||||
|
|
||||||
|
public OSPersonConfigPanel()
|
||||||
|
{
|
||||||
|
this.Titulo = "PARAMETRIZAÇÃO GLOBAL DO SISTEMA (LEVELOS)";
|
||||||
|
_configAtual = new ModeloOSPerson();
|
||||||
|
MontarInterfaceCompleta();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MontarInterfaceCompleta()
|
||||||
|
{
|
||||||
|
// Inicializando o TabControl
|
||||||
|
tabPrincipal = new TabControl
|
||||||
|
{
|
||||||
|
Location = new Point(10, 10),
|
||||||
|
Size = new Size(1060, 520),
|
||||||
|
Font = new Font("Segoe UI", 9.5f)
|
||||||
|
};
|
||||||
|
|
||||||
|
// Criando as Abas
|
||||||
|
var tpGeral = new TabPage("Equipamento / Geral");
|
||||||
|
var tpFinanceiro = new TabPage("Financeiro / Regras");
|
||||||
|
var tpGarantia = new TabPage("Textos / Garantia");
|
||||||
|
var tpImpressao = new TabPage("Impressão / PDV");
|
||||||
|
var tpWeb = new TabPage("Web / Integração");
|
||||||
|
|
||||||
|
tabPrincipal.TabPages.AddRange(new[] { tpGeral, tpFinanceiro, tpGarantia, tpImpressao, tpWeb });
|
||||||
|
content.Controls.Add(tabPrincipal);
|
||||||
|
|
||||||
|
ConfigurarAbaGeral(tpGeral);
|
||||||
|
ConfigurarAbaFinanceiro(tpFinanceiro);
|
||||||
|
ConfigurarAbaGarantia(tpGarantia);
|
||||||
|
ConfigurarAbaImpressao(tpImpressao);
|
||||||
|
ConfigurarAbaWeb(tpWeb);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaGeral(TabPage tp)
|
||||||
|
{
|
||||||
|
txtTituloOS = AddInput(tp, "TÍTULO DA ORDEM DE SERVIÇO", 20, 20, 450, 28);
|
||||||
|
txtDesc = AddInput(tp, "DESCRIÇÃO PADRÃO", 20, 80, 450, 28);
|
||||||
|
txtMarca = AddInput(tp, "MARCA", 20, 140, 200, 28);
|
||||||
|
txtModelo = AddInput(tp, "MODELO", 240, 140, 230, 28);
|
||||||
|
txtSerie = AddInput(tp, "Nº SÉRIE", 20, 200, 200, 28);
|
||||||
|
txtPat = AddInput(tp, "PATRIMÔNIO", 240, 200, 230, 28);
|
||||||
|
txtEquipam = AddInput(tp, "TEXTO EQUIPAMENTO", 20, 260, 450, 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaFinanceiro(TabPage tp)
|
||||||
|
{
|
||||||
|
txtVDesloca = AddInput(tp, "VALOR DESLOCAMENTO (PADRÃO)", 20, 20, 180, 28);
|
||||||
|
txtVTerceiros = AddInput(tp, "VALOR TERCEIROS (PADRÃO)", 220, 20, 180, 28);
|
||||||
|
|
||||||
|
chkCobraDesloca = CreateCheckBox(tp, "Cobrar Deslocamento por Padrão?", 20, 70);
|
||||||
|
chkCobraTerceiros = CreateCheckBox(tp, "Cobrar Terceiros por Padrão?", 20, 95);
|
||||||
|
chkBaixaEstoque = CreateCheckBox(tp, "Baixa de estoque automática no lançamento?", 20, 120);
|
||||||
|
|
||||||
|
txtMaxDesc = AddInput(tp, "% MÁXIMO DESCONTO VENDAS", 20, 160, 180, 28);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaGarantia(TabPage tp)
|
||||||
|
{
|
||||||
|
txtPrazoGar = AddInput(tp, "PRAZO DE GARANTIA (EX: 90 DIAS)", 20, 20, 250, 28);
|
||||||
|
txtTermoGar = AddInput(tp, "TERMO DE GARANTIA COMPLETO", 20, 80, 600, 100);
|
||||||
|
|
||||||
|
txtObsRec1 = AddInput(tp, "OBS. RECEBIMENTO LINHA 1", 20, 200, 400, 28);
|
||||||
|
txtObsRec2 = AddInput(tp, "OBS. RECEBIMENTO LINHA 2", 20, 245, 400, 28);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaImpressao(TabPage tp)
|
||||||
|
{
|
||||||
|
txtPortaPrn = AddInput(tp, "PORTA IMPRESSORA (EX: LPT1, COM1)", 20, 20, 200, 28);
|
||||||
|
txtSaltos = AddInput(tp, "SALTOS DE LINHA (DRAFT)", 240, 20, 100, 28);
|
||||||
|
|
||||||
|
chkNoEpson = CreateCheckBox(tp, "Não utilizar comandos Epson (ESC/P)?", 20, 70);
|
||||||
|
chk40Colunas = CreateCheckBox(tp, "Habilitar modo 40 colunas (Bobina)?", 20, 95);
|
||||||
|
|
||||||
|
txtCopiasRec = AddInput(tp, "Nº CÓPIAS RECIBO", 20, 130, 100, 28);
|
||||||
|
txtCopiasEnt = AddInput(tp, "Nº CÓPIAS ENTREGA", 140, 130, 100, 28);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConfigurarAbaWeb(TabPage tp)
|
||||||
|
{
|
||||||
|
txtEmailAbrir = AddInput(tp, "ASSUNTO E-MAIL (ABERTURA)", 20, 20, 450, 28);
|
||||||
|
txtEmailFechar = AddInput(tp, "ASSUNTO E-MAIL (FECHAMENTO)", 20, 80, 450, 28);
|
||||||
|
|
||||||
|
txtWeb1 = AddInput(tp, "URL/TEXTO WEB 1", 20, 140, 450, 28);
|
||||||
|
txtWeb2 = AddInput(tp, "URL/TEXTO WEB 2", 20, 190, 450, 28);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper para criar CheckBoxes no padrão do sistema
|
||||||
|
private CheckBox CreateCheckBox(Control parent, string text, int x, int y)
|
||||||
|
{
|
||||||
|
var ck = new CheckBox { Text = text, Location = new Point(x, y), AutoSize = true, ForeColor = Color.FromArgb(64, 64, 64) };
|
||||||
|
parent.Controls.Add(ck);
|
||||||
|
return ck;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- IMPLEMENTAÇÃO DA LÓGICA DE PERSISTÊNCIA ---
|
||||||
|
|
||||||
|
protected override void OnSalvar()
|
||||||
|
{
|
||||||
|
// Mapeando todos os campos de volta para o objeto de modelo
|
||||||
|
_configAtual.TX_DESC = txtDesc.Text;
|
||||||
|
_configAtual.TX_MARCA = txtMarca.Text;
|
||||||
|
_configAtual.TX_MODELO = txtModelo.Text;
|
||||||
|
_configAtual.TX_SERIE = txtSerie.Text;
|
||||||
|
_configAtual.TX_PAT = txtPat.Text;
|
||||||
|
_configAtual.OS_TITULO = txtTituloOS.Text;
|
||||||
|
_configAtual.PRAZO_GARANTIA = txtPrazoGar.Text;
|
||||||
|
_configAtual.TERMO_GARANTIA = txtTermoGar.Text;
|
||||||
|
|
||||||
|
// Tratando os "booleanos" que no banco são string (S/N)
|
||||||
|
_configAtual.COBRA_DESLOCA = chkCobraDesloca.Checked ? "S" : "N";
|
||||||
|
_configAtual.COBRA_TERCEIROS = chkCobraTerceiros.Checked ? "S" : "N";
|
||||||
|
_configAtual.BAIXA_ESTOQUE_NAHORA = chkBaixaEstoque.Checked ? "S" : "N";
|
||||||
|
_configAtual.NO_EPSON = chkNoEpson.Checked ? "S" : "N";
|
||||||
|
_configAtual.VENDA_40COLUNAS = chk40Colunas.Checked ? "S" : "N";
|
||||||
|
|
||||||
|
// Chamada para a sua BLL (LevelCode)
|
||||||
|
MessageBox.Show("Parâmetros do sistema salvos com sucesso!", "LevelOS", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNovo() { /* Carregar padrão */ }
|
||||||
|
protected override void OnAlterar() { /* Habilitar campos */ }
|
||||||
|
protected override void OnExcluir() { /* Bloqueado para configurações */ }
|
||||||
|
protected override void OnLocalizar() { /* Buscar configuração ativa */ }
|
||||||
|
protected override void OnCancelar() { OnLocalizar(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user