|
|
unit u_sys_frprint;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|
|
dxExEdtr, bsDialogs, bsSkinShellCtrls,
|
|
|
DB, ADODB,
|
|
|
BusinessSkinForm, StdCtrls, Mask, bsSkinBoxCtrls, bsdbctrls, bsSkinCtrls,
|
|
|
dxTL, dxDBCtrl, dxDBGrid, dxCntner, dxDBTLCl, dxGrClms, DBCtrls, XPMenu,
|
|
|
Menus, ExtDlgs, ImgList, IdFTP,IdFTPCommon, frxChBox, frxOLE,
|
|
|
frxDCtrl, frxCross, frxClass, frxADOComponents, frxRich, frxExportCSV,
|
|
|
frxExportImage, frxExportMail, frxGZip, frxCrypt, frxDesgn, frxExportODF,
|
|
|
frxExportPDF, frxExportXML, frxExportXLS, frxExportHTML, frxExportText,
|
|
|
frxExportRTF, frxDBSet, Grids, DBGrids,IniFiles,IdAttachmentFile,
|
|
|
IdMessage, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
|
|
|
IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP,
|
|
|
frxBarcode;
|
|
|
|
|
|
type
|
|
|
Tfrm_sys_frprint = class(TForm)
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column1: TdxDBGridMaskColumn;
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
t_sys_report: TADOQuery;
|
|
|
t_sys_report1: TDataSource;
|
|
|
bsSkinInputDialog1: TbsSkinInputDialog;
|
|
|
bsSkinDBEdit1: TbsSkinDBEdit;
|
|
|
dxDBGrid1Column2: TdxDBGridCheckColumn;
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
Label1: TLabel;
|
|
|
DBEdit1: TDBEdit;
|
|
|
Label2: TLabel;
|
|
|
DBEdit2: TDBEdit;
|
|
|
Button5: TButton;
|
|
|
PopupMenu1: TPopupMenu;
|
|
|
XPMenu1: TXPMenu;
|
|
|
N1: TMenuItem;
|
|
|
N2: TMenuItem;
|
|
|
EXCEL1: TMenuItem;
|
|
|
N3: TMenuItem;
|
|
|
WORD1: TMenuItem;
|
|
|
N4: TMenuItem;
|
|
|
PDF1: TMenuItem;
|
|
|
N5: TMenuItem;
|
|
|
RTF1: TMenuItem;
|
|
|
ImageList: TImageList;
|
|
|
OpenDialog1: TOpenDialog;
|
|
|
t_sys_report_employee: TADOQuery;
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
bsSkinButton12: TbsSkinButton;
|
|
|
bsSkinPanel4: TbsSkinPanel;
|
|
|
bsSkinButton6: TbsSkinButton;
|
|
|
bsSkinButton8: TbsSkinButton;
|
|
|
bsSkinButton7: TbsSkinButton;
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
bsSkinButton11: TbsSkinButton;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
t_sys_report_lei: TADOQuery;
|
|
|
t_sys_reportfile: TADOQuery;
|
|
|
t_sys_reportfile1: TDataSource;
|
|
|
frxBMPExport1: TfrxBMPExport;
|
|
|
frxJPEGExport1: TfrxJPEGExport;
|
|
|
frxTIFFExport1: TfrxTIFFExport;
|
|
|
frxRTFExport1: TfrxRTFExport;
|
|
|
frxSimpleTextExport1: TfrxSimpleTextExport;
|
|
|
frxHTMLExport1: TfrxHTMLExport;
|
|
|
frxXLSExport1: TfrxXLSExport;
|
|
|
frxPDFExport1: TfrxPDFExport;
|
|
|
frxODSExport1: TfrxODSExport;
|
|
|
frxODTExport1: TfrxODTExport;
|
|
|
frxDesigner1: TfrxDesigner;
|
|
|
frxCrypt1: TfrxCrypt;
|
|
|
frxGZipCompressor1: TfrxGZipCompressor;
|
|
|
frxMailExport1: TfrxMailExport;
|
|
|
frxGIFExport1: TfrxGIFExport;
|
|
|
frxCSVExport1: TfrxCSVExport;
|
|
|
frxRichObject1: TfrxRichObject;
|
|
|
frxReport1: TfrxReport;
|
|
|
db: TfrxADOComponents;
|
|
|
frxCrossObject1: TfrxCrossObject;
|
|
|
frxDialogControls1: TfrxDialogControls;
|
|
|
frxOLEObject1: TfrxOLEObject;
|
|
|
frxCheckBoxObject1: TfrxCheckBoxObject;
|
|
|
one_table_1: TfrxDBDataset;
|
|
|
one_table_2: TfrxDBDataset;
|
|
|
one_table_3: TfrxDBDataset;
|
|
|
one_table_4: TfrxDBDataset;
|
|
|
all_table_4: TfrxDBDataset;
|
|
|
all_table_3: TfrxDBDataset;
|
|
|
all_table_2: TfrxDBDataset;
|
|
|
all_table_1: TfrxDBDataset;
|
|
|
all_table_7: TfrxDBDataset;
|
|
|
all_table_5: TfrxDBDataset;
|
|
|
all_table_6: TfrxDBDataset;
|
|
|
print_head: TfrxDBDataset;
|
|
|
load_employee: TfrxDBDataset;
|
|
|
t_sys_cust: TADOQuery;
|
|
|
t_sys_cust1: TDataSource;
|
|
|
load_cust: TfrxDBDataset;
|
|
|
SaveDialog1: TSaveDialog;
|
|
|
ds_sys_reporthead1: TDataSource;
|
|
|
t_sys_reporthead: TADOQuery;
|
|
|
all_table_8: TfrxDBDataset;
|
|
|
all_table_9: TfrxDBDataset;
|
|
|
N6: TMenuItem;
|
|
|
N7: TMenuItem;
|
|
|
frxXLSExport2: TfrxXLSExport;
|
|
|
SMTP1: TIdSMTP;
|
|
|
IdMsg: TIdMessage;
|
|
|
mailsend1: TDataSource;
|
|
|
frxBarCodeObject1: TfrxBarCodeObject;
|
|
|
procedure bsSkinButton8Click(Sender: TObject);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton6Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure bsSkinButton7Click(Sender: TObject);
|
|
|
procedure N1Click(Sender: TObject);
|
|
|
procedure EXCEL1Click(Sender: TObject);
|
|
|
procedure WORD1Click(Sender: TObject);
|
|
|
procedure PDF1Click(Sender: TObject);
|
|
|
procedure RTF1Click(Sender: TObject);
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
procedure t_sys_reportAfterPost(DataSet: TDataSet);
|
|
|
procedure bsSkinButton12Click(Sender: TObject);
|
|
|
procedure t_sys_reportAfterOpen(DataSet: TDataSet);
|
|
|
procedure t_sys_reportBeforeClose(DataSet: TDataSet);
|
|
|
procedure t_sys_reportfileAfterInsert(DataSet: TDataSet);
|
|
|
procedure t_sys_reportfileAfterPost(DataSet: TDataSet);
|
|
|
function frxDesigner1SaveReport(Report: TfrxReport;
|
|
|
SaveAs: Boolean): Boolean;
|
|
|
function frxReport1UserFunction(const MethodName: String;
|
|
|
var Params: Variant): Variant;
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
procedure Button5Click(Sender: TObject);
|
|
|
procedure N7Click(Sender: TObject);
|
|
|
procedure bsSkinButton11Click(Sender: TObject);
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
var
|
|
|
frm_sys_frprint: Tfrm_sys_frprint;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, u_data_share,
|
|
|
my_sys_function, u_code_send_head,u_op_seae;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton8Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<>д<EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
if t_sys_reportfile.fieldbyname('report').IsNull then begin
|
|
|
showmessage('û<><C3BB>ҪԤ<D2AA><D4A4><EFBFBD>ĸ<EFBFBD>ʽ<EFBFBD><CABD>');
|
|
|
exit;
|
|
|
end;
|
|
|
try
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
frxReport1.PrepareReport;
|
|
|
frxReport1.Print;
|
|
|
except
|
|
|
showmessage('<27><>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
if frm_sys_frprint.caption='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤' then
|
|
|
begin
|
|
|
if not t_sys_report_employee.Locate('CH_ID',t_sys_report.fieldbyname('CH_ID').asinteger,[])then
|
|
|
begin
|
|
|
t_sys_report_employee.insert;
|
|
|
t_sys_report_employee['CH_ID']:=t_sys_report['CH_ID'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_report['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report_employee.edit;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton2Click(Sender: TObject);
|
|
|
var
|
|
|
book1:Tbookmark;
|
|
|
str:string;
|
|
|
inifile1:TIniFile;
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
t_sys_report.DisableControls;
|
|
|
book1:=t_sys_report.GetBookmark;
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
str:=t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
|
|
|
t_sys_report.First;
|
|
|
while not t_sys_report.eof do
|
|
|
begin
|
|
|
if t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring=str then
|
|
|
begin
|
|
|
t_sys_report.edit;
|
|
|
t_sys_report['<27>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>']:=1;
|
|
|
t_sys_report.post;
|
|
|
inifile1.EraseSection(t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
inifile1.WriteInteger(t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,t_sys_report.fieldbyname('CH_ID').AsInteger);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report.edit;
|
|
|
t_sys_report['<27>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>']:=0;
|
|
|
t_sys_report.post;
|
|
|
end;
|
|
|
t_sys_report.next;
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
inifile1.free;
|
|
|
t_sys_report.GotoBookmark(book1);
|
|
|
t_sys_report.EnableControls;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
SelectedMulti:=False;
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton3Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_sys_report.IsEmpty then begin
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select top 0 * from t_sys_report ');
|
|
|
t_sys_reportfile.Open;
|
|
|
end else begin
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
end;
|
|
|
t_sys_reportfile.Insert;
|
|
|
t_sys_reportfile['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=bsSkinInputDialog1.InputBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>',t_sys_reportfile.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
t_sys_reportfile.post;
|
|
|
{
|
|
|
if frm_sys_frprint.caption='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤' then
|
|
|
begin
|
|
|
if not t_sys_report_employee.Locate('CH_ID',t_sys_reportfile.fieldbyname('CH_ID').asinteger,[])then
|
|
|
begin
|
|
|
t_sys_report_employee.insert;
|
|
|
t_sys_report_employee['CH_ID']:=t_sys_reportfile['CH_ID'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_reportfile['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report_employee.edit;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end;
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
frxReport1.DesignReport;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton4Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<><C3BB>Ҫ<EFBFBD><D2AA><EFBFBD>Ƶĸ<C6B5>ʽ<EFBFBD><CABD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
try
|
|
|
if not t_sys_reportfile.fieldbyname('report').IsNull then begin
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
end;
|
|
|
frxReport1.DesignReport;
|
|
|
except
|
|
|
showmessage('<27><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
|
|
|
if frm_sys_frprint.caption='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤' then
|
|
|
begin
|
|
|
if not t_sys_report_employee.Locate('CH_ID',t_sys_reportfile.fieldbyname('CH_ID').asinteger,[])then
|
|
|
begin
|
|
|
t_sys_report_employee.insert;
|
|
|
t_sys_report_employee['CH_ID']:=t_sys_reportfile['CH_ID'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_reportfile['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report_employee.edit;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton9Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
begin
|
|
|
showmessage('û<><C3BB>Ҫɾ<D2AA><C9BE><EFBFBD>ĸ<EFBFBD>ʽ<EFBFBD><CABD>');
|
|
|
exit;
|
|
|
end;
|
|
|
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)=IDOK then
|
|
|
t_sys_report.delete;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton1Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
begin
|
|
|
showmessage('û<><C3BB>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶĸ<C6B5>ʽ<EFBFBD><CABD>');
|
|
|
exit;
|
|
|
end;
|
|
|
t_sys_report.edit;
|
|
|
t_sys_report['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=bsSkinInputDialog1.InputBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>',t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring);
|
|
|
t_sys_report.post;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton6Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
if t_sys_reportfile.isempty then
|
|
|
exit;
|
|
|
if t_sys_reportfile.fieldbyname('report').IsNull then begin
|
|
|
showmessage('û<><C3BB>ҪԤ<D2AA><D4A4><EFBFBD>ĸ<EFBFBD>ʽ<EFBFBD><CABD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
frxReport1.ShowReport;
|
|
|
except
|
|
|
showmessage('<27><>ӡԤ<D3A1><D4A4>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
if frm_sys_frprint.caption='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤' then
|
|
|
begin
|
|
|
if not t_sys_report_employee.Locate('CH_ID',t_sys_reportfile.fieldbyname('CH_ID').asinteger,[])then
|
|
|
begin
|
|
|
t_sys_report_employee.insert;
|
|
|
t_sys_report_employee['CH_ID']:=t_sys_reportfile['CH_ID'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_reportfile['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report_employee.edit;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.FormShow(Sender: TObject);
|
|
|
var inifile1:TIniFile;
|
|
|
ch_id:Integer;
|
|
|
begin
|
|
|
if not if_open('170') then
|
|
|
begin
|
|
|
bsSkinButton3.Enabled:=false;
|
|
|
bsSkinButton4.Enabled:=false;
|
|
|
bsSkinButton9.Enabled:=false;
|
|
|
bsSkinButton1.Enabled:=false;
|
|
|
// bsSkinButton2.Enabled:=false;
|
|
|
bsSkinButton10.Enabled:=false;
|
|
|
// bsSkinButton11.Enabled:=false;
|
|
|
end;
|
|
|
// frm_data_share.t_sys_report_head.Requery();
|
|
|
// frm_data_share.t_load_employee.Requery();
|
|
|
if not t_sys_reporthead.IsEmpty then
|
|
|
begin
|
|
|
t_sys_reporthead.edit;
|
|
|
t_sys_reporthead['̨ͷTO']:='';
|
|
|
t_sys_reporthead['̨ͷATTN']:='';
|
|
|
t_sys_reporthead.post;
|
|
|
end;
|
|
|
if frm_sys_frprint.caption='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤' then
|
|
|
bsSkinPanel2.Visible:=true;
|
|
|
|
|
|
|
|
|
ch_id:=0;
|
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
|
ch_id:=inifile1.Readinteger(frm_sys_frprint.t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,frm_sys_frprint.t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,0);
|
|
|
if ch_id<>0 then
|
|
|
begin
|
|
|
if t_sys_report.locate('CH_ID',ch_id,[])then
|
|
|
begin
|
|
|
t_sys_report.edit;
|
|
|
t_sys_report['<27>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>']:=1;
|
|
|
// t_sys_report.post;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
// rd.XHD_help:=t_sys_report_lei.fieldbyname('<27><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>').asstring;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton7Click(Sender: TObject);
|
|
|
var
|
|
|
Pnt:Tpoint;
|
|
|
begin
|
|
|
Pnt:=bsSkinButton7.ClientToScreen(Point(0,bsSkinButton7.Height));
|
|
|
PopupMenu1.Popup(Pnt.x,Pnt.y);
|
|
|
if frm_sys_frprint.caption='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤' then
|
|
|
begin
|
|
|
if not t_sys_report_employee.Locate('CH_ID',t_sys_report.fieldbyname('CH_ID').asinteger,[])then
|
|
|
begin
|
|
|
t_sys_report_employee.insert;
|
|
|
t_sys_report_employee['CH_ID']:=t_sys_report['CH_ID'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_report['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report_employee.edit;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.N1Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<>д<EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
frxReport1.PrepareReport;
|
|
|
frxReport1.Export(frxJPEGExport1);
|
|
|
except
|
|
|
showmessage('<27><>Ϊ<EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.EXCEL1Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<>д<EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
frxReport1.PrepareReport;
|
|
|
frxReport1.Export(frxXLSExport1);
|
|
|
except
|
|
|
showmessage('<27><>Ϊ<EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.WORD1Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<>д<EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
frxReport1.PrepareReport;
|
|
|
frxReport1.Export(frxHTMLExport1);
|
|
|
except
|
|
|
showmessage('<27><>Ϊ<EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.PDF1Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<>д<EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
frxReport1.PrepareReport;
|
|
|
frxReport1.Export(frxPDFExport1);
|
|
|
except
|
|
|
showmessage('<27><>Ϊ<EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.RTF1Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<>д<EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
frxReport1.PrepareReport;
|
|
|
frxReport1.Export(frxRTFExport1);
|
|
|
except
|
|
|
showmessage('<27><>Ϊ<EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton10Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<>д<EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
if t_sys_reportfile.fieldbyname('report').IsNull then begin
|
|
|
showmessage('û<><C3BB>ҪԤ<D2AA><D4A4><EFBFBD>ĸ<EFBFBD>ʽ<EFBFBD><CABD>');
|
|
|
exit;
|
|
|
end;
|
|
|
try
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
if SaveDialog1.Execute then
|
|
|
frxReport1.savetofile(SaveDialog1.filename);
|
|
|
except
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽʧ<CABD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
// GetNewData('t_sys_report','CH_ID','',t_sys_reportfile);
|
|
|
|
|
|
{
|
|
|
try
|
|
|
IdFTP1:=TIdFTP.Create(application);
|
|
|
with idftp1 do
|
|
|
begin
|
|
|
Username:='dongsheng';
|
|
|
Password:='zouwenkun';
|
|
|
Host:='218.57.11.18';
|
|
|
Connect;
|
|
|
end;
|
|
|
idftp1.Disconnect;
|
|
|
update_jiandu;
|
|
|
try
|
|
|
if not assigned(frm_sys_print_down) then
|
|
|
frm_sys_print_down:=tfrm_sys_print_down.Create (self);
|
|
|
frm_sys_print_down.Caption:=frm_sys_print.Caption;
|
|
|
frm_sys_print_down.ShowModal;
|
|
|
finally
|
|
|
frm_sys_print_down.free;
|
|
|
frm_sys_print_down:=NIL;
|
|
|
end;
|
|
|
except
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
|
|
|
end;
|
|
|
idftp1.free;
|
|
|
}
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.t_sys_reportAfterPost(DataSet: TDataSet);
|
|
|
begin
|
|
|
|
|
|
if frm_sys_frprint.caption='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤' then
|
|
|
begin
|
|
|
if not t_sys_report_employee.Locate('CH_ID',t_sys_report.fieldbyname('CH_ID').asinteger,[])then
|
|
|
begin
|
|
|
t_sys_report_employee.insert;
|
|
|
t_sys_report_employee['CH_ID']:=t_sys_report['CH_ID'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_report['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report_employee.edit;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton12Click(Sender: TObject);
|
|
|
var
|
|
|
str:widestring;
|
|
|
begin
|
|
|
|
|
|
if bsSkinButton12.caption='<27><><EFBFBD>и<EFBFBD>ʽ'then
|
|
|
begin
|
|
|
bsSkinButton12.caption:='<27><><EFBFBD>ڸ<EFBFBD>ʽ';
|
|
|
t_sys_reportfile.close;
|
|
|
t_sys_report.close;
|
|
|
t_sys_report.sql.clear;
|
|
|
t_sys_report.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>,CH_ID from t_sys_report where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
t_sys_report.Parameters[0].value:=frm_sys_frprint.caption;
|
|
|
t_sys_report.open;
|
|
|
t_sys_reportfile.Open;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if not t_sys_report_employee.IsEmpty then
|
|
|
begin
|
|
|
t_sys_report_employee.first;
|
|
|
while not t_sys_report_employee.eof do
|
|
|
begin
|
|
|
if t_sys_report_employee.fieldbyname('<27><><EFBFBD><EFBFBD>').AsDateTime>=date-30 then
|
|
|
begin
|
|
|
if str='' then
|
|
|
str:=t_sys_report_employee.fieldbyname('CH_ID').asstring
|
|
|
else
|
|
|
str:=str+','+t_sys_report_employee.fieldbyname('CH_ID').asstring;
|
|
|
end;
|
|
|
t_sys_report_employee.next;
|
|
|
end;
|
|
|
str:=' and CH_ID in ('+str+')';
|
|
|
t_sys_reportfile.close;
|
|
|
t_sys_report.close;
|
|
|
t_sys_report.sql.clear;
|
|
|
t_sys_report.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>,CH_ID from t_sys_report where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '+str+' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
t_sys_report.Parameters[0].value:=frm_sys_frprint.caption;
|
|
|
t_sys_report.open;
|
|
|
t_sys_reportfile.Open;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_reportfile.close;
|
|
|
t_sys_report.close;
|
|
|
t_sys_report.sql.clear;
|
|
|
t_sys_report.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>,CH_ID from t_sys_report where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
t_sys_report.Parameters[0].value:=frm_sys_frprint.caption;
|
|
|
t_sys_report.open;
|
|
|
t_sys_reportfile.Open;
|
|
|
end;
|
|
|
bsSkinButton12.caption:='<27><><EFBFBD>и<EFBFBD>ʽ';
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.t_sys_reportAfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
// t_sys_reportfile.Open;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.t_sys_reportBeforeClose(DataSet: TDataSet);
|
|
|
begin
|
|
|
// t_sys_reportfile.Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.t_sys_reportfileAfterInsert(DataSet: TDataSet);
|
|
|
begin
|
|
|
t_sys_reportfile['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_sys_frprint.Caption;
|
|
|
t_sys_reportfile['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_sys_frprint.Caption;
|
|
|
t_sys_reportfile['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='12311';
|
|
|
t_sys_reportfile['<27>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>']:=false;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.t_sys_reportfileAfterPost(DataSet: TDataSet);
|
|
|
var
|
|
|
str:widestring;
|
|
|
begin
|
|
|
if frm_sys_frprint.caption='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤' then
|
|
|
begin
|
|
|
if not t_sys_report_employee.Locate('CH_ID',t_sys_reportfile.fieldbyname('CH_ID').asinteger,[])then
|
|
|
begin
|
|
|
t_sys_report_employee.insert;
|
|
|
t_sys_report_employee['CH_ID']:=t_sys_reportfile['CH_ID'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_sys_reportfile['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report_employee.edit;
|
|
|
t_sys_report_employee['<27><><EFBFBD><EFBFBD>']:=date;
|
|
|
t_sys_report_employee.post;
|
|
|
end;
|
|
|
|
|
|
if bsSkinButton12.caption='<27><><EFBFBD>и<EFBFBD>ʽ'then
|
|
|
begin
|
|
|
if not t_sys_report_employee.IsEmpty then
|
|
|
begin
|
|
|
t_sys_report_employee.first;
|
|
|
while not t_sys_report_employee.eof do
|
|
|
begin
|
|
|
if t_sys_report_employee.fieldbyname('<27><><EFBFBD><EFBFBD>').AsDateTime>=date-30 then
|
|
|
begin
|
|
|
if str='' then
|
|
|
str:=t_sys_report_employee.fieldbyname('CH_ID').asstring
|
|
|
else
|
|
|
str:=str+','+t_sys_report_employee.fieldbyname('CH_ID').asstring;
|
|
|
end;
|
|
|
t_sys_report_employee.next;
|
|
|
end;
|
|
|
str:=' and CH_ID in ('+str+')';
|
|
|
t_sys_report.close;
|
|
|
t_sys_report.sql.clear;
|
|
|
t_sys_report.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>,CH_ID from t_sys_report where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '+str+' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
t_sys_report.Parameters[0].value:=frm_sys_frprint.caption;
|
|
|
t_sys_report.open;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report.close;
|
|
|
t_sys_report.sql.clear;
|
|
|
t_sys_report.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>,CH_ID from t_sys_report where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
t_sys_report.Parameters[0].value:=frm_sys_frprint.caption;
|
|
|
t_sys_report.open;
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_sys_report.close;
|
|
|
t_sys_report.sql.clear;
|
|
|
t_sys_report.sql.add('select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>,CH_ID from t_sys_report where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
t_sys_report.Parameters[0].value:=frm_sys_frprint.caption;
|
|
|
t_sys_report.open;
|
|
|
end;
|
|
|
|
|
|
end else
|
|
|
t_sys_report.Requery;
|
|
|
|
|
|
t_sys_report.Locate('CH_ID',t_sys_reportfile['CH_ID'],[]);
|
|
|
|
|
|
end;
|
|
|
|
|
|
function Tfrm_sys_frprint.frxDesigner1SaveReport(Report: TfrxReport;
|
|
|
SaveAs: Boolean): Boolean;
|
|
|
var template : TStream;
|
|
|
begin
|
|
|
if saveas then begin
|
|
|
|
|
|
try
|
|
|
if SaveDialog1.Execute then
|
|
|
frxReport1.savetofile(SaveDialog1.filename);
|
|
|
except
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽʧ<CABD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
end else begin
|
|
|
template := TMemoryStream.Create;
|
|
|
template.Position := 0;
|
|
|
frxReport1.SaveToStream(template);
|
|
|
t_sys_reportfile.Edit;
|
|
|
try
|
|
|
t_sys_reportfile.DisableControls;
|
|
|
(t_sys_reportfile.FieldByName('Report') as TBlobField).LoadFromStream(template);
|
|
|
t_sys_reportfile.Post;
|
|
|
finally
|
|
|
t_sys_reportfile.EnableControls;
|
|
|
template.Free;
|
|
|
end;
|
|
|
|
|
|
|
|
|
result:=true;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function Tfrm_sys_frprint.frxReport1UserFunction(const MethodName: String;
|
|
|
var Params: Variant): Variant;
|
|
|
begin
|
|
|
//
|
|
|
|
|
|
if uppercase(MethodName)='MONEYCN' then
|
|
|
Result := MoneyCn(Params[0],Params[1]);
|
|
|
|
|
|
if uppercase(MethodName)='ENGDATEFMT' then
|
|
|
Result := EngDateFmt(Params[0],Params[1],Params[2],Params[3],Params[4],Params[5],Params[6]);
|
|
|
|
|
|
if uppercase(MethodName)='GETCUSTBALDATE' then
|
|
|
Result :=formatdatetime('YYYY-MM-DD',getstlDate(Params[0],Params[1],Params[2]));
|
|
|
|
|
|
if uppercase(MethodName)='GETCUSTBALDAY' then
|
|
|
Result :=inttostr(getstlDay(Params[0],Params[1],Params[2]));
|
|
|
|
|
|
if uppercase(MethodName)='MONEYEN' then
|
|
|
Result := EWords(Params[0],0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.FormCreate(Sender: TObject);
|
|
|
begin
|
|
|
|
|
|
frxReport1.AddFunction('function MoneyCn(num:real;lx:boolean=false):widestring;','<27>Զ<EFBFBD><D4B6><EFBFBD>');
|
|
|
frxReport1.AddFunction('function MoneyEn(num:real;):widestring;','<27>Զ<EFBFBD><D4B6><EFBFBD>');
|
|
|
frxReport1.AddFunction('function EngDateFmt(ADateTime:TDateTime;JX,DX:boolean;MDY:Boolean=true;MD:Boolean=false;DIAN:Boolean=false;MY:Boolean=false):string;','<27>Զ<EFBFBD><D4B6><EFBFBD>');
|
|
|
frxReport1.AddFunction('function GETCUSTBALDATE(ADateTime:TDateTime;Cust,Sale:String):TDateTime;','<27>Զ<EFBFBD><D4B6><EFBFBD>');
|
|
|
frxReport1.AddFunction('function GETCUSTBALDAY(ADateTime:TDateTime;Cust,Sale:String):integer;','<27>Զ<EFBFBD><D4B6><EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.Button5Click(Sender: TObject);
|
|
|
begin
|
|
|
try
|
|
|
frm_code_send_head:=tfrm_code_send_head.Create (self);
|
|
|
code_send_head_num:=5;
|
|
|
frm_code_send_head.DataSource2:=ds_sys_reporthead1;
|
|
|
frm_code_send_head.ShowModal;
|
|
|
finally
|
|
|
frm_code_send_head.Free;
|
|
|
frm_code_send_head:=nil;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.N7Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
str:widestring;
|
|
|
ScriptPath:string;
|
|
|
str_memo:Tmemo;
|
|
|
begin
|
|
|
if t_sys_report.isempty then
|
|
|
exit;
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<>д<EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
try
|
|
|
finally
|
|
|
|
|
|
|
|
|
try
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
frxReport1.PrepareReport;
|
|
|
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'CUSTOMFILE\';
|
|
|
if not DirectoryExists(ScriptPath) then
|
|
|
CreateDir(ScriptPath);
|
|
|
str:=ScriptPath
|
|
|
+one_table_1.DataSource.DataSet.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString
|
|
|
+FormatDateTime('yyyy',now)
|
|
|
+FormatDateTime('mm',now)
|
|
|
+FormatDateTime('dd',now)
|
|
|
+FormatDateTime('hh',now)
|
|
|
+FormatDateTime('nn',now)+'.xls';
|
|
|
|
|
|
|
|
|
frxXLSExport2.FileName:=str;
|
|
|
frxReport1.Export(frxXLSExport2);
|
|
|
|
|
|
|
|
|
str_memo:=Tmemo.create(application);
|
|
|
str_memo.visible:=false;
|
|
|
str_memo.Parent:=frm_sys_frprint;
|
|
|
str_memo.Lines.Add('<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>-Զ<><D4B6>');
|
|
|
str_memo.Lines.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+Employee);
|
|
|
try
|
|
|
if Trim(str_memo.lines.Text)<>'' then
|
|
|
begin
|
|
|
SMTP1.AuthType := satDefault; //(satNone, satDefault, satSASL);
|
|
|
SMTP1.username:=MailAddress;
|
|
|
SMTP1.Password :=MailPw;
|
|
|
SMTP1.Host:='mail.sdsmartlogistics.com';
|
|
|
SMTP1.Port:=25;
|
|
|
try
|
|
|
SMTP1.Connect;
|
|
|
except
|
|
|
on e : Exception do
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+E.Message);
|
|
|
end;
|
|
|
end;
|
|
|
if not SMTP1.Connected then
|
|
|
begin
|
|
|
Sleep(1000);
|
|
|
SMTP1.Connect;
|
|
|
end;
|
|
|
try
|
|
|
with IdMsg do
|
|
|
begin
|
|
|
body.Clear;
|
|
|
Body.Text :=str_memo.lines.Text;
|
|
|
From.address :=MailAddress;
|
|
|
Recipients.EMailAddresses :=MailAddress;
|
|
|
Subject:='<27><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD> <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>:'+one_table_1.DataSource.DataSet.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
TIdAttachmentFile.Create(MessageParts,str);
|
|
|
end;
|
|
|
if not SMTP1.Connected then
|
|
|
begin
|
|
|
Sleep(1000);
|
|
|
SMTP1.Connect;
|
|
|
end;
|
|
|
SMTP1.Send(IdMsg);
|
|
|
MessageDlg('<27><><EFBFBD>ͳɹ<CDB3>!',mtConfirmation,[mbOK],0)
|
|
|
finally
|
|
|
SMTP1.Disconnect;
|
|
|
end;
|
|
|
end;
|
|
|
except
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!',mtError,[mbOK],0);
|
|
|
end;
|
|
|
str_memo.free;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except
|
|
|
showmessage('<27><>Ϊ<EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.bsSkinButton11Click(Sender: TObject);
|
|
|
var
|
|
|
template : TStream;
|
|
|
str,s:widestring;
|
|
|
ScriptPath,naspath:string;
|
|
|
str_memo:Tmemo;
|
|
|
begin
|
|
|
naspath:=get_parameters_value(175,'\\223.223.95.160\data');
|
|
|
|
|
|
if t_sys_report.isempty then exit;
|
|
|
|
|
|
t_sys_reportfile.Close;
|
|
|
t_sys_reportfile.SQL.Clear;
|
|
|
t_sys_reportfile.SQL.Add('select * from t_sys_report where CH_ID='+inttostr(t_sys_report['CH_ID']));
|
|
|
t_sys_reportfile.Open;
|
|
|
|
|
|
if t_sys_reportfile.isempty then
|
|
|
begin
|
|
|
showmessage('û<>д<EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>ܴ<EFBFBD>Ϊ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
try
|
|
|
template := t_sys_reportfile.CreateBlobStream(t_sys_reportfile.FieldByName('report'), bmRead);
|
|
|
template.Position := 0;
|
|
|
frxReport1.LoadFromStream(template);
|
|
|
finally
|
|
|
template.Free;
|
|
|
end;
|
|
|
frxReport1.PrepareReport;
|
|
|
|
|
|
try
|
|
|
if mailsend1.DataSet.IsEmpty then
|
|
|
begin
|
|
|
ShowMessage('û<><C3BB><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飡');
|
|
|
Exit;
|
|
|
end;
|
|
|
|
|
|
str_memo:=Tmemo.create(application);
|
|
|
str_memo.Parent:=frm_sys_frprint;
|
|
|
str_memo.visible:=False;
|
|
|
|
|
|
|
|
|
try
|
|
|
SMTP1.AuthType := satDefault; //(satNone, satDefault, satSASL);
|
|
|
SMTP1.username:=MailAddress;
|
|
|
SMTP1.Password :=MailPw;
|
|
|
SMTP1.Host:='mail.sdsmartlogistics.com';
|
|
|
SMTP1.Port:=25;
|
|
|
try
|
|
|
SMTP1.Connect;
|
|
|
except
|
|
|
on e : Exception do
|
|
|
begin
|
|
|
ShowMessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+E.Message);
|
|
|
end;
|
|
|
end;
|
|
|
if not SMTP1.Connected then
|
|
|
begin
|
|
|
Sleep(1000);
|
|
|
SMTP1.Connect;
|
|
|
end;
|
|
|
|
|
|
if SelectedMulti then
|
|
|
//op_seae<61><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡӦ<D1A1><D3A6><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>Ϊһ<CEAA><D2BB><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᵥ<EFBFBD><E1B5A5>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD> --- Ӧ<><D3A6><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡ
|
|
|
begin
|
|
|
mailsend1.DataSet.First;
|
|
|
while not mailsend1.DataSet.Eof do
|
|
|
begin
|
|
|
str_memo.Lines.Clear;
|
|
|
str_memo.Lines.Add(mailsend1.DataSet.fieldbyname('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString);
|
|
|
str_memo.Lines.Add('');
|
|
|
str_memo.Lines.Add(mailsend1.DataSet.fieldbyname('<27>ʼ<EFBFBD>ǩ<EFBFBD><C7A9>').AsString);
|
|
|
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'CUSTOMFILE\';
|
|
|
if not DirectoryExists(ScriptPath) then CreateDir(ScriptPath);
|
|
|
|
|
|
s:= mailsend1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
with IdMsg do
|
|
|
begin
|
|
|
body.Clear;
|
|
|
Body.Text :=str_memo.lines.Text;
|
|
|
From.address :=MailAddress;
|
|
|
Recipients.EMailAddresses :=mailsend1.DataSet.fieldbyname('<27>ռ<EFBFBD><D5BC><EFBFBD>').AsString;
|
|
|
Subject:=mailsend1.DataSet.fieldbyname('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
end;
|
|
|
while s<>'' do
|
|
|
begin
|
|
|
str:=ScriptPath +Copy(s,0,Pos(',',s)-1)+'.PDF';
|
|
|
frxPDFExport1.FileName:=str;
|
|
|
frxPDFExport1.ShowDialog:=false;
|
|
|
frxReport1.Export(frxPDFExport1);
|
|
|
TIdAttachmentFile.Create(IdMsg.MessageParts,str);
|
|
|
s:=Copy(s,Pos(',',s)+1,Length(s)-1);
|
|
|
end;
|
|
|
|
|
|
|
|
|
if not SMTP1.Connected then
|
|
|
begin
|
|
|
Sleep(1000);
|
|
|
SMTP1.Connect;
|
|
|
end;
|
|
|
SMTP1.Send(IdMsg);
|
|
|
|
|
|
UpLoadmailFile(str,naspath,'user','user',mailsend1.DataSet.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString
|
|
|
,mailsend1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,mailsend1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
,mailsend1.DataSet.fieldbyname('<27>ռ<EFBFBD><D5BC><EFBFBD>').AsString,mailsend1.DataSet.fieldbyname('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString,str_memo.lines.Text);
|
|
|
|
|
|
mailsend1.DataSet.Next;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
//<2F><>ǰ<EFBFBD>ķ<EFBFBD><C4B7>ʼ<EFBFBD><CABC><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>
|
|
|
begin
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'CUSTOMFILE\';
|
|
|
if not DirectoryExists(ScriptPath) then CreateDir(ScriptPath);
|
|
|
str:=ScriptPath +mailsend1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+'.PDF';
|
|
|
|
|
|
frxPDFExport1.FileName:=str;
|
|
|
frxPDFExport1.ShowDialog:=false;
|
|
|
frxReport1.Export(frxPDFExport1);
|
|
|
ScriptPath:=ExtractFilePath(ParamStr(0))+'CUSTOMFILE\';
|
|
|
if not DirectoryExists(ScriptPath) then CreateDir(ScriptPath);
|
|
|
|
|
|
try
|
|
|
with IdMsg do
|
|
|
begin
|
|
|
body.Clear;
|
|
|
Body.Text :=str_memo.lines.Text;
|
|
|
From.address :=MailAddress;
|
|
|
Recipients.EMailAddresses :=mailsend1.DataSet.fieldbyname('<27>ռ<EFBFBD><D5BC><EFBFBD>').AsString;
|
|
|
Subject:=mailsend1.DataSet.fieldbyname('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
TIdAttachmentFile.Create(MessageParts,str);
|
|
|
end;
|
|
|
if not SMTP1.Connected then
|
|
|
begin
|
|
|
Sleep(1000);
|
|
|
SMTP1.Connect;
|
|
|
end;
|
|
|
SMTP1.Send(IdMsg);
|
|
|
|
|
|
UpLoadmailFile(str,naspath,'user','user',mailsend1.DataSet.fieldbyname('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString
|
|
|
,mailsend1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,mailsend1.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString
|
|
|
,mailsend1.DataSet.fieldbyname('<27>ռ<EFBFBD><D5BC><EFBFBD>').AsString,mailsend1.DataSet.fieldbyname('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString,str_memo.lines.Text);
|
|
|
|
|
|
finally
|
|
|
SMTP1.Disconnect;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
except
|
|
|
MessageDlg('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!',mtError,[mbOK],0);
|
|
|
end;
|
|
|
|
|
|
MessageDlg('<27><><EFBFBD>ͳɹ<CDB3>!',mtConfirmation,[mbOK],0);
|
|
|
str_memo.free;
|
|
|
if SMTP1.Connected then SMTP1.Disconnect;
|
|
|
|
|
|
except
|
|
|
showmessage('<27><>Ϊ<EFBFBD>ļ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_sys_frprint.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
SelectedMulti:=False;
|
|
|
end;
|
|
|
|
|
|
end.
|