📄 cjuserinfofm.pas
字号:
unit CjUserInfoFM;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ChildFM, StdCtrls, Buttons, Grids, DBGrids, ExtCtrls;
type
TFM_CjUserInfo = class(Tfm_Child)
pnl_Top: TPanel;
dbgd_Client: TDBGrid;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
edt_CZH: TEdit;
edt_Telephone: TEdit;
edt_UserName: TEdit;
btn_Query: TBitBtn;
Label4: TLabel;
cb_type: TComboBox;
pnl_Bottom: TPanel;
shp_warningColor: TShape;
Label5: TLabel;
lbl_Num: TLabel;
Label6: TLabel;
lbl_WarningVal: TLabel;
Label8: TLabel;
Label9: TLabel;
lbl_largeQfeeNum: TLabel;
sb_largeQfee: TSpeedButton;
clrDlg_Warning: TColorDialog;
procedure FormCreate(Sender: TObject);
procedure btn_QueryClick(Sender: TObject);
procedure dbgd_ClientDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure shp_warningColorMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure sb_largeQfeeClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
FLargeQfeeUserNum:integer;
FLargeQfeeWarningVal:integer;
FLargeQfeeWarningColor:TColor;
public
{ Public declarations }
end;
var
FM_CjUserInfo: TFM_CjUserInfo;
implementation
uses CommonDataDM,SystemDM,lQFWarningValFM;
{$R *.DFM}
procedure TFM_CjUserInfo.FormCreate(Sender: TObject);
begin
inherited;
edt_CZH.Text :='';
edt_Telephone.Text :='';
edt_UserName.Text :='';
cb_Type.ItemIndex :=0;
FLargeQfeeWarningVal:=strtoInt(SysDM.ReadIni('system','LargeQfeeWarningVal','100'));
lbl_WarningVal.Caption :=IntToStr(FLargeQfeeWarningVal);
FLargeQfeeWarningColor:=strToInt(SysDM.ReadIni('system','LargeQfeeWarningColor',IntTostr(clred)));
shp_WarningColor.Brush.Color :=FLargeQfeeWarningcolor;
end;
procedure TFM_CjUserInfo.btn_QueryClick(Sender: TObject);
var
sSql,sCondition:string;
begin
inherited;
FLargeQfeeUserNum:=0;
if trim(edt_CZH.Text)<>'' then sCondition:=sCondition+' or CZH='''+trim(edt_CZH.Text)+'''';
if trim(edt_Telephone.Text)<>'' then sCondition:=sCondition+' or Telephone='''+trim(edt_Telephone.Text)+'''';
if trim(edt_UserName.Text)<>'' then sCondition:=sCondition+' or UserName='''+trim(edt_UserName.Text)+'''';
if trim(scondition)<>'or' then
begin
sCondition:=StringReplace(sCondition,'or','where',[rfIgnoreCase]);
end
else
sCondition:='';
case cb_type.ItemIndex of
0:;
1:if sCondition = '' then
sCondition:=' where Cj_Num<YCj_Num'
else
sCondition:=sCondition+' and Cj_Num<YCj_Num';
2:if sCondition = '' then
sCondition:=' where Cj_Num=YCj_Num'
else
sCondition:=sCondition+' and Cj_Num=YCj_Num';
3:if sCondition = '' then
sCondition:=' where Today_Num>0'
else
sCondition:=sCondition+' and Today_Num>0';
end;
with DM_CommonData.Qr_CjTable do
begin
Close;
Sql.Text :='select Telephone,CZH,UserName,Qfee,(YCj_Num-Cj_Num) CJ_SucNum,'
+'Cj_FailNum,Today_Num from CJ_Table'+sCondition;
prepare;
Open;
end;
sSQl:='select count(*) RecCount from CJ_Table ';
if sCondition='' then
sSql:=sSql+'where Qfee>='+intToStr(FLargeQfeeWarningVal)
else
sSql:=sSql+sCondition+' and Qfee>='+intToStr(FLargeQfeeWarningVal);
SysDM.SQL_Querys(SysDM.Qr_Temp,sSql);
FLargeQfeeUserNum:=SysDM.Qr_Temp.FieldbyName('RecCount').Asinteger;
lbl_Num.Caption :=IntToStr(DM_CommonData.Qr_CjTable.RecordCount);
lbl_LargeQfeeNum.caption:=intToStr(FLargeQfeeUserNum);
end;
procedure TFM_CjUserInfo.dbgd_ClientDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
inherited;
if DM_CommonData.Qr_CjTable.FieldByName('Qfee').AsFloat>=FLargeQfeeWarningVal then
begin
dbgd_Client.Canvas.Font.Color :=FlargeQfeeWarningColor;
end;
dbgd_Client.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
procedure TFM_CjUserInfo.shp_warningColorMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
inherited;
if ClrDlg_Warning.Execute then
begin
FLargeQfeeWarningColor:=ClrDlg_Warning.Color;
Shp_WarningColor.Brush.Color :=FLargeQfeeWarningColor;
SysDM.WriteIni('system','LargeQfeeWarningColor',IntToStr(FLargeQfeeWarningColor));
end;
end;
procedure TFM_CjUserInfo.sb_largeQfeeClick(Sender: TObject);
var
FM_lQFWarningVal:TFM_lQFWarningVal;
begin
inherited;
Fm_lQFWarningVal:=TFM_lQFWarningVal.CreateForm(Self,lbl_WarningVal.Caption);
try
if FM_lQFWarningVal.ShowModal = mrOk then
begin
FLargeQfeeWarningVal:=strtoint(trim(FM_lQFWarningVal.edt_Val.Text));
lbl_WarningVal.Caption :=FM_lQFWarningVal.edt_Val.Text ;
SysDM.WriteIni('system','LargeQfeeWarningVal',lbl_WarningVal.Caption);
end;
finally
Fm_lQfWarningVal.Free;
end;
end;
procedure TFM_CjUserInfo.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
inherited;
DM_CommonData.Qr_CjTable.Close;
FM_CjUserInfo:=nil;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -