?? userverchg.pas
字號:
unit Userverchg;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, DBCtrls, Buttons, Mask;
type
TfrmServiceVisit = class(TForm)
GroupBox1: TGroupBox;
Label9: TLabel;
Label6: TLabel;
Label7: TLabel;
bbtn_serverchg: TBitBtn;
bbtn_serverchgcalcle: TBitBtn;
Label12: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit3: TEdit;
ComboBox1: TComboBox;
Edit4: TEdit;
ComboBox2: TComboBox;
Memo1: TMemo;
ComboBox3: TComboBox;
procedure FormShow(Sender: TObject);
procedure bbtn_serverchgClick(Sender: TObject);
procedure bbtn_serverchgcalcleClick(Sender: TObject);
procedure ComboBox3DropDown(Sender: TObject);
procedure ComboBox3Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmServiceVisit: TfrmServiceVisit;
opinions:string;
implementation
uses mydata, Userver, Umain, UcustomerAdd;
{$R *.dfm}
procedure TfrmServiceVisit.FormShow(Sender: TObject);
var
maxvalue:Integer;
begin
Edit4.Text:=FormatDateTime('YYYY-MM-DD',Date);
with dm.AQService do
begin
close;
sql.Clear;
sql.Add('select max(Serno)as maxSerNO from Service');
open;
maxvalue:=dm.AQService.FieldValues['maxSerNO'];
maxvalue:=maxvalue+1;
if dm.AQService.Fields.Fields[0].IsNull then
begin
Edit1.Text:=IntToStr(1);
end
else
begin
Edit1.Text:=IntToStr(maxvalue);
end;
end;
end;
procedure TfrmServiceVisit.bbtn_serverchgClick(Sender: TObject);
var
LastVist:TDateTime;
ID:Integer;
begin
with dm.AQCustName do
begin
close;
sql.Clear;
sql.Text:='select * from Service where SerName='''+Trim(Edit3.Text)+''' and ProName='''+Trim(ComboBox3.Text)+''' and VisitDate is not null';
open;
if dm.AQCustName.RecordCount>0 then
begin
LastVist:=dm.AQCustName.FieldValues['VisitDate'];
ID:=MessageBox(self.Handle,PChar('該客戶曾在'+DateTimeToStr(LastVist)+'日,已回訪過,請您斟酌是否還要錄入?'),'提示',MB_OKCANCEL+MB_ICONINFORMATION);
if ID=2 then Exit;
end;
with dm.AQService do
begin
close;
sql.Clear;
sql.Add('INSERT INTO Service(Sername,ProName,Opinions,VisitDate,VisitRecords,Questions)');
sql.Add('VALUES(:Sername,:ProName,:Opinions,:VisitDate,:VisitRecords,:Questions)');
Parameters.ParamByName('Sername').Value:=Trim(Edit3.Text);
Parameters.ParamByName('ProName').Value:=Trim(ComboBox3.Text);
Parameters.ParamByName('Opinions').Value:=Trim(ComboBox1.Text);
Parameters.ParamByName('VisitDate').Value:=Trim(Edit4.Text);
Parameters.ParamByName('VisitRecords').Value:=Trim(Memo1.Text);
Parameters.ParamByName('Questions').Value:=Trim(ComboBox2.Text);
ExecSQL;
ShowMessage('已存盤!');
Edit1.Text:='';
Edit3.Text:='';
Edit4.Text:='';
ComboBox1.Text:='';
ComboBox3.Text:='';
ComboBox2.Text:='';
Memo1.Text:='';
end;
end;
frmServer.FormShow(Sender);
end;
procedure TfrmServiceVisit.bbtn_serverchgcalcleClick(Sender: TObject);
begin
close;
end;
procedure TfrmServiceVisit.ComboBox3DropDown(Sender: TObject);
begin
ComboBox3.Items.Clear;
with dm.AQItems do
begin
close;
sql.Clear;
sql.Add('select * from ProjectItem where status='''+'是'+'''');
open;
while not dm.AQItems.Eof do
begin
ComboBox3.Items.Add(dm.AQItems.FieldValues['ProName']);
dm.AQItems.Next;
end;
end;
end;
procedure TfrmServiceVisit.ComboBox3Change(Sender: TObject);
begin
with dm.AQService do
begin
close;
sql.Clear;
sql.Text:='select CustomName from ProjectItem where ProName ='''+Trim(ComboBox3.Text)+'''';
open;
if dm.AQService.RecordCount>0 then
Edit3.Text:=dm.AQService.FieldValues['CustomName'];
end;
end;
procedure TfrmServiceVisit.ComboBox2Change(Sender: TObject);
var
UserName,Opinions,VisitDate,Project:string;
begin
Project:=Trim(ComboBox3.Text);
UserName:=Trim(Edit3.Text);
Opinions:=Trim(ComboBox1.Text);
VisitDate:=Trim(Edit4.Text);
if ComboBox2.Text<>'' then
Memo1.Text:='在'+VisitDate+'日,對'+UserName+'的'+Project+'項目,進行回訪,用戶評價:'+Opinions;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -