📄 viptz.pas
字号:
unit viptz;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Menus, ComCtrls, ToolWin, Buttons, StdCtrls, AppEvnts,
LabelButton, TradeImage, MaskImageButton, MoveImageButton, DB, Grids,
DBGrids;
type
Tfrm_viptz = class(TForm)
palUp: TPanel;
palLeftUp: TPanel;
imgLeftUp: TImage;
palRightUp: TPanel;
imgRightUp: TImage;
palUpMid: TPanel;
imgCaption: TImage;
palDown: TPanel;
imgLeftDown: TImage;
imgRightDown: TImage;
imgDownMin: TImage;
palLeft: TPanel;
palRight: TPanel;
imgRight: TImage;
imgCloseButton: TImage;
imgMinButton: TImage;
imgSizeButton: TImage;
imgMaxButton: TImage;
imgRestoreButton: TImage;
imgSysIcon: TImage;
popSystemMenu: TPopupMenu;
N_Restore: TMenuItem;
N_Max: TMenuItem;
N_Min: TMenuItem;
N_Move: TMenuItem;
N_Size: TMenuItem;
N_Speater: TMenuItem;
N_Close: TMenuItem;
palClient: TPanel;
lbCaption: TLabel;
CoolBarMenu: TCoolBar;
ToolBarMenu: TToolBar;
imgLeft: TImage;
imgColorLeftUp: TImage;
imgGrayCaption: TImage;
imgGrayMenuBar: TImage;
imgGrayRightUp: TImage;
imgColorCaption: TImage;
imgGrayLeftUp: TImage;
imgColorRightUp: TImage;
imgRightUp1: TImage;
imgLeftUp1: TImage;
imgColorMenubar: TImage;
GroupBox1: TGroupBox;
Label1: TLabel;
Label2: TLabel;
e_zh: TEdit;
e_name: TEdit;
Label3: TLabel;
Label4: TLabel;
e_date: TEdit;
e_zlx: TEdit;
GroupBox2: TGroupBox;
DBGrid1: TDBGrid;
Label5: TLabel;
e_qk: TEdit;
Label6: TLabel;
e_hk: TEdit;
b_tz: TMoveImgBtn;
b_exit: TMoveImgBtn;
blabel_tz: TLabelBtn;
blabel_exit: TLabelBtn;
DataSource1: TDataSource;
Label7: TLabel;
e_yj: TEdit;
procedure imgMinButtonClick(Sender: TObject);
procedure imgSizeButtonClick(Sender: TObject);
procedure imgCloseButtonClick(Sender: TObject);
procedure imgCaptionMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure imgCaptionMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure imgCaptionMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure imgSysIconMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure popSystemMenuPopup(Sender: TObject);
procedure N_SizeClick(Sender: TObject);
procedure N_MoveClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure e_zhExit(Sender: TObject);
procedure e_zhKeyPress(Sender: TObject; var Key: Char);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure b_tzClick(Sender: TObject);
procedure b_exitClick(Sender: TObject);
private
{ Private declarations }
canmove:boolean;
curPoint:TPoint;
oldPoint:TPoint;
Canvas:TCanvas;
protected
procedure CreateParams(var Params:TCreateParams);override;
procedure WMActivate(var Msg:TWMACTIVATE); message WM_ACTIVATE;
public
{ Public declarations }
end;
var
frm_viptz: Tfrm_viptz;
implementation
uses datam;
{$R *.dfm}
procedure Tfrm_viptz.CreateParams(var Params:TCreateParams);
begin
inherited CreateParams(Params);
if BorderStyle<>bsNone then
Params.Style :=WS_THICKFRAME or WS_POPUP or WS_BORDER;
end;
procedure Tfrm_viptz.imgMinButtonClick(Sender: TObject);
begin
if Application.MainForm =self then
Application.Minimize
else
DefWindowProc(Handle, WM_SYSCOMMAND, SC_MINIMIZE, 0);
end;
procedure Tfrm_viptz.imgSizeButtonClick(Sender: TObject);
begin
if self.WindowState = wsNormal then
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
imgSizeButton.Picture :=imgRestoreButton.Picture;
end
else
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_RESTORE, 0);
imgSizeButton.Picture :=imgMaxButton.Picture;
end;
end;
procedure Tfrm_viptz.imgCloseButtonClick(Sender: TObject);
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_CLOSE, 0);
end;
procedure Tfrm_viptz.imgCaptionMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (Button=mbLeft)and(ssLeft in Shift)then
begin
canmove:=true;
Canvas:=TCanvas.Create;
with Canvas do
begin
pen.Style :=psdot;
brush.Style :=bsClear;
pen.Width :=2;
Pen.Mode :=pmNotXor;
Handle :=GetDC(0);
Rectangle(left,top,Left+width,top+height);
curPoint.X :=X;
curPoint.Y :=Y;
oldPoint.X :=Left;
oldPoint.Y :=Top;
end; //end with
end; //end if
end;
procedure Tfrm_viptz.imgCaptionMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if not canmove then exit;
with Canvas do
begin
Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
oldPoint.x :=Left +X-curPoint.x;
oldPoint.y :=Top +Y-curPoint.y;
Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
end;
end;
procedure Tfrm_viptz.imgCaptionMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if not canmove then exit;
with Canvas do
begin
Rectangle(oldPoint.x,oldPoint.y,oldPoint.x+Width,oldPoint.y+Height);
Left :=oldPoint.x;
Top :=oldPoint.y;
Free;
end;
canmove:=not canmove;
end;
procedure Tfrm_viptz.FormCreate(Sender: TObject);
begin
lbCaption.Caption :=Caption;
end;
procedure Tfrm_viptz.imgSysIconMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
PopSystemMenu.Popup(Left+ImgSysIcon.Left,Top+ImgSysIcon.Top+ImgSysIcon.Height);
end;
procedure Tfrm_viptz.popSystemMenuPopup(Sender: TObject);
begin
N_Restore.Enabled :=imgSizeButton.Visible and (WindowState =wsMaximized);
N_Max.Enabled :=imgSizeButton.Visible and (WindowState =wsNormal);
N_Size.Enabled :=imgSizeButton.Visible ;
n_min.Enabled:=imgMinButton.Visible;
end;
procedure Tfrm_viptz.N_SizeClick(Sender: TObject);
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_SIZE, 0);
end;
procedure Tfrm_viptz.N_MoveClick(Sender: TObject);
begin
DefWindowProc(Handle, WM_SYSCOMMAND, SC_MOVE, 0);
end;
procedure Tfrm_viptz.FormShow(Sender: TObject);
begin
if WindowState=wsNormal then
imgSizeButton.Picture.Bitmap :=imgMaxButton.Picture.Bitmap
else if WindowState=wsMaximized then
imgSizeButton.Picture.Bitmap :=imgRestoreButton.Picture.Bitmap;
e_zh.SetFocus();
e_qk.Text:='0.00';
e_hk.Text:='0.00';
end;
procedure Tfrm_viptz.WMActivate(var Msg: TWMACTIVATE);
begin
if (Msg.Active =WA_ACTIVE) or (Msg.Active =WA_CLICKACTIVE) then
begin
imgCaption.Picture.Bitmap :=imgColorCaption.Picture.Bitmap;
imgLeftUp1.Picture.Bitmap :=imgColorLeftUp.Picture.Bitmap;
imgRightUp1.Picture.Bitmap :=imgColorRightUp.Picture.Bitmap;
coolBarMenu.Bitmap :=imgColorMenubar.Picture.Bitmap;
end
else begin
imgCaption.Picture.Bitmap :=imgGrayCaption.Picture.Bitmap;
imgLeftUp1.Picture.Bitmap :=imgGrayLeftUp.Picture.Bitmap;
imgRightUp1.Picture.Bitmap :=imgGrayRightUp.Picture.Bitmap;
coolBarMenu.Bitmap :=imgGrayMenubar.Picture.Bitmap;
end;
end;
procedure Tfrm_viptz.e_zhExit(Sender: TObject);
begin
if e_zh.Text='' then exit
else
begin
if Length(e_zh.Text)<5 then
case Length(e_zh.Text) of
1: e_zh.text:='0000'+e_zh.text;
2: e_zh.text:='000'+e_zh.text;
3: e_zh.text:='00'+e_zh.text;
4: e_zh.text:='0'+e_zh.text;
end
end;
if dm.ADO_vip.Locate('证号',e_zh.Text,[]) then
begin
e_name.Text:=dm.ADO_vip.fieldbyname('姓名').AsString;
e_date.Text:=dm.ADO_vip.fieldbyname('办证日期').AsString;
e_zlx.Text:=dm.ADO_vip.fieldbyname('证类型').AsString;
e_yj.Text:=formatfloat('0.00',dm.ADO_vip.fieldbyname('押金').Asfloat);
dm.ADO_qk.Open;
dm.ADO_qk.First;
if dm.ADO_qk.Locate('证号',e_zh.Text,[]) then
e_qk.Text:=formatfloat('0.00',dm.ADO_qk.FieldByName('金额').AsFloat);
dm.ADOQ_cx.Close;
dm.ADOQ_cx.SQL.Clear;
dm.ADOQ_cx.SQL.add('select 编号,名称,出租日期 from czb where 证号='+'"'+e_zh.Text+'"');
dm.ADOQ_cx.Open;
end;
end;
procedure Tfrm_viptz.e_zhKeyPress(Sender: TObject; var Key: Char);
begin
if not ( Key in ['0'..'9',#13,#8]) then Key := #0;
if key=#13 then
begin
e_hk.SetFocus();
end;
end;
procedure Tfrm_viptz.FormClose(Sender: TObject; var Action: TCloseAction);
begin
dm.ADOQ_cx.Close;
dm.ADOQ_cx.SQL.Clear;
dm.ado_qk.Close;
dm.ADO_cash.Close;
dm.ADO_czb.Close;
release;
end;
procedure Tfrm_viptz.b_tzClick(Sender: TObject);
begin
if e_hk.Text='' then e_hk.Text:='0.00';
if e_name.Text='' then exit;
if not dm.ADOQ_cx.IsEmpty then
begin
application.MessageBox(pchar('存在未还资料,不能退证!'),pchar('提示'),48);
exit;
end;
if e_qk.Text<>e_hk.Text then
begin
application.MessageBox(pchar('欠款未结清,不能退证!'),pchar('提示'),48);
exit;
end;
//删除欠款记录
if dm.ADO_qk.Locate('证号',e_zh.Text,[]) then
dm.ado_qk.Delete;
dm.ADO_qk.Close;
if e_yj.text<>'0.00' then
begin
dm.ADO_cash.Open;
dm.ADO_cash.AppendRecord([e_zh.text,date(),'退会员押金','0.00',e_yj.text]);
dm.ADO_cash.Close;
end;
if e_hk.text<>'0.00' then
begin
dm.ADO_cash.Open;
dm.ADO_cash.AppendRecord([e_zh.text,date(),'收租金',e_hk.text,'0.00']);
dm.ADO_cash.Close;
end;
dm.ADO_vip.Delete;
application.MessageBox(pchar('会员退证完成!'),pchar('提示'),64);
close;
end;
procedure Tfrm_viptz.b_exitClick(Sender: TObject);
begin
close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -