不知问题出在哪里,请大家指点(100分)

A

andywos

Unregistered / Unconfirmed
GUEST, unregistred user!
本人做一个天心的计件工资管理的小软件,出现一天几千条记录输入,总会出现几条TF_SZTZ1(明细表)有记录,但TF_SZTZ(总表)没有记录,每天明细表与总表比较总有一点差异<br>看了很久源码,不知问题出在哪里,请高手指点一下。谢谢,分不够在加<br><br>function &nbsp;TFORM1.CHK_CLEAR:Boolean;<br>BEGIN<br>if TRIM(edit1.Text)='' then<br>BEGIN<br>showmessage('单号为空');<br>Result :=false;<br>END<br>else<br>if trim(RzDateTimeEdit2.Text)='' then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp;showmessage('调薪月份为空');<br>&nbsp; &nbsp;result:=false;<br>&nbsp; &nbsp;end<br>&nbsp; &nbsp;else<br>&nbsp; &nbsp; &nbsp; if trim(combobox1.Text)='' then<br>&nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp;showmessage('计薪项目为空');<br>&nbsp; &nbsp; &nbsp; &nbsp;result:=false;<br>&nbsp; &nbsp; &nbsp; &nbsp;end;<br>END;<br><br>function &nbsp;TFORM1.CHK_CLEAR1:Boolean;<br>BEGIN<br>if trim(edit2.Text)='' then<br>BEGIN<br>showmessage('工号为空');<br>Result :=false;<br>END<br>else<br>&nbsp; &nbsp;if trim(RzDateTimeEdit2.Text)='' then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp;showmessage('调薪时间为空');<br>&nbsp; &nbsp;result:=false;<br>&nbsp; &nbsp;end<br>&nbsp; &nbsp;else<br>&nbsp; &nbsp; &nbsp; &nbsp;if trim(edit6.Text)='' then<br>&nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp;showmessage('金额为空');<br>&nbsp; &nbsp; &nbsp; &nbsp;result:=false;<br>&nbsp; &nbsp; &nbsp; &nbsp;end<br>&nbsp; &nbsp; &nbsp; &nbsp;else<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if trim(edit5.Text)='' then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage('数量为空');<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result:=false;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end<br>&nbsp; &nbsp; &nbsp; &nbsp; <br>END;<br>PROCEDURE tform1.post_CLEAR;<br>begin<br>edit2.Text:='';<br>//DBDateTimeEditEh2.Text:='';<br>//edit5.Text:='';<br>edit6.Text:='';<br>//combobox2.Text:='';<br>edit3.Text:='';<br>end;<br><br>PROCEDURE tform1.CLEAR;<br>begin<br>edit1.Text:='';<br>RzDateTimeEdit2.Clear; &nbsp; //因加CHANGE所在要在前<br>RzDateTimeEdit1.Clear;<br>combobox1.Text:='';<br>edit2.Text:='';<br><br>edit6.Text:='';<br>edit5.Text:='';<br>edit3.Text:='';<br>end;<br><br>procedure TForm1.ToolButton4Click(Sender: TObject);<br>begin<br>application.Terminate;<br>end;<br><br>procedure TForm1.ToolButton1Click(Sender: TObject);<br>begin<br>CLEAR;<br>if adoquery1.Active=true then<br>&nbsp; &nbsp;adoquery1.Close;<br>edit1.Text:=FormatdateTime('yyyymmddhhmmss',now);<br>IF StatusBar1.Panels[3].Text&lt;&gt;'I001' THEN<br>BEGIN<br>ToolButton5.Enabled:=FALSE;<br>ToolButton2.Enabled:=TRUE;<br>ToolButton3.Enabled:=TRUE;<br>end;<br>END;<br><br>procedure TForm1.ToolButton10Click(Sender: TObject);<br>begin<br>try<br>&nbsp; adoquery1.Close;<br>&nbsp; adoquery1.SQL.Clear;<br>&nbsp; adoquery1.SQL.Add('select * from tf_sztz1 where yd_dh='+''''+trim(edit1.text)+''''+'and sz_ym='+''''+trim(RzDateTimeEdit1.Text)+'-1'+''''+'and sz_no='+''''+trim(combobox1.Text)+'''');<br>&nbsp; adoquery1.Open;<br>&nbsp; if (TRIM(adoquery1.FieldByName('sh').AsString)&lt;&gt;'') AND (trim(StatusBar1.Panels[3].Text)&lt;&gt;'I001') then<br>&nbsp; &nbsp;begin<br>&nbsp; &nbsp;ToolButton2.Enabled:=false;<br>&nbsp; &nbsp;ToolButton3.Enabled:=false;<br>&nbsp; &nbsp;end<br>&nbsp; ELSE<br>&nbsp; BEGIN<br>&nbsp; &nbsp;ToolButton2.Enabled:=TRUE;<br>&nbsp; &nbsp;ToolButton3.Enabled:=TRUE;<br>&nbsp; END;<br>except<br>CHK_CLEAR;<br>end;<br>end;<br><br>procedure TForm1.ToolButton3Click(Sender: TObject);<br>begin<br>if StartOfTheMonth(RzDateTimeEdit2.Date)&lt;&gt;strtodate(trim(RzDateTimeEdit1.Text)+'-1') then<br>showmessage('调薪时间不在调整月份之内!')<br>else<br>if CHK_CLEAR and CHK_CLEAR1 then<br>begin<br>adoconnection1.begintrans;<br>try<br>&nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.Close;<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.SQL.Clear;<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.SQL.Add('select * from tf_sztz1 where yd_dh='+''''+trim(edit1.text)+''''+'and sz_ym='+''''+Trim(RzDateTimeEdit1.Text)+'-1'+''''+'and sz_no='+''''+trim(combobox1.Text)+'''');<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.Open;<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.Append;<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('yd_dh').Value:=trim(edit1.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('sz_ym').Value:=FormatdateTime('yyyy-mm-dd',STRTODATE(trim(RzDateTimeEdit1.Text)+'-1'));<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('sz_no').Value:=trim(combobox1.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('yg_no').Value:=trim(edit2.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('name').Value:=trim(edit7.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('tz_dd').Value:=strtodate(trim(RzDateTimeEdit2.Text));<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('qty').Value:=trim(edit5.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('amtn').Value:=STRTOFLOAT(trim(edit6.Text));<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('chk_man').Value:=trim(StatusBar1.Panels[3].Text);<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.FieldByName('rem').Value:=trim(edit3.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery1.Post;<br><br>&nbsp; &nbsp; // 写入异动<br><br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery4.Close;<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery4.SQL.Clear;<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery4.SQL.Add('select * from tf_sztz where yg_no='+''''+trim(edit2.text)+''''+'and sz_no='+''''+trim(combobox1.text)+''''+'and tz_dd='+''''+trim(RzDateTimeEdit2.Text)+''''+'and sz_ym='+''''+trim(RzDateTimeEdit1.Text)+'-1'+'''');<br>&nbsp; &nbsp; &nbsp; &nbsp;adoquery4.Open;<br>&nbsp; &nbsp; &nbsp; &nbsp;if adoquery4.RecordCount=1 then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.edit;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; adoquery4.FieldByName('amtn').Value:=adoquery4.FieldByName('amtn').Value+STRTOFLOAT(trim(edit6.Text));<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; adoquery4.Post;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end<br>&nbsp; &nbsp; &nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.Append;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.FieldByName('yg_no').Value:=trim(edit2.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.FieldByName('sz_no').Value:=trim(combobox1.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.FieldByName('tz_dd').Value:=strtodate(trim(RzDateTimeEdit2.Text));<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.FieldByName('sz_ym').Value:=FormatdateTime('yyyy-mm-dd',STRTODATE(trim(RzDateTimeEdit1.Text)+'-1'));<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.FieldByName('unit').Value:=null;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.FieldByName('amtn').Value:=STRTOFLOAT(trim(edit6.Text));<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.FieldByName('qty').Value:=trim(edit5.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.FieldByName('rem').Value:=trim(edit3.Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.FieldByName('chk_man').Value:=trim(StatusBar1.Panels[3].Text);<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adoquery4.Post;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; post_CLEAR;<br>&nbsp; &nbsp;adoconnection1.CommitTrans;<br>&nbsp; &nbsp;edit2.SetFocus;<br>&nbsp; &nbsp;except<br>&nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp;adoconnection1.RollbackTrans;//事务回滚<br>&nbsp; &nbsp; &nbsp;showmessage('保存失败!');<br>&nbsp; &nbsp; &nbsp;end;<br>&nbsp; &nbsp;end; &nbsp;<br>end; &nbsp; &nbsp; <br>end;
 
T

Tuatara

Unregistered / Unconfirmed
GUEST, unregistred user!
建议把数据库的real类型全部改成money类型。
 
A

andywos

Unregistered / Unconfirmed
GUEST, unregistred user!
表里没REAL类,只有NUMERIC,还有一个原因是,天心的表TF_SZTZ的表我不能修改,否则会影响天心ERP使用,TF_SZTZ1是我加的,一般都是我加的表增加记录没有问题,出问题的在天心那个表上,有时增加不到.不知什么原因
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
2K
import
I
I
回复
0
查看
922
import
I
L
回复
2
查看
366
lostangelnj
L
顶部