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.

1030 lines
35 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_SetMessage;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, ExtCtrls, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid,
dxCntner, DB, ADODB, StdCtrls, Mask, DBCtrls, bsdbctrls, DBCtrlsEh,
Grids, DBGridEh, Menus, Psock, NMsmtp, IdMessage, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP,
IdExplicitTLSClientServerBase, IdSMTPBase,IdFTP,inifiles;
type
TfrmMessageSet = class(TForm)
Panel2: TPanel;
bsSkinButton7: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinButton38: TbsSkinButton;
bsSkinPanel1: TbsSkinPanel;
t_sys_awoke: TADOQuery;
t_sys_awoke1: TDataSource;
Panel1: TPanel;
Notebook1: TNotebook;
dxDBGrid2: TdxDBGrid;
dxDBGrid2Column1: TdxDBGridColumn;
dxDBGrid2Column2: TdxDBGridColumn;
dxDBGrid2Column3: TdxDBGridColumn;
dxDBGrid2Column5: TdxDBGridColumn;
dxDBGrid2Column6: TdxDBGridColumn;
dxDBGrid2Column7: TdxDBGridColumn;
dxDBGrid2Column8: TdxDBGridColumn;
bsSkinPanel2: TbsSkinPanel;
bsSkinGroupBox1: TbsSkinGroupBox;
bsSkinGroupBox4: TbsSkinGroupBox;
DBGridEh1: TDBGridEh;
Label1: TLabel;
DBMemo1: TDBMemo;
Label2: TLabel;
DBEdit1: TDBEdit;
Label8: TLabel;
DBMemo2: TDBMemo;
dxDBGrid2Column9: TdxDBGridColumn;
dxDBGrid2Column10: TdxDBGridColumn;
dxDBGrid2Column11: TdxDBGridColumn;
dxDBGrid2Column12: TdxDBGridColumn;
t_sys_awoke_emp: TADOQuery;
t_sys_awoke_emp1: TDataSource;
bsSkinButton8: TbsSkinButton;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
Panel3: TPanel;
bsSkinGroupBox2: TbsSkinGroupBox;
Label3: TLabel;
Label4: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
DBEdit3: TDBEdit;
DBComboBox2: TDBComboBox;
DBComboBox4: TDBComboBox;
DBDateTimeEditEh1: TDBDateTimeEditEh;
DBDateTimeEditEh2: TDBDateTimeEditEh;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
bsSkinGroupBox3: TbsSkinGroupBox;
bsSkinDBRadioGroup2: TbsSkinDBRadioGroup;
bsSkinGroupBox5: TbsSkinGroupBox;
Label5: TLabel;
Label6: TLabel;
Label9: TLabel;
DBNumberEditEh1: TDBNumberEditEh;
DBNumberEditEh2: TDBNumberEditEh;
DBNumberEditEh3: TDBNumberEditEh;
Label7: TLabel;
DBEdit2: TDBEdit;
bsSkinButton10: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
N6: TMenuItem;
N7: TMenuItem;
DBComboBoxEh1: TDBComboBoxEh;
PopupMenu2: TPopupMenu;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
dxDBGrid2Column13: TdxDBGridColumn;
SMTP1: TIdSMTP;
IdMsg: TIdMessage;
dxDBGrid2Column14: TdxDBGridColumn;
Label15: TLabel;
DBNumberEditEh4: TDBNumberEditEh;
bsSkinButton13: TbsSkinButton;
Label16: TLabel;
DBComboBox1: TDBComboBox;
procedure t_sys_awokeAfterInsert(DataSet: TDataSet);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinButton38Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure t_sys_awoke_empAfterInsert(DataSet: TDataSet);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure dxDBGrid2DblClick(Sender: TObject);
procedure Panel2Resize(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure t_sys_awokeBeforePost(DataSet: TDataSet);
procedure bsSkinButton12Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure t_sys_awokeBeforeInsert(DataSet: TDataSet);
procedure t_sys_awokeBeforeDelete(DataSet: TDataSet);
procedure NMSMTP1Connect(Sender: TObject);
procedure N8Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure N10Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure bsSkinButton13Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetStrChar(str:String):string;
function CreateIgengzongxml(SOI:string):TStringlist;
end;
var
frmMessageSet: TfrmMessageSet;
implementation
uses u_data_share, u_main, my_sys_function, u_message_query,
u_message_guide, u_messageset, u_addemp;
{$R *.dfm}
procedure TfrmMessageSet.t_sys_awokeAfterInsert(DataSet: TDataSet);
begin
DataSet.FieldByName('¼<><C2BC><EFBFBD><EFBFBD>').AsString:=employee;
DataSet.FieldByName('¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=date;
DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
DataSet.FieldByName('<27><><EFBFBD>ѷ<EFBFBD>ʽ').AsString:='<27>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>';
DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString:='׼<><D7BC>ִ<EFBFBD><D6B4>';
end;
procedure TfrmMessageSet.bsSkinButton11Click(Sender: TObject);
var
answer:TModalResult;
begin
if bsSkinButton11.Caption='<27><EFBFBD>޸<EFBFBD>' then
begin
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
// t_sys_awoke.Edit;
Notebook1.PageIndex:=1;
exit;
end;
if bsSkinButton11.Caption='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>' then
begin
if (t_sys_awoke.State=dsinsert)or(t_sys_awoke.State=dsedit) then
BEGIN
answer:=messagedlg( '<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE>޸ģ<DEB8><C4A3>Ƿ񱣴棿',mtWarning,mbYesNoCancel,0);
if answer=mrYes then
begin
t_sys_awoke.post;
end;
if answer=mrNo then
begin
t_sys_awoke.cancel;
end;
if answer=mrCancel then
begin
exit;
end;
END;
bsSkinButton11.Caption:='<27><EFBFBD>޸<EFBFBD>';
Notebook1.PageIndex:=0;
exit;
end;
end;
procedure TfrmMessageSet.bsSkinButton38Click(Sender: TObject);
begin
t_sys_awoke.Refresh;
end;
procedure TfrmMessageSet.bsSkinButton3Click(Sender: TObject);
begin
if t_sys_awoke.State in [dsedit,dsinsert] then t_sys_awoke.Cancel;
end;
procedure TfrmMessageSet.bsSkinButton2Click(Sender: TObject);
begin
if t_sys_awoke.State in [dsedit,dsinsert] then t_sys_awoke.Post;
end;
procedure TfrmMessageSet.bsSkinButton7Click(Sender: TObject);
begin
if not t_sys_awoke.Bof then t_sys_awoke.Prior;
end;
procedure TfrmMessageSet.bsSkinButton6Click(Sender: TObject);
begin
if not t_sys_awoke.Eof then t_sys_awoke.Next;
end;
procedure TfrmMessageSet.t_sys_awoke_empAfterInsert(DataSet: TDataSet);
begin
DataSet.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').AsBoolean:=false;
end;
procedure TfrmMessageSet.FormShow(Sender: TObject);
begin
if not if_open('244') then begin
N3.Visible:=false;
N5.Visible:=false;
N12.Visible:=false;
end;
if not if_open('245') then begin
N5.Visible:=false;
N12.Visible:=false;
end;
if t_sys_awoke.Active then t_sys_awoke.Close;
t_sys_awoke.sql.clear;
t_sys_awoke.sql.add('Select * from t_sys_awoke where 1=1 ');
t_sys_awoke.sql.add(' and '+open_data('9005','¼<><C2BC><EFBFBD><EFBFBD>','no','no','no','no'));
t_sys_awoke.Open;
if not t_sys_awoke_emp.Active then t_sys_awoke_emp.Open;
end;
procedure TfrmMessageSet.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frmMessageSet.Hide;
frmMessageSet.ManualFloat(frmMessageSet.BoundsRect );
frm_main.freeTabs('frmMessageSet');
action:=cafree;
frmMessageSet:=nil;
end;
procedure TfrmMessageSet.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure TfrmMessageSet.bsSkinButton8Click(Sender: TObject);
begin
// if not (t_sys_awoke.State in [dsedit,dsinsert]) then exit;
frm_message_guide:=Tfrm_message_guide.Create(self);
try
frm_message_guide.showmodal;
finally
FreeAndNil(frm_message_guide);
end;
end;
procedure TfrmMessageSet.N1Click(Sender: TObject);
begin
if t_sys_awoke.State in [dsinsert,dsedit] then t_sys_awoke.Post;
if not t_sys_awoke_emp.Locate('<27><>Ա',employee,[]) then begin
t_sys_awoke_emp.Insert;
t_sys_awoke_emp.FieldByName('awoke_id').AsInteger:=t_sys_awoke.fieldByName('awoke_id').AsInteger;
t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_sys_awoke_emp.FieldByName('<27><>Ա').AsString:=employee;
t_sys_awoke_emp['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_sys_awoke_emp.Post;
end;
end;
procedure TfrmMessageSet.N3Click(Sender: TObject);
var
aQuery:TADOQuery;
begin
if t_sys_awoke.State in [dsinsert,dsedit] then t_sys_awoke.Post;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+department+'''');
Open;
first;
while not eof do begin
if not t_sys_awoke_emp.Locate('<27><>Ա',FieldByName('<27><><EFBFBD><EFBFBD>').AsString,[]) then begin
t_sys_awoke_emp.Insert;
t_sys_awoke_emp.FieldByName('awoke_id').AsInteger:=t_sys_awoke.fieldByName('awoke_id').AsInteger;
t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_sys_awoke_emp.FieldByName('<27><>Ա').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_sys_awoke_emp['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_sys_awoke_emp.Post;
end;
Next;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure TfrmMessageSet.N5Click(Sender: TObject);
var
aQuery:TADOQuery;
begin
if t_sys_awoke.State in [dsinsert,dsedit] then t_sys_awoke.Post;
aQuery:=CreateAdoQuery;
try
with aQuery do begin
close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD> from t_sys_employee ');
Open;
first;
while not eof do begin
if not t_sys_awoke_emp.Locate('<27><>Ա',FieldByName('<27><><EFBFBD><EFBFBD>').AsString,[]) then begin
t_sys_awoke_emp.Insert;
t_sys_awoke_emp.FieldByName('awoke_id').AsInteger:=t_sys_awoke.fieldByName('awoke_id').AsInteger;
t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
t_sys_awoke_emp.FieldByName('<27><>Ա').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_sys_awoke_emp['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
t_sys_awoke_emp.Post;
end;
Next;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure TfrmMessageSet.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
if t_sys_awoke_emp.State in [dsedit,dsinsert] then t_sys_awoke_emp.Post;
if t_sys_awoke.State in [dsedit,dsinsert] then t_sys_awoke.Post;
end;
procedure TfrmMessageSet.dxDBGrid2DblClick(Sender: TObject);
begin
if bsSkinButton11.Caption='<27><EFBFBD>޸<EFBFBD>' then
begin
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
// t_sys_awoke.Edit;
Notebook1.PageIndex:=1;
exit;
end;
end;
procedure TfrmMessageSet.Panel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round(Panel2.Width/13);
bsSkinButton7.Width:=i;
bsSkinButton6.Width:=i;
bsSkinButton9.Width:=i;
bsSkinButton1.Width:=i;
bsSkinButton11.Width:=i;
bsSkinButton12.Width:=i;
bsSkinButton2.Width:=i;
bsSkinButton4.Width:=i;
bsSkinButton3.Width:=i;
bsSkinButton38.Width:=i;
bsSkinButton5.Width:=i;
bsSkinButton13.Width:=i;
end;
procedure TfrmMessageSet.bsSkinButton4Click(Sender: TObject);
begin
if t_sys_awoke.FieldByName('<27><><EFBFBD><EFBFBD>״̬').AsString='׼<><D7BC>ִ<EFBFBD><D6B4>' then exit;
if t_sys_awoke.IsEmpty then exit;
t_sys_awoke.Delete;
end;
procedure TfrmMessageSet.t_sys_awokeBeforePost(DataSet: TDataSet);
begin
table_before_post(t_sys_awoke,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
table_before_post(t_sys_awoke,'<27><><EFBFBD>ѷ<EFBFBD>ʽ');
table_before_post(t_sys_awoke,'<27><><EFBFBD><EFBFBD>״̬');
table_before_post(t_sys_awoke,'<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>');
table_before_post(t_sys_awoke,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure TfrmMessageSet.bsSkinButton12Click(Sender: TObject);
begin
if not if_open('242') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
exit;
end;
frmmessageparam:=Tfrmmessageparam.Create(SELF);
try
frmmessageparam.ShowModal;
finally
FreeAndNil(frmmessageparam);
end;
end;
procedure TfrmMessageSet.bsSkinButton10Click(Sender: TObject);
var
A1,A2,A3,A4,S,str_bill,mail_s,str_emp,startday,endday:String;
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
t_sys_awoke_emp.First;
while not t_sys_awoke_emp.Eof do begin
if t_sys_awoke_emp['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>'] then begin
A1:='';
A2:='';
A3:='';
A4:='';
str_bill:='';
mail_s:='';
str_emp:='';
S:=Trim(t_sys_awoke.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString);
if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
aQuery.Close;aQuery.sql.Clear;
aQuery.SQL.Add('Select <20><><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=(select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_sys_employee where <20><><EFBFBD><EFBFBD>='''+t_sys_awoke_emp.FieldByName('<27><>Ա').AsString+''')');
aQuery.Open;
if not aQuery.IsEmpty then begin
aQuery.first;
while not aQuery.Eof do begin
if str_emp='' then
str_emp:=''''+t_sys_awoke_emp.FieldByName('<27><>Ա').AsString+''''
else
str_emp:=str_emp+','+''''+t_sys_awoke_emp.FieldByName('<27><>Ա').AsString+'''';
aQuery.Next;
end;
end;
end;
if Trim(t_sys_awoke.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='Ƿ<><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
A1:=Copy(s,6,pos(',',s)-6);
A2:=Copy(s,pos('Ƿ<>ѹ<EFBFBD><D1B9><EFBFBD>=',s)+9,length(s)-pos('Ƿ<>ѹ<EFBFBD><D1B9><EFBFBD>=',s)-7);
if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>' then begin
Str_bill:=' where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
end else if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
Str_bill:=' where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+''''
+' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in ('+str_emp+')';
end else if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
Str_bill:=' where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+''''
+' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+t_sys_awoke_emp.FieldByName('<27><>Ա').asstring+'''';
end else if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
Str_bill:='where '+open_data('0033','v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_bscard.<2E><><EFBFBD><EFBFBD>Ա','v_op_bscard.<2E>ͷ<EFBFBD>Ա','no','no')
+' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
end;
if A2='ֻ<><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>' Then begin
Str_bill:=Str_bill+' and t_ch_fee.Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+FormatDateTime('YYYY-MM-DD',NOW)+'''';
end;
if A1='ҵ<><D2B5><EFBFBD><EFBFBD>ϸ' then begin
aQuery.Close;aQuery.SQL.Clear;
aQuery.SQL.text:='SELECT t_ch_fee.<2E><><EFBFBD><EFBFBD>, t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
+' THEN (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as δ<>պϼ<D5BA>,'
+'v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>, v_op_bscard.<2E><><EFBFBD><EFBFBD><E1B5A5>,'
+'v_op_bscard.<2E><><EFBFBD><EFBFBD><E1B5A5>, v_op_bscard.ί<>б<EFBFBD><D0B1><EFBFBD>,'
+'v_op_bscard.ί<>е<EFBFBD>λ '
+' FROM t_ch_fee inner join v_op_bscard on v_op_bscard.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> '
+Str_bill
+' GROUP BY t_ch_fee.<2E><><EFBFBD><EFBFBD>, t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>, v_op_bscard.<2E><><EFBFBD><EFBFBD><E1B5A5>,'
+'v_op_bscard.<2E><><EFBFBD><EFBFBD><E1B5A5>, v_op_bscard.ί<>б<EFBFBD><D0B1><EFBFBD>, '
+'v_op_bscard.ί<>е<EFBFBD>λ ';
aQuery.Open;
if not aQuery.IsEmpty then begin
aQuery.first;
mail_s:='Ƿ<><C7B7><EFBFBD><EFBFBD>ϸ';
while not aQuery.eof do begin
mail_s:=mail_s+#13#10+'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+aQuery.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+';'+'ί<>б<EFBFBD><D0B1><EFBFBD>:'+aQuery.FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString+';'+'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>:'+aQuery.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+';'+'Ƿ<>ѽ<EFBFBD><D1BD><EFBFBD>:'+aQuery.FieldByName('δ<>պϼ<D5BA>').AsString;
aQuery.next;
end;
end;
end else if A1='<27>ͻ<EFBFBD><CDBB>ϼ<EFBFBD>' then begin
aQuery.Close;aQuery.SQL.Clear;
aQuery.SQL.text:='SELECT t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
+' THEN (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as δ<>պϼ<D5BA>'
+' FROM t_ch_fee inner join v_op_bscard on v_op_bscard.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> '
+Str_bill
+' GROUP BY t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
aQuery.Open;
if not aQuery.IsEmpty then begin
aQuery.first;
mail_s:='<27>ͻ<EFBFBD>Ƿ<EFBFBD><C7B7>';
while not aQuery.eof do begin
mail_s:=mail_s+#13#10+'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>:'+aQuery.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+';'+'Ƿ<>ѽ<EFBFBD><D1BD><EFBFBD>:'+aQuery.FieldByName('δ<>պϼ<D5BA>').AsString;
aQuery.next;
end;
end;
end else if A1='<27><><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD>' then begin
aQuery.Close;aQuery.SQL.Clear;
aQuery.SQL.text:='SELECT '
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
+' THEN (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as δ<>պϼ<D5BA>'
+' FROM t_ch_fee inner join v_op_bscard on v_op_bscard.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> '
+Str_bill;
aQuery.Open;
if not aQuery.IsEmpty then begin
mail_s:='Ƿ<><C7B7><EFBFBD>ܼ<EFBFBD>';
mail_s:=mail_s+#13#10+'Ƿ<>ѽ<EFBFBD><D1BD><EFBFBD>:'+aQuery.FieldByName('δ<>պϼ<D5BA>').AsString;
end;
end;
end else if Trim(t_sys_awoke.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='δ<><CEB4><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
if (dayofweek(now)=2) then begin
startday:=FormatDateTime('YYYY-MM-DD',NOW);
ENDday:=FormatDateTime('YYYY-MM-DD',NOW+3);
end;
if (dayofweek(now)=3) then begin
startday:=FormatDateTime('YYYY-MM-DD',NOW-1);
ENDday:=FormatDateTime('YYYY-MM-DD',NOW+2);
end;
if (dayofweek(now)=4) then begin
startday:=FormatDateTime('YYYY-MM-DD',NOW-2);
ENDday:=FormatDateTime('YYYY-MM-DD',NOW+1);
end;
if (dayofweek(now)=5) then begin
startday:=FormatDateTime('YYYY-MM-DD',NOW-3);
ENDday:=FormatDateTime('YYYY-MM-DD',NOW);
end;
if (dayofweek(now)=6) then begin
startday:=FormatDateTime('YYYY-MM-DD',NOW);
ENDday:=FormatDateTime('YYYY-MM-DD',NOW+2);
end;
if (dayofweek(now)=7) then begin
startday:=FormatDateTime('YYYY-MM-DD',NOW-1);
ENDday:=FormatDateTime('YYYY-MM-DD',NOW+1);
end;
if (dayofweek(now)=1) then begin
startday:=FormatDateTime('YYYY-MM-DD',NOW-2);
ENDday:=FormatDateTime('YYYY-MM-DD',NOW);
end;
if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>' then begin
Str_bill:=' where v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+startday+''''+' AND v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+endday+'''';
end else if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
Str_bill:=' where v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+startday+''''+' AND v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+endday+''''
+' and v_op_bscard.<2E><><EFBFBD><EFBFBD>Ա in ('+str_emp+')';
end else if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
Str_bill:=' where v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+startday+''''+' AND v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+endday+''''
+' and v_op_bscard.<2E><><EFBFBD><EFBFBD>Ա='+''''+t_sys_awoke_emp.FieldByName('<27><>Ա').asstring+'''';
end else if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
Str_bill:=' where v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+startday+''''+' AND v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+endday+''''
+' and '+open_data('0001','v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_bscard.<2E><><EFBFBD><EFBFBD>Ա','v_op_bscard.<2E>ͷ<EFBFBD>Ա','no','no');
end;
if pos('<27><><EFBFBD>صķ<D8B5><C4B7><EFBFBD>=',s)>0 then
A1:='1'
else
A1:='0';
if pos('<27><><EFBFBD><EFBFBD>δ¼<CEB4><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=',s)>0 then
A2:='1'
else
A2:='0';
if pos('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>=',s)>0 then
A3:='1'
else
A3:='0';
if pos('Ʊ<><C6B1><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>Ʊ=',s)>0 then
A4:='1'
else
A4:='0';
if A1='1' then begin
aQuery.Close;aQuery.SQL.Clear;
aQuery.SQL.Add('select count(distinct <20><><EFBFBD><EFBFBD>) as Ʊ<><C6B1> from t_ch_fee where <20><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD><EFBFBD><EFBFBD>ύ'' and <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from v_op_bscard '+str_bill+')');
aQuery.Open;
if aQuery.FieldByName('Ʊ<><C6B1>').AsInteger<>0 then begin
mail_s:='<27><><EFBFBD>ط<EFBFBD><D8B7><EFBFBD>:'+aQuery.fieldByName('Ʊ<><C6B1>').AsString+'Ʊ';
end;
end;
if A2='1' then begin
end;
if A3='1' then begin
aQuery.Close;aQuery.SQL.Clear;
aQuery.SQL.Add('select count(distinct <20><><EFBFBD><EFBFBD>) as Ʊ<><C6B1> from t_ch_fee where <20><><EFBFBD><EFBFBD>״̬=''¼<><C2BC>״̬'' and <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from v_op_bscard '+str_bill+' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+FormatDateTime('YYYY-MM-DD',NOW)+''')');
aQuery.Open;
if aQuery.FieldByName('Ʊ<><C6B1>').AsInteger<>0 then begin
mail_s:=mail_s+#13#10+'δ<><EFBFBD><E1BDBB><EFBFBD><EFBFBD>:'+aQuery.fieldByName('Ʊ<><C6B1>').AsString+'Ʊ';
end;
end;
if A4='1' then begin
aQuery.Close;aQuery.SQL.Clear;
aQuery.SQL.Add('select count(distinct <20><><EFBFBD><EFBFBD>) as Ʊ<><C6B1> from t_ch_fee where <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>=0 and <20><><EFBFBD><EFBFBD>=''<27><>'' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> not in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales) and <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD> from v_op_bscard '+str_bill+' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='''+FormatDateTime('YYYY-MM-DD',NOW)+''')');
aQuery.Open;
if aQuery.FieldByName('Ʊ<><C6B1>').AsInteger<>0 then begin
mail_s:=mail_s+#13#10+'Ʊ<><C6B1><EFBFBD>ͻ<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>Ʊ:'+aQuery.fieldByName('Ʊ<><C6B1>').AsString+'Ʊ';
end;
end;
end else if Trim(t_sys_awoke.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
A1:=Copy(S,6,POS(',<2C><><EFBFBD><EFBFBD>',S)-6);
A2:=Copy(S,POS('<27><><EFBFBD><EFBFBD>=',S)+5,POS(',<2C><><EFBFBD>ѷ<EFBFBD>ʽ=',S)-POS('<27><><EFBFBD><EFBFBD>=',S)-5);
A3:=Copy(s,pos('<27><><EFBFBD>ѷ<EFBFBD>ʽ=',s)+9,length(s)-pos('<27><><EFBFBD>ѷ<EFBFBD>ʽ=',s)-7);
if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>' then begin
Str_bill:=' where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
end else if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
Str_bill:=' where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+''''
+' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in ('+str_emp+')';
end else if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
Str_bill:=' where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+''''
+' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+t_sys_awoke_emp.FieldByName('<27><>Ա').asstring+'''';
end else if t_sys_awoke_emp.FieldByName('<27><><EFBFBD>ݷ<EFBFBD>Χ').AsString='Ȩ<><C8A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
Str_bill:='where '+open_data('0033','v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_bscard.<2E><><EFBFBD><EFBFBD>Ա','v_op_bscard.<2E>ͷ<EFBFBD>Ա','no','no')
+' and t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+' and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
end;
if A1='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
str_bill:=str_bill+' and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+FormatDateTime('YYYY-MM-DD',now-strtointdef(A1,0))+'''';
end else if A1='<27><><EFBFBD>ں<EFBFBD>' then begin
str_bill:=str_bill+' and t_ch_fee.Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+FormatDateTime('YYYY-MM-DD',now-strtointdef(A1,0))+'''';
end;
if A3='ҵ<><D2B5><EFBFBD><EFBFBD>ϸ' then begin
aQuery.Close;aQuery.SQL.Clear;
aQuery.SQL.text:='SELECT t_ch_fee.<2E><><EFBFBD><EFBFBD>, t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
+' THEN (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as δ<>պϼ<D5BA>,'
+'v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>, v_op_bscard.<2E><><EFBFBD><EFBFBD><E1B5A5>,'
+'v_op_bscard.<2E><><EFBFBD><EFBFBD><E1B5A5>, v_op_bscard.ί<>б<EFBFBD><D0B1><EFBFBD>,'
+'v_op_bscard.ί<>е<EFBFBD>λ '
+' FROM t_ch_fee inner join v_op_bscard on v_op_bscard.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> '
+Str_bill
+' GROUP BY t_ch_fee.<2E><><EFBFBD><EFBFBD>, t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>, v_op_bscard.<2E><><EFBFBD><EFBFBD><E1B5A5>,'
+'v_op_bscard.<2E><><EFBFBD><EFBFBD><E1B5A5>, v_op_bscard.ί<>б<EFBFBD><D0B1><EFBFBD>, '
+'v_op_bscard.ί<>е<EFBFBD>λ ';
aQuery.Open;
if not aQuery.IsEmpty then begin
aQuery.first;
mail_s:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ';
while not aQuery.eof do begin
mail_s:=mail_s+#13#10+'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+aQuery.FieldByName('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+';'+'ί<>б<EFBFBD><D0B1><EFBFBD>:'+aQuery.FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString+';'+'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>:'+aQuery.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+';'+'Ƿ<>ѽ<EFBFBD><D1BD><EFBFBD>:'+aQuery.FieldByName('δ<>պϼ<D5BA>').AsString;
aQuery.next;
end;
end;
end else if A3='<27>ͻ<EFBFBD><CDBB>ϼ<EFBFBD>' then begin
aQuery.Close;aQuery.SQL.Clear;
aQuery.SQL.text:='SELECT t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
+' THEN (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as δ<>պϼ<D5BA>'
+' FROM t_ch_fee inner join v_op_bscard on v_op_bscard.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> '
+Str_bill
+' GROUP BY t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
aQuery.Open;
if not aQuery.IsEmpty then begin
aQuery.first;
mail_s:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
while not aQuery.eof do begin
mail_s:=mail_s+#13#10+'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>:'+aQuery.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+';'+'Ƿ<>ѽ<EFBFBD><D1BD><EFBFBD>:'+aQuery.FieldByName('δ<>պϼ<D5BA>').AsString;
aQuery.next;
end;
end;
end else if A3='<27>ܽ<EFBFBD><DCBD><EFBFBD>' then begin
aQuery.Close;aQuery.SQL.Clear;
aQuery.SQL.text:='SELECT '
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
+' THEN (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as δ<>պϼ<D5BA>'
+' FROM t_ch_fee inner join v_op_bscard on v_op_bscard.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> '
+Str_bill;
aQuery.Open;
if not aQuery.IsEmpty then begin
mail_s:='<27><><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD>';
mail_s:=mail_s+#13#10+'Ƿ<>ѽ<EFBFBD><D1BD><EFBFBD>:'+aQuery.FieldByName('δ<>պϼ<D5BA>').AsString;
end;
end;
end else if Trim(t_sys_awoke.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
A1:=Copy(s,pos('<27><><EFBFBD><EFBFBD>=',s)+5,length(s)-pos('<27><><EFBFBD><EFBFBD>=',s)-3);
aQuery.Close;
aQuery.SQL.Clear;
aQuery.SQL.Add('Select * from t_crm_client_contract where <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><='''+FormatDateTime('YYYY-MM-DD',NOW+Strtointdef(A1,0))+''' AND <20><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>>'''+FormatDateTime('YYYY-MM-DD',NOW)+'''');
aQuery.Open;
if not aQuery.IsEmpty then begin
aQuery.First;
while not aQuery.Eof do begin
mail_s:='<27><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>';
mail_s:=mail_s+#13#10+'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>:'+aQuery.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
aQuery.Next;
end;
end;
end else if Trim(t_sys_awoke.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='SQL<51><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then begin
end;
end;
if Trim(mail_s)<>'' then begin
SMTP1.AuthType := satDefault; //(satNone, satDefault, satSASL);
// SMTP1.AuthenticationType := atLogin;
SMTP1.username:= frm_data_share.t_sys_company.FieldByName('<27><>¼<EFBFBD>û<EFBFBD><C3BB><EFBFBD>').AsString;
SMTP1.Password :=frm_data_share.t_sys_company.FieldByName('<27><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>').AsString;
SMTP1.Host :=frm_data_share.t_sys_company.FieldByName('SMTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ').AsString;
SMTP1.Port :=Strtointdef(Trim(frm_data_share.t_sys_company.FieldByName('SMTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>').AsString),25);
try
SMTP1.Connect;
except
Showmessage('<27><><EFBFBD><EFBFBD>SMTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!');
Exit;
end;
try
with IdMsg do
begin
body.Clear;
Body.Text :=mail_s;
From.address :=frm_data_share.t_sys_company.FieldByName('SMTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
Recipients.EMailAddresses :=GetEmail(t_sys_awoke_emp.FieldByName('<27><>Ա').asstring);
Subject:=t_sys_awoke.fieldByName('<27><><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD>').AsString;
end;
SMTP1.Send(IdMsg);
finally
showmessage(t_sys_awoke_emp.FieldByName('<27><>Ա').asstring+'<27><><EFBFBD>ż<EFBFBD><C5BC>ѳɹ<D1B3><C9B9><EFBFBD><EFBFBD><EFBFBD>');
SMTP1.Disconnect;
end;
{
NMSMTP1.Host:=frm_data_share.t_sys_company.FieldByName('SMTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ').AsString;
NMSMTP1.Port:=Strtointdef(Trim(frm_data_share.t_sys_company.FieldByName('SMTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>').AsString),25);
if NMSMTP1.Connected then
begin
NMSMTP1.Disconnect;
end;
NMSMTP1.Connect;
NMSMTP1.PostMessage.FromAddress :=frm_data_share.t_sys_company.FieldByName('SMTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
NMSMTP1.PostMessage.FromName :='<27>ʼ<EFBFBD><CABC>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>';
NMSMTP1.PostMessage.ToAddress.Text :=GetEmail(t_sys_awoke_emp.FieldByName('<27><>Ա').asstring);
NMSMTP1.PostMessage.Body.Text :=mail_s;
NMSMTP1.PostMessage.Subject :=t_sys_awoke.fieldByName('<27><><EFBFBD>ѱ<EFBFBD><D1B1><EFBFBD>').AsString;
NMSMTP1.SendMail;
}
// showmessage(t_sys_awoke_emp.FieldByName('<27><>Ա').asstring);
end;
t_sys_awoke_emp.Next;
end;
FreeAndNil(aQuery);
end;
procedure TfrmMessageSet.N7Click(Sender: TObject);
begin
if MessageDlg('ȷʵҪɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>Ϣ<EFBFBD><CFA2>?',mtWarning,[mbYes,mbNo],0)<>mrYes then
exit;
t_sys_awoke_emp.First;
while not t_sys_awoke_emp.Eof do begin
t_sys_awoke_emp.Delete;
end;
end;
procedure TfrmMessageSet.t_sys_awokeBeforeInsert(DataSet: TDataSet);
begin
if not if_open('241') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
Abort;
end;
end;
procedure TfrmMessageSet.t_sys_awokeBeforeDelete(DataSet: TDataSet);
begin
if not if_open('243') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
Abort;
end;
end;
procedure TfrmMessageSet.NMSMTP1Connect(Sender: TObject);
var
StrUserName,strPassword:String;
begin
{
strUserName:=EncodeString(frm_data_share.t_sys_company.FieldByName('<27><>¼<EFBFBD>û<EFBFBD><C3BB><EFBFBD>').AsString);
strPassword:=EncodeString(frm_data_share.t_sys_company.FieldByName('<27><>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>').AsString);
nmsmtp1.Transaction('EHLO') ;
nmsmtp1.Transaction('AUTH LOGIN');
nmsmtp1.Transaction(strUserName);
nmsmtp1.Transaction(strPassword);
}
end;
procedure TfrmMessageSet.N8Click(Sender: TObject);
begin
t_sys_awoke.Insert;
Notebook1.PageIndex:=1;
end;
procedure TfrmMessageSet.bsSkinButton1Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height));
PopupMenu2.Popup(Pnt.x,Pnt.y);
end;
procedure TfrmMessageSet.N10Click(Sender: TObject);
var
afield : variant;
i: Integer;
begin
if t_sys_awoke.IsEmpty then
begin
showmessage('û<>и<EFBFBD><D0B8><EFBFBD>ĸ<EFBFBD><EFBFBD><E5A3AC><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>');
exit;
end;
afield := vararraycreate([0,t_sys_awoke.fieldcount-1],varvariant);
for i := 0 to (t_sys_awoke.fieldcount-1) do
begin
afield[i] :=t_sys_awoke.fields[i].value ;
end;
t_sys_awoke.append;
for i := 0 to (t_sys_awoke.fieldcount-1) do
begin
if t_sys_awoke.fields[i].FieldName<>'AWOKE_ID' then
t_sys_awoke.fields[i].value := afield[i] ;
end;
t_sys_awoke.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:='';
Notebook1.PageIndex:=1;
// t_sys_awoke.Post;
end;
procedure TfrmMessageSet.N12Click(Sender: TObject);
begin
if t_sys_awoke.State in [dsinsert] then t_sys_awoke.Post;
frmaddemp:=Tfrmaddemp.Create(self);
try
frmaddemp.ShowModal;
finally
FreeAndNil(frmaddemp);
end;
end;
procedure TfrmMessageSet.N14Click(Sender: TObject);
begin
if MessageDlg('ȷʵҪɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>Ϣ<EFBFBD><CFA2>?',mtWarning,[mbYes,mbNo],0)<>mrYes then
exit;
t_sys_awoke_emp.Delete;
end;
function TfrmMessageSet.GetStrChar(str:String):string;
var
i:integer;
begin
result:='';
if str='' then exit;
for i:=1 to length(Str) do begin
if str[i] in ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
then
else
result:=result+str[i];
end;
end;
function TfrmMessageSet.CreateIgengzongxml(SOI:string):TStringlist;
var
str,alist:Tstringlist;
ScriptPath,StlType,UpPath:string;
s:widestring;
aQuery:TAdoQuery;
i:integer;
IdFTP1:TIdFTP;
sourcestr,str_file:widestring;
hh:Word;
begin
i:=1;
aQuery:=CreateAdoQuery;
str:=Tstringlist.Create;
alist:=Tstringlist.Create;
with aQuery do
try
close;
sql.Clear;
sql.Add('Select t_op_seae.<2E><><EFBFBD><EFBFBD>˾,t_crm_client.IGZ<47><5A><EFBFBD><EFBFBD> EDI<44><49><EFBFBD><EFBFBD>, t_op_seae.װ<>۴<EFBFBD><DBB4><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD><E1B5A5>');
sql.Add('from t_op_seae');
sql.Add('left join t_crm_client on t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_op_seae.<2E><><EFBFBD><EFBFBD>˾');
sql.Add('where t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=GetDate()-100 and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=GetDate() ');
open;First;
if not IsEmpty then
begin
str.Clear;
str.Add('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>');
str.Add('<Message>');
str.Add('<Header>');
str.Add('<MessageType MessageVersion="2.0">QueryCondition');
str.Add('</MessageType>');
str.Add('<DateTime DateType="Document">'+FormatDateTime('YYYYMMDD',Date)+'000000');
str.Add('</DateTime>');
str.Add('</Header>');
str.Add('<MessageBody>');
while not eof do
begin
if GetStrChar(trim(fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring))='' then
begin
str.Add('<Trace Type="BLNo" CarrierCode="'+FieldByName('EDI<44><49><EFBFBD><EFBFBD>').AsString+'" PortCode="'+FieldByName('װ<>۴<EFBFBD><DBB4><EFBFBD>').AsString+'" DockCode="" EndDate="">');
str.Add('<Index Count="'+IntTostr(i)+'">'+trim(FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString)+'</Index>');
str.Add('</Trace>');
end
else
begin
showmessage('<27>Ƿ<EFBFBD><C7B7><EFBFBD><E1B5A5>:'+fieldbyname('<27><><EFBFBD><EFBFBD><E1B5A5>').asstring);
end;
Next;
end;
end;
if not IsEmpty then
begin
str.Add('</MessageBody>');
str.Add('</Message>');
end;
IdFTP1:=TIdFTP.Create(application);
with idftp1 do
begin
idftp1.ListenTimeout:=6000;
idftp1.ReadTimeout:=6000;
Host:=frm_data_share.t_sys_company.FieldByName('FTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ').AsString;
Username:=frm_data_share.t_sys_company.FieldByName('FTP<54>û<EFBFBD><C3BB><EFBFBD>').AsString;
Password:=frm_data_share.t_sys_company.FieldByName('FTP<54><50><EFBFBD><EFBFBD>').AsString;
Port:=frm_data_share.t_sys_company.FieldByName('FTP<54>˿<EFBFBD>').AsInteger;
Connect;
Passive:=true;
if idftp1.Connected then
begin
showmessage('FTP<54>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ӳɹ<D3B3>'+' '+Host+' '+Username+' '+Password+' '+IntToStr(Port));
end
else
begin
showmessage('FTP<54>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>');
end;
end;
// Sleep(2000);
UpPath:='/';
idftp1.ChangeDir(UpPath);
//idftp1.TransferType:=ftASCII;
//idftp1.TransferType:=ftBinary;
hh:=24;
finally
if str.Count>0 then
begin
str.SaveToFile('d:\YT_'+FormatDateTime('YYYYMMDD',Date)+'_'+IntTostr(hh)+'.xml');
str_file:='YT_'+FormatDateTime('YYYYMMDD',Date)+'_'+IntTostr(hh)+'.xml';
sourcestr:='d:\YT_'+FormatDateTime('YYYYMMDD',Date)+'_'+IntTostr(hh)+'.xml';
if idftp1.Connected then
begin
idftp1.Put(sourcestr,str_file);
showmessage('FTP<54>ϴ<EFBFBD><CFB4>ļ<EFBFBD><C4BC>ɹ<EFBFBD>')
end;
end;
freeandnil(aQuery);
str.Free;
alist.Free;
if idftp1.Connected then
idftp1.Disconnect;
end;
end;
procedure TfrmMessageSet.bsSkinButton13Click(Sender: TObject);
begin
CreateIgengzongxml('SO');
end;
end.