解决方案 »
- 还有人在不
- delphi 2009
- 求更好的方法:如何判断SQL Server中数据库已经存在并得到它的大小?
- 用ole流的格式存储到long row字段中,再取出时直接存成文件不能打开
- 如何在DBGRID里的单元格里按方向键的时候,调用一个窗口
- 初学者,请各位高手看看这代码有什么错误?
- 今年9月1日是我的生日,我来放分了!还在外地不能跟老婆一起过伤心!
- 请各位高手帮忙,怎样清空一个数据表?
- [请教]取得当前时间,想在这个时间上加若干秒,如何实现? 有段代码,大家帮忙看看。谢了!
- 客户/服务器开发
- 一个用java写的加密方法想转成成delphi的加密方法。菜鸟期望能得到帮助!
- 请问谁有好用的基窗体,能发一个给我吗
SaveDBGridEhToExportFile(TDBGridEhExportAsXLS, DBGrideh, FileName, True);
procedure TRes_HrCq_YD_F.btnSB_PrintClick(Sender: TObject);
begin
inherited;
if qry_ydcx.IsEmpty then
begin
MessageBox(Handle,'數據不能為空!!!','數據導出...',MB_OK+ MB_ICONWARNING);
Exit;
end else
begin
if dlgSave1.Execute then
begin
ExportGridToExcel(dlgSave1.FileName,cxGrid2,True,True,False,'XLS');
MessageBox(Handle,'數據成功導出!!!','數據導出...',MB_OK+ MB_ICONWARNING);
end;
end;
end;
var
iLoop,Rownos:Integer;
begin
inherited;
if (cbb_cb.Text<>'') and
(cbb_kb.Text<>'') and
(cbb_zxb.Text<>'') and
(cxdt.Text<>'') and
(cxComboBox1.Text<>'') and
(cxComboBox2.Text<>'') and
(cxComboBox3.Text<>'') and
(cxComboBox4.Text<>'') and
(cxComboBox5.Text<>'') and
(cxComboBox6.Text<>'') and
(cxComboBox7.Text<>'') then
begin
if qry_HrYd.RecordCount>0 then
begin
if MessageDlg('操作詢問(“人事異動”):你確定要異動這些人事資料數據嗎!',mtConfirmation,[mbYes,mbNo],0)=idyes then
begin
if not qry_HrYd.FieldByName('YDDCheck').AsBoolean then
begin
MessageDlg('操作提示:請勾選要異動的人員記錄數據!',mtWarning,[mbOK],0);
Exit;
end;
Application.ProcessMessages;
ProgressBar1.Min:=0;
ProgressBar1.Max:=qry_HrYd.RecordCount;
qry_HrYd.First;
Rownos:=qry_HrYd.RecNo;
for iLoop:=0 to qry_HrYd.RecordCount -1 do
begin
ProgressBar1.Position:=ProgressBar1.Position+1;
Application.ProcessMessages;
if qry_HrYd.FieldByName('YDDCheck').AsBoolean then
begin
if (cxdt.Date>TnowDt) then
begin
qry_getdsc.Close;
qry_getdsc.SQL.Text:=' select * from RES_HR_RSYD where ACCOUNT_ID='''+ Trim(qry_HrYd.FieldByName('Account_Id').AsString)+''' and SXRQ='''+ FormatDateTime('yyyy/mm/dd',cxdt.Date)+''' ';
qry_getdsc.Open;
if (qry_getdsc.RecordCount >0) then
begin
qry_HrYd.Edit;
qry_HrYd.FieldByName('YDDCheck').AsBoolean:=False;
qry_HrYd.Next;
Continue;
end;
end;
try
//插入日誌數據
qry_BaseTemp.Close;
qry_BaseTemp.SQL.Clear;
qry_BaseTemp.SQL.Add( ' insert into RES_HR_RSYD_Log (TypeID,ACCOUNT_ID,FULL_NAME,YCB,YBM,YBMID,YKB,YZXB,YBC,YJZ,YZJQF,YCBZX,YGW,YZW,XCB,XBM,XKB,XZXB,XBMID,XBC,XJZ,XZJQF,XCBZX,XGW,XZW,JN,FLAG,USERID,USERNAME,SXRQ) values (''新增'', ');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('Account_Id').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('Full_Name').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('CB').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('BM').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('BMID').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('KB').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('XB').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('BC').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('JZ').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('ZJQF').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('CBZX').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('GW').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('ZW').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(cxComboBox1.Text)+',');
qry_BaseTemp.SQL.Add(QuotedStr(cxComboBox2.Text)+',');
qry_BaseTemp.SQL.Add(QuotedStr(cxComboBox3.Text)+',');
qry_BaseTemp.SQL.Add(QuotedStr(cxComboBox4.Text)+',');
qry_BaseTemp.SQL.Add(QuotedStr(StrBMID)+',');
qry_BaseTemp.SQL.Add(QuotedStr(cxComboBox5.Text)+',');
qry_BaseTemp.SQL.Add(QuotedStr(cxComboBox8.Text)+',');
qry_BaseTemp.SQL.Add(QuotedStr(cxComboBox7.Text)+',');
qry_BaseTemp.SQL.Add(QuotedStr(StrCBZX)+',');
qry_BaseTemp.SQL.Add(QuotedStr(cxTextEdit1.Text)+',');
qry_BaseTemp.SQL.Add(QuotedStr(cxComboBox6.Text)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('JN').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(qry_HrYd.fieldbyname('FLAG').AsString)+',');
qry_BaseTemp.SQL.Add(QuotedStr(_UserNo)+',');
qry_BaseTemp.SQL.Add(QuotedStr(_UserName)+',');
qry_BaseTemp.SQL.Add(QuotedStr(FormatDateTime('yyyy/mm/dd',cxdt.Date))+')');
qry_BaseTemp.ExecSQL;
//插入異動數據
qry_spydd.Close;
qry_spydd.SQL.Clear;
qry_spydd.SQL.Add( ' exec SP_MES_HRYDD '+quotedstr(Trim(qry_HrYd.fieldbyname('Account_Id').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('Full_Name').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('CB').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('BM').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('BMID').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('PartID').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('KB').AsString))+','+
quotedstr(Trim(qry_HrYd.fieldbyname('XB').AsString))+','+quotedstr(Trim(Ybuyercode))+','+quotedstr(Trim(qry_HrYd.fieldbyname('BC').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('JZ').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('ZJQF').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('CBZX').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('GW').AsString))+','+quotedstr(Trim(qry_HrYd.fieldbyname('ZW').AsString))+','+quotedstr(Trim(cxComboBox1.Text))+','+
quotedstr(Trim(cxComboBox2.Text))+','+quotedstr(Trim(cxComboBox3.Text))+','+quotedstr(Trim(cxComboBox4.Text))+','+quotedstr(Trim(Xbuyercode))+','+quotedstr(Trim(StrBMID))+','+quotedstr(Trim(StrPartID))+','+quotedstr(Trim(cxComboBox5.Text))+','+quotedstr(Trim(cxComboBox8.Text))+','+quotedstr(Trim(cxComboBox7.Text))+','+quotedstr(Trim(StrCBZX))+','+quotedstr(Trim(cxTextEdit1.Text))+','+quotedstr(Trim(cxComboBox6.Text))+','+quotedstr(Trim(qry_HrYd.fieldbyname('JN').AsString))+','+
quotedstr(FormatDateTime('yyyy/mm/dd',cxdt.Date)));
qry_spydd.ExecSQL;
qry_HrYd.Edit;
qry_HrYd.FieldByName('YDDCheck').AsBoolean:=False;
except
qry_HrYd.Edit;
qry_HrYd.FieldByName('YDDCheck').AsBoolean:=False;
qry_HrYd.Next;
Continue;
end;
end;
qry_HrYd.Next;
end;
qry_HrYd.RecNo:=Rownos;
ProgressBar1.Position:=0;
cbb_cb.Clear;
cbb_kb.Clear;
cbb_zxb.Clear;
cbb_gh.Clear;
cxComboBox1.Clear;
cxComboBox2.Clear;
cxComboBox3.Clear;
cxComboBox4.Clear;
cxComboBox5.Clear;
cxComboBox6.Clear;
cxTextEdit1.Clear;
cxComboBox7.Clear;
cxComboBox8.Clear;
cbb_cb.SetFocus;
end else
Abort;
end;
end else
MessageDlg('操作提示:請確認異動信息是否填寫完整或是否為空!',mtWarning,[mbOK],0);
Exit;
end;