1479 lines
41 KiB
C#
1479 lines
41 KiB
C#
using CPM;
|
|
using CustomMessageBox;
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Windows.Forms;
|
|
|
|
namespace UI
|
|
{
|
|
public class OrdensCadastroPanel : FormularioModelo
|
|
{
|
|
#region Campos
|
|
|
|
private Label lblNumeroOS = null!;
|
|
|
|
private Panel cardCliente = null!;
|
|
private Panel cardDatas = null!;
|
|
private Panel cardFinanceiro = null!;
|
|
private Panel cardRodape = null!;
|
|
|
|
private TabControl tabDetalhes = null!;
|
|
|
|
private LV_TEXTBOX1 txtCliente = null!;
|
|
private LV_TEXTBOX1 txtEndereco = null!;
|
|
private LV_TEXTBOX1 txtTelefones = null!;
|
|
private LV_TEXTBOX1 txtDocs = null!;
|
|
private LV_TEXTBOX1 txtEmail = null!;
|
|
|
|
private LV_TEXTBOX1 txtGarantia = null!;
|
|
|
|
private LV_TEXTBOX1 txtAdiantamento = null!;
|
|
private LV_TEXTBOX1 txtMaoObra = null!;
|
|
private LV_TEXTBOX1 txtPecas = null!;
|
|
private LV_TEXTBOX1 txtDeslocamento = null!;
|
|
private LV_TEXTBOX1 txtServicosTerceiros = null!;
|
|
private LV_TEXTBOX1 txtOutros = null!;
|
|
private LV_TEXTBOX1 txtTotal = null!;
|
|
|
|
private DateTimePicker dtpEntrada = null!;
|
|
private DateTimePicker dtpPronto = null!;
|
|
private DateTimePicker dtpSaida = null!;
|
|
private DateTimePicker dtpGarantia = null!;
|
|
|
|
private ComboBox cbSituacao = null!;
|
|
private ComboBox cbTecnico = null!;
|
|
private ComboBox cbPrioridade = null!;
|
|
|
|
|
|
#endregion
|
|
|
|
public OrdensCadastroPanel()
|
|
{
|
|
Titulo = "Ordem de Serviço";
|
|
|
|
content.Width = 1200;
|
|
content.Height = 960;
|
|
content.BackColor = Color.FromArgb(245, 247, 250);
|
|
|
|
BuildInterface();
|
|
}
|
|
|
|
#region Build
|
|
|
|
private void BuildInterface()
|
|
{
|
|
BuildHeader();
|
|
BuildCliente();
|
|
BuildDatasStatus();
|
|
BuildFinanceiro();
|
|
BuildTabs();
|
|
BuildRodape();
|
|
}
|
|
private Panel CreateInternalCard(string title,Rectangle rect)
|
|
{
|
|
var pnl = new Panel
|
|
{
|
|
Location = rect.Location,
|
|
Size = rect.Size,
|
|
|
|
BackColor = Color.White,
|
|
|
|
BorderStyle = BorderStyle.FixedSingle
|
|
};
|
|
|
|
var lbl = new Label
|
|
{
|
|
Text = title,
|
|
|
|
Font = new Font("Segoe UI", 9f, FontStyle.Bold),
|
|
|
|
ForeColor = AccentBlue,
|
|
|
|
Location = new Point(10, 10),
|
|
|
|
AutoSize = true
|
|
};
|
|
|
|
pnl.Controls.Add(lbl);
|
|
|
|
return pnl;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Header
|
|
|
|
private void BuildHeader()
|
|
{
|
|
var header = new Panel
|
|
{
|
|
Location = new Point(20, 20),
|
|
Size = new Size(1130, 90),
|
|
BackColor = Color.White
|
|
};
|
|
|
|
header.Paint += CardPaint;
|
|
|
|
lblNumeroOS = new Label
|
|
{
|
|
Text = "O.S. nº 1771",
|
|
Font = new Font("Segoe UI", 25f, FontStyle.Bold),
|
|
ForeColor = Color.FromArgb(210, 38, 38),
|
|
Location = new Point(15, 20),
|
|
AutoSize = true
|
|
};
|
|
|
|
var lblSub = new Label
|
|
{
|
|
Text = "Cadastro e gerenciamento da ordem de serviço",
|
|
Font = new Font("Segoe UI", 9f),
|
|
ForeColor = Color.Gray,
|
|
Location = new Point(24, 63),
|
|
AutoSize = true
|
|
};
|
|
|
|
header.Controls.Add(lblNumeroOS);
|
|
header.Controls.Add(lblSub);
|
|
|
|
content.Controls.Add(header);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Cliente
|
|
|
|
private void BuildCliente()
|
|
{
|
|
cardCliente = CreateCard(new Rectangle(20, 130, 760, 220), "Dados do Cliente");
|
|
|
|
txtCliente = AddModernInput(cardCliente, "Cliente", 20, 45, 700);
|
|
txtEndereco = AddModernInput(cardCliente, "Endereço", 20, 95, 700);
|
|
|
|
txtTelefones = AddModernInput(cardCliente, "Telefones", 20, 145, 220);
|
|
txtDocs = AddModernInput(cardCliente, "Documentos", 260, 145, 220);
|
|
txtEmail = AddModernInput(cardCliente, "E-mail", 500, 145, 220);
|
|
|
|
content.Controls.Add(cardCliente);
|
|
txtCliente.Text = "Nicolas Felipe G. dos santos";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Datas
|
|
|
|
private void BuildDatasStatus()
|
|
{
|
|
cardDatas = CreateCard(new Rectangle(20, 370, 760, 170), "Status e Datas");
|
|
|
|
AddSmallLabel(cardDatas, "Entrada", 20, 45);
|
|
|
|
dtpEntrada = CreatePicker(20, 65, 180);
|
|
cardDatas.Controls.Add(dtpEntrada);
|
|
|
|
AddSmallLabel(cardDatas, "Pronto", 20, 100);
|
|
|
|
dtpPronto = CreatePicker(20, 120, 180);
|
|
cardDatas.Controls.Add(dtpPronto);
|
|
|
|
AddSmallLabel(cardDatas, "Saída", 220, 45);
|
|
|
|
dtpSaida = CreatePicker(220, 65, 180);
|
|
cardDatas.Controls.Add(dtpSaida);
|
|
|
|
cbSituacao = AddComboBox(cardDatas, "Situação da OS", 430, 45, 280);
|
|
|
|
AddSmallLabel(cardDatas, "Garantia até", 220, 100);
|
|
dtpGarantia = CreatePicker(220, 120, 180);
|
|
cardDatas.Controls.Add(dtpGarantia);
|
|
|
|
var btnHistorico = new Button
|
|
{
|
|
Text = "🕘 Histórico",
|
|
Location = new Point(480, 120),
|
|
Size = new Size(220, 36),
|
|
|
|
FlatStyle = FlatStyle.Flat,
|
|
BackColor = Color.White,
|
|
ForeColor = TextDark,
|
|
|
|
Font = new Font("Segoe UI Semibold", 9f),
|
|
|
|
Cursor = Cursors.Hand
|
|
};
|
|
|
|
btnHistorico.FlatAppearance.BorderColor = BorderColor;
|
|
btnHistorico.FlatAppearance.MouseOverBackColor = Color.Blue;
|
|
|
|
// Evento clique
|
|
btnHistorico.Click += (s, e) =>
|
|
{
|
|
MessageBox.Show(
|
|
"Abrir histórico da OS",
|
|
"Histórico",
|
|
MessageBoxButtons.OK,
|
|
MessageBoxIcon.Information);
|
|
};
|
|
|
|
// Adiciona no painel
|
|
cardDatas.Controls.Add(btnHistorico);
|
|
|
|
//txtGarantia = AddModernInput(cardDatas, "Garantia até", 250, 105, 180);
|
|
|
|
content.Controls.Add(cardDatas);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Financeiro
|
|
|
|
private void BuildFinanceiro()
|
|
{
|
|
cardFinanceiro = CreateCard(new Rectangle(800, 130, 350, 410), "Financeiro");
|
|
|
|
int y = 50;
|
|
|
|
txtAdiantamento = AddFinanceRow(cardFinanceiro, "Adiantamento", y);
|
|
y += 42;
|
|
|
|
txtMaoObra = AddFinanceRow(cardFinanceiro, "Mão-de-obra", y);
|
|
y += 42;
|
|
|
|
txtPecas = AddFinanceRow(cardFinanceiro, "Peças", y);
|
|
y += 42;
|
|
|
|
txtDeslocamento = AddFinanceRow(cardFinanceiro, "Deslocamento", y);
|
|
y += 42;
|
|
|
|
txtServicosTerceiros = AddFinanceRow(cardFinanceiro, "Serviços terceiros", y);
|
|
y += 42;
|
|
|
|
txtOutros = AddFinanceRow(cardFinanceiro, "Outros", y);
|
|
y += 65;
|
|
|
|
var line = new Panel
|
|
{
|
|
BackColor = BorderColor,
|
|
Location = new Point(20, y),
|
|
Size = new Size(300, 1)
|
|
};
|
|
|
|
cardFinanceiro.Controls.Add(line);
|
|
|
|
y += 20;
|
|
|
|
var lblTotal = new Label
|
|
{
|
|
Text = "TOTAL",
|
|
Font = new Font("Segoe UI", 12f, FontStyle.Bold),
|
|
ForeColor = Color.FromArgb(220, 38, 38),
|
|
Location = new Point(20, y + 8),
|
|
AutoSize = true
|
|
};
|
|
|
|
txtTotal = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(140, y),
|
|
Size = new Size(180, 38),
|
|
Font = new Font("Segoe UI", 14f, FontStyle.Bold),
|
|
TextAlign = HorizontalAlignment.Right,
|
|
BorderColor = Color.FromArgb(220, 38, 38),
|
|
BorderFocusColor = Color.FromArgb(220, 38, 38),
|
|
ForeColor = Color.FromArgb(220, 38, 38)
|
|
};
|
|
|
|
cardFinanceiro.Controls.Add(lblTotal);
|
|
cardFinanceiro.Controls.Add(txtTotal);
|
|
|
|
content.Controls.Add(cardFinanceiro);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Tabs
|
|
|
|
private void BuildTabs()
|
|
{
|
|
tabDetalhes = new TabControl
|
|
{
|
|
Location = new Point(20, 560),
|
|
Size = new Size(1130, 320),
|
|
Font = new Font("Segoe UI", 9f),
|
|
DrawMode = TabDrawMode.OwnerDrawFixed,
|
|
SizeMode = TabSizeMode.Fixed,
|
|
ItemSize = new Size(180, 35)
|
|
};
|
|
|
|
tabDetalhes.DrawItem += DrawTab;
|
|
|
|
BuildTabAparelho();
|
|
BuildTabServicos();
|
|
BuildTabPecas();
|
|
BuildTabLaudo();
|
|
BuildTabMiscelanea();
|
|
|
|
|
|
//tabDetalhes.TabPages.Add(CreateSimpleTab("Peças utilizadas"));
|
|
//tabDetalhes.TabPages.Add(CreateSimpleTab("Obs / Laudo técnico"));
|
|
//tabDetalhes.TabPages.Add(CreateSimpleTab("Miscelânea"));
|
|
|
|
content.Controls.Add(tabDetalhes);
|
|
}
|
|
|
|
private void BuildTabAparelho()
|
|
{
|
|
var tab = new TabPage("Aparelho")
|
|
{
|
|
BackColor = Color.White
|
|
};
|
|
|
|
AddModernInput(tab, "Modelo", 20, 20, 500);
|
|
AddModernInput(tab, "Marca", 550, 20, 500);
|
|
|
|
AddModernInput(tab, "Operadora", 20, 90, 300);
|
|
AddModernInput(tab, "Serial", 350, 90, 300);
|
|
AddModernInput(tab, "Nº Patrimônio", 680, 90, 370);
|
|
|
|
var txtAcessorios = AddModernInput(tab, "Acessórios", 20, 160, 500, 90);
|
|
txtAcessorios.Multiline = true;
|
|
|
|
var txtDefeito = AddModernInput(tab, "Defeito / Reclamação", 550, 160, 500, 90);
|
|
txtDefeito.Multiline = true;
|
|
|
|
tabDetalhes.TabPages.Add(tab);
|
|
}//Aparelho
|
|
private void BuildTabServicos()
|
|
{
|
|
var tab = new TabPage("Mão de obra / Serviços")
|
|
{
|
|
BackColor = Color.White
|
|
};
|
|
|
|
// =====================================================
|
|
// GRID DE SERVIÇOS
|
|
// =====================================================
|
|
|
|
var lblLista = new Label
|
|
{
|
|
Text = "Lista de Serviços executados nesta OS",
|
|
Font = new Font("Segoe UI", 9f, FontStyle.Bold),
|
|
ForeColor = TextDark,
|
|
Location = new Point(15, 15),
|
|
AutoSize = true
|
|
};
|
|
|
|
tab.Controls.Add(lblLista);
|
|
|
|
var gridServicos = new DataGridView
|
|
{
|
|
Location = new Point(15, 40),
|
|
Size = new Size(900, 240),
|
|
|
|
BackgroundColor = Color.White,
|
|
BorderStyle = BorderStyle.FixedSingle,
|
|
|
|
AllowUserToAddRows = false,
|
|
AllowUserToDeleteRows = false,
|
|
AllowUserToResizeRows = false,
|
|
|
|
RowHeadersVisible = false,
|
|
|
|
SelectionMode = DataGridViewSelectionMode.FullRowSelect,
|
|
MultiSelect = false,
|
|
|
|
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None,
|
|
|
|
EnableHeadersVisualStyles = false,
|
|
|
|
Font = new Font("Segoe UI", 8.5f),
|
|
|
|
GridColor = BorderColor
|
|
};
|
|
|
|
// =========================
|
|
// HEADER STYLE
|
|
// =========================
|
|
|
|
gridServicos.ColumnHeadersDefaultCellStyle.BackColor =
|
|
Color.FromArgb(245, 247, 250);
|
|
|
|
gridServicos.ColumnHeadersDefaultCellStyle.ForeColor =
|
|
TextDark;
|
|
|
|
gridServicos.ColumnHeadersDefaultCellStyle.Font =
|
|
new Font("Segoe UI", 8.5f, FontStyle.Bold);
|
|
|
|
gridServicos.ColumnHeadersHeight = 30;
|
|
|
|
// =========================
|
|
// COLUNAS
|
|
// =========================
|
|
|
|
gridServicos.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Descrição",
|
|
Width = 320
|
|
});
|
|
|
|
gridServicos.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Tipo",
|
|
Width = 80
|
|
});
|
|
|
|
gridServicos.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Início",
|
|
Width = 70
|
|
});
|
|
|
|
gridServicos.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Fim",
|
|
Width = 70
|
|
});
|
|
|
|
gridServicos.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Qtd",
|
|
Width = 60
|
|
});
|
|
|
|
gridServicos.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Valor",
|
|
Width = 90
|
|
});
|
|
|
|
gridServicos.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Técnico",
|
|
Width = 180
|
|
});
|
|
|
|
tab.Controls.Add(gridServicos);
|
|
|
|
// =====================================================
|
|
// MENU LATERAL
|
|
// =====================================================
|
|
|
|
var pnlLateral = new Panel
|
|
{
|
|
Location = new Point(930, 40),
|
|
Size = new Size(170, 240),
|
|
BackColor = Color.White
|
|
};
|
|
|
|
Button CriarBotao(string texto, int y, Color cor)
|
|
{
|
|
var btn = new Button
|
|
{
|
|
Text = texto,
|
|
Location = new Point(10, y),
|
|
Size = new Size(145, 38),
|
|
|
|
FlatStyle = FlatStyle.Flat,
|
|
BackColor = cor,
|
|
ForeColor = Color.White,
|
|
|
|
Font = new Font("Segoe UI Semibold", 8.5f),
|
|
|
|
Cursor = Cursors.Hand
|
|
};
|
|
|
|
btn.FlatAppearance.BorderSize = 0;
|
|
|
|
return btn;
|
|
}
|
|
|
|
var btnPadroes = CriarBotao(
|
|
"Padrões",
|
|
0,
|
|
AccentBlue);
|
|
|
|
var btnAvulsos = CriarBotao(
|
|
"Avulsos",
|
|
50,
|
|
Color.FromArgb(34, 197, 94));
|
|
|
|
var btnExcluir = CriarBotao(
|
|
"Excluir",
|
|
100,
|
|
Color.FromArgb(239, 68, 68));
|
|
|
|
pnlLateral.Controls.Add(btnPadroes);
|
|
pnlLateral.Controls.Add(btnAvulsos);
|
|
pnlLateral.Controls.Add(btnExcluir);
|
|
|
|
// =====================================================
|
|
// TOTAL HORAS
|
|
// =====================================================
|
|
|
|
var lblHoras = new Label
|
|
{
|
|
Text = "Total de horas",
|
|
Font = new Font("Segoe UI", 8.5f, FontStyle.Bold),
|
|
ForeColor = TextDark,
|
|
Location = new Point(10, 170),
|
|
AutoSize = true
|
|
};
|
|
|
|
pnlLateral.Controls.Add(lblHoras);
|
|
|
|
var txtHoras = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(10, 190),
|
|
Size = new Size(145, 30),
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue,
|
|
|
|
Font = new Font("Segoe UI", 10f, FontStyle.Bold)
|
|
};
|
|
|
|
pnlLateral.Controls.Add(txtHoras);
|
|
|
|
// =====================================================
|
|
// TOTAL
|
|
// =====================================================
|
|
|
|
var lblTotal = new Label
|
|
{
|
|
Text = "Total",
|
|
Font = new Font("Segoe UI", 9f, FontStyle.Bold),
|
|
ForeColor = Color.Red,
|
|
Location = new Point(10, 230),
|
|
AutoSize = true
|
|
};
|
|
|
|
pnlLateral.Controls.Add(lblTotal);
|
|
|
|
var txtTotal = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(10, 250),
|
|
Size = new Size(145, 34),
|
|
|
|
BorderColor = Color.Red,
|
|
BorderFocusColor = Color.Red,
|
|
|
|
Font = new Font("Segoe UI", 11f, FontStyle.Bold),
|
|
ForeColor = Color.Red
|
|
};
|
|
|
|
pnlLateral.Controls.Add(txtTotal);
|
|
|
|
tab.Controls.Add(pnlLateral);
|
|
|
|
// =====================================================
|
|
// OBSERVAÇÕES
|
|
// =====================================================
|
|
|
|
var lblObs = new Label
|
|
{
|
|
Text = "Observações internas",
|
|
Font = new Font("Segoe UI", 8.5f, FontStyle.Bold),
|
|
ForeColor = TextDark,
|
|
Location = new Point(15, 295),
|
|
AutoSize = true
|
|
};
|
|
|
|
tab.Controls.Add(lblObs);
|
|
|
|
var txtObs = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(15, 318),
|
|
Size = new Size(900, 90),
|
|
|
|
Multiline = true,
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
tab.Controls.Add(txtObs);
|
|
|
|
// =====================================================
|
|
// BOTÃO DESLOCAMENTO
|
|
// =====================================================
|
|
|
|
var btnDeslocamento = new Button
|
|
{
|
|
Text = "Deslocamentos",
|
|
|
|
Location = new Point(930, 360),
|
|
Size = new Size(145, 40),
|
|
|
|
FlatStyle = FlatStyle.Flat,
|
|
|
|
BackColor = AccentBlue,
|
|
ForeColor = Color.White,
|
|
|
|
Font = new Font("Segoe UI Semibold", 8.5f),
|
|
|
|
Cursor = Cursors.Hand
|
|
};
|
|
//eventos clicks
|
|
btnPadroes.Click += (s, e) =>
|
|
{
|
|
NT_MessageBox.Show(
|
|
"Testando evento click padrão",
|
|
"Padrão",
|
|
MessageBoxButtons.OK,
|
|
MessageBoxIcon.Information);
|
|
};
|
|
|
|
btnDeslocamento.FlatAppearance.BorderSize = 0;
|
|
|
|
tab.Controls.Add(btnDeslocamento);
|
|
|
|
// =====================================================
|
|
// ADD TAB
|
|
// =====================================================
|
|
|
|
tabDetalhes.TabPages.Add(tab);
|
|
}//Mão de obra e serviço
|
|
private void BuildTabPecas()
|
|
{
|
|
var tab = new TabPage("Peças utilizadas")
|
|
{
|
|
BackColor = Color.White
|
|
};
|
|
|
|
// =====================================================
|
|
// TITULO
|
|
// =====================================================
|
|
|
|
var lblLista = new Label
|
|
{
|
|
Text = "Lista de Peças utilizadas nesta OS",
|
|
Font = new Font("Segoe UI", 9f, FontStyle.Bold),
|
|
ForeColor = TextDark,
|
|
Location = new Point(15, 15),
|
|
AutoSize = true
|
|
};
|
|
|
|
tab.Controls.Add(lblLista);
|
|
|
|
// =====================================================
|
|
// GRID
|
|
// =====================================================
|
|
|
|
var gridPecas = new DataGridView
|
|
{
|
|
Location = new Point(15, 40),
|
|
Size = new Size(900, 360),
|
|
|
|
BackgroundColor = Color.White,
|
|
BorderStyle = BorderStyle.FixedSingle,
|
|
|
|
AllowUserToAddRows = false,
|
|
AllowUserToDeleteRows = false,
|
|
AllowUserToResizeRows = false,
|
|
|
|
RowHeadersVisible = false,
|
|
|
|
SelectionMode = DataGridViewSelectionMode.FullRowSelect,
|
|
MultiSelect = false,
|
|
|
|
AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None,
|
|
|
|
EnableHeadersVisualStyles = false,
|
|
|
|
Font = new Font("Segoe UI", 8.5f),
|
|
|
|
GridColor = BorderColor
|
|
};
|
|
|
|
// =====================================================
|
|
// HEADER STYLE
|
|
// =====================================================
|
|
|
|
gridPecas.ColumnHeadersDefaultCellStyle.BackColor =
|
|
Color.FromArgb(245, 247, 250);
|
|
|
|
gridPecas.ColumnHeadersDefaultCellStyle.ForeColor =
|
|
TextDark;
|
|
|
|
gridPecas.ColumnHeadersDefaultCellStyle.Font =
|
|
new Font("Segoe UI", 8.5f, FontStyle.Bold);
|
|
|
|
gridPecas.ColumnHeadersHeight = 30;
|
|
|
|
// =====================================================
|
|
// COLUNAS
|
|
// =====================================================
|
|
|
|
gridPecas.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Peça nº",
|
|
Width = 120
|
|
});
|
|
|
|
gridPecas.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Descrição",
|
|
Width = 300
|
|
});
|
|
|
|
gridPecas.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Valor un",
|
|
Width = 110
|
|
});
|
|
|
|
gridPecas.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Qtd.",
|
|
Width = 80
|
|
});
|
|
|
|
gridPecas.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Valor Total",
|
|
Width = 120
|
|
});
|
|
|
|
gridPecas.Columns.Add(new DataGridViewTextBoxColumn
|
|
{
|
|
HeaderText = "Técnico",
|
|
Width = 170
|
|
});
|
|
|
|
tab.Controls.Add(gridPecas);
|
|
|
|
// =====================================================
|
|
// MENU LATERAL
|
|
// =====================================================
|
|
|
|
var pnlLateral = new Panel
|
|
{
|
|
Location = new Point(930, 40),
|
|
Size = new Size(170, 360),
|
|
BackColor = Color.White
|
|
};
|
|
|
|
Button CriarBotao(
|
|
string texto,
|
|
int y,
|
|
Color cor)
|
|
{
|
|
var btn = new Button
|
|
{
|
|
Text = texto,
|
|
|
|
Location = new Point(10, y),
|
|
Size = new Size(145, 40),
|
|
|
|
FlatStyle = FlatStyle.Flat,
|
|
|
|
BackColor = cor,
|
|
ForeColor = Color.White,
|
|
|
|
Font = new Font("Segoe UI Semibold", 8.5f),
|
|
|
|
Cursor = Cursors.Hand
|
|
};
|
|
|
|
btn.FlatAppearance.BorderSize = 0;
|
|
|
|
return btn;
|
|
}
|
|
|
|
// =====================================================
|
|
// BOTÕES
|
|
// =====================================================
|
|
|
|
var btnEstoque = CriarBotao(
|
|
"Peças do Estoque",
|
|
0,
|
|
AccentBlue);
|
|
|
|
var btnAvulsas = CriarBotao(
|
|
"Peças avulsas",
|
|
50,
|
|
Color.FromArgb(34, 197, 94));
|
|
|
|
var btnKit = CriarBotao(
|
|
"KIT Montado",
|
|
100,
|
|
Color.FromArgb(245, 158, 11));
|
|
|
|
var btnExcluir = CriarBotao(
|
|
"Excluir",
|
|
150,
|
|
Color.FromArgb(239, 68, 68));
|
|
|
|
var btnOrcamento = CriarBotao(
|
|
"Inserir orçamento",
|
|
210,
|
|
Color.FromArgb(99, 102, 241));
|
|
|
|
var btnRequisicao = CriarBotao(
|
|
"Requisição",
|
|
260,
|
|
Color.FromArgb(107, 114, 128));
|
|
|
|
pnlLateral.Controls.Add(btnEstoque);
|
|
pnlLateral.Controls.Add(btnAvulsas);
|
|
pnlLateral.Controls.Add(btnKit);
|
|
pnlLateral.Controls.Add(btnExcluir);
|
|
pnlLateral.Controls.Add(btnOrcamento);
|
|
pnlLateral.Controls.Add(btnRequisicao);
|
|
|
|
tab.Controls.Add(pnlLateral);
|
|
|
|
// =====================================================
|
|
// ADD TAB
|
|
// =====================================================
|
|
|
|
tabDetalhes.TabPages.Add(tab);
|
|
}//Peças utilizadas
|
|
private void BuildTabLaudo()
|
|
{
|
|
var tab = new TabPage("Obs / Laudo técnico")
|
|
{
|
|
BackColor = Color.White
|
|
};
|
|
|
|
// =====================================================
|
|
// TITULO
|
|
// =====================================================
|
|
|
|
var lblInfo = new Label
|
|
{
|
|
Text = "Escreva no espaço abaixo o laudo técnico ou detalhes do conserto do equipamento",
|
|
|
|
Font = new Font("Segoe UI", 9f, FontStyle.Bold),
|
|
|
|
ForeColor = TextDark,
|
|
|
|
Location = new Point(15, 15),
|
|
|
|
AutoSize = true
|
|
};
|
|
|
|
tab.Controls.Add(lblInfo);
|
|
|
|
// =====================================================
|
|
// AJUDA
|
|
// =====================================================
|
|
|
|
var lblAjuda = new Label
|
|
{
|
|
Text = "(SHIFT + Enter para pular linha)",
|
|
|
|
Font = new Font("Segoe UI", 8f),
|
|
|
|
ForeColor = Color.Gray,
|
|
|
|
Location = new Point(780, 18),
|
|
|
|
AutoSize = true
|
|
};
|
|
|
|
tab.Controls.Add(lblAjuda);
|
|
|
|
// =====================================================
|
|
// CAMPO DO LAUDO
|
|
// =====================================================
|
|
|
|
var txtLaudo = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(15, 40),
|
|
|
|
Size = new Size(1080, 300),
|
|
|
|
Multiline = true,
|
|
|
|
BorderColor = BorderColor,
|
|
|
|
BorderFocusColor = AccentBlue,
|
|
|
|
Font = new Font("Segoe UI", 9f),
|
|
|
|
BackColor = Color.White
|
|
};
|
|
|
|
tab.Controls.Add(txtLaudo);
|
|
|
|
// =====================================================
|
|
// BOTÃO PREENCHER
|
|
// =====================================================
|
|
|
|
var btnPreencher = new Button
|
|
{
|
|
Text = "📝 Preencher Laudo",
|
|
|
|
Location = new Point(15, 355),
|
|
|
|
Size = new Size(180, 38),
|
|
|
|
FlatStyle = FlatStyle.Flat,
|
|
|
|
BackColor = AccentBlue,
|
|
|
|
ForeColor = Color.White,
|
|
|
|
Font = new Font("Segoe UI Semibold", 9f),
|
|
|
|
Cursor = Cursors.Hand
|
|
};
|
|
|
|
btnPreencher.FlatAppearance.BorderSize = 0;
|
|
|
|
btnPreencher.Click += (s, e) =>
|
|
{
|
|
txtLaudo.Text =
|
|
@"Equipamento analisado e testado em bancada.
|
|
|
|
Foi identificado defeito no componente principal.
|
|
|
|
Realizado:
|
|
- limpeza interna
|
|
- substituição de peças
|
|
- testes finais
|
|
|
|
Equipamento funcionando normalmente.";
|
|
};
|
|
|
|
tab.Controls.Add(btnPreencher);
|
|
|
|
// =====================================================
|
|
// ADD TAB
|
|
// =====================================================
|
|
|
|
tabDetalhes.TabPages.Add(tab);
|
|
}//Laudo tecnico
|
|
private void BuildTabMiscelanea()
|
|
{
|
|
var tab = new TabPage("Miscelânea")
|
|
{
|
|
BackColor = Color.White
|
|
};
|
|
|
|
// =====================================================
|
|
// CARD GARANTIA
|
|
// =====================================================
|
|
|
|
var cardGarantia = CreateInternalCard(
|
|
"Garantia / Garantidor",
|
|
new Rectangle(15, 15, 650, 280));
|
|
|
|
// Garantidor
|
|
|
|
var cbGarantidor = AddComboBox(
|
|
cardGarantia,
|
|
"Fábrica / Garantidor",
|
|
15,
|
|
20,
|
|
300);
|
|
|
|
cbGarantidor.Items.AddRange(new object[]
|
|
{
|
|
"Nenhum",
|
|
"Samsung",
|
|
"LG",
|
|
"Motorola",
|
|
"Dell"
|
|
});
|
|
|
|
cbGarantidor.SelectedIndex = 0;
|
|
|
|
// Senha
|
|
|
|
AddSmallLabel(
|
|
cardGarantia,
|
|
"Senha garantidor",
|
|
15,
|
|
75);
|
|
|
|
var txtSenha = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(15, 95),
|
|
Size = new Size(220, 30),
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
cardGarantia.Controls.Add(txtSenha);
|
|
|
|
// Aviso
|
|
|
|
var lblAviso = new Label
|
|
{
|
|
Text =
|
|
"A fábrica/Garantidor é aquele que pagará pelo reparo do equipamento.",
|
|
|
|
Font = new Font("Segoe UI", 8f),
|
|
|
|
ForeColor = Color.FromArgb(120, 53, 15),
|
|
|
|
BackColor = Color.FromArgb(254, 249, 195),
|
|
|
|
Location = new Point(250, 95),
|
|
|
|
Size = new Size(360, 45),
|
|
|
|
TextAlign = ContentAlignment.MiddleCenter
|
|
};
|
|
|
|
cardGarantia.Controls.Add(lblAviso);
|
|
|
|
// NF Venda
|
|
|
|
AddSmallLabel(
|
|
cardGarantia,
|
|
"Nº NF de venda",
|
|
15,
|
|
150);
|
|
|
|
var txtNFVenda = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(15, 170),
|
|
Size = new Size(180, 30),
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
cardGarantia.Controls.Add(txtNFVenda);
|
|
|
|
// Certificado
|
|
|
|
AddSmallLabel(
|
|
cardGarantia,
|
|
"Nº certificado de garantia",
|
|
220,
|
|
150);
|
|
|
|
var txtCertificado = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(220, 170),
|
|
Size = new Size(390, 30),
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
cardGarantia.Controls.Add(txtCertificado);
|
|
|
|
// Compra
|
|
|
|
AddSmallLabel(
|
|
cardGarantia,
|
|
"Data da compra",
|
|
15,
|
|
215);
|
|
|
|
var dtCompra = new DateTimePicker
|
|
{
|
|
Location = new Point(15, 235),
|
|
Width = 180,
|
|
|
|
Format = DateTimePickerFormat.Short,
|
|
|
|
Font = new Font("Segoe UI", 8.5f)
|
|
};
|
|
|
|
cardGarantia.Controls.Add(dtCompra);
|
|
|
|
// Revendedor
|
|
|
|
AddSmallLabel(
|
|
cardGarantia,
|
|
"Revendedor",
|
|
220,
|
|
215);
|
|
|
|
var txtRevendedor = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(220, 235),
|
|
Size = new Size(390, 30),
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
cardGarantia.Controls.Add(txtRevendedor);
|
|
|
|
tab.Controls.Add(cardGarantia);
|
|
|
|
// =====================================================
|
|
// CARD NF ENTRADA
|
|
// =====================================================
|
|
|
|
var cardNF = CreateInternalCard(
|
|
"Nota Fiscal Entrada / Remessa",
|
|
new Rectangle(685, 15, 420, 130));
|
|
|
|
// Numero NF
|
|
|
|
AddSmallLabel(
|
|
cardNF,
|
|
"Número da NF",
|
|
15,
|
|
20);
|
|
|
|
var txtNumeroNF = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(15, 40),
|
|
Size = new Size(140, 30),
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
cardNF.Controls.Add(txtNumeroNF);
|
|
|
|
// Valor NF
|
|
|
|
AddSmallLabel(
|
|
cardNF,
|
|
"Valor da NF",
|
|
175,
|
|
20);
|
|
|
|
var txtValorNF = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(175, 40),
|
|
Size = new Size(180, 30),
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
cardNF.Controls.Add(txtValorNF);
|
|
|
|
// Emissor
|
|
|
|
var cbFornecedorNF = AddComboBox(
|
|
cardNF,
|
|
"Emissor (Fornecedor)",
|
|
15,
|
|
75,
|
|
340);
|
|
|
|
cbFornecedorNF.Items.Add("Nenhum");
|
|
cbFornecedorNF.SelectedIndex = 0;
|
|
|
|
tab.Controls.Add(cardNF);
|
|
|
|
// =====================================================
|
|
// CARD TERCEIROS
|
|
// =====================================================
|
|
|
|
var cardTerceiros = CreateInternalCard(
|
|
"Ordem de serviço de Terceiros / Parceiros",
|
|
new Rectangle(685, 160, 420, 135));
|
|
|
|
// OS Terceiro
|
|
|
|
AddSmallLabel(
|
|
cardTerceiros,
|
|
"Nº OS terceiros",
|
|
15,
|
|
20);
|
|
|
|
var txtOSTerceiros = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(15, 40),
|
|
Size = new Size(120, 30),
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
cardTerceiros.Controls.Add(txtOSTerceiros);
|
|
|
|
// OS Fabricante
|
|
|
|
AddSmallLabel(
|
|
cardTerceiros,
|
|
"Nº OS Fabricante",
|
|
160,
|
|
20);
|
|
|
|
var txtOSFabricante = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(160, 40),
|
|
Size = new Size(160, 30),
|
|
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
cardTerceiros.Controls.Add(txtOSFabricante);
|
|
|
|
// Fornecedor
|
|
|
|
var cbFornecedor = AddComboBox(
|
|
cardTerceiros,
|
|
"Emissor (Fornecedor)",
|
|
15,
|
|
75,
|
|
340);
|
|
|
|
cbFornecedor.Items.Add("Nenhum");
|
|
cbFornecedor.SelectedIndex = 0;
|
|
|
|
tab.Controls.Add(cardTerceiros);
|
|
|
|
// =====================================================
|
|
// ADD TAB
|
|
// =====================================================
|
|
|
|
tabDetalhes.TabPages.Add(tab);
|
|
}//Miscelânea
|
|
|
|
#endregion
|
|
|
|
#region Rodapé
|
|
|
|
private void BuildRodape()
|
|
{
|
|
cardRodape = CreateCard(new Rectangle(20, 900, 1130, 70), "");
|
|
|
|
cbTecnico = AddComboBox(cardRodape, "Técnico Responsável", 20, 10, 350);
|
|
|
|
cbPrioridade = AddComboBox(cardRodape, "Prioridade", 400, 10, 180);
|
|
cbPrioridade.Items.AddRange(new object[]{"Baixa","Normal", "Alta", "Urgente" ,"Emergencial"});
|
|
cbPrioridade.SelectedIndex = 1;
|
|
|
|
var btnFotos = new Button
|
|
{
|
|
Text = "Fotos / Docs",
|
|
Location = new Point(930, 20),
|
|
Size = new Size(160, 35),
|
|
FlatStyle = FlatStyle.Flat,
|
|
BackColor = AccentBlue,
|
|
ForeColor = Color.White,
|
|
Font = new Font("Segoe UI Semibold", 9f),
|
|
Cursor = Cursors.Hand
|
|
};
|
|
|
|
btnFotos.FlatAppearance.BorderSize = 0;
|
|
|
|
cardRodape.Controls.Add(btnFotos);
|
|
|
|
content.Controls.Add(cardRodape);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Helpers
|
|
|
|
private Panel CreateCard(Rectangle rect, string title)
|
|
{
|
|
var pnl = new Panel
|
|
{
|
|
Location = rect.Location,
|
|
Size = rect.Size,
|
|
BackColor = Color.White
|
|
};
|
|
|
|
pnl.Paint += CardPaint;
|
|
|
|
if (!string.IsNullOrWhiteSpace(title))
|
|
{
|
|
var lbl = new Label
|
|
{
|
|
Text = title,
|
|
Font = new Font("Segoe UI", 10f, FontStyle.Bold),
|
|
ForeColor = AccentBlue,
|
|
Location = new Point(18, 15),
|
|
AutoSize = true
|
|
};
|
|
|
|
pnl.Controls.Add(lbl);
|
|
|
|
var line = new Panel
|
|
{
|
|
BackColor = BorderColor,
|
|
Location = new Point(18, 40),
|
|
Size = new Size(rect.Width - 36, 1)
|
|
};
|
|
|
|
pnl.Controls.Add(line);
|
|
}
|
|
|
|
return pnl;
|
|
}
|
|
|
|
private LV_TEXTBOX1 AddModernInput(
|
|
Control parent,
|
|
string label,
|
|
int x,
|
|
int y,
|
|
int width,
|
|
int height = 32)
|
|
{
|
|
var lbl = new Label
|
|
{
|
|
Text = label,
|
|
Font = new Font("Segoe UI", 8.5f, FontStyle.Bold),
|
|
ForeColor = TextDark,
|
|
Location = new Point(x, y),
|
|
AutoSize = true
|
|
};
|
|
|
|
var txt = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(x, y + 20),
|
|
Size = new Size(width, height),
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue,
|
|
BackColor = Color.White
|
|
};
|
|
|
|
parent.Controls.Add(lbl);
|
|
parent.Controls.Add(txt);
|
|
|
|
return txt;
|
|
}
|
|
|
|
private LV_TEXTBOX1 AddFinanceRow(Control parent, string text, int y)
|
|
{
|
|
var lbl = new Label
|
|
{
|
|
Text = text,
|
|
Font = new Font("Segoe UI", 9f, FontStyle.Bold),
|
|
ForeColor = TextDark,
|
|
Location = new Point(20, y + 7),
|
|
AutoSize = true
|
|
};
|
|
|
|
var txt = new LV_TEXTBOX1
|
|
{
|
|
Location = new Point(140, y),
|
|
Size = new Size(180, 32),
|
|
TextAlign = HorizontalAlignment.Right,
|
|
BorderColor = BorderColor,
|
|
BorderFocusColor = AccentBlue
|
|
};
|
|
|
|
parent.Controls.Add(lbl);
|
|
parent.Controls.Add(txt);
|
|
|
|
return txt;
|
|
}
|
|
|
|
private void AddSmallLabel(Control parent, string text, int x, int y)
|
|
{
|
|
parent.Controls.Add(new Label
|
|
{
|
|
Text = text,
|
|
Font = new Font("Segoe UI", 8.5f, FontStyle.Bold),
|
|
ForeColor = TextDark,
|
|
Location = new Point(x, y),
|
|
AutoSize = true
|
|
});
|
|
}
|
|
|
|
private DateTimePicker CreatePicker(int x, int y, int width)
|
|
{
|
|
return new DateTimePicker
|
|
{
|
|
Location = new Point(x, y),
|
|
Width = width,
|
|
Format = DateTimePickerFormat.Custom,
|
|
CustomFormat = "dd/MM/yyyy HH:mm",
|
|
Font = new Font("Segoe UI", 9f)
|
|
};
|
|
}
|
|
|
|
private TabPage CreateSimpleTab(string title)
|
|
{
|
|
return new TabPage(title)
|
|
{
|
|
BackColor = Color.White
|
|
};
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Eventos Visuais
|
|
|
|
private void CardPaint(object? sender, PaintEventArgs e)
|
|
{
|
|
var pnl = sender as Panel;
|
|
|
|
using var pen = new Pen(BorderColor);
|
|
|
|
e.Graphics.DrawRectangle(
|
|
pen,
|
|
0,
|
|
0,
|
|
pnl!.Width - 1,
|
|
pnl.Height - 1);
|
|
}
|
|
|
|
private void DrawTab(object? sender, DrawItemEventArgs e)
|
|
{
|
|
var tab = tabDetalhes.TabPages[e.Index];
|
|
var rect = e.Bounds;
|
|
|
|
bool selected = e.Index == tabDetalhes.SelectedIndex;
|
|
|
|
using var back = new SolidBrush(
|
|
selected
|
|
? AccentBlue
|
|
: Color.FromArgb(230, 233, 238));
|
|
|
|
using var text = new SolidBrush(
|
|
selected
|
|
? Color.White
|
|
: TextDark);
|
|
|
|
e.Graphics.FillRectangle(back, rect);
|
|
|
|
var sf = new StringFormat
|
|
{
|
|
Alignment = StringAlignment.Center,
|
|
LineAlignment = StringAlignment.Center
|
|
};
|
|
|
|
e.Graphics.DrawString(
|
|
tab.Text,
|
|
new Font("Segoe UI", 9f, FontStyle.Bold),
|
|
text,
|
|
rect,
|
|
sf);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Métodos Abstratos
|
|
|
|
protected override void OnNovo()
|
|
{
|
|
|
|
}
|
|
|
|
protected override void OnAlterar()
|
|
{
|
|
|
|
}
|
|
|
|
protected override void OnExcluir()
|
|
{
|
|
|
|
}
|
|
|
|
protected override void OnLocalizar()
|
|
{
|
|
|
|
}
|
|
|
|
protected override void OnSalvar()
|
|
{
|
|
|
|
}
|
|
|
|
protected override void OnCancelar()
|
|
{
|
|
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |