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.

314 lines
11 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_op_seae_print_mul;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, ADODB, DB, BusinessSkinForm, dxDBTLCl, dxGrClms,
bsSkinCtrls, dxTL, dxDBCtrl, dxDBGrid, dxCntner, ComCtrls, bsSkinTabs,
StdCtrls, kbmMemTable;
type
Tfrm_op_seae_print_mul = class(TForm)
bsSkinPanel1: TbsSkinPanel;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column5: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridMaskColumn;
dxDBGrid1Column7: TdxDBGridMaskColumn;
dxDBGrid1Column13: TdxDBGridMaskColumn;
dxDBGrid1Column14: TdxDBGridMaskColumn;
dxDBGrid1Column15: TdxDBGridMaskColumn;
dxDBGrid1Column16: TdxDBGridDateColumn;
dxDBGrid1Column19: TdxDBGridMaskColumn;
dxDBGrid1Column20: TdxDBGridMaskColumn;
dxDBGrid1TEU: TdxDBGridMaskColumn;
dxDBGrid1Column63: TdxDBGridMaskColumn;
dxDBGrid1Column64: TdxDBGridMaskColumn;
dxDBGrid1Column65: TdxDBGridDateColumn;
dxDBGrid1Column66: TdxDBGridMaskColumn;
dxDBGrid1Column67: TdxDBGridMaskColumn;
bsBusinessSkinForm1: TbsBusinessSkinForm;
t_op_seae1: TDataSource;
t_sys_report: TADOQuery;
t_sys_report1: TDataSource;
t_op_seae: TADOStoredProc;
t_sys_report_employee: TADOQuery;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
bsSkinPanel2: TbsSkinPanel;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
bsSkinButton12: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinGroupBox1: TbsSkinGroupBox;
bsSkinPanel3: TbsSkinPanel;
bsSkinGroupBox2: TbsSkinGroupBox;
Memo1: TMemo;
Memo2: TMemo;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
SaveDialog1: TSaveDialog;
bsSkinButton11: TbsSkinButton;
mailSend: TkbmMemTable;
mailSendStringField: TStringField;
mailSendField: TStringField;
mailSendField2: TStringField;
mailSendField3: TStringField;
mailSendField4: TStringField;
mailSendField5: TStringField;
mailSendField6: TStringField;
mailSendField7: TStringField;
t_op_seae2: TDataSource;
t_op_seae_print: TADOQuery;
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_op_seae_print_mul: Tfrm_op_seae_print_mul;
implementation
uses my_sys_function, u_main, u_data_share;
{$R *.dfm}
procedure Tfrm_op_seae_print_mul.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_seae_print_mul.bsSkinButton8Click(Sender: TObject);
begin
if t_sys_report.IsEmpty then
begin
showmessage('û<>е<EFBFBD>֤<EFBFBD><D6A4>ʽ<EFBFBD><CABD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>');
exit;
end;
sys_print_piliang('<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤',t_sys_report.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,t_op_seae,t_op_seae1,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,t_sys_report.fieldbyname('CH_ID').asinteger);
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>']:='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<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;
procedure Tfrm_op_seae_print_mul.FormShow(Sender: TObject);
var
str:widestring;
begin
t_sys_report_employee.close;
t_sys_report_employee.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').value:=employee;
t_sys_report_employee.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').value:='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤';
t_sys_report_employee.open;
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 * 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:='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤';
t_sys_report.open;
end
else
begin
t_sys_report.close;
t_sys_report.sql.clear;
t_sys_report.sql.add('select * 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:='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤';
t_sys_report.open;
end;
if FileExists(ExtractFilePath(application.ExeName)+'exptxt.ini') then memo1.Lines.LoadFromFile(ExtractFilePath(application.ExeName)+'exptxt.ini');
end;
procedure Tfrm_op_seae_print_mul.bsSkinButton12Click(Sender: TObject);
var
str:widestring;
begin
if bsSkinButton12.caption='<27><><EFBFBD>и<EFBFBD>ʽ'then
begin
bsSkinButton12.caption:='<27><><EFBFBD>ڸ<EFBFBD>ʽ';
t_sys_report.close;
t_sys_report.sql.clear;
t_sys_report.sql.add('select * 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:='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤';
t_sys_report.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_report.close;
t_sys_report.sql.clear;
t_sys_report.sql.add('select * 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:='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤';
t_sys_report.open;
end
else
begin
t_sys_report.close;
t_sys_report.sql.clear;
t_sys_report.sql.add('select * 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:='<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤';
t_sys_report.open;
end;
bsSkinButton12.caption:='<27><><EFBFBD>и<EFBFBD>ʽ';
end;
end;
procedure Tfrm_op_seae_print_mul.bsSkinButton1Click(Sender: TObject);
var
sl_tmp:tstringlist;
str_tmp:string;
m,i,n:integer;
begin //<2F><><EFBFBD>ݹ<EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD><EFBFBD>ļ<EFBFBD>
Memo2.Lines.clear;
t_op_seae.first;
i:=0;
while not t_op_seae.eof do
begin
i:=i+1;
for n:=0 to memo1.Lines.Count-1 do begin
str_tmp:=Memo1.Lines.Strings[n];
str_tmp:=StringReplace(str_tmp,'[RDNUM]',inttostr(i),[]);
for m:=0 to t_op_seae.FieldCount-1 do begin
str_tmp:=StringReplace(str_tmp,'['+t_op_seae.Fields[m].FieldName+']',t_op_seae.Fields[m].AsString,[]);
end;
Memo2.Lines.Add(str_tmp);
end;
t_op_seae.next;
end;
end;
procedure Tfrm_op_seae_print_mul.bsSkinButton2Click(Sender: TObject);
begin
memo1.Lines.SaveToFile(ExtractFilePath(application.ExeName)+'exptxt.ini');
end;
procedure Tfrm_op_seae_print_mul.bsSkinButton3Click(Sender: TObject);
begin
if SaveDialog1.Execute then
begin
memo2.Lines.SaveToFile(SaveDialog1.FileName+'.txt');
end;
end;
procedure Tfrm_op_seae_print_mul.bsSkinButton11Click(Sender: TObject);
var
aQuery:TADOQuery;
str:string;
begin
aQuery:=CreateAdoQuery;
try
t_op_seae.First;
while not t_op_seae.Eof do begin
if t_op_seae.FieldByName('<27>ͻ<EFBFBD><CDBB>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString<>'' then begin
with aQuery do begin
close;sql.Clear;
SQL.Add('select * from t_code_cust_mailproject_detail where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+t_op_seae.FieldByName('<27>ͻ<EFBFBD><CDBB>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString+''' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><EFBFBD><E1B5A5><EFBFBD>»<EFBFBD>ֽ'' ');
Open;
if not isempty then begin
mailSend.EmptyTable;
mailSend.Open;
mailSend.Insert;
mailSend.FieldByName('<27>ռ<EFBFBD><D5BC><EFBFBD>').AsString:=fieldbyname('<27>ռ<EFBFBD><D5BC><EFBFBD>').AsString;
str:=fieldbyname('<27><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>').AsString;
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD><E1B5A5>]',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[ί<>е<EFBFBD>λ]',t_op_seae.fieldbyname('ί<>е<EFBFBD>λ').AsString,[]);
mailSend.FieldByName('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString:=str;
str:=fieldbyname('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString;
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD><E1B5A5>]',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[ί<>е<EFBFBD>λ]',t_op_seae.fieldbyname('ί<>е<EFBFBD>λ').AsString,[]);
mailSend.FieldByName('<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>').AsString:=str;
frm_data_share.t_sys_employee.Locate('<27><><EFBFBD><EFBFBD>',employee,[]);
mailSend.FieldByName('<27>ʼ<EFBFBD>ǩ<EFBFBD><C7A9>').AsString:=frm_data_share.t_sys_employee.fieldbyname('<27>ʼ<EFBFBD>ǩ<EFBFBD><C7A9>').AsString;
str:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD><E1B5A5>]',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[<5B><><EFBFBD><EFBFBD>]',t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString,[]);
str:=StringReplace(str,'[ί<>е<EFBFBD>λ]',t_op_seae.fieldbyname('ί<>е<EFBFBD>λ').AsString,[]);
mailSend.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=str;
mailSend.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
mailSend.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
mailSend.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString:=t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
mailSend.Post;
t_op_seae_print.Close;
t_op_seae_print.SQL.Text:='select * from t_op_seae where <20><><EFBFBD><EFBFBD>='''+t_op_seae.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+'''';
t_op_seae_print.Open;
sys_frprint('<27><><EFBFBD>˳<EFBFBD><CBB3>ڵ<EFBFBD>֤',5,t_op_seae2,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,True,'',nil,nil,mailSend);
end else begin
ShowMessage('<27><EFBFBD><E1B5A5>:'+t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString+',<2C>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7>');
end;
end else begin
ShowMessage('<27><EFBFBD><E1B5A5>:'+t_op_seae.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString+',δ<><CEB4><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
t_op_seae.Next;
end;
finally
FreeAndNil(aQuery);
end;
end;
end.