⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsss_pas.~pas

📁 delphi6.0电子寻更源程序,用来计算保安有无查抄
💻 ~PAS
📖 第 1 页 / 共 2 页
字号:
 exit;
 end;
 except
 on E: EConvertError do
     begin
       Application.MessageBox('請輸入整數!','消息',MB_ICONINFORMATION);
       edit5.text:='';
       edit5.SetFocus;
       exit;
     end;
 end;//try
end; }
end;

procedure Tclass_form.Edit1Exit(Sender: TObject);
begin
{IF trim(EDIT5.Text)='' THEN
edit5.Text:='0';
if trim(edit1.Text)<>'' then
begin
 try//try
 if strtoint(edit1.text)<0 then
 begin
 Application.MessageBox('請輸入大於零的數位','消息',MB_ICONINFORMATION);
 edit1.SetFocus ;
 edit1.Text:='';
 exit;
 end;
 except
 on E: EConvertError do
     begin
       Application.MessageBox('請輸入整數!','消息',MB_ICONINFORMATION);
       edit1.text:='';
       edit1.SetFocus;
       exit;
     end;
 end;//try
end;
}end;

procedure Tclass_form.DateTimePicker1Exit(Sender: TObject);
begin
//if edit6.Text='' then
//edit6.Text:=inttostr(dectime(datetimepicker1.time,datetimepicker2.time));
end;

procedure Tclass_form.DBGrid1CellClick(Column: TColumn);
begin
{with dm_class_form.q_class do
begin
open;
dblookupcombobox1.KeyValue:=fieldbyname('linename').asstring;
edit1.text:=inttostr(fieldbyname('dgpcxx').asinteger);
edit2.Text:=fieldbyname('shifts').asstring;
edit5.Text:=inttostr(fieldbyname('dgpcsx').asinteger);
edit6.Text:=inttostr(fieldbyname('chkcycl').asinteger);
datetimepicker1.Time:=fieldbyname('firstp').asdatetime;
datetimepicker2.Time:=fieldbyname('lastp').asdatetime;
end;}
 end;
procedure Tclass_form.DBGrid1KeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
{if (key=vk_up) or (key=vk_down) then
begin
  with dm_class_form.q_class do
begin
open;
dblookupcombobox1.KeyValue:=fieldbyname('linename').asstring;
edit1.text:=inttostr(fieldbyname('dgpcxx').asinteger);
edit2.Text:=fieldbyname('shifts').asstring;
edit5.Text:=inttostr(fieldbyname('dgpcsx').asinteger);
edit6.Text:=inttostr(fieldbyname('chkcycl').asinteger);
datetimepicker1.Time:=fieldbyname('firstp').asdatetime;
datetimepicker2.Time:=fieldbyname('lastp').asdatetime;
end;
end; }
end;

procedure Tclass_form.BitBtn5Click(Sender: TObject);
var bookmark1:tbookmark ;
recno1,recno2:integer;
begin
{with dm_class_form.q_class  do
begin
   open;
//last;
  bookmark1:=getbookmark;
  recno1:=RecNo;
    try   //try
      if dblookupcombobox1.KeyValue =null then
      begin
      Application.MessageBox('請輸入線路!','消息',MB_ICONINFORMATION);
      dblookupcombobox1.SetFocus;
      exit;
      end;
      if edit2.Text='' then
      begin
      Application.MessageBox('請輸入班次!','消息',MB_ICONINFORMATION);
      edit2.SetFocus ;
      exit;
      end  ;
      if edit6.Text='' then
      begin
      Application.MessageBox('請輸入周期!') ;
      edit6.SetFocus ;
     //gotobookmark(bookmark1);
     //freebookmark(bookmark1);
      exit;
      end
        else
        begin
        if strtoint(edit6.text)<dectime(datetimepicker1.Time,datetimepicker2.Time ) then
          begin
          Application.MessageBox('巡更周期不能小於班次的下班時間與上班時間之差!','消息',MB_ICONINFORMATION);
          edit6.Text:='';
          edit6.SetFocus;
          exit;
          end;
        end;
      if edit5.Text='' then
      begin
      Application.MessageBox('請輸入偏差上限!','消息',MB_ICONINFORMATION);
      edit5.SetFocus ;
      exit;
      end;
      if edit1.Text='' then
      begin
      Application.MessageBox('請輸入偏差下限!','消息',MB_ICONINFORMATION);
      edit6.SetFocus ;
      exit;
      end;
      if recno1<0 then
       begin       //增加信息
         dm_class_form.q_find.close;
         dm_class_form.q_find.open;
         if dm_class_form.q_find.Locate('linename;shifts',vararrayOf([dblookupcombobox1.KeyValue ,edit2.text]),[loCaseInsensitive]) then
          begin
          Application.MessageBox('該線路上已有相同的班次,請重新選擇班次!','消息',MB_ICONINFORMATION);
          edit2.SetFocus ;
          edit2.Text:='';
          exit;
          end;
       append;
       edit;
       fieldbyname('linename').asstring:=uppercase(dblookupcombobox1.Text);
       fieldbyname('shifts').asstring:=uppercase(edit2.Text);
       fieldbyname('firstp').asdatetime:=datetimepicker1.Time ;
       fieldbyname('lastp').asdatetime:=datetimepicker2.Time;
       fieldbyname('chkcycl').asinteger:=strtoint(edit6.Text);
       fieldbyname('dgpcsx').asinteger:=strtoint(edit5.text);
       fieldbyname('dgpcxx').asinteger:=strtoint(edit1.Text);
       post;
       end  //增加信息
       else
       begin//修改信息
        dm_class_form.q_find.close;
         dm_class_form.q_find.open;
         if Locate('linename;shifts',vararrayOf([dblookupcombobox1.KeyValue ,edit2.text]),[loCaseInsensitive]) then
           begin
           recno2:=RecNo;
              if recno1<>recno2 then
                begin
                Application.MessageBox('該線路上已有相同的次序號!','消息',MB_ICONINFORMATION);
                edit2.SetFocus ;
                gotobookmark(bookmark1);
                exit;
                end;
           end;
       edit;
       fieldbyname('linename').asstring:=uppercase(dblookupcombobox1.Text);
       fieldbyname('shifts').asstring:=uppercase(edit2.Text);
       fieldbyname('firstp').asdatetime:=datetimepicker1.Time ;
       fieldbyname('lastp').asdatetime:=datetimepicker2.Time;
       fieldbyname('chkcycl').asinteger:=strtoint(edit6.Text);
       fieldbyname('dgpcsx').asinteger:=strtoint(edit5.text);
       fieldbyname('dgpcxx').asinteger:=strtoint(edit1.Text);
       post;
       end;        //修改信息
    except
      begin
      Application.MessageBox('資料錄入有誤,請重新輸入','消息',MB_ICONINFORMATION);
      exit;
      end;
    end; // end try
  end;
  bitbtn1.Enabled:=true;
  bitbtn2.Enabled:=true;
}end;
procedure Tclass_form.PageControl1Change(Sender: TObject);
begin
 if PageControl1.ActivePage=tabsheet2 then
    begin
    dblookupcombobox2.SetFocus ;
    with dm_class_form.q_view do
        begin
        close;
        sql.Clear ;
        sql.Add('select * from shiftrule');
        open;
        end;
    end;

end;

procedure Tclass_form.BitBtn10Click(Sender: TObject);
begin
with dm_class_form do
begin
q_class.close;
q_line.close;
q_find.close;
q_view.close;
q_shift.close;
end;
close;
end;

procedure Tclass_form.BitBtn7Click(Sender: TObject);
begin
with dm_class_form.q_view do
begin
close;
sql.clear;
sql.add('select * from shiftrule');
sql.add('order by linename') ;
open;
end;
dblookupcombobox2.KeyValue:=null;
edit3.keyvalue:=null;
end;

procedure Tclass_form.BitBtn4Click(Sender: TObject);
begin
with dm_class_form.q_view do
begin
close;
sql.Clear ;
sql.Add('select * from shiftrule');
sql.Add('where (linename<>'''')');
if dblookupcombobox2.KeyValue <>null then
begin
sql.add('and(linename like :linename)');
parambyname('linename').asstring:='%'+varastype(dblookupcombobox2.keyvalue,varstring)+'%';
end;
if edit3.Text<>''   then
begin
sql.add('and(shifts like :shifts)');
parambyname('shifts').asstring:='%'+varastype(edit3.keyvalue,varstring)+'%';
end;
open;
end;
end;

procedure Tclass_form.FormCreate(Sender: TObject);
begin
if not assigned(DM_class_form) then
  Application.CreateForm(TDM_class_form, dm_class_form);
end;

procedure Tclass_form.FormClose(Sender: TObject; var Action: TCloseAction);
begin
dm_class_form.free;
dm_class_form:=nil;
action:=cafree;
class_form :=nil ;
end;

procedure Tclass_form.BitBtn9Click(Sender: TObject);
begin
add_class:=tadd_class.Create(self);
add_class.Caption:='修改巡更班次資訊' ;
with dm_class_form.q_class do
begin
add_class.DBLookupComboBox1.KeyValue:=fieldbyname('linename').asstring;
add_class.e_linename:=fieldbyname('linename').asstring;
add_class.edit1.text:=inttostr(fieldbyname('dgpcxx').asinteger);
add_class.edit2.Text:=fieldbyname('shifts').asstring;
add_class.e_shifts:=fieldbyname('shifts').asstring;
add_class.e_time.text:=inttostr(fieldbyname('times').asinteger);
add_class.edit5.Text:=inttostr(fieldbyname('dgpcsx').asinteger);
add_class.edit6.Text:=inttostr(fieldbyname('chkcycl').asinteger);
add_class.datetimepicker1.Time:=fieldbyname('firstp').asdatetime;
add_class.datetimepicker2.Time:=fieldbyname('lastp').asdatetime;
end;
add_class.showmodal;
add_class.free;

end;

procedure Tclass_form.edit1Change(Sender: TObject);
begin
with dm_class_form.q_class do
begin
first;
Locate('linename',edit1.text,[loCaseInsensitive,loPartialKey]);
end;
end;
procedure Tclass_form.BitBtn8Click(Sender: TObject);
begin
dm_class_form.q_view.DisableControls;
class_print:=tclass_print.Create(self);
class_print.QRLabel11.Caption:=password.ComboBox1.Text  ;
class_print.QuickRep1.Preview;
class_print.QuickRep1.free;
dm_class_form.q_view.enableControls;

end;

procedure Tclass_form.Button1Click(Sender: TObject);
begin
Application.MessageBox(Pchar('width='+inttostr(self.width)+'--'+'height='+inttostr(self.height)+'--'+'left='+inttostr(self.left)+'--top='+inttostr(self.top)),'消息',MB_ICONINFORMATION);

end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -