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

📄 giveprizefrm.pas

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

interface

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

type
  TGivePrizeForm = class(TForm)
    Panel1: TPanel;
    BitBtn1: TBitBtn;
    BitBtn5: TBitBtn;
    Label2: TLabel;
    DateTimePicker1: TDateTimePicker;
    Label3: TLabel;
    Label4: TLabel;
    Label1: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    ComboBox1: TComboBox;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    procedure SaveData;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  GivePrizeForm: TGivePrizeForm;

implementation
uses Datamodule1;

{$R *.dfm}

procedure TGivePrizeForm.BitBtn1Click(Sender: TObject);
begin
   if (isfloat(Edit5.Text)) and (ComboBox1.Text<>'') then SaveData
   else   MessageBox(Application.Handle,pchar(ErrAct),
    '提示',MB_OK+MB_ICONERROR+MB_SYSTEMMODAL);
end;

procedure TGivePrizeForm.FormShow(Sender: TObject);
begin
   DateTimePicker1.Date :=Date;
   Edit1.Text :='';
   Edit2.Text :='';
   Edit3.Text :='';
   Edit4.Text :='';
   Edit5.Text :='';
   ComboBox1.Text :='';
   GetComboboxItem(ComboBox1);
   ComboBox1.Text :=CurrentWorker;
end;

procedure TGivePrizeForm.SaveData;
begin
   try
   DM.Database1.StartTransaction;
   with DM.qryPrize do
   begin
      Close;
      SQL.Clear;
      SQL.Add('Insert into GivePrize(G_Date,G_ManName,G_ManCode,G_ManAddress,G_Goods,G_Cash,G_ManageMan)');
      SQL.Add('Values(:varDate,:varManName,:varManCode,:varManAddress,:varGoods,:varCash,:varManageMan)');
      params[0].AsDatetime :=DateTimepicker1.Date;
      Params[1].AsString :=Edit1.Text;
      Params[2].AsString :=Edit2.Text;
      Params[3].AsString :=Edit3.Text;
      Params[4].AsString :=Edit4.Text;
      Params[5].Asfloat :=StrToFloat(Edit5.Text);
      Params[6].AsString :=ComboBox1.Text;
      ExecSQL;
   end;
      DM.Database1.Commit;
      MessageBox(Application.Handle,'保存成功!',
    '提示',MB_OK+MB_ICONINFORMATION+MB_SYSTEMMODAL);
   except
      DM.Database1.Rollback;
      MessageBox(Application.Handle,pchar(ErrAct),
    '提示',MB_OK+MB_ICONERROR+MB_SYSTEMMODAL);
   end;
end;

end.

⌨️ 快捷键说明

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