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