You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
197 lines
6.0 KiB
Plaintext
197 lines
6.0 KiB
Plaintext
unit u_sys_print_down;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, BusinessSkinForm, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid,IdFTPCommon,
|
|
DB, RxMemDS, bsSkinCtrls, IdFTP, StdCtrls, DBCtrls, ExtCtrls;
|
|
|
|
type
|
|
Tfrm_sys_print_down = class(TForm)
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
t_down_list: TRxMemoryData;
|
|
t_down_list1: TDataSource;
|
|
dxDBGrid1: TdxDBGrid;
|
|
dxDBGrid1Column1: TdxDBGridMaskColumn;
|
|
dxDBGrid1Column2: TdxDBGridMaskColumn;
|
|
dxDBGrid1Column4: TdxDBGridColumn;
|
|
Panel1: TPanel;
|
|
bsSkinButton3: TbsSkinButton;
|
|
bsSkinButton1: TbsSkinButton;
|
|
bsSkinButton5: TbsSkinButton;
|
|
procedure FormShow(Sender: TObject);
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frm_sys_print_down: Tfrm_sys_print_down;
|
|
|
|
implementation
|
|
|
|
uses u_sys_print, u_main, u_data_share,
|
|
u_sys_print_view;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure Tfrm_sys_print_down.FormShow(Sender: TObject);
|
|
var
|
|
line:string;
|
|
i:integer;
|
|
IdFTP1: TIdFTP;
|
|
str_list: TListBox;
|
|
begin
|
|
try
|
|
idftp1:=tidftp.Create(application);
|
|
str_list:=Tlistbox.Create(nil);
|
|
str_list.Visible:=false;
|
|
str_list.Parent:=frm_sys_print_down;
|
|
t_down_list.close;
|
|
t_down_list.open;
|
|
with idftp1 do
|
|
begin
|
|
Username:='xhdsoft.com';
|
|
Password:='fgerHJKy678';
|
|
Host:='218.107.216.42';
|
|
Connect;
|
|
end;
|
|
IdFTP1.ChangeDir('/航运物流管理系统/航运物流管理系统企业版/报表');
|
|
IdFTP1.TransferType := ftASCII;
|
|
str_list.Items.Clear;
|
|
IdFTP1.List(str_list.Items);
|
|
//下载报表名称
|
|
for i:=0 to str_list.Count -1 do
|
|
begin
|
|
try
|
|
Line:=str_list.Items[i];
|
|
while pos(' ',line) <> 0 do
|
|
begin
|
|
delete(line,1,pos(' ',line)); //类别^名称#日期~说明&.rtm
|
|
end;
|
|
// SHOWMESSAGE(copy(str_list.Items[i],pos('$',str_list.Items[i])+1,pos('^',str_list.Items[i])-pos('$',str_list.Items[i])-1));
|
|
if copy(str_list.Items[i],pos('$',str_list.Items[i])+1,pos('^',str_list.Items[i])-pos('$',str_list.Items[i])-1)=frm_sys_print_down.caption then
|
|
begin
|
|
t_down_list.insert;
|
|
t_down_list['报表名称']:=copy(str_list.Items[i],pos('^',str_list.Items[i])+1,pos('#',str_list.Items[i])-pos('^',str_list.Items[i])-1);
|
|
t_down_list['更新日期']:=copy(str_list.Items[i],pos('#',str_list.Items[i])+1,pos('~',str_list.Items[i])-pos('#',str_list.Items[i])-1);
|
|
t_down_list['报表说明']:=copy(str_list.Items[i],pos('~',str_list.Items[i])+1,pos('&',str_list.Items[i])-pos('~',str_list.Items[i])-1);
|
|
t_down_list.post;
|
|
end;
|
|
except
|
|
;
|
|
end;
|
|
//下载结束
|
|
end;
|
|
finally
|
|
str_list.free;
|
|
idftp1.Disconnect;
|
|
idftp1.Free;
|
|
end;
|
|
end;
|
|
|
|
procedure Tfrm_sys_print_down.bsSkinButton5Click(Sender: TObject);
|
|
begin
|
|
close;
|
|
end;
|
|
|
|
procedure Tfrm_sys_print_down.bsSkinButton3Click(Sender: TObject);
|
|
var
|
|
IdFTP1:TIdFTP;
|
|
str_name:widestring;
|
|
begin
|
|
if t_down_list.IsEmpty then
|
|
exit;
|
|
try
|
|
IdFTP1:=TIdFTP.Create(application);
|
|
with idftp1 do
|
|
begin
|
|
Username:='xhdsoft.com';
|
|
Password:='fgerHJKy678';
|
|
Host:='218.107.216.42';
|
|
Connect; //类别^名称#日期~说明&.rtm
|
|
end;
|
|
if not DirectoryExists(ExtractFilePath(Application.ExeName)+'update') then
|
|
CreateDir(ExtractFilePath(Application.ExeName)+'update');
|
|
IdFTP1.ChangeDir('/航运物流管理系统/航运物流管理系统企业版/报表');
|
|
str_name:='$'+frm_sys_print_down.caption
|
|
+'^'+t_down_list['报表名称']
|
|
+'#'+t_down_list['更新日期']
|
|
+'~'+t_down_list['报表说明']
|
|
+'&.rtm';
|
|
IdFTP1.Get(str_name,ExtractFilePath(Application.ExeName)+'update\'+str_name,true);
|
|
|
|
frm_sys_print.rp.template.DatabaseSettings.name :='';
|
|
frm_sys_print.rp.AllowPrintToFile:=false;
|
|
frm_sys_print.rp.template.FileName:=ExtractFilePath(Application.ExeName)+'update\'+str_name;
|
|
frm_sys_print.rp.Template.LoadFromFile;
|
|
if not assigned(frm_sys_print_view) then
|
|
frm_sys_print_view:=tfrm_sys_print_view.Create(self);
|
|
frm_sys_print_view.ppViewer1.Report:=frm_sys_print.rp;
|
|
frm_sys_print.rp.PrintToDevices;
|
|
frm_sys_print_view.ShowModal;
|
|
except
|
|
showmessage('与下载服务器联机失败!!');
|
|
end;
|
|
idftp1.Disconnect;
|
|
IdFTP1.free;
|
|
end;
|
|
|
|
procedure Tfrm_sys_print_down.bsSkinButton1Click(Sender: TObject);
|
|
var
|
|
IdFTP1:TIdFTP;
|
|
str_name:widestring;
|
|
str:widestring;
|
|
begin
|
|
if t_down_list.IsEmpty then
|
|
exit;
|
|
try
|
|
IdFTP1:=TIdFTP.Create(application);
|
|
with idftp1 do
|
|
begin
|
|
Username:='xhdsoft.com';
|
|
Password:='fgerHJKy678';
|
|
Host:='218.107.216.42';
|
|
Connect;
|
|
end;
|
|
if not DirectoryExists(ExtractFilePath(Application.ExeName)+'update') then
|
|
CreateDir(ExtractFilePath(Application.ExeName)+'update');
|
|
IdFTP1.ChangeDir('/航运物流管理系统/航运物流管理系统企业版/报表');
|
|
str_name:='$'+frm_sys_print_down.caption
|
|
+'^'+t_down_list['报表名称']
|
|
+'#'+t_down_list['更新日期']
|
|
+'~'+t_down_list['报表说明']
|
|
+'&.rtm';
|
|
IdFTP1.Get(str_name,ExtractFilePath(Application.ExeName)+'update\'+str_name,true);
|
|
|
|
str:=trim(InputBox('请输入新报表名称', '报表名称:', ''));
|
|
if str=''then
|
|
begin
|
|
showmessage('新报表名称不能为空,下载失败!!');
|
|
exit;
|
|
end;
|
|
if frm_sys_print.t_sys_report.locate('报表名称',str,[]) then
|
|
begin
|
|
showmessage('数据库中存在与新报表名称相同名称的报表,下载失败!!');
|
|
exit;
|
|
end;
|
|
|
|
frm_sys_print.rp.template.DatabaseSettings.name :=str;
|
|
frm_sys_print.rp.AllowPrintToFile:=true;
|
|
frm_sys_print.rp.template.FileName:=ExtractFilePath(Application.ExeName)+'update\'+str_name;
|
|
frm_sys_print.rp.Template.LoadFromFile;
|
|
frm_sys_print.rp.Template.Save;
|
|
except
|
|
showmessage('与下载服务器联机失败!!');
|
|
end;
|
|
idftp1.Disconnect;
|
|
IdFTP1.free;
|
|
end;
|
|
|
|
end.
|