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

📄 penaltyfrm.pas

📁 结合读卡器使用。程序中有按迟到时间长短自动开罚单功能
💻 PAS
字号:
unit Penaltyfrm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons, ComCtrls,Strutils;


type
  TPenaltyForm = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    ComboBox1: TComboBox;
    Label2: TLabel;
    ComboBox2: TComboBox;
    Label3: TLabel;
    Edit1: TEdit;
    Memo1: TMemo;
    Label4: TLabel;
    BitBtn5: TBitBtn;
    BitBtn4: TBitBtn;
    Label5: TLabel;
    DateTimePicker1: TDateTimePicker;
    Label6: TLabel;
    ComboBox3: TComboBox;
    procedure FormShow(Sender: TObject);
    procedure ComboBox1Change(Sender: TObject);
    procedure BitBtn4Click(Sender: TObject);
    procedure ComboBox3Change(Sender: TObject);
  private
    IPStr:String;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  PenaltyForm: TPenaltyForm;

implementation
uses Datamodule1;

{$R *.dfm}

procedure TPenaltyForm.FormShow(Sender: TObject);
begin
   ComboBox1.Text :='';
   ComboBox2.Text :='';
   ComboBox3.Items.Clear;
   DateTimePicker1.Date :=Date;
   Edit1.Text :='';
   Memo1.Text :='';
   With DM.TBIP do
   begin
      Open;
      First;
      while not eof do
      begin
        ComboBox3.Items.Add(FieldByName('Machine').AsString+'     '+
          FieldByName('Address').AsString);
        Next;
      end;
      close;
   end;
  GetComboBoxItem(ComboBox2);
end;

procedure TPenaltyForm.ComboBox1Change(Sender: TObject);
begin
    if ComboBox1.ItemIndex=1 then ComboBox2.Text :=CurrentDutyMan;
end;

procedure TPenaltyForm.BitBtn4Click(Sender: TObject);
begin
  try
   DM.Database1.StartTransaction;
   with DM.TBJiangFa do
   begin
       Open;
       Append;
       
       FieldByName('F_Object').AsString :=ComboBox1.Text;
       FieldByName('F_Name').AsString :=ComboBox2.Text;
       FieldByName('F_Date').AsDateTime :=DateTimePicker1.Date;
       FieldByName('F_Number').AsInteger :=StrToInt(Edit1.Text);
       FieldByName('F_Memo').AsString :=Memo1.Text;
       if ComboBox1.ItemIndex <3 then FieldByName('F_JorF').AsString :='处罚'
       else FieldByName('F_JorF').AsString :='奖励';
       Post;
       close;
       MessageBox(Application.Handle,'发送成功!',
       '提示',MB_OK+MB_ICONINFORMATION+MB_SYSTEMMODAL);
    end;
    DM.Database1.Commit;
   // DM.CSShu.Service :=IPStr;
    DM.CSShu.Socket.SendText('奖罚单');
   except
    DM.Database1.Rollback;
    MessageBox(Application.Handle,pchar(ErrAct),
    '提示',MB_OK+MB_ICONERROR+MB_SYSTEMMODAL);
   end;


end;

procedure TPenaltyForm.ComboBox3Change(Sender: TObject);
begin
    IPStr:=TrimLeft(RightStr(ComboBox3.Text,14));
end;

end.

⌨️ 快捷键说明

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