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.
172 lines
4.0 KiB
172 lines
4.0 KiB
unit ufrmLogActions;
|
|
|
|
interface
|
|
|
|
uses
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|
System.Classes, Vcl.Graphics,
|
|
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, umstLista, Data.DB, Vcl.ExtCtrls,
|
|
Vcl.DBCtrls, Vcl.ComCtrls,
|
|
Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls, System.ImageList, Vcl.ImgList,
|
|
ZAbstractRODataset, ZDataset,
|
|
Vcl.Buttons;
|
|
|
|
type
|
|
TfrmLogActions = class(TmstLista)
|
|
ImageList1: TImageList;
|
|
GroupBox2: TGroupBox;
|
|
zroqryTableNames: TZReadOnlyQuery;
|
|
zroqryTableNamesNAMES: TWideStringField;
|
|
dtsTableNames: TDataSource;
|
|
lbl_tablenames: TLabel;
|
|
db_memo: TDBMemo;
|
|
lbl_id: TLabel;
|
|
edt_id: TEdit;
|
|
edt_action: TEdit;
|
|
lbl_action: TLabel;
|
|
dblucb_user: TDBLookupComboBox;
|
|
lbl_user: TLabel;
|
|
zroqryLog: TZReadOnlyQuery;
|
|
dtp_inicio: TDateTimePicker;
|
|
Label1: TLabel;
|
|
dtp_fim: TDateTimePicker;
|
|
lbl_intervalo: TLabel;
|
|
btn_filter: TButton;
|
|
btn_nofilter: TButton;
|
|
spdbtn_refresh: TSpeedButton;
|
|
dblucb_names: TDBLookupComboBox;
|
|
zroqryLogID_LOG: TIntegerField;
|
|
zroqryLogTX_TABELA: TWideStringField;
|
|
zroqryLogID_REGISTRO: TIntegerField;
|
|
zroqryLogTX_ACAO: TWideStringField;
|
|
zroqryLogID_USUARIO: TIntegerField;
|
|
zroqryLogDT_LOG: TDateTimeField;
|
|
zroqryLogTL_ACAO: TWideMemoField;
|
|
zroqryLogUSER_NAME: TStringField;
|
|
cb_range: TCheckBox;
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure btn_nofilterClick(Sender: TObject);
|
|
procedure spdbtn_refreshClick(Sender: TObject);
|
|
procedure btn_filterClick(Sender: TObject);
|
|
procedure grdListaTitleClick(Column: TColumn);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frmLogActions: TfrmLogActions;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses udtmSystem;
|
|
|
|
procedure TfrmLogActions.btn_filterClick(Sender: TObject);
|
|
var
|
|
tbl_name, id_reg, log_type, user, dti, dtf: string;
|
|
begin
|
|
inherited;
|
|
if dblucb_names.KeyValue <> Null then
|
|
begin
|
|
tbl_name := 'and TX_TABELA = ' + QuotedStr(dblucb_names.KeyValue);
|
|
end
|
|
else
|
|
begin
|
|
tbl_name := '';
|
|
end;
|
|
|
|
if edt_id.Text <> '' then
|
|
begin
|
|
id_reg := 'and ID_REGISTRO = ' + QuotedStr(edt_id.Text);
|
|
end
|
|
else
|
|
begin
|
|
id_reg := '';
|
|
end;
|
|
|
|
if edt_action.Text <> '' then
|
|
begin
|
|
log_type := 'and TX_ACAO = ' + QuotedStr(edt_action.Text);
|
|
end
|
|
else
|
|
begin
|
|
log_type := '';
|
|
end;
|
|
|
|
if dblucb_user.KeyValue <> Null then
|
|
begin
|
|
user := 'and ID_USUARIO = ' + QuotedStr(dblucb_user.KeyValue);
|
|
end
|
|
else
|
|
begin
|
|
user := '';
|
|
end;
|
|
|
|
if cb_range.Checked then
|
|
begin
|
|
dti := 'and CAST(DT_LOG AS DATE) >= ' +
|
|
QuotedStr(FormatDateTime('yyyy-mm-dd', dtp_inicio.Date));
|
|
dtf := 'and CAST(DT_LOG AS DATE) <= ' +
|
|
QuotedStr(FormatDateTime('yyyy-mm-dd', dtp_fim.Date));
|
|
end
|
|
else
|
|
begin
|
|
dti := '';
|
|
dtf := '';
|
|
end;
|
|
|
|
zroqryLog.Close;
|
|
zroqryLog.SQL.Text := 'SELECT * FROM SYS_LOG WHERE ID_LOG >= 0 ' + tbl_name +
|
|
id_reg + log_type + user + dti + dtf;
|
|
zroqryLog.Open;
|
|
end;
|
|
|
|
procedure TfrmLogActions.btn_nofilterClick(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
zroqryLog.Close;
|
|
zroqryLog.SQL.Text := 'SELECT * FROM SYS_LOG';
|
|
zroqryLog.Open;
|
|
zroqryLog.First;
|
|
zroqryLog.SortedFields := 'ID_LOG';
|
|
zroqryLog.SortType := stDescending;
|
|
cb_range.Checked := false;
|
|
dblucb_user.KeyValue := null;
|
|
dblucb_names.KeyValue := null;
|
|
edt_id.Text := '';
|
|
edt_action.Text := '';
|
|
end;
|
|
|
|
procedure TfrmLogActions.FormCreate(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
with dtmSystem do
|
|
begin
|
|
SetupHackedNavigator(navPrincipal, ImageList1, 's');
|
|
tblUsuariosConsulta.Open;
|
|
end;
|
|
zroqryTableNames.Open;
|
|
zroqryLog.SortedFields := 'ID_LOG';
|
|
zroqryLog.SortType := stDescending;
|
|
zroqryLog.Open;
|
|
zroqryLog.First;
|
|
dtp_inicio.Date := Date;
|
|
dtp_fim.Date := Date;
|
|
end;
|
|
|
|
procedure TfrmLogActions.grdListaTitleClick(Column: TColumn);
|
|
begin
|
|
inherited;
|
|
dtmSystem.OrganizaPorColuna(zroqryLog, Column);
|
|
end;
|
|
|
|
procedure TfrmLogActions.spdbtn_refreshClick(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
zroqryLog.Refresh;
|
|
end;
|
|
|
|
end.
|