You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
3.4 KiB
125 lines
3.4 KiB
unit ucadPoli_Faixa;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, umstMaster, Vcl.ComCtrls, Vcl.StdCtrls,
|
|
Vcl.DBCtrls, Data.DB, Vcl.Mask;
|
|
|
|
type
|
|
TcadPoli_Faixa = class(TmstMaster)
|
|
rbtn_politica: TRadioButton;
|
|
rbtn_faixa: TRadioButton;
|
|
lbl_nomepol: TLabel;
|
|
lbl_nomefaixa: TLabel;
|
|
edt_pol: TEdit;
|
|
edt_faixa: TEdit;
|
|
btn_ok: TButton;
|
|
btn_cancelar: TButton;
|
|
lbl_faixaatraso: TLabel;
|
|
lbl_ligaatraso: TLabel;
|
|
edt_faixaini: TEdit;
|
|
edt_faixafim: TEdit;
|
|
procedure rbtn_politicaClick(Sender: TObject);
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure rbtn_faixaClick(Sender: TObject);
|
|
procedure btn_okClick(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
tipo_add : string;
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
cadPoli_Faixa: TcadPoli_Faixa;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses udtmSystem;
|
|
|
|
//cadastro de políticas/faixas
|
|
|
|
procedure TcadPoli_Faixa.btn_okClick(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
if rbtn_politica.Checked then
|
|
begin
|
|
if edt_pol.Text <> '' then
|
|
begin
|
|
//se política foi selecionado adiciona uma nova entrada na tabela de políticas com o id da
|
|
//empresa em que o usuário estava
|
|
dtmSystem.dtsPoliticas.DataSet.Append;
|
|
dtmSystem.tblPoliticasTX_DESCRICAO.AsString := edt_pol.Text;
|
|
end else
|
|
begin
|
|
MessageDlg('Insira um nome para a política.',mtError,[mbOK],0);
|
|
ModalResult := mrNone;
|
|
end;
|
|
end;
|
|
if rbtn_faixa.Checked then
|
|
begin
|
|
if dtmSystem.tblPoliticas.IsEmpty then
|
|
begin
|
|
MessageDlg('Não há políticas para inserir esta faixa. Crie uma nova política primeiro.',mtError,[mbOK],0);
|
|
ModalResult := mrNone;
|
|
exit;
|
|
end;
|
|
|
|
if edt_faixa.Text <> '' then
|
|
begin
|
|
//se faixa foi selecionado adiciona uma nova entrada na tabela de faixas com o id
|
|
//da política em que o usuário estava
|
|
dtmSystem.dtsFaixas.DataSet.Append;
|
|
dtmSystem.tblFaixasTX_DESCRICAO.AsString := edt_faixa.Text;
|
|
dtmSystem.dtsFaixas.DataSet.Post;
|
|
//dtmSystem.tblFaixasID_POLITICA.AsString := dtmSystem.tblPoliticasID_POLITICA.AsString;
|
|
end else
|
|
begin
|
|
MessageDlg('Insira um nome para a faixa.',mtError,[mbOK],0);
|
|
ModalResult := mrNone;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadPoli_Faixa.FormCreate(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
//inicializa algumas variáveis usadas
|
|
rbtn_politica.Checked := false;
|
|
rbtn_faixa.Checked := false;
|
|
edt_pol.Enabled := false;
|
|
edt_faixa.Enabled := false;
|
|
end;
|
|
|
|
procedure TcadPoli_Faixa.rbtn_faixaClick(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
//toggle checked e algumas funcionalidades
|
|
if rbtn_faixa.Checked then
|
|
begin
|
|
edt_pol.Enabled := false;
|
|
rbtn_politica.Checked := false;
|
|
edt_faixa.Enabled := true;
|
|
edt_faixaini.Enabled := true;
|
|
edt_faixafim.Enabled := true;
|
|
end;
|
|
end;
|
|
|
|
procedure TcadPoli_Faixa.rbtn_politicaClick(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
//toggle checked e algumas funcionalidades
|
|
if rbtn_politica.Checked then
|
|
begin
|
|
edt_pol.Enabled := true;
|
|
rbtn_faixa.Checked := false;
|
|
edt_faixa.Enabled := false;
|
|
edt_faixaini.Enabled := false;
|
|
edt_faixafim.Enabled := false;
|
|
end;
|
|
end;
|
|
end.
|