Z
zongytao
Unregistered / Unconfirmed
GUEST, unregistred user!
本人开发《物业公司收费管理系统》遇到了一个问题,问题描述如下:
不进行打印及打印预览情况下form25的功能正常,一旦进行打印及关闭打印预览窗体时系统就提示“[Microsoft][ODBC Microsoft Access Driver]由于将在索引、主关键字或关系中创建重复的值,请求对表的改变没有成功。改变该字段中的或包含重复数据的字段中的数据,删除索引或重新定义索引以允许重复的值并再试一次。”请问这个问题如何解决?
以下是相关信息:
1、开发语言:DELPHI6企业版;
2、采用的数据库系统:ACCESS2000;
3、数据库表有2个:pay_feiyong,pay_feiyong_qichu(2个表之间无关系)。
pay_feiyong表中的字段内容及含义如下:
字段名称 标题 数据类型 字段长度 索引 主键
jiaofei_num 交费编号 文本 12 有(无重复) 是
house_num 房屋编号 文本 20 无 否
man_name 人员姓名 文本 10 无 否
jiaofei_shiqi 交费月份 文本 7 无 否
feiyong_yingjiao 本月应交费用 整型 无 否
feiyong_shijiao 本月实交费用 单精度(2个小数点) 无 否
feiyong_yue 余额 同上 无 否
feiyong_yujiao 本月预交费用 同上 无 否
feiyong_yujiao_qichu 月初预交费用 同上 无 否
feiyong_yujiao_zhuanchu预交费用转出 同上 无 否
feiyong_yujiao_qimo 月末预交费用 同上 无 否
feiyong_qianjiao_qichu 月初欠交费用 同上 无 否
feiyong_qianjiao 本月欠交费用 同上 无 否
zhinajin_qichu 月初应交滞纳金 同上 无 否
zhinajin_benyue 本月应交滞纳金 同上 无 否
zhinajin_yuemo 月末应交滞纳金 同上 无 否
jiaofei 已经交费? 文本 无 否
feiyong_yingjiao_date 最晚应交费日期 短日期 无 否
jiaofei_date 交费日期 同上 无 否
shuibiao_yuechu 月初水表读数 整型 无 否
shuibiao_yuemo 月末水表读数 同上 无 否
shuibiao_benyue 本月用水数 同上 无 否
shuifei_yingjiao 本月应交水费 单精度(2个小数点) 无 否
rent_yingjiao 本月应交房租 整型 无 否
wgf_yingjiao 本月应交物管费 同上 无 否
dianbiao_yuechu 月初电表读数 同上 无 否
dianbiao_yuemo 月末电表读数 同上 无 否
dianbiao_benyue 本月用电数 同上 无 否
dianfei_yingjiao 本月应交电费 单精度(2个小数点) 无 否
qunuanfei_yingjiao 本月应交取暖费 同上 无 否
qunuanfei_shijiao 本月实交取暖费 同上 无 否
qunuanfei_qianjiao 本月欠交取暖费 同上 无 否
pay_feiyong表中的字段内容只有qunuanfei_yingjiao,qunuanfei_shijiao,qunuanfei_qianjiao可以为空.
pay_feiyong_qichu表中的字段内容及含义如下:
字段名称 标题 数据类型 字段长度 索引 主键
house_num 房屋编号 文本 20 有(无重复) 是
man_name 人员姓名 文本 10 无 否
feiyong_yue 月初余额 单精度(2个小数点) 无 否
feiyong_yujiao_qichu 月初预交费用 单精度(2个小数点) 无 否
feiyong_qianjiao_qichu 月初欠交费用 单精度(2个小数点) 无 否
zhinajin_qichu 月初应交滞纳金 单精度(2个小数点) 无 否
shuibiao_yuechu 月初水表读数 整型 无 否
dianbiao_yuechu 月初电表读数 同上 无 否
qunuanfei_qianjiao_qichu月初欠交取暖费 单精度(2个小数点) 无 否
4、form25窗体所在单元的相关代码如下:
unit shuidianfei_input;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, ComCtrls, DBCtrls, Buttons;
type
TForm25 = class(TForm)
Label1: TLabel;
Label3: TLabel;
Edit1: TEdit;
Label9: TLabel;
Edit3: TEdit;
Label12: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label19: TLabel;
Edit6: TEdit;
Edit7: TEdit;
Label4: TLabel;
DBEdit1: TDBEdit;
Label2: TLabel;
DBEdit2: TDBEdit;
Label5: TLabel;
DBEdit3: TDBEdit;
Label6: TLabel;
DBEdit4: TDBEdit;
Label7: TLabel;
DBEdit5: TDBEdit;
Label8: TLabel;
Edit2: TEdit;
Label10: TLabel;
DBEdit6: TDBEdit;
Label11: TLabel;
Edit4: TEdit;
Label13: TLabel;
Edit5: TEdit;
Label14: TLabel;
Label15: TLabel;
DBEdit7: TDBEdit;
Label16: TLabel;
Label17: TLabel;
Edit8: TEdit;
Label18: TLabel;
Label20: TLabel;
Edit9: TEdit;
Label21: TLabel;
Label22: TLabel;
Edit10: TEdit;
Label23: TLabel;
Label24: TLabel;
Edit11: TEdit;
Label25: TLabel;
Edit12: TEdit;
Label26: TLabel;
Label27: TLabel;
DBEdit8: TDBEdit;
Label30: TLabel;
Label31: TLabel;
Edit14: TEdit;
Label32: TLabel;
ComboBox1: TComboBox;
Label33: TLabel;
Label34: TLabel;
DateTimePicker1: TDateTimePicker;
Label35: TLabel;
BitBtn3: TBitBtn;
Label36: TLabel;
Label37: TLabel;
DBEdit9: TDBEdit;
Edit15: TEdit;
Edit13: TEdit;
Edit17: TEdit;
Edit16: TEdit;
Label28: TLabel;
BitBtn4: TBitBtn;
procedure Edit1Exit(Sender: TObject);
procedure Edit3Exit(Sender: TObject);
procedure Edit6Exit(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
procedure Edit6KeyPress(Sender: TObject; var Key: Char);
procedure FormActivate(Sender: TObject);
procedure Edit5Exit(Sender: TObject);
procedure Edit5KeyPress(Sender: TObject; var Key: Char);
procedure Edit9Exit(Sender: TObject);
procedure Edit9KeyPress(Sender: TObject; var Key: Char);
procedure Edit8Exit(Sender: TObject);
procedure Edit8KeyPress(Sender: TObject; var Key: Char);
procedure DateTimePicker1KeyPress(Sender: TObject; var Key: Char);
procedure ComboBox1CloseUp(Sender: TObject);
procedure Edit17KeyPress(Sender: TObject; var Key: Char);
procedure Edit17Exit(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form25: TForm25;
s1,s2,s3,s4,s5,s6,s7,s8,s9:string;
jiaofei_num:string;
jiaofei_month:string;
house_num:string;
man_name:string;
house_type:string;
louhao:string;
fanghao:string;
dianbiao_qichu:real;
dianbiao_qimo:real;
dianbiao_benyue:real;
shuibiao_qichu:real;
shuibiao_qimo:real;
yongshui_benyue:real;
feiyong_yingjiao:real;
feiyong_shijiao:real;
feiyong_yujiao_qichu:real;
feiyong_yujiao:real;
feiyong_yujiao_zhuanchu:real;
feiyong_yujiao_qimo:real;
feiyong_yue:real;
feiyong_qianjiao_yuemo:real;
jiaofei:string;
feiyong_yingjiao_date:string;
jiaofei_date:string;
dianfei_price:real;
shuifei_price:real;
dianbiao_yuechu:real;
shuifei_yingjiao:real;
dianfei_yingjiao:real;
wgf_yingjiao:real;
rent_yingjiao:real;
feiyong_qianjiao_qichu:real;
zhinajin_qichu:real;
feiyong_yue_benyue:real;
zhinajin_benyue:real;
zhinajin_yuemo:real;
zhinajin_bilv:real;
zhinajin_benyuex:string;
qunuanfei_qianjiao_yuechu:real;
qunuanfei_yingjiao_bennian:real;
qunuanfei_yingjiao_benyue:real;
qunuanfei_shijiao_benyue:real;
qunuanfei_qianjiao_yuemo:real;
max_shuibiao:integer;
max_dianbiao:integer;
max_dianbiao1:integer;
i:integer;
ss:integer;
implementation
uses Unit1, dianfei_price_add, shuidian_piaojv_print;
{$R *.dfm}
procedure TForm25.FormActivate(Sender: TObject);
begin
max_shuibiao:=9999;
max_dianbiao:=9999;
max_dianbiao1:=99999;
datamodule1.ADOQuery13.Close;
datamodule1.ADOQuery13.Open;
datamodule1.ADOQuery2.Close;
datamodule1.ADOQuery2.Open;
datamodule1.ADOQuery_add_price.Close;
datamodule1.ADOQuery_add_price.Open;
datamodule1.ADOQuery_add_jiaofei.Close;
datamodule1.ADOQuery_add_jiaofei.Open;
//datamodule1.ADOQuery_add_jiaofei.Last;
bitbtn1.Enabled:=false;
bitbtn3.Enabled:=false;
bitbtn4.Enabled:=false;
edit16.Text:=formatdatetime('yyyymmdd',date);
edit17.Text:='0001';
edit17.SetFocus;
end;
procedure TForm25.BitBtn1Click(Sender: TObject);
begin
jiaofei_num:=edit16.Text+edit17.text;
jiaofei:=combobox1.Text;
feiyong_yingjiao_date:=datetostr(datetimepicker1.Date);
house_num:=trim(edit1.Text);
man_name:=s1;
//feiyong_yujiao_zhuanchu:=trim(edit9.Text);
dianfei_yingjiao:=dianbiao_benyue*dianfei_price;
shuifei_yingjiao:=yongshui_benyue*shuifei_price;
with datamodule1.ADOQuery_add_jiaofei do
begin
close;
sql.Clear;
sql.Add('insert into pay_feiyong(jiaofei_num,house_num,man_name,jiaofei_shiqi,feiyong_yingjiao,feiyong_shijiao,feiyong_yue,feiyong_yujiao,feiyong_yujiao_qichu,feiyong_yujiao_zhuanchu,feiyong_yujiao_qimo,feiyong_qianjiao_qichu,feiyong_qianjiao,'); //feiyong_yingjiao,feiyong_shijiao,feiyong_yue,feiyong_yujiao,feiyong_yujiao_qichu,feiyong_yujiao_zhuanchu,feiyong_yujiao_qimo) 'values('''+jiaofei_num+''','''+house_num+''','''+jiaofei_month+''')');
sql.Add('zhinajin_qichu,zhinajin_benyue,zhinajin_yuemo,jiaofei,feiyong_yingjiao_date,jiaofei_date,shuibiao_yuechu,shuibiao_yuemo,shuibiao_benyue,shuifei_yingjiao,rent_yingjiao,wgf_yingjiao,dianbiao_yuechu,dianbiao_yuemo,dianbiao_benyue,dianfei_yingjiao)');
sql.Add('values('''+jiaofei_num+''','''+house_num+''','''+dbedit1.Text+''','''+jiaofei_month+''','''+floattostr(feiyong_yingjiao)+''','''+floattostr(feiyong_shijiao)+''','''+edit12.Text+''','''+floattostr(feiyong_yujiao)+''','''+floattostr(feiyong_yujiao_qichu)+''','''+floattostr(feiyong_yujiao_zhuanchu)+''','''+floattostr(feiyong_yujiao_qimo)+''','''+floattostr(feiyong_qianjiao_qichu)+''','''+edit11.Text+''','''+floattostr(zhinajin_qichu)+''','''+zhinajin_benyuex+''','''+edit14.Text+''','''+jiaofei+''','''+feiyong_yingjiao_date+''','''+jiaofei_date+''','''+floattostr(shuibiao_qichu)+''','''+floattostr(shuibiao_qimo)+''','''+floattostr(yongshui_benyue)+''','''+floattostr(shuifei_yingjiao)+''','''+floattostr(rent_yingjiao)+''','''+floattostr(wgf_yingjiao)+''','''+floattostr(dianbiao_qichu)+''','''+floattostr(dianbiao_qimo)+''','''+floattostr(dianbiao_benyue)+''','''+floattostr(dianfei_yingjiao)+''')');
execsql;
with datamodule1.ADOQuery_modify_pay_feiyong_qichu do
begin
close;
sql.Clear;
sql.Add('update pay_feiyong_qichu set feiyong_yue='''+edit12.Text+''',feiyong_yujiao_qichu='''+floattostr(feiyong_yujiao_qimo)+''',feiyong_qianjiao_qichu='''+edit11.Text+''',zhinajin_qichu='''+edit14.Text+''',shuibiao_yuechu='''+floattostr(shuibiao_qimo)+''',dianbiao_yuechu='''+floattostr(dianbiao_qimo)+'''');
sql.Add('Where house_num='+''''+edit1.Text+'''');
execsql;
end;
Application.Messagebox('·¿·ÑÊý¾Ý¼Èë³É¹¦!.','Ìáʾ',MB_OK);
if Application.MessageBox('ÄãÊÇ·ñÐèÒª´òÓ¡·¿·ÑÊվݣ¿Èç¹ûÊÇÇë°´È·¶¨°´Å¥£¬·ñÔòÇë°´È¡Ïû°´Å¥¡£','Ìáʾ',MB_okcancel)=idcancel then
begin
i:=0001;
ss:=i+strtoint(edit17.Text);
edit17.Text:=formatfloat('0000',ss);
edit1.Text:='';
edit3.Text:='';
edit2.Text:='';
edit6.Text:='';
edit4.Text:='';
edit7.Text:='';
edit12.Text:='';
edit5.Text:='';
edit8.Text:='';
edit9.Text:='';
edit10.Text:='';
edit11.Text:='';
edit14.Text:='';
combobox1.Text:='';
dbedit1.Text:='';
dbedit3.Text:='';
dbedit4.Text:='';
dbedit2.Text:='';
dbedit5.Text:='';
dbedit6.Text:='';
dbedit7.Text:='';
dbedit8.Text:='';
dbedit9.Text:='';
bitbtn1.Enabled:=false;
bitbtn3.Enabled:=false;
bitbtn4.Enabled:=false;
edit1.SetFocus;
end
else
begin
bitbtn1.Enabled:=false;
bitbtn4.SetFocus;
end;
end;
end;
procedure TForm25.BitBtn3Click(Sender: TObject);
begin
//form25.Hide;
form27.QuickRep1.Preview;
end;
procedure TForm25.BitBtn4Click(Sender: TObject);
begin
form27.QuickRep1.Print;
end;
end.
5、form25窗体所用到的ADO组件属性及按钮含义如下:
ADOQuery_add_jiaofei的SQL语句为select * from pay_feiyong
ADOQuery_add_jiaofei的数据源为DataSource_add_jiaofei
ADOQuery_modify_pay_feiyong_qichu的SQL语句为select * from pay_feiyong_qichu。
Bitbtn1、Bitbtn2、Bitbtn3、Bitbtn4分别表示交费、打印预览、打印、取消。
6、form27中的内容
(1)
ADOQuery1的SQL语句为select * from pay_eiyong
ADOQuery1的数据源为DataSource1.
(2)
QuickRep1的QRBand1的BandType为rbColumnHeader.
ADOQuery1的表格内容为
票据号的内容为QRLabel40
楼号房号的内容为QRLabel42
住户姓名的内容为QRLabel44
年月的内容为QRLabel4
应交水电费的内容为QRLabel6
余额的内容为QRLabel8
实交费用的内容为QRLabel10
预交费用月初余额的内容为QRLabel12
本月预交费用的内容为QRLabel14
本月预交费用转实交数的内容为QRLabel16
本月应交滞纳金的内容为QRLabel18
月末水表读数的内容为QRLabel24
本月用水数的内容为QRLabel26
本月应交房租的内容为QRLabel28
本月应交物管费的内容为QRLabel30
月末电表读数的内容为QRLabel32
本月电表数的内容为QRLabel37
收款人的内容为QRLabel21
表格内容大致形状为左边为栏目名称,右边紧接着是栏目内容.例如 楼号房号 楼号房号的内容.
不进行打印及打印预览情况下form25的功能正常,一旦进行打印及关闭打印预览窗体时系统就提示“[Microsoft][ODBC Microsoft Access Driver]由于将在索引、主关键字或关系中创建重复的值,请求对表的改变没有成功。改变该字段中的或包含重复数据的字段中的数据,删除索引或重新定义索引以允许重复的值并再试一次。”请问这个问题如何解决?
以下是相关信息:
1、开发语言:DELPHI6企业版;
2、采用的数据库系统:ACCESS2000;
3、数据库表有2个:pay_feiyong,pay_feiyong_qichu(2个表之间无关系)。
pay_feiyong表中的字段内容及含义如下:
字段名称 标题 数据类型 字段长度 索引 主键
jiaofei_num 交费编号 文本 12 有(无重复) 是
house_num 房屋编号 文本 20 无 否
man_name 人员姓名 文本 10 无 否
jiaofei_shiqi 交费月份 文本 7 无 否
feiyong_yingjiao 本月应交费用 整型 无 否
feiyong_shijiao 本月实交费用 单精度(2个小数点) 无 否
feiyong_yue 余额 同上 无 否
feiyong_yujiao 本月预交费用 同上 无 否
feiyong_yujiao_qichu 月初预交费用 同上 无 否
feiyong_yujiao_zhuanchu预交费用转出 同上 无 否
feiyong_yujiao_qimo 月末预交费用 同上 无 否
feiyong_qianjiao_qichu 月初欠交费用 同上 无 否
feiyong_qianjiao 本月欠交费用 同上 无 否
zhinajin_qichu 月初应交滞纳金 同上 无 否
zhinajin_benyue 本月应交滞纳金 同上 无 否
zhinajin_yuemo 月末应交滞纳金 同上 无 否
jiaofei 已经交费? 文本 无 否
feiyong_yingjiao_date 最晚应交费日期 短日期 无 否
jiaofei_date 交费日期 同上 无 否
shuibiao_yuechu 月初水表读数 整型 无 否
shuibiao_yuemo 月末水表读数 同上 无 否
shuibiao_benyue 本月用水数 同上 无 否
shuifei_yingjiao 本月应交水费 单精度(2个小数点) 无 否
rent_yingjiao 本月应交房租 整型 无 否
wgf_yingjiao 本月应交物管费 同上 无 否
dianbiao_yuechu 月初电表读数 同上 无 否
dianbiao_yuemo 月末电表读数 同上 无 否
dianbiao_benyue 本月用电数 同上 无 否
dianfei_yingjiao 本月应交电费 单精度(2个小数点) 无 否
qunuanfei_yingjiao 本月应交取暖费 同上 无 否
qunuanfei_shijiao 本月实交取暖费 同上 无 否
qunuanfei_qianjiao 本月欠交取暖费 同上 无 否
pay_feiyong表中的字段内容只有qunuanfei_yingjiao,qunuanfei_shijiao,qunuanfei_qianjiao可以为空.
pay_feiyong_qichu表中的字段内容及含义如下:
字段名称 标题 数据类型 字段长度 索引 主键
house_num 房屋编号 文本 20 有(无重复) 是
man_name 人员姓名 文本 10 无 否
feiyong_yue 月初余额 单精度(2个小数点) 无 否
feiyong_yujiao_qichu 月初预交费用 单精度(2个小数点) 无 否
feiyong_qianjiao_qichu 月初欠交费用 单精度(2个小数点) 无 否
zhinajin_qichu 月初应交滞纳金 单精度(2个小数点) 无 否
shuibiao_yuechu 月初水表读数 整型 无 否
dianbiao_yuechu 月初电表读数 同上 无 否
qunuanfei_qianjiao_qichu月初欠交取暖费 单精度(2个小数点) 无 否
4、form25窗体所在单元的相关代码如下:
unit shuidianfei_input;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, ComCtrls, DBCtrls, Buttons;
type
TForm25 = class(TForm)
Label1: TLabel;
Label3: TLabel;
Edit1: TEdit;
Label9: TLabel;
Edit3: TEdit;
Label12: TLabel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label19: TLabel;
Edit6: TEdit;
Edit7: TEdit;
Label4: TLabel;
DBEdit1: TDBEdit;
Label2: TLabel;
DBEdit2: TDBEdit;
Label5: TLabel;
DBEdit3: TDBEdit;
Label6: TLabel;
DBEdit4: TDBEdit;
Label7: TLabel;
DBEdit5: TDBEdit;
Label8: TLabel;
Edit2: TEdit;
Label10: TLabel;
DBEdit6: TDBEdit;
Label11: TLabel;
Edit4: TEdit;
Label13: TLabel;
Edit5: TEdit;
Label14: TLabel;
Label15: TLabel;
DBEdit7: TDBEdit;
Label16: TLabel;
Label17: TLabel;
Edit8: TEdit;
Label18: TLabel;
Label20: TLabel;
Edit9: TEdit;
Label21: TLabel;
Label22: TLabel;
Edit10: TEdit;
Label23: TLabel;
Label24: TLabel;
Edit11: TEdit;
Label25: TLabel;
Edit12: TEdit;
Label26: TLabel;
Label27: TLabel;
DBEdit8: TDBEdit;
Label30: TLabel;
Label31: TLabel;
Edit14: TEdit;
Label32: TLabel;
ComboBox1: TComboBox;
Label33: TLabel;
Label34: TLabel;
DateTimePicker1: TDateTimePicker;
Label35: TLabel;
BitBtn3: TBitBtn;
Label36: TLabel;
Label37: TLabel;
DBEdit9: TDBEdit;
Edit15: TEdit;
Edit13: TEdit;
Edit17: TEdit;
Edit16: TEdit;
Label28: TLabel;
BitBtn4: TBitBtn;
procedure Edit1Exit(Sender: TObject);
procedure Edit3Exit(Sender: TObject);
procedure Edit6Exit(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
procedure Edit6KeyPress(Sender: TObject; var Key: Char);
procedure FormActivate(Sender: TObject);
procedure Edit5Exit(Sender: TObject);
procedure Edit5KeyPress(Sender: TObject; var Key: Char);
procedure Edit9Exit(Sender: TObject);
procedure Edit9KeyPress(Sender: TObject; var Key: Char);
procedure Edit8Exit(Sender: TObject);
procedure Edit8KeyPress(Sender: TObject; var Key: Char);
procedure DateTimePicker1KeyPress(Sender: TObject; var Key: Char);
procedure ComboBox1CloseUp(Sender: TObject);
procedure Edit17KeyPress(Sender: TObject; var Key: Char);
procedure Edit17Exit(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form25: TForm25;
s1,s2,s3,s4,s5,s6,s7,s8,s9:string;
jiaofei_num:string;
jiaofei_month:string;
house_num:string;
man_name:string;
house_type:string;
louhao:string;
fanghao:string;
dianbiao_qichu:real;
dianbiao_qimo:real;
dianbiao_benyue:real;
shuibiao_qichu:real;
shuibiao_qimo:real;
yongshui_benyue:real;
feiyong_yingjiao:real;
feiyong_shijiao:real;
feiyong_yujiao_qichu:real;
feiyong_yujiao:real;
feiyong_yujiao_zhuanchu:real;
feiyong_yujiao_qimo:real;
feiyong_yue:real;
feiyong_qianjiao_yuemo:real;
jiaofei:string;
feiyong_yingjiao_date:string;
jiaofei_date:string;
dianfei_price:real;
shuifei_price:real;
dianbiao_yuechu:real;
shuifei_yingjiao:real;
dianfei_yingjiao:real;
wgf_yingjiao:real;
rent_yingjiao:real;
feiyong_qianjiao_qichu:real;
zhinajin_qichu:real;
feiyong_yue_benyue:real;
zhinajin_benyue:real;
zhinajin_yuemo:real;
zhinajin_bilv:real;
zhinajin_benyuex:string;
qunuanfei_qianjiao_yuechu:real;
qunuanfei_yingjiao_bennian:real;
qunuanfei_yingjiao_benyue:real;
qunuanfei_shijiao_benyue:real;
qunuanfei_qianjiao_yuemo:real;
max_shuibiao:integer;
max_dianbiao:integer;
max_dianbiao1:integer;
i:integer;
ss:integer;
implementation
uses Unit1, dianfei_price_add, shuidian_piaojv_print;
{$R *.dfm}
procedure TForm25.FormActivate(Sender: TObject);
begin
max_shuibiao:=9999;
max_dianbiao:=9999;
max_dianbiao1:=99999;
datamodule1.ADOQuery13.Close;
datamodule1.ADOQuery13.Open;
datamodule1.ADOQuery2.Close;
datamodule1.ADOQuery2.Open;
datamodule1.ADOQuery_add_price.Close;
datamodule1.ADOQuery_add_price.Open;
datamodule1.ADOQuery_add_jiaofei.Close;
datamodule1.ADOQuery_add_jiaofei.Open;
//datamodule1.ADOQuery_add_jiaofei.Last;
bitbtn1.Enabled:=false;
bitbtn3.Enabled:=false;
bitbtn4.Enabled:=false;
edit16.Text:=formatdatetime('yyyymmdd',date);
edit17.Text:='0001';
edit17.SetFocus;
end;
procedure TForm25.BitBtn1Click(Sender: TObject);
begin
jiaofei_num:=edit16.Text+edit17.text;
jiaofei:=combobox1.Text;
feiyong_yingjiao_date:=datetostr(datetimepicker1.Date);
house_num:=trim(edit1.Text);
man_name:=s1;
//feiyong_yujiao_zhuanchu:=trim(edit9.Text);
dianfei_yingjiao:=dianbiao_benyue*dianfei_price;
shuifei_yingjiao:=yongshui_benyue*shuifei_price;
with datamodule1.ADOQuery_add_jiaofei do
begin
close;
sql.Clear;
sql.Add('insert into pay_feiyong(jiaofei_num,house_num,man_name,jiaofei_shiqi,feiyong_yingjiao,feiyong_shijiao,feiyong_yue,feiyong_yujiao,feiyong_yujiao_qichu,feiyong_yujiao_zhuanchu,feiyong_yujiao_qimo,feiyong_qianjiao_qichu,feiyong_qianjiao,'); //feiyong_yingjiao,feiyong_shijiao,feiyong_yue,feiyong_yujiao,feiyong_yujiao_qichu,feiyong_yujiao_zhuanchu,feiyong_yujiao_qimo) 'values('''+jiaofei_num+''','''+house_num+''','''+jiaofei_month+''')');
sql.Add('zhinajin_qichu,zhinajin_benyue,zhinajin_yuemo,jiaofei,feiyong_yingjiao_date,jiaofei_date,shuibiao_yuechu,shuibiao_yuemo,shuibiao_benyue,shuifei_yingjiao,rent_yingjiao,wgf_yingjiao,dianbiao_yuechu,dianbiao_yuemo,dianbiao_benyue,dianfei_yingjiao)');
sql.Add('values('''+jiaofei_num+''','''+house_num+''','''+dbedit1.Text+''','''+jiaofei_month+''','''+floattostr(feiyong_yingjiao)+''','''+floattostr(feiyong_shijiao)+''','''+edit12.Text+''','''+floattostr(feiyong_yujiao)+''','''+floattostr(feiyong_yujiao_qichu)+''','''+floattostr(feiyong_yujiao_zhuanchu)+''','''+floattostr(feiyong_yujiao_qimo)+''','''+floattostr(feiyong_qianjiao_qichu)+''','''+edit11.Text+''','''+floattostr(zhinajin_qichu)+''','''+zhinajin_benyuex+''','''+edit14.Text+''','''+jiaofei+''','''+feiyong_yingjiao_date+''','''+jiaofei_date+''','''+floattostr(shuibiao_qichu)+''','''+floattostr(shuibiao_qimo)+''','''+floattostr(yongshui_benyue)+''','''+floattostr(shuifei_yingjiao)+''','''+floattostr(rent_yingjiao)+''','''+floattostr(wgf_yingjiao)+''','''+floattostr(dianbiao_qichu)+''','''+floattostr(dianbiao_qimo)+''','''+floattostr(dianbiao_benyue)+''','''+floattostr(dianfei_yingjiao)+''')');
execsql;
with datamodule1.ADOQuery_modify_pay_feiyong_qichu do
begin
close;
sql.Clear;
sql.Add('update pay_feiyong_qichu set feiyong_yue='''+edit12.Text+''',feiyong_yujiao_qichu='''+floattostr(feiyong_yujiao_qimo)+''',feiyong_qianjiao_qichu='''+edit11.Text+''',zhinajin_qichu='''+edit14.Text+''',shuibiao_yuechu='''+floattostr(shuibiao_qimo)+''',dianbiao_yuechu='''+floattostr(dianbiao_qimo)+'''');
sql.Add('Where house_num='+''''+edit1.Text+'''');
execsql;
end;
Application.Messagebox('·¿·ÑÊý¾Ý¼Èë³É¹¦!.','Ìáʾ',MB_OK);
if Application.MessageBox('ÄãÊÇ·ñÐèÒª´òÓ¡·¿·ÑÊվݣ¿Èç¹ûÊÇÇë°´È·¶¨°´Å¥£¬·ñÔòÇë°´È¡Ïû°´Å¥¡£','Ìáʾ',MB_okcancel)=idcancel then
begin
i:=0001;
ss:=i+strtoint(edit17.Text);
edit17.Text:=formatfloat('0000',ss);
edit1.Text:='';
edit3.Text:='';
edit2.Text:='';
edit6.Text:='';
edit4.Text:='';
edit7.Text:='';
edit12.Text:='';
edit5.Text:='';
edit8.Text:='';
edit9.Text:='';
edit10.Text:='';
edit11.Text:='';
edit14.Text:='';
combobox1.Text:='';
dbedit1.Text:='';
dbedit3.Text:='';
dbedit4.Text:='';
dbedit2.Text:='';
dbedit5.Text:='';
dbedit6.Text:='';
dbedit7.Text:='';
dbedit8.Text:='';
dbedit9.Text:='';
bitbtn1.Enabled:=false;
bitbtn3.Enabled:=false;
bitbtn4.Enabled:=false;
edit1.SetFocus;
end
else
begin
bitbtn1.Enabled:=false;
bitbtn4.SetFocus;
end;
end;
end;
procedure TForm25.BitBtn3Click(Sender: TObject);
begin
//form25.Hide;
form27.QuickRep1.Preview;
end;
procedure TForm25.BitBtn4Click(Sender: TObject);
begin
form27.QuickRep1.Print;
end;
end.
5、form25窗体所用到的ADO组件属性及按钮含义如下:
ADOQuery_add_jiaofei的SQL语句为select * from pay_feiyong
ADOQuery_add_jiaofei的数据源为DataSource_add_jiaofei
ADOQuery_modify_pay_feiyong_qichu的SQL语句为select * from pay_feiyong_qichu。
Bitbtn1、Bitbtn2、Bitbtn3、Bitbtn4分别表示交费、打印预览、打印、取消。
6、form27中的内容
(1)
ADOQuery1的SQL语句为select * from pay_eiyong
ADOQuery1的数据源为DataSource1.
(2)
QuickRep1的QRBand1的BandType为rbColumnHeader.
ADOQuery1的表格内容为
票据号的内容为QRLabel40
楼号房号的内容为QRLabel42
住户姓名的内容为QRLabel44
年月的内容为QRLabel4
应交水电费的内容为QRLabel6
余额的内容为QRLabel8
实交费用的内容为QRLabel10
预交费用月初余额的内容为QRLabel12
本月预交费用的内容为QRLabel14
本月预交费用转实交数的内容为QRLabel16
本月应交滞纳金的内容为QRLabel18
月末水表读数的内容为QRLabel24
本月用水数的内容为QRLabel26
本月应交房租的内容为QRLabel28
本月应交物管费的内容为QRLabel30
月末电表读数的内容为QRLabel32
本月电表数的内容为QRLabel37
收款人的内容为QRLabel21
表格内容大致形状为左边为栏目名称,右边紧接着是栏目内容.例如 楼号房号 楼号房号的内容.