📄 unit4.~pas
字号:
adoquery1.SQL.Add('shangpin_name as"商品名称",jiliangdanwei as"计量单位",shuliangdanjia as"数量单价",hejimoney as"合计金额",');
adoquery1.SQL.Add('changshang_no as"厂商编号",tuihuoyuanyin as"退货原因",chulujieguo as"处理结果",gouhuodate as"购货日期",yaoqiutuihuodate as"要求退货时间",');
adoquery1.SQL.Add('chulidate as"处理日期",tuihuojbperson as"退货经办人",jbperson_id as"经办人号"');
adoquery1.SQL.Add('from tuihuoxinxi as T,customer as C where T.thdanju_id='''+Edit2.Text+'''and T.customer_id=C.customer_id');
Adoquery1.Open;
if Adoquery1.RecordCount<>0 then
showmessage('单据编号为'''+Edit2.Text+'''的记录信息已经存在,请重新输入!')
else
begin
adoquery1.Close;
Adoquery1.SQL.Clear;
Adoquery1.SQL.Add('select*from tuihuoxinxi where thdanju_id='''+Edit2.Text+'''');
Adoquery1.Open;
if adoquery1.RecordCount=0 then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit1.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount=0 then
begin
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('update customer set customer_id='''+Edit1.Text+''',customer_name='''+Edit15.Text+''',');
adoquery1.SQL.Add('customer_sex ='''+ComboBox1.Text+''',customer_old ='''+Edit17.Text+''',');
adoquery1.SQL.Add('customer_adress ='''+Edit18.Text+''',customer_phone ='''+Edit19.Text+'''');
adoquery1.SQL.Add('where customer_id ='''+Edit1.Text+'''');
adoquery1.ExecSQL;
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into tuihuoxinxi(customer_id,thdanju_id,spno,');
adoquery1.SQL.Add('shangpin_name,jiliangdanwei,shuliangdanjia,hejimoney,changshang_name,');
adoquery1.SQL.Add('changshang_no,tuihuoyuanyin,chulujieguo,gouhuodate,yaoqiutuihuodate,');
adoquery1.SQL.Add('chulidate,tuihuojbperson,jbperson_id)values('''+edit1.Text+''','''+edit2.Text+''','''+Edit4.Text+''',');
adoquery1.SQL.Add(''''+edit3.Text+''','''+edit5.Text+''','''+edit6.Text+''','''+edit7.Text+''','''+edit8.Text+''',');
adoquery1.SQL.Add(''''+edit9.Text+''','''+edit10.Text+''','''+Edit11.Text+''', '''+edit12.Text+''',');
adoquery1.SQL.Add(''''+edit13.Text+''','''+edit14.Text+''','''+edit20.Text+''','''+edit21.Text+''')');
adoquery1.ExecSQL;
showmessage('添加成功!');
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit1.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount=0 then
begin
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into customer(customer_id,customer_name,');
adoquery1.SQL.Add('customer_sex,customer_old,');
adoquery1.SQL.Add('customer_adress,customer_phone)values('''+Edit1.Text+''','''+Edit15.Text+''','''+ComboBox1.Text+''','''+Edit17.Text+''','''+Edit18.Text+''','''+Edit19.Text+''')');
adoquery1.ExecSQL;
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into tuihuoxinxi(customer_id,thdanju_id,spno,');
adoquery1.SQL.Add('shangpin_name,jiliangdanwei,shuliangdanjia,hejimoney,changshang_name,');
adoquery1.SQL.Add('changshang_no,tuihuoyuanyin,chulujieguo,gouhuodate,yaoqiutuihuodate,');
adoquery1.SQL.Add('chulidate,tuihuojbperson,jbperson_id)values('''+edit1.Text+''','''+edit2.Text+''','''+Edit4.Text+''',');
adoquery1.SQL.Add(''''+edit3.Text+''','''+edit5.Text+''','''+edit6.Text+''','''+edit7.Text+''','''+edit8.Text+''',');
adoquery1.SQL.Add(''''+edit9.Text+''','''+edit10.Text+''','''+Edit11.Text+''', '''+edit12.Text+''',');
adoquery1.SQL.Add(''''+edit13.Text+''','''+edit14.Text+''','''+edit20.Text+''','''+edit21.Text+''')');
adoquery1.ExecSQL;
showmessage('添加成功!');
end;
end;
adoquery1.Close;
Adoquery1.SQL.Clear;
Adoquery1.SQL.Add('select*from tuihuoxinxi where thdanju_id='''+Edit2.Text+'''');
Adoquery1.Open;
if adoquery1.RecordCount<>0 then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit1.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount=0 then
begin
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into customer(customer_id,customer_name,');
adoquery1.SQL.Add('customer_sex,customer_old,');
adoquery1.SQL.Add('customer_adress,customer_phone)values('''+Edit1.Text+''','''+Edit15.Text+''','''+ComboBox1.Text+''','''+Edit17.Text+''','''+Edit18.Text+''','''+Edit19.Text+''')');
adoquery1.ExecSQL;
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('update tuihuoxinxi set customer_id='''+edit1.Text+''',thdanju_id='''+edit2.Text+''',spno='''+Edit4.Text+''',');
adoquery1.SQL.Add('shangpin_name='''+edit3.Text+''',jiliangdanwei='''+edit5.Text+''',shuliangdanjia='''+edit6.Text+''',hejimoney='''+edit7.Text+''',changshang_name='''+edit8.Text+''',');
adoquery1.SQL.Add('changshang_no='''+edit9.Text+''',tuihuoyuanyin='''+edit10.Text+''',chulujieguo='''+Edit11.Text+''',gouhuodate='''+edit12.Text+''',yaoqiutuihuodate='''+edit13.Text+''',');
adoquery1.SQL.Add('chulidate='''+edit14.Text+''',tuihuojbperson='''+edit20.Text+''',jbperson_id='''+edit21.Text+'''');
adoquery1.SQL.Add('where thdanju_id='''+Edit2.text+'''');
adoquery1.ExecSQL;
Showmessage('添加成功!');
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit1.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount<>0 then
begin
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('update customer set customer_id='''+Edit1.Text+''',customer_name='''+Edit15.Text+''',');
adoquery1.SQL.Add('customer_sex ='''+ComboBox1.Text+''',customer_old ='''+Edit17.Text+''',');
adoquery1.SQL.Add('customer_adress ='''+Edit18.Text+''',customer_phone ='''+Edit19.Text+'''');
adoquery1.SQL.Add('where customer_id ='''+Edit1.Text+'''');
adoquery1.ExecSQL;
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('update tuihuoxinxi set customer_id='''+edit1.Text+''',thdanju_id='''+edit2.Text+''',spno='''+Edit4.Text+''',');
adoquery1.SQL.Add('shangpin_name='''+edit3.Text+''',jiliangdanwei='''+edit5.Text+''',shuliangdanjia='''+edit6.Text+''',hejimoney='''+edit7.Text+''',changshang_name='''+edit8.Text+''',');
adoquery1.SQL.Add('changshang_no='''+edit9.Text+''',tuihuoyuanyin='''+edit10.Text+''',chulujieguo='''+Edit11.Text+''',gouhuodate='''+edit12.Text+''',yaoqiutuihuodate='''+edit13.Text+''',');
adoquery1.SQL.Add('chulidate='''+edit14.Text+''',tuihuojbperson='''+edit20.Text+''',jbperson_id='''+edit21.Text+'''');
adoquery1.SQL.Add('where thdanju_id='''+Edit2.text+'''');
adoquery1.ExecSQL;
showmessage('添加成功!');
end;
end;
end;
end;
end;
procedure TForm4.Button6Click(Sender: TObject);
begin
var1:=Edit2.Text;
if(var1='')then
showmessage('单据编号不能够为空,请重新输入!')
else
begin
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('select T.customer_id as"客户编号",thdanju_id as"单据编号",spno as"商品型号",');
adoquery1.SQL.Add('shangpin_name as"商品名称",jiliangdanwei as"计量单位",shuliangdanjia as"数量单价",hejimoney as"合计金额",');
adoquery1.SQL.Add('changshang_no as"厂商编号",tuihuoyuanyin as"退货原因",chulujieguo as"处理结果",gouhuodate as"购货日期",yaoqiutuihuodate as"要求退货时间",');
adoquery1.SQL.Add('chulidate as"处理日期",tuihuojbperson as"退货经办人",jbperson_id as"经办人号"');
adoquery1.SQL.Add('from tuihuoxinxi as T,customer as C where T.thdanju_id='''+Edit2.Text+'''and T.customer_id=C.customer_id');
Adoquery1.Open;
if Adoquery1.RecordCount=0 then
showmessage('单据编号为'''+Edit2.Text+'''的记录信息不存在,请重新输入!')
else
begin
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('delete from tuihuoxinxi where thdanju_id='''+Edit2.Text+'''');
Adoquery1.ExecSQL;
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('delete from customer where customer_id='''+Edit1.Text+'''');
Adoquery1.ExecSQL;
showmessage('删除成功!');
end;
end;
end;
procedure TForm4.Button7Click(Sender: TObject);
begin
var1:=Edit2.Text;
if(var1='')then
showmessage('单据编号不能够为空,请重新输入!')
else
begin
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('select T.customer_id as"客户编号",thdanju_id as"单据编号",spno as"商品型号",');
adoquery1.SQL.Add('shangpin_name as"商品名称",jiliangdanwei as"计量单位",shuliangdanjia as"数量单价",hejimoney as"合计金额",');
adoquery1.SQL.Add('changshang_no as"厂商编号",tuihuoyuanyin as"退货原因",chulujieguo as"处理结果",gouhuodate as"购货日期",yaoqiutuihuodate as"要求退货时间",');
adoquery1.SQL.Add('chulidate as"处理日期",tuihuojbperson as"退货经办人",jbperson_id as"经办人号"');
adoquery1.SQL.Add('from tuihuoxinxi as T,customer as C where T.thdanju_id='''+Edit2.Text+'''and T.customer_id=C.customer_id');
Adoquery1.Open;
if Adoquery1.RecordCount=0 then
showmessage('单据编号为'''+Edit2.Text+'''的记录信息不存在,请重新输入!')
else
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit1.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount<>0 then
begin
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('update customer set customer_id='''+Edit1.Text+''',customer_name='''+Edit15.Text+''',');
adoquery1.SQL.Add('customer_sex ='''+ComboBox1.Text+''',customer_old ='''+Edit17.Text+''',');
adoquery1.SQL.Add('customer_adress ='''+Edit18.Text+''',customer_phone ='''+Edit19.Text+'''');
adoquery1.SQL.Add('where customer_id ='''+Edit1.Text+'''');
adoquery1.ExecSQL;
adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('update tuihuoxinxi set customer_id='''+edit1.Text+''',thdanju_id='''+edit2.Text+''',spno='''+Edit4.Text+''',');
adoquery1.SQL.Add('shangpin_name='''+edit3.Text+''',jiliangdanwei='''+edit5.Text+''',shuliangdanjia='''+edit6.Text+''',hejimoney='''+edit7.Text+''',changshang_name='''+edit8.Text+''',');
adoquery1.SQL.Add('changshang_no='''+edit9.Text+''',tuihuoyuanyin='''+edit10.Text+''',chulujieguo='''+Edit11.Text+''',gouhuodate='''+edit12.Text+''',yaoqiutuihuodate='''+edit13.Text+''',');
adoquery1.SQL.Add('chulidate='''+edit14.Text+''',tuihuojbperson='''+edit20.Text+''',jbperson_id='''+edit21.Text+'''');
adoquery1.SQL.Add('where thdanju_id='''+Edit2.text+'''');
adoquery1.ExecSQL;
{ adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('update customer set customer_id='''+Edit1.Text+''',customer_name='''+Edit15.Text+''',');
adoquery1.SQL.Add('customer_sex ='''+ComboBox1.Text+''',customer_old ='''+Edit17.Text+''',');
adoquery1.SQL.Add('customer_adress ='''+Edit18.Text+''',customer_phone ='''+Edit19.Text+'''');
adoquery1.SQL.Add('where customer_id ='''+Edit1.Text+'''');
adoquery1.ExecSQL; }
showmessage('更新成功');
end;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('Select*from customer where customer_id='''+Edit1.Text+'''');
adoquery1.Open;
if adoquery1.RecordCount=0 then
begin
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into customer(customer_id,customer_name,');
adoquery1.SQL.Add('customer_sex,customer_old,');
adoquery1.SQL.Add('customer_adress,customer_phone)values('''+Edit1.Text+''','''+Edit15.Text+''','''+ComboBox1.Text+''','''+Edit17.Text+''','''+Edit18.Text+''','''+Edit19.Text+''')');
adoquery1.ExecSQL;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('update tuihuoxinxi set customer_id='''+edit1.Text+''',thdanju_id='''+edit2.Text+''',spno='''+Edit4.Text+''',');
adoquery1.SQL.Add('shangpin_name='''+edit3.Text+''',jiliangdanwei='''+edit5.Text+''',shuliangdanjia='''+edit6.Text+''',hejimoney='''+edit7.Text+''',changshang_name='''+edit8.Text+''',');
adoquery1.SQL.Add('changshang_no='''+edit9.Text+''',tuihuoyuanyin='''+edit10.Text+''',chulujieguo='''+Edit11.Text+''',gouhuodate='''+edit12.Text+''',yaoqiutuihuodate='''+edit13.Text+''',');
adoquery1.SQL.Add('chulidate='''+edit14.Text+''',tuihuojbperson='''+edit20.Text+''',jbperson_id='''+edit21.Text+'''');
adoquery1.SQL.Add('where thdanju_id='''+Edit2.text+'''');
adoquery1.ExecSQL;
{ adoquery1.Close;
Adoquery1.SQL.Clear;
adoquery1.SQL.Add('insert into customer(customer_id,customer_name,');
adoquery1.SQL.Add('customer_sex,customer_old,');
adoquery1.SQL.Add('customer_adress,customer_phone)values('''+Edit1.Text+''','''+Edit15.Text+''','''+ComboBox1.Text+''','''+Edit17.Text+''','''+Edit18.Text+''','''+Edit19.Text+''')');
adoquery1.ExecSQL; }
showmessage('更新成功');
end;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -