📄 pm_pchistory_c.pas
字号:
unit Pm_PcHistory_C;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Condition, Db, AdODB, StdCtrls, ExtEdit, Mask, linkedit;
Type
TFrm_Pm_PcHistory_C = Class(TFrm_Base_Condition)
Label1: TLabel;
Lbl_VendorName: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Medt_OperatorTime_Fm: TMaskEdit;
Medt_OperatorTime_To: TMaskEdit;
Lbl_Operator_Name_Fm: TLabel;
Lbl_Operator_Name_To: TLabel;
ExtEdt_PcCode_Fm: TLinkEdit;
ExtEdt_PcCode_To: TLinkEdit;
ExtEdt_OperatorCode_Fm: TLinkEdit;
ExtEdt_OperatorCode_To: TLinkEdit;
Edt_OperatorName_Fm: TEdit;
Edt_OperatorName_to: TEdit;
procedure btn_okClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ExtEdt_PcCode_ToExit(Sender: TObject);
procedure ExtEdt_OperatorCode_ToExit(Sender: TObject);
procedure ExtEdt_OperatorCode_FmExit(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_Pm_PcHistory_C: TFrm_Pm_PcHistory_C;
implementation
uses Sys_Global;
{$R *.DFM}
procedure TFrm_Pm_PcHistory_C.btn_okClick(Sender: TObject);
var
date_to:string;
begin
inherited;
date_to:=Medt_OperatorTime_To.text+' '+formatdatetime('hh:mm:dd',now());
Condition:='';
ConditionHint:='';
if Extedt_PcCode_fm.text='' then
Condition:=' PcHistory.PCno between ''0'''
else
Condition:=' PcHistory.PCno between '''+ExtEdt_PcCode_Fm.Text+'''';
ConditionHint:='采购价格单号从'+ExtEdt_PcCode_Fm.Text;
if ExtEdt_PcCode_TO.Text<>'' then
begin
Condition:=Condition+' and '''+ExtEdt_PcCode_To.Text+'''';
ConditionHint:=ConditionHint+'\采购价格单号到'+ExtEdt_PcCode_To.Text;
end;
if ExtEdt_OperatorCode_Fm.text='' then
Condition:=Condition+' AND PcHistory.ChgEmployeeCode between ''0'''
else
Condition:=Condition+' AND PcHistory.ChgEmployeeCode between '''+ExtEdt_OperatorCode_Fm.Text+'''';
if ExtEdt_OperatorCode_To.Text<>'' then
begin
Condition:=Condition+' AND '''+ExtEdt_OperatorCode_To.Text+'''';
end;
if Length(Trim(Medt_OperatorTime_Fm.Text))<>4 then
begin
Condition:=Condition+' AND PcHistory.ChgTime between cast('''+Medt_OperatorTime_Fm.Text+''' as datetime)';
ConditionHint:=ConditionHint+'\操作时间从'+Medt_OperatorTime_Fm.Text;
end;
if Length(Trim(Medt_OperatorTime_To.Text))<>4 then
begin
Condition:=Condition+' AND cast('''+date_to+''' as datetime) ';
ConditionHint:=ConditionHint+'\操作时间到'+Medt_OperatorTime_To.Text;
end;
ModalResult:=mrOk;
end;
procedure TFrm_Pm_PcHistory_C.FormCreate(Sender: TObject);
begin
inherited;
ExtEdt_PcCode_Fm.Text:='';
ExtEdt_PcCode_TO.Text:='ZZZZZ';
ExtEdt_OperatorCode_Fm.Text:='';
ExtEdt_OperatorCode_To.Text:='ZZZZZ';
Medt_OperatorTime_Fm.Text:=formatdatetime('yyyy.mm.dd',now-30);
Medt_OperatorTime_To.Text:=formatdatetime('yyyy.mm.dd',now);
end;
procedure TFrm_Pm_PcHistory_C.ExtEdt_PcCode_ToExit(Sender: TObject);
begin
NotNullTextCheck(sender,'采购价格单号');
end;
procedure TFrm_Pm_PcHistory_C.ExtEdt_OperatorCode_ToExit(Sender: TObject);
begin
NotNullTextCheck(sender,'操作员代码');
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select EmployeeName,EmployeeCode From Vw_Operator '
+' Where EmployeeCode = '''+ExtEdt_OperatorCode_To.Text +''' ';
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof Then
Edt_OperatorName_To.Text :=''
else
Edt_OperatorName_To.Text := AdoQry_Tmp.fieldbyname('EmployeeName').AsString;
end;
procedure TFrm_Pm_PcHistory_C.ExtEdt_OperatorCode_FmExit(Sender: TObject);
begin
inherited;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.clear;
AdoQry_Tmp.SQL.Text := ' Select EmployeeName,EmployeeCode From Vw_Operator '
+' Where EmployeeCode = '''+ExtEdt_OperatorCode_Fm.Text +''' ';
AdoQry_Tmp.Open;
if AdoQry_Tmp.Eof Then
Edt_OperatorName_Fm.Text :=''
else
Edt_OperatorName_Fm.Text := AdoQry_Tmp.fieldbyname('EmployeeName').AsString;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -