u_zigeystzs.pas
来自「招投标软件代码,很有应用价值,请大家参考下哦,不明白的地方给我留言」· PAS 代码 · 共 743 行 · 第 1/2 页
PAS
743 行
end;
procedure Tf_zigeystzs.Com_GclxnameChange(Sender: TObject);
begin
inherited;
//GetBiaoduan;
if (com_xmname.Items.IndexOf(com_xmname.text)<0)
or (Com_Gclxname.Items.IndexOf(Com_Gclxname.text)<0)
or (com_zhaobiao.items.IndexOf(com_zhaobiao.text)<0) then exit;
loaddwname;
FileName:=GetFilePath;
end;
procedure Tf_zigeystzs.SpeedButton2Click(Sender: TObject);
var
listitem:tlistitem;
begin
listitem:=listview2.Items.Add;
listitem.Caption:=listview1.Selected.Caption;
listitem.SubItems.Add(listview1.Selected.SubItems[0]);
listview1.DeleteSelected;
end;
procedure Tf_zigeystzs.SpeedButton3Click(Sender: TObject);
var
listitem:tlistitem;
begin
listitem:=listview1.Items.Add;
listitem.Caption:=listview2.Selected.Caption;
listitem.SubItems.Add(listview2.Selected.SubItems[0]);
listview2.DeleteSelected;
end;
procedure Tf_zigeystzs.bb_SaveClick(Sender: TObject);
VAR
FormField: variant;
i:integer;
sdata1,sdata2:string;
listtext:tStringList;
FileHandle:integer;
begin
if not IsExistsPath then exit;
if com_zhaobiao.Text='施工' then
begin
if IsFileInUse(GetFilePath+'yushen.Doc') then
begin
if IsPrint then
begin
if application.MessageBox('打印通知书调用该文件,是否结束','请确定',MB_YESNO)<>Idyes then
exit;
end;
try
if CanSave then
Doc.save
else
Doc.saved:=True;
Word.quit;
Word:=Unassigned;
except
showmessage('文件在程序外打开,请先关闭!');
exit;
end;
end;
Try
Word:=CreateOleObject('word.application');
Doc := Word.Documents.Open(GetFilePath+'yushen.doc');
except
showmessage('打开模板错误');
Word.quit;
word:=UnAssigned;
exit;
end;
if not fileexists(GetFilePath+'yushen.txt') then
begin
FileHandle:=filecreate(GetFilePath+'yushen.txt');
fileclose(FileHandle);
end;
sdata1:=mintomax(DateTimePicker1.DateTime);
sdata2:=mintomax(DateTimePicker2.DateTime);
memo1.Lines.LoadFromFile(GetFilePath+'yushen.txt');
for i:=0 to listview1.Items.Count-1 do
begin
Doc.FormFields.Item(1).Result := ListView1.Items[i].Caption;
Doc.FormFields.Item(2).Result := xmbdgc.XM_NAME;
Doc.FormFields.Item(3).Result := xmbdgc.GCLX_NAME;
Doc.FormFields.Item(4).Result := sdata1;
Doc.FormFields.Item(5).Result := sdata2;
word.printOut; memo1.Lines.Add('发送单位:'+listview1.Items[i].Caption);
memo1.lines.Add('发送日期:'+(sdata1));
end;
memo1.Lines.SaveToFile(GetFilePath+'yushen.txt');
isPrint:=True;
CanSave:=False;
end
else if com_zhaobiao.Text='监理' then
begin
if IsFileInUse(GetFilePath+'yushen.Doc') then
begin
if IsPrint then
begin
if application.MessageBox('打印通知书调用该文件,是否结束','请确定',MB_YESNO)<>Idyes then
exit;
end;
try
if CanSave then
Doc.save
else
Doc.saved:=True;
Word.quit;
Word:=Unassigned;
except
showmessage('文件在程序外打开,请先关闭!');
exit;
end;
end;
Try
Word:=CreateOleObject('word.application');
Doc := Word.Documents.Open(GetFilePath+'yushen.doc');
except
showmessage('打开模板错误');
Word.quit;
word:=UnAssigned;
exit;
end;
if not fileexists(GetFilePath+'yushen.txt') then
begin
FileHandle:=filecreate(GetFilePath+'yushen.txt');
fileclose(FileHandle);
end;
sdata1:=mintomax(DateTimePicker1.DateTime);
sdata2:=mintomax(DateTimePicker2.DateTime);
memo1.Lines.LoadFromFile(GetFilePath+'yushen.txt');
for i:=0 to listview1.Items.Count-1 do
begin
Doc.FormFields.Item(1).Result := ListView1.Items[i].Caption;
Doc.FormFields.Item(2).Result := xmbdgc.XM_NAME;
Doc.FormFields.Item(3).Result := xmbdgc.GCLX_NAME;
Doc.FormFields.Item(4).Result := sdata1;
Doc.FormFields.Item(5).Result := sdata2;
word.printOut;
memo1.Lines.Add('发送单位:'+listview1.Items[i].Caption);
memo1.lines.Add('发送日期:'+(sdata1));
end;
memo1.Lines.SaveToFile(GetFilePath+'yushen.txt');
isPrint:=True;
CanSave:=False;
end;
end;
{procedure Tf_zigeystzs.Com_LeibieChange(Sender: TObject);
begin
loaddwname;
end;}
procedure Tf_zigeystzs.bb_PrintPreClick(Sender: TObject);
VAR
FormField: variant;
sdata1,sdata2:string;
begin
if not IsExistsPath then exit;
if com_zhaobiao.Text='施工' then
begin
if listview1.Selected=nil then exit;
if IsFileInUse(GetFilePath+'yushen.Doc') then
begin
if IsPrint then
begin
if application.MessageBox('通知书调用该文件,是否结束','请确定',MB_YESNO)<>Idyes then
exit;
end;
try
if CanSave then
Doc.save
else
Doc.saved:=True;
Word.Quit;
Word:=Unassigned;
except
showmessage('程序在软件外打开,请先关闭');
exit;
end;
end;
Try
Word:=CreateOleObject('word.application');
Doc := Word.Documents.Open(GetFilePath+'yushen.doc');
except
showmessage('打开模板错误');
Word.quit;
word:=UnAssigned;
exit;
end;
sdata1 := mintomax(DateTimePicker1.DateTime);
sdata2 := mintomax(DateTimePicker2.DateTime);
Doc.FormFields.Item(1).Result := ListView1.Selected.Caption;
Doc.FormFields.Item(2).Result := xmbdgc.XM_NAME;
Doc.FormFields.Item(3).Result := xmbdgc.GCLX_NAME;
Doc.FormFields.Item(4).Result := sdata1;
Doc.FormFields.Item(5).Result := sdata2;
Word.Visible := True;
//Doc.PrintPreview;
IsPrint:=False;
CanSave:=False;
end
else if com_zhaobiao.Text='监理' then
begin
if listview1.Selected=nil then exit;
if IsFileInUse(GetFilePath+'yushen.Doc') then
begin
if IsPrint then
begin
if application.MessageBox('打印通知书调用该文件,是否结束','请确定',MB_YESNO)<>Idyes then
exit;
end;
if CanSave then
Doc.save
else
Doc.saved:=True;
Word.Quit;
Word:=Unassigned;
end;
try
Word:=CreateOleObject('word.application');
Doc := Word.Documents.Open(GetFilePath+'yushen.doc');
except
showmessage('打开模板错误!');
word.quit;
word:=UnAssigned;
exit;
end;
sdata1 := mintomax(DateTimePicker1.DateTime);
sdata2 := mintomax(DateTimePicker2.DateTime);
Doc.FormFields.Item(1).Result := ListView1.Selected.Caption;
Doc.FormFields.Item(2).Result := xmbdgc.XM_NAME;
Doc.FormFields.Item(3).Result := xmbdgc.GCLX_NAME;
Doc.FormFields.Item(4).Result := sdata1;
Doc.FormFields.Item(5).Result := sdata2;
Word.Visible := True;
//Doc.PrintPreview;
IsPrint:=False;
CanSave:=False;
end;
end;
procedure Tf_zigeystzs.BitBtn1Click(Sender: TObject);
var
FileHandle:integer;
begin
if not IsExistsPath then exit;
if com_zhaobiao.Text='施工' then
begin
if IsFileInUse(GetFilePath+'yushen.Doc') then
begin
if IsPrint then
begin
if application.MessageBox('通知书调用该文件,是否结束','请确定',MB_YESNO)<>Idyes then
exit;
end;
try
if CanSave then
Doc.save
else
Doc.saved:=True;
Word.Quit;
Word:=Unassigned;
except
showmessage('文件在程序外打开,请先关闭!');
exit;
end;
end;
try
word:=CreateOleObject('word.application');
Doc:=Word.Documents.open(GetFilePath+'yushen.doc');
except
showmessage('打开模板错误');
word.quit;
word:=unassigned;
exit;
end;
word.visible:=true;
Word.activate;
IsPrint:=false;
CanSave:=true;
end
else if com_zhaobiao.text='监理' then
begin
if IsFileInUse(GetFilePath+'yushen.Doc') then
begin
if IsPrint then
begin
if application.MessageBox('打印通知书调用该文件,是否结束','请确定',MB_YESNO)<>Idyes then
exit;
end;
try
if CanSave then
Doc.save
else
Doc.saved:=True;
Word.Quit;
Word:=Unassigned;
except
showmessage('文件在程序外打开,请先关闭!');
exit;
end;
end;
try
word:=CreateOleObject('word.application');
Doc:=Word.Documents.open(GetFilePath+'yushen.doc');
except
showmessage('打开模板错误');
word.quit;
word:=unassigned;
exit;
end;
word.visible:=true;
Word.activate;
IsPrint:=false;
CanSave:=true;
end;
end;
procedure Tf_zigeystzs.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
if IsExistsPath then
begin
if com_zhaobiao.Text='施工' then
begin
if (IsFileInUse(GetFilePath+'yushen.Doc')) and IsPrint then
begin
if application.MessageBox('打印通知书调用该文件,是否结束','请确定',MB_YESNO)<>Idyes then
exit;
end;
try
if CanSave then
Doc.save
else
Doc.saved:=True;
Word.quit;
Word:=Unassigned;
except
end;
end
else if com_zhaobiao.Text='监理' then
begin
if (IsFileInUse(GetFilePath+'yushen.Doc')) and IsPrint then
begin
if application.MessageBox('打印通知书调用该文件,是否结束','请确定',MB_YESNO)<>Idyes then
exit;
end;
try
if CanSave then
Doc.save
else
Doc.saved:=True;
Word.quit;
Word:=Unassigned;
except
end;
end;
end;
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?