unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, FormSize, ExtCtrls, Shader, DB, DBTables, TodoList, DBTodoList,
  StdCtrls, Buttons, AdvPanel, RzButton, ImgList, RzBorder, jpeg, RzBckgnd,ShellAPI,
  Grids, DBGrids, DBCtrls, RzTray, RzPanel, Mask, WebCopy, RzForms;

type
  TForm4 = class(TForm)
    FormSize1: TFormSize;
    Timer1: TTimer;
    RzTrayIcon1: TRzTrayIcon;
    RzFormShape1: TRzFormShape;
    Label2: TLabel;
    RzToolButton1: TRzToolButton;
    RzToolButton3: TRzToolButton;
    RzToolButton4: TRzToolButton;
    RzToolButton5: TRzToolButton;
    RzToolButton2: TRzToolButton;
    RzToolButton6: TRzToolButton;
    Label3: TLabel;
    DBTodoList1: TDBTodoList;
    procedure RzToolButton5Click(Sender: TObject);
    procedure RzToolButton4Click(Sender: TObject);
    procedure DBTodoList1ItemSelect(Sender: TObject; ATodoItem: TTodoItem);
    procedure RzBackground1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure RzToolButton3Click(Sender: TObject);
    procedure RzToolButton1Click(Sender: TObject);
    procedure Shader1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure RzToolButton2Click(Sender: TObject);
    procedure RzTrayIcon1LButtonDblClick(Sender: TObject);
    procedure AdvPanel1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure RzPanel1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    procedure RzToolButton6Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form4: TForm4;

implementation

uses Unit2, Unit1, Unit3, Unit5;

{$R *.dfm}

procedure TForm4.Shader1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
releasecapture;
perform(wm_syscommand,$f012,0);

 end;
procedure TForm4.RzToolButton1Click(Sender: TObject);
begin
form4.Close;
end;

procedure TForm4.RzToolButton3Click(Sender: TObject);
begin
form1.ADOTable1.Active:=false;
form3.ADOTable1.Active:=false;
form1.ADOTable1.Active:=true;
form3.ADOTable1.Active:=true;
form1.ADOTable1.Insert;
form2.RzPageControl1.ActivePageIndex:=0;
form2.TabSheet4.Enabled:=true;
form2.show;
end;

procedure TForm4.RzBackground1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
releasecapture;
perform(wm_syscommand,$f012,0);

end;

procedure TForm4.DBTodoList1ItemSelect(Sender: TObject; ATodoItem: TTodoItem);
begin
form1.ADOTable1.RecNo:=DBTodoList1.Selected.Index+1;
if form5.dbedit1.Text='TRUE' then
RzToolButton6.Caption:='Unrefuse'
else
RzToolButton6.Caption:='Refuse';
RzToolButton4.Enabled:=true;
RzToolButton6.Enabled:=true;
end;

procedure TForm4.RzToolButton4Click(Sender: TObject);
begin
form2.RzPageControl1.ActivePageIndex:=0;
form2.Show;
RzToolButton4.Enabled:=false;
RzToolButton6.Enabled:=false;
form2.TabSheet4.Enabled:=false;
end;

procedure TForm4.RzToolButton5Click(Sender: TObject);
begin
ShellExecute(0,'open','http://www.ntxsoft.com','','',SW_SHOWMAXIMIZED);
end;

procedure TForm4.Button2Click(Sender: TObject);
begin
form3.ADOTable1.Active:=false;
end;

procedure TForm4.Button3Click(Sender: TObject);
begin
form3.ADOTable1.Active:=true;
end;

procedure TForm4.Timer1Timer(Sender: TObject);
var
  i:integer;
begin
form1.adotable1.First;
For i := 0 to form1.adotable1.RecordCount-1 do
  begin
    if date>strtodate(form3.dbedit8.text) then
    form5.show
       else
    if StrToTime(form3.edit3.text)>strtotime(form3.dbedit7.text) then
    form5.show;
       form1.adotable1.Next;
  end;
begin
timer1.Enabled:=false;
end;
end;

procedure TForm4.FormCreate(Sender: TObject);
begin
timer1.Enabled:=true;
SetWindowLong(Application.Handle, GWL_EXSTYLE, WS_EX_TOOLWINDOW);
CreateMutex(nil,FALSE,'PROGRAMADI');
if GetLastError = ERROR_ALREADY_EXISTS then
begin
  ShowMessage('Program still running...');
  Halt(0);
end;
 end;
procedure TForm4.RzToolButton2Click(Sender: TObject);
begin
form4.WindowState:=wsMinimized;
end;

procedure TForm4.RzTrayIcon1LButtonDblClick(Sender: TObject);
begin
form4.WindowState:=wsNormal;
end;

procedure TForm4.AdvPanel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
releasecapture;
perform(wm_syscommand,$f012,0);
end;

procedure TForm4.RzPanel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
releasecapture;
perform(wm_syscommand,$f012,0);
end;

procedure TForm4.RzToolButton6Click(Sender: TObject);
begin
if rztoolbutton6.Caption='Refuse' then
begin
form1.ADOTable1.Edit;
form5.DBEdit1.Text:='TRUE';
form1.ADOTable1.Post;
end;
if rztoolbutton6.Caption='Unrefuse' then
begin
form1.ADOTable1.Edit;
form5.DBEdit1.Text:='FALSE';
form1.ADOTable1.Post;
end;
RzToolButton4.Enabled:=false;
RzToolButton6.Enabled:=false;
form1.ADOTable1.Active:=false;
form3.ADOTable1.Active:=false;
form1.ADOTable1.Active:=true;
form3.ADOTable1.Active:=true;
rztoolbutton6.Caption:='Refuse';
end;

end.
