📄 unit3.~pas
字号:
adoquery1.SQL.Add('customer_adress ='''+Edit18.Text+''',customer_phone ='''+Edit19.Text+'''');
adoquery1.SQL.Add('where customer_id ='''+Edit13.Text+'''');
adoquery1.ExecSQL;
{ adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into tousuxinxi(spdanju_id,customer_id,shangpin_xinghao,shangpin_name ,');
adoquery1.SQL.Add('chanshang_name,chanshang_id,jiliangdanwei,shuliang,shangpin_danwei,hejinoney,tousuliyou,chuliyaoqiu,gouhuodate)values');
adoquery1.Sql.Add('('''+Edit1.Text+''','''+Edit13.Text+''','''+Edit2.Text+''','''+Edit3.Text+''',');
adoquery1.Sql.Add(''''+Edit4.Text+''','''+Edit5.Text+''','''+Edit6.Text+''',');
adoquery1.Sql.Add(''''+Edit7.Text+''','''+Edit8.Text+''','''+Edit9.Text+''','''+Edit10.Text+''','''+Edit11.Text+''','''+Edit12.Text+''')');
adoquery1.ExecSQL; }
showmessage('添加成功!');
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select*from tousuxinxi where spdanju_id='''+Edit1.Text+'''');
adoquery1.open;
if adoquery1.RecordCount<>0 then
begin
{ adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into tousuxinxi(spdanju_id,customer_id,shangpin_xinghao,shangpin_name ,');
adoquery1.SQL.Add('chanshang_name,chanshang_id,jiliangdanwei,shuliang,shangpin_danwei,hejinoney,tousuliyou,chuliyaoqiu,gouhuodate)values');
adoquery1.Sql.Add('('''+Edit1.Text+''','''+Edit13.Text+''','''+Edit2.Text+''','''+Edit3.Text+''',');
adoquery1.Sql.Add(''''+Edit4.Text+''','''+Edit5.Text+''','''+Edit6.Text+''',');
adoquery1.Sql.Add(''''+Edit7.Text+''','''+Edit8.Text+''','''+Edit9.Text+''','''+Edit10.Text+''','''+Edit11.Text+''','''+Edit12.Text+''')');
adoquery1.ExecSQL; }
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into customer(customer_id,customer_name,customer_sex ,customer_old ,customer_department,');
adoquery1.SQL.Add('customer_adress,customer_phone )values('''+Edit13.Text+''','''+Edit14.Text+''','''+ComboBox1.Text+''',');
adoquery1.SQL.Add(''''+Edit16.Text+''','''+Edit17.Text+''','''+Edit18.Text+''','''+Edit19.Text+''')');
adoquery1.ExecSQL;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into tousuxinxi(spdanju_id,customer_id,shangpin_xinghao,shangpin_name ,');
adoquery1.SQL.Add('chanshang_name,chanshang_id,jiliangdanwei,shuliang,shangpin_danwei,hejinoney,tousuliyou,chuliyaoqiu,gouhuodate)values');
adoquery1.Sql.Add('('''+Edit1.Text+''','''+Edit13.Text+''','''+Edit2.Text+''','''+Edit3.Text+''',');
adoquery1.Sql.Add(''''+Edit4.Text+''','''+Edit5.Text+''','''+Edit6.Text+''',');
adoquery1.Sql.Add(''''+Edit7.Text+''','''+Edit8.Text+''','''+Edit9.Text+''','''+Edit10.Text+''','''+Edit11.Text+''','''+Edit12.Text+''')');
adoquery1.ExecSQL;
showmessage('添加成功!');
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit13.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount<>0 then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('update tousuxinxi set spdanju_id='''+Edit1.Text+''',customer_id='''+Edit13.Text+''',shangpin_xinghao='''+Edit2.Text+''',shangpin_name='''+Edit3.Text+''' ,');
adoquery1.SQL.Add('chanshang_name='''+Edit4.Text+''',chanshang_id='''+Edit5.Text+''',jiliangdanwei='''+Edit6.Text+''',shuliang='''+Edit7.Text+''',shangpin_danwei='''+Edit8.Text+''',');
adoquery1.SQL.Add('hejinoney='''+Edit9.Text+''',tousuliyou='''+Edit10.Text+''',chuliyaoqiu='''+Edit11.Text+''',gouhuodate='''+Edit2.Text+'''');
adoquery1.SQL.Add('where spdanju_id='''+Edit1.Text+'''');
adoquery1.ExecSQL;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit13.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount=0 then
begin
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into customer(customer_id,customer_name,customer_sex ,customer_old ,customer_department,');
adoquery1.SQL.Add('customer_adress,customer_phone )values('''+Edit13.Text+''','''+Edit14.Text+''','''+ComboBox1.Text+''',');
adoquery1.SQL.Add(''''+Edit16.Text+''','''+Edit17.Text+''','''+Edit18.Text+''','''+Edit19.Text+''')');
adoquery1.ExecSQL;
end;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit13.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount<>0 then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('update customer set customer_id='''+Edit13.Text+''',customer_name='''+Edit14.Text+''',');
adoquery1.SQL.Add('customer_sex ='''+ComboBox1.Text+''',customer_old ='''+Edit16.Text+''',customer_department='''+Edit17.Text+''',');
adoquery1.SQL.Add('customer_adress ='''+Edit18.Text+''',customer_phone ='''+Edit19.Text+'''');
adoquery1.SQL.Add('where customer_id ='''+Edit13.Text+'''');
adoquery1.ExecSQL;
showmessage('添加成功!');
end;
end;
end;
end;
end; end;
end;
procedure TForm3.Button3Click(Sender: TObject);
begin
var1:=Edit1.Text;
var2:=Edit13.Text;
if(var1='')then
Showmessage('单据编号不能够为空,请重新输入!')
else
begin
if(var2='')then
Showmessage('客户编号不能够为空,请重新输入!')
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from tousuxinxi as T,customer as C');
adoquery1.SQL.Add('where T.spdanju_id='''+Edit1.Text+'''and T.customer_id=C.customer_id ');
adoquery1.Open;
if Adoquery1.RecordCount=0 then
Showmessage('此单据编号信息不存在,请确认后重新输入!')
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('delete from tousuxinxi ');
adoquery1.SQL.Add('where spdanju_id='''+Edit1.Text+'''');
adoquery1.ExecSQL;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('delete from customer ');
adoquery1.SQL.Add('where customer_id='''+Edit13.Text+'''');
adoquery1.ExecSQL;
Showmessage('删除成功!');
end;
end;
end;
end;
procedure TForm3.Button4Click(Sender: TObject);
begin
var1:=Edit1.Text;
var2:=Edit13.Text;
if(var1='')then
Showmessage('单据编号不能够为空,请重新输入!')
else
begin
if(var2='')then
Showmessage('客户编号不能够为空,请重新输入!')
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from tousuxinxi as T,customer as C');
adoquery1.SQL.Add('where T.spdanju_id='''+Edit1.Text+'''and T.customer_id=C.customer_id ');
adoquery1.Open;
if Adoquery1.RecordCount=0 then
Showmessage('此单据编号信息不存在,请确认后重新输入!')
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit13.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount<>0 then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('update tousuxinxi set spdanju_id='''+Edit1.Text+''',customer_id='''+Edit13.Text+''',shangpin_xinghao='''+Edit2.Text+''',shangpin_name='''+Edit3.Text+''' ,');
adoquery1.SQL.Add('chanshang_name='''+Edit4.Text+''',chanshang_id='''+Edit5.Text+''',jiliangdanwei='''+Edit6.Text+''',shuliang='''+Edit7.Text+''',shangpin_danwei='''+Edit8.Text+''',');
adoquery1.SQL.Add('hejinoney='''+Edit9.Text+''',tousuliyou='''+Edit10.Text+''',chuliyaoqiu='''+Edit11.Text+''',gouhuodate='''+Edit2.Text+'''');
adoquery1.SQL.Add('where spdanju_id='''+Edit1.Text+'''');
adoquery1.ExecSQL;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('update customer set customer_id='''+Edit13.Text+''',customer_name='''+Edit14.Text+''',');
adoquery1.SQL.Add('customer_sex ='''+ComboBox1.Text+''',customer_old ='''+Edit16.Text+''',customer_department='''+Edit17.Text+''',');
adoquery1.SQL.Add('customer_adress ='''+Edit18.Text+''',customer_phone ='''+Edit19.Text+'''');
adoquery1.SQL.Add('where customer_id ='''+Edit13.Text+'''');
adoquery1.ExecSQL;
Showmessage('修改成功!');
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit13.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount=0 then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('update tousuxinxi set spdanju_id='''+Edit1.Text+''',customer_id='''+Edit13.Text+''',shangpin_xinghao='''+Edit2.Text+''',shangpin_name='''+Edit3.Text+''' ,');
adoquery1.SQL.Add('chanshang_name='''+Edit4.Text+''',chanshang_id='''+Edit5.Text+''',jiliangdanwei='''+Edit6.Text+''',shuliang='''+Edit7.Text+''',shangpin_danwei='''+Edit8.Text+''',');
adoquery1.SQL.Add('hejinoney='''+Edit9.Text+''',tousuliyou='''+Edit10.Text+''',chuliyaoqiu='''+Edit11.Text+''',gouhuodate='''+Edit2.Text+'''');
adoquery1.SQL.Add('where spdanju_id='''+Edit1.Text+'''');
adoquery1.ExecSQL;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into customer(customer_id,customer_name,customer_sex ,customer_old ,customer_department,');
adoquery1.SQL.Add('customer_adress,customer_phone )values('''+Edit13.Text+''','''+Edit14.Text+''','''+ComboBox1.Text+''',');
adoquery1.SQL.Add(''''+Edit16.Text+''','''+Edit17.Text+''','''+Edit18.Text+''','''+Edit19.Text+''')');
adoquery1.ExecSQL;
Showmessage('修改成功!');
end;
end;
end;
end;
end;
procedure TForm3.Button7Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select spdanju_id as "单据编号",T.customer_id "顾客编号",shangpin_xinghao "商品型号",shangpin_name "商品名称",');
adoquery1.SQL.Add('chanshang_name "产商名",chanshang_id "产商编号",jiliangdanwei "计量单位",shuliang "数量",shangpin_danwei "商品单位",');
adoquery1.SQL.Add('hejinoney "合计金额",tousuliyou "投诉理由",chuliyaoqiu "处理要求",gouhuodate "购货日期",customer_name as "客户姓名",customer_sex as "性别",');
adoquery1.SQL.Add('customer_old as "年龄",customer_department as "单位",customer_adress as "地址",');
adoquery1.SQL.Add('customer_phone as ''联系电话'' from tousuxinxi as T,customer as C ');
adoquery1.SQL.Add('where T.customer_id=C.customer_id ');
adoquery1.Open;
DBGRid1.Columns[0].Width:=60; //修改dbgrid列宽度
DBGRid1.Columns[1].Width:=60;
DBGRid1.Columns[2].Width:=60;
DBGRid1.Columns[3].Width:=60;
DBGRid1.Columns[4].Width:=60;
DBGRid1.Columns[5].Width:=60;
DBGRid1.Columns[6].Width:=60;
DBGRid1.Columns[7].Width:=60;
DBGRid1.Columns[8].Width:=65;
DBGRid1.Columns[9].Width:=65;
DBGRid1.Columns[10].Width:=65;
DBGRid1.Columns[11].Width:=65;
DBGRid1.Columns[12].Width:=65;
DBGRid1.Columns[13].Width:=65;
DBGRid1.Columns[14].Width:=65;
DBGRid1.Columns[15].Width:=65;
DBGRid1.Columns[16].Width:=65;
DBGRid1.Columns[17].Width:=65;
DBGRid1.Columns[18].Width:=65;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -