|
|
unit u_rp_op_ttl;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
|
|
ExtCtrls, wwdbdatetimepicker, StdCtrls, Mask, wwdbedit, Wwdotdot,
|
|
|
Wwdbcomb, fcButton, fcImgBtn, dxCntner, dxTL, dxDBGrid, Menus, XPMenu,
|
|
|
TXComp, Db, ADODB, ppBands, wwdblook, RXCtrls, CheckLst, ToolEdit,
|
|
|
RxMemDS, DBTables, MemTable, dxExEdtr, dxDBCtrl, RxLookup, bsSkinCtrls,
|
|
|
kbmMemTable,IdSMTP,IdMessage,IdAttachmentFile;
|
|
|
|
|
|
type
|
|
|
|
|
|
Tfrm_rp_op_ttl = class(TForm)
|
|
|
main_pool: TPanel;
|
|
|
Panel1: TPanel;
|
|
|
XPMenu1: TXPMenu;
|
|
|
dxDBGrid2: TdxDBGrid;
|
|
|
ADOQueryFee: TADOQuery;
|
|
|
ADOQuerySelect: TADOQuery;
|
|
|
memtbl1: TDataSource;
|
|
|
SaveDialog: TSaveDialog;
|
|
|
Panel2: TPanel;
|
|
|
ADOQuerysum: TADOQuery;
|
|
|
dxDBGrid2Column3: TdxDBGridColumn;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
memtbl: TkbmMemTable;
|
|
|
dxDBGrid2Column13: TdxDBGridColumn;
|
|
|
dbsub: TADOConnection;
|
|
|
dxDBGrid2Column16: TdxDBGridColumn;
|
|
|
dxDBGrid2Column17: TdxDBGridColumn;
|
|
|
Label11: TLabel;
|
|
|
Label12: TLabel;
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
Label1: TLabel;
|
|
|
wwDBDateTimePicker3: TwwDBDateTimePicker;
|
|
|
memtblORDNO: TIntegerField;
|
|
|
Label213: TLabel;
|
|
|
RxDBLookupCombo57: TRxDBLookupCombo;
|
|
|
memtblch_id: TIntegerField;
|
|
|
memtblField: TStringField;
|
|
|
memtblField2: TStringField;
|
|
|
memtblField3: TStringField;
|
|
|
memtblField5: TStringField;
|
|
|
memtblField6: TStringField;
|
|
|
memtblField7: TStringField;
|
|
|
memtblField8: TStringField;
|
|
|
memtblField9: TStringField;
|
|
|
memtblField10: TStringField;
|
|
|
memtblField11: TFloatField;
|
|
|
memtblField12: TStringField;
|
|
|
memtblField13: TStringField;
|
|
|
memtblField4: TDateField;
|
|
|
dxDBGrid2Column8: TdxDBGridColumn;
|
|
|
dxDBGrid2Column9: TdxDBGridColumn;
|
|
|
dxDBGrid2Column10: TdxDBGridColumn;
|
|
|
dxDBGrid2Column11: TdxDBGridColumn;
|
|
|
dxDBGrid2Column18: TdxDBGridColumn;
|
|
|
memtblField14: TStringField;
|
|
|
dxDBGrid2Column19: TdxDBGridColumn;
|
|
|
memtblField15: TDateField;
|
|
|
CheckBox1: TCheckBox;
|
|
|
memtblUSD: TFloatField;
|
|
|
memtblRMB: TFloatField;
|
|
|
dxDBGrid2Column12: TdxDBGridColumn;
|
|
|
dxDBGrid2Column14: TdxDBGridColumn;
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
billno,CorpName:String;
|
|
|
function GetsubMblprofit(mblno:string):double;
|
|
|
Procedure ExportExcelFile(FileName: string; bWriteTitle: Boolean; aDataSet: TDataSet);
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_rp_op_ttl: Tfrm_rp_op_ttl;
|
|
|
base_num:integer;
|
|
|
arXlsBegin:array[0..5] of Word = ($809, 8, 0, $10, 0,0);
|
|
|
arXlsEnd: array[0..1] of Word = ($0A, 00);
|
|
|
arXlsString: array[0..5] of Word = ($204, 0, 0, 0, 0, 0);
|
|
|
arXlsNumber: array[0..4] of Word = ($203, 14, 0, 0, 0);
|
|
|
arXlsInteger: array[0..4] of Word = ($27E, 10, 0, 0, 0);
|
|
|
arXlsBlank: array[0..4] of Word = ($201, 6, 0, 0, $17);
|
|
|
implementation
|
|
|
|
|
|
uses my_sys_function,u_data_share,u_main, u_sys_progress;
|
|
|
|
|
|
{$R *.DFM}
|
|
|
|
|
|
procedure Tfrm_rp_op_ttl.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
frm_rp_op_ttl.Hide;
|
|
|
frm_rp_op_ttl.ManualFloat(frm_rp_op_ttl.BoundsRect );
|
|
|
frm_main.freeTabs('frm_rp_op_ttl');
|
|
|
action:=cafree;
|
|
|
frm_rp_op_ttl:=nil;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
Procedure Tfrm_rp_op_ttl.ExportExcelFile(FileName: string; bWriteTitle: Boolean; aDataSet: TDataSet);
|
|
|
var
|
|
|
i,j: integer;
|
|
|
Col , row: word;
|
|
|
ABookMark: TBookMark;
|
|
|
aFileStream: TFileStream;
|
|
|
|
|
|
|
|
|
|
|
|
procedure incColRow; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>
|
|
|
begin
|
|
|
if Col = ADataSet.FieldCount - 1 then
|
|
|
begin
|
|
|
Inc(Row);
|
|
|
Col :=0;
|
|
|
end
|
|
|
else
|
|
|
Inc(Col);
|
|
|
end;
|
|
|
|
|
|
procedure WriteStringCell(AValue: string);//д<>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
var
|
|
|
L: Word;
|
|
|
begin
|
|
|
L := Length(AValue);
|
|
|
arXlsString[1] := 8 + L;
|
|
|
arXlsString[2] := Row;
|
|
|
arXlsString[3] := Col;
|
|
|
arXlsString[5] := L;
|
|
|
aFileStream.WriteBuffer(arXlsString, SizeOf (arXlsString));
|
|
|
aFileStream.WriteBuffer(Pointer(AValue)^, L);
|
|
|
IncColRow;
|
|
|
end;
|
|
|
|
|
|
procedure WriteIntegerCell(AValue: integer);//д<><D0B4><EFBFBD><EFBFBD>
|
|
|
var
|
|
|
V: Integer;
|
|
|
begin
|
|
|
arXlsInteger[2] := Row;
|
|
|
arXlsInteger[3] := Col;
|
|
|
aFileStream.WriteBuffer(arXlsInteger, SizeOf(arXlsInteger));
|
|
|
V := (AValue shl 2) or 2;
|
|
|
aFileStream.WriteBuffer(V, 4);
|
|
|
IncColRow;
|
|
|
end;
|
|
|
|
|
|
procedure WriteFloatCell(AValue: double );//д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
begin
|
|
|
arXlsNumber[2] := Row;
|
|
|
arXlsNumber[3] := Col;
|
|
|
aFileStream.WriteBuffer(arXlsNumber, SizeOf(arXlsNumber));
|
|
|
aFileStream.WriteBuffer(AValue, 8);
|
|
|
IncColRow;
|
|
|
end;
|
|
|
begin
|
|
|
if FileExists(FileName) then DeleteFile(FileName); //<2F>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>ɾ<EFBFBD><C9BE>
|
|
|
aFileStream := TFileStream.Create(FileName, fmCreate);
|
|
|
Try //д<>ļ<EFBFBD>ͷ<EFBFBD><CDB7>
|
|
|
aFileStream.WriteBuffer(arXlsBegin, SizeOf(arXlsBegin)); //д<><D0B4>ͷ <20><>
|
|
|
Col := 0; Row := 0;
|
|
|
if bWriteTitle then
|
|
|
begin
|
|
|
for i := 0 to aDataSet.FieldCount - 1 do
|
|
|
WriteStringCell(aDataSet.Fields[i].FieldName);
|
|
|
end;
|
|
|
//д<><D0B4><EFBFBD>ݼ<EFBFBD><DDBC>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
aDataSet.DisableControls;
|
|
|
//ABookMark := aDataSet.GetBookmark;
|
|
|
aDataSet.First ;
|
|
|
while not aDataSet.Eof do
|
|
|
begin
|
|
|
for i := 0 to aDataSet.FieldCount - 1 do
|
|
|
case ADataSet.Fields[i].DataType of
|
|
|
ftSmallint, ftInteger, ftWord, ftAutoInc, ftBytes:
|
|
|
WriteIntegerCell(aDataSet.Fields[i].AsInteger);
|
|
|
ftFloat, ftCurrency, ftBCD:
|
|
|
WriteFloatCell(StrToFloat(FormatFloat('0.00;-0.00;0',aDataSet.Fields[i].AsFloat)))
|
|
|
else
|
|
|
WriteStringCell(aDataSet.Fields[i].AsString);
|
|
|
end;
|
|
|
aDataSet.Next;
|
|
|
Application.ProcessMessages;
|
|
|
end;
|
|
|
//д<>ļ<EFBFBD>β <20><>
|
|
|
AFileStream.WriteBuffer(arXlsEnd, SizeOf(arXlsEnd));
|
|
|
//if ADataSet.BookmarkValid(ABookMark) then aDataSet.GotoBookmark(ABookMark);
|
|
|
Finally
|
|
|
AFileStream.Free;
|
|
|
ADataSet.EnableControls;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_op_ttl.bsSkinButton1Click(Sender: TObject);
|
|
|
var ADOQueryFee,ADOQueryCrmSales:TAdoquery;
|
|
|
OrdNo:integer;
|
|
|
RecordVar:TRecordVar;
|
|
|
aList:TStringlist;
|
|
|
i:integer;
|
|
|
str_memo:Tmemo;
|
|
|
SMTP1:TIdSMTP;
|
|
|
IdMsg:TIdMessage;
|
|
|
|
|
|
begin
|
|
|
ADOQueryFee:=CreateAdoQuery;
|
|
|
with ADOQueryFee do
|
|
|
begin
|
|
|
close;sql.Clear;
|
|
|
SQL.Add('select t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
if CheckBox1.Checked then
|
|
|
begin
|
|
|
SQL.Add(',t_ch_fee.ch_id,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>, t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD>, t_ch_fee.<2E>ұ<EFBFBD>');
|
|
|
end;
|
|
|
SQL.Add(',sum(case when <20>ұ<EFBFBD>=''USD'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) USD');
|
|
|
SQL.Add(',sum(case when <20>ұ<EFBFBD>=''RMB'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) RMB');
|
|
|
SQL.Add('from t_op_seae ');
|
|
|
SQL.Add('Left join t_ch_fee on t_op_seae.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' and t_ch_fee.<2E><><EFBFBD><EFBFBD>״̬<>''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
|
|
SQL.Add('where (not t_ch_fee.<2E><><EFBFBD><EFBFBD> is null) and (not t_op_seae.<2E><><EFBFBD><EFBFBD> is null) and t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=:<3A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ');
|
|
|
if CheckBox1.Checked then
|
|
|
begin
|
|
|
SQL.Add('Group by t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.ί<>е<EFBFBD>λ,t_op_seae.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(',t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',t_ch_fee.ch_id,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>, t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_ch_fee.<2E>ұ<EFBFBD>');
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
SQL.Add('Group by t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.ί<>е<EFBFBD>λ,t_op_seae.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD> ');
|
|
|
SQL.Add(',t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
end;
|
|
|
SQL.Add('having (sum(case when <20>ұ<EFBFBD>=''USD'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end)<>0) or (sum(case when <20>ұ<EFBFBD>=''RMB'' then <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end)<>0)');
|
|
|
SQL.Add('order by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seae.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>');
|
|
|
|
|
|
Parameters.ParamByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker1.Date;
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker2.Date;
|
|
|
Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:='';
|
|
|
end;
|
|
|
|
|
|
if wwDBDateTimePicker1.Text='' then
|
|
|
begin
|
|
|
showmessage('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if wwDBDateTimePicker2.Text='' then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD>㿪<EFBFBD><E3BFAA><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if wwDBDateTimePicker3.Text='' then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>');
|
|
|
exit;
|
|
|
end;
|
|
|
if CheckBox1.Checked then
|
|
|
begin
|
|
|
dxDBGrid2Column9.Visible:=true;
|
|
|
dxDBGrid2Column10.Visible:=true;
|
|
|
dxDBGrid2Column11.Visible:=true;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
dxDBGrid2Column9.Visible:=false;
|
|
|
dxDBGrid2Column10.Visible:=false;
|
|
|
dxDBGrid2Column11.Visible:=false;
|
|
|
end;
|
|
|
|
|
|
|
|
|
try
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<C8BA><F2A1A3A1><EFBFBD>';
|
|
|
frm_sys_progress.Show;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=100;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
|
|
|
aList:=TStringlist.create;
|
|
|
|
|
|
SMTP1:=TIdSMTP.Create(nil);
|
|
|
IdMsg:=TIdMessage.Create(nil);
|
|
|
str_memo:=Tmemo.create(nil);
|
|
|
|
|
|
|
|
|
ADOQueryCrmSales:=CreateAdoQuery;
|
|
|
with ADOQueryCrmSales do
|
|
|
begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
SMTP1.AuthType := satDefault; //(satNone, satDefault, satSASL);
|
|
|
SMTP1.username:=MailAddress;
|
|
|
SMTP1.Password :=MailPw;
|
|
|
SMTP1.Host :='smtpcom.263xmail.com';
|
|
|
// 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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memtbl.Close;
|
|
|
|
|
|
memtbl.Fields.Clear;
|
|
|
memtbl.FieldDefs.Clear;
|
|
|
memtbl.FieldDefs.Add('<27><><EFBFBD><EFBFBD>', ftInteger, 0, false);
|
|
|
// memtbl.FieldDefs.Add('<27><><EFBFBD><EFBFBD>', ftString, 20, false);
|
|
|
memtbl.FieldDefs.Add('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>', ftString, 20, false);
|
|
|
memtbl.FieldDefs.Add('<27>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', ftdate, 0, false);
|
|
|
memtbl.FieldDefs.Add('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>', ftString, 60, false);
|
|
|
memtbl.FieldDefs.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', ftdate, 0, false);
|
|
|
memtbl.FieldDefs.Add('<27><><EFBFBD><EFBFBD>', ftString, 60, false);
|
|
|
memtbl.FieldDefs.Add('<27><><EFBFBD><EFBFBD>', ftString, 20, false);
|
|
|
memtbl.FieldDefs.Add('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>', ftString, 20, false);
|
|
|
memtbl.FieldDefs.Add('USD', ftFloat, 0, false);
|
|
|
memtbl.FieldDefs.Add('RMB', ftFloat, 0, false);
|
|
|
if CheckBox1.Checked then
|
|
|
begin
|
|
|
memtbl.FieldDefs.Add('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', ftString, 20, false);
|
|
|
memtbl.FieldDefs.Add('<27><><EFBFBD><EFBFBD>', ftFloat, 0, false);
|
|
|
memtbl.FieldDefs.Add('<27>ұ<EFBFBD>', ftString, 10, false);
|
|
|
end;
|
|
|
memtbl.Open;
|
|
|
memtbl.IndexDefs.Clear;
|
|
|
if CheckBox1.Checked then
|
|
|
begin
|
|
|
memtbl.AddIndex('Indexordno', '<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD>ᵥ<EFBFBD><E1B5A5>;CH_ID', []);
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
memtbl.AddIndex('Indexordno', '<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD>ᵥ<EFBFBD><E1B5A5>', []);
|
|
|
end;
|
|
|
memtbl.IndexName := 'Indexordno';
|
|
|
memtbl.EmptyTable;
|
|
|
memtbl.DisableControls;
|
|
|
with ADOQuerySelect do
|
|
|
begin
|
|
|
close;sql.Clear;
|
|
|
SQL.Add('select * from t_crm_client_sales ');
|
|
|
SQL.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker1.Date;
|
|
|
|
|
|
if RxDBLookupCombo57.Text<>'<<3C><>>' then
|
|
|
begin
|
|
|
SQL.Add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=RxDBLookupCombo57.DisplayValues[1];
|
|
|
end;
|
|
|
|
|
|
ADOQuerySelect.DisableControls;
|
|
|
Open;First;
|
|
|
while not eof do
|
|
|
begin
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<C8BA><F2A1A3A1><EFBFBD>'+FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
with ADOQueryFee do
|
|
|
begin
|
|
|
close;
|
|
|
Parameters.ParamByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker1.Date;
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=wwDBDateTimePicker2.Date;
|
|
|
Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=ADOQuerySelect.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
open;First;
|
|
|
while not eof do
|
|
|
begin
|
|
|
RecordVar:=getzqitem(ADOQuerySelect.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime);
|
|
|
|
|
|
if RecordVar.stlDate<=wwDBDateTimePicker3.Date then
|
|
|
begin
|
|
|
OrdNo:=OrdNo+1;
|
|
|
memtbl.Append;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD>').AsInteger:=Ordno;
|
|
|
// memtbl.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString:=FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime:=RecordVar.stlDate;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=RecordVar.S1;
|
|
|
memtbl.FieldByName('USD').AsString:=FieldByName('USD').AsString;
|
|
|
memtbl.FieldByName('RMB').AsString:=FieldByName('RMB').AsString;
|
|
|
if CheckBox1.Checked then
|
|
|
begin
|
|
|
memtbl.FieldByName('ch_id').AsInteger:=FieldByName('ch_id').AsInteger;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27>ұ<EFBFBD>').AsString:=FieldByName('<27>ұ<EFBFBD>').AsString;
|
|
|
end;
|
|
|
if aList.IndexOf(trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString))<0 then
|
|
|
aList.Add(trim(FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString));
|
|
|
memtbl.Post;
|
|
|
end;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
if aList.Count>0 then
|
|
|
begin
|
|
|
for i:=0 to aList.count do
|
|
|
begin
|
|
|
memtbl.Filtered:=false;
|
|
|
memtbl.Filter:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+aList[i]+'''';
|
|
|
memtbl.Filtered:=true;
|
|
|
|
|
|
if not DirectoryExists(ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)) then
|
|
|
MkDir(ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now));
|
|
|
ExportExcelFile(ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)+'\'+aList[i]+FormatDateTime('YYMMDDhhmm',Now)+'.xls',true,TDataSet(memtbl));
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
with IdMsg do
|
|
|
begin
|
|
|
body.Clear;
|
|
|
Body.Text :=str_memo.lines.Text;
|
|
|
From.address :=MailAddress;
|
|
|
Recipients.EMailAddresses :=MailAddress;
|
|
|
Body.add('<27>½<EFBFBD><C2BD><EFBFBD><EFBFBD>˵<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
From.address :=MailAddress;
|
|
|
Recipients.EMailAddresses :='cs003@DONGSHENGSOFT.COM';
|
|
|
|
|
|
Subject:='<27>½<EFBFBD><C2BD><EFBFBD><EFBFBD>˵<EFBFBD>'+' '+aList[i]+FormatDateTime('YYMMDD',Now) ;
|
|
|
|
|
|
TIdAttachmentFile.Create(MessageParts,ExtractFilePath(Application.ExeName)+FormatDateTime('YYMMDD',Now)+'\'+aList[i]+FormatDateTime('YYMMDDhhmm',Now)+'.xls');
|
|
|
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;
|
|
|
end;
|
|
|
finally
|
|
|
frm_sys_progress.close;
|
|
|
frm_sys_progress:=nil;
|
|
|
SMTP1.Disconnect;
|
|
|
memtbl.EnableControls; //mtbl.IndexName:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD>';
|
|
|
memtbl.Refresh;
|
|
|
ADOQuerySelect.EnableControls;
|
|
|
aList.Free;
|
|
|
|
|
|
str_memo.Free;
|
|
|
SMTP1.Free;
|
|
|
IdMsg.Free;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
{procedure Tfrm_rp_op_ttl.bsSkinButton1Click(Sender: TObject);
|
|
|
begin
|
|
|
if d1.text='' then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>뿪ʼ<EBBFAA><CABC><EFBFBD>ڣ<EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
if d2.text='' then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
|
|
|
try
|
|
|
if not ASSIGNED(frm_sys_progress) then
|
|
|
frm_sys_progress:=tfrm_sys_progress.Create(application);
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<C8BA><F2A1A3A1><EFBFBD>';
|
|
|
frm_sys_progress.Show;
|
|
|
frm_sys_progress.bsSkinGauge1.MaxValue:=100;
|
|
|
frm_sys_progress.bsSkinGauge1.MinValue:=0;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=0;
|
|
|
|
|
|
memtbl.Close;
|
|
|
memtbl.IndexDefs.Clear;
|
|
|
memtbl.AddIndex('Indexordno', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD>', []);
|
|
|
memtbl.IndexName := 'Indexordno';
|
|
|
memtbl.Open;
|
|
|
memtbl.EmptyTable;
|
|
|
memtbl.DisableControls;
|
|
|
with ADOQuerySelect do
|
|
|
begin
|
|
|
|
|
|
close;sql.Clear;
|
|
|
SQL.Add('select t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',v_op_bscard.ί<>б<EFBFBD><D0B1><EFBFBD>,v_op_bscard.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,v_op_bscard.ί<>е<EFBFBD>λ,v_op_bscard.װ<><D7B0><EFBFBD><EFBFBD>,v_op_bscard.ж<><D0B6><EFBFBD><EFBFBD>,v_op_bscard.<2E><>Դ<EFBFBD><D4B4>ϸ');
|
|
|
SQL.Add(',t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',v_op_bscard.ë<><C3AB><EFBFBD><EFBFBD> <20><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',t_ch_fee.<2E><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',case when v_op_bscard.ë<><C3AB><EFBFBD><EFBFBD><>0 then t_ch_fee.<2E><><EFBFBD><EFBFBD>/v_op_bscard.ë<><C3AB><EFBFBD><EFBFBD>*100 else 0 end as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('from v_op_bscard');
|
|
|
SQL.Add('Left join t_crm_client_sales on t_crm_client_sales.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=v_op_bscard.ί<>е<EFBFBD>λ');
|
|
|
SQL.Add('Left join t_ch_fee on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('where t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'' and (v_op_bscard.<2E><>Դ<EFBFBD><D4B4>ϸ<>''<27><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>'' or v_op_bscard.<2E><>Դ<EFBFBD><D4B4>ϸ is null ) ');
|
|
|
SQL.Add('and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+FormatDateTime('yyyy-mm-dd',d1.Date)+'''' +'and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+FormatDateTime('yyyy-mm-dd',d2.Date)+'''');
|
|
|
SQL.Add(' 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','no'));
|
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
|
|
|
|
|
if RxDBLookupCombo21.DisplayValues[1]<>'' then
|
|
|
begin
|
|
|
SQL.Add('and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:CorpName');
|
|
|
Parameters.ParamByName('CorpName').Value:=RxDBLookupCombo21.DisplayValues[1];
|
|
|
end;
|
|
|
if RxDBLookupCombo20.DisplayValues[1]<>'' then
|
|
|
begin
|
|
|
SQL.Add('and v_op_bscard.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=RxDBLookupCombo20.DisplayValues[1];
|
|
|
end;
|
|
|
|
|
|
|
|
|
Open;First;
|
|
|
while not eof do
|
|
|
begin
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<C8BA><F2A1A3A1><EFBFBD>'+FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
memtbl.Append;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString:=FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString:=FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
memtbl.FieldByName('ί<>е<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>').AsString:=FieldByName('ί<>е<EFBFBD>λ').AsString;
|
|
|
memtbl.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
|
memtbl.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>').AsFloat:=FieldByName('<27><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=FormatFloat('0.00;-0.00;0',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat);
|
|
|
memtbl.FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString:=FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('ж<><D0B6><EFBFBD><EFBFBD>').AsString:=FieldByName('ж<><D0B6><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
|
memtbl.FieldByName('<27><>Դ<EFBFBD><D4B4>ϸ').AsString:=FieldByName('<27><>Դ<EFBFBD><D4B4>ϸ').AsString;
|
|
|
frm_rp_op_ttl.Caption:='ҵ<><D2B5>ͳ<EFBFBD><CDB3>:'+FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
|
|
|
memtbl.Post;
|
|
|
Next;
|
|
|
end;
|
|
|
|
|
|
|
|
|
//
|
|
|
close;sql.Clear;
|
|
|
SQL.Add('select t_ch_fee.<2E><><EFBFBD><EFBFBD>,t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',v_op_bscard.ί<>б<EFBFBD><D0B1><EFBFBD>,v_op_bscard.<2E><><EFBFBD>ᵥ<EFBFBD><E1B5A5>,v_op_bscard.ί<>е<EFBFBD>λ,v_op_bscard.װ<><D7B0><EFBFBD><EFBFBD>,v_op_bscard.ж<><D0B6><EFBFBD><EFBFBD>,v_op_bscard.<2E><>Դ<EFBFBD><D4B4>ϸ');
|
|
|
SQL.Add(',t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',v_op_bscard.ë<><C3AB><EFBFBD><EFBFBD> <20><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',t_ch_fee.<2E><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add(',case when v_op_bscard.ë<><C3AB><EFBFBD><EFBFBD><>0 then t_ch_fee.<2E><><EFBFBD><EFBFBD>/v_op_bscard.ë<><C3AB><EFBFBD><EFBFBD>*100 else 0 end as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('from v_op_bscard');
|
|
|
SQL.Add('Left join t_crm_client_sales on t_crm_client_sales.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=v_op_bscard.ί<>е<EFBFBD>λ');
|
|
|
SQL.Add('Left join t_ch_fee on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_bscard.<2E><><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('where t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and t_ch_fee.<2E><><EFBFBD><EFBFBD>=''<27><>'' and v_op_bscard.<2E><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>'' and v_op_bscard.<2E><>Դ<EFBFBD><D4B4>ϸ=''<27><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>''');
|
|
|
SQL.Add('and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+FormatDateTime('yyyy-mm-dd',d1.Date)+'''' +'and v_op_bscard.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+FormatDateTime('yyyy-mm-dd',d2.Date)+'''');
|
|
|
SQL.Add(' 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','no'));
|
|
|
|
|
|
|
|
|
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
|
|
if RxDBLookupCombo21.DisplayValues[1]<>'' then
|
|
|
begin
|
|
|
SQL.Add('and t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:CorpName');
|
|
|
Parameters.ParamByName('CorpName').Value:=RxDBLookupCombo21.DisplayValues[1];
|
|
|
end;
|
|
|
|
|
|
if RxDBLookupCombo20.DisplayValues[1]<>'' then
|
|
|
begin
|
|
|
SQL.Add('and v_op_bscard.<2E><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
|
|
|
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=RxDBLookupCombo20.DisplayValues[1];
|
|
|
end;
|
|
|
|
|
|
Open;First;
|
|
|
while not eof do
|
|
|
begin
|
|
|
memtbl.Append;
|
|
|
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><C9B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ<C8BA><F2A1A3A1><EFBFBD>'+FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
|
|
|
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD>').AsString:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString:=FieldByName('ί<>б<EFBFBD><D0B1><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString:=FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
memtbl.FieldByName('ί<>е<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>').AsString:=FieldByName('ί<>е<EFBFBD>λ').AsString;
|
|
|
memtbl.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
|
memtbl.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString:=FieldByName('<27>տ<EFBFBD><D5BF><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
if CheckBox1.Checked then begin
|
|
|
memtbl.FieldByName('<27><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>').AsFloat:=FieldByName('<27><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>').AsFloat+GetsubMblprofit(FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString);
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
|
|
|
if memtbl.FieldByName('<27><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>').AsFloat<>0 then
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=FormatFloat('0.00;-0.00;0',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat/memtbl.FieldByName('<27><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>').AsFloat*100)
|
|
|
else memtbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=0;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
memtbl.FieldByName('<27><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>').AsFloat:=FieldByName('<27><>˾ë<CBBE><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat;
|
|
|
memtbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=FormatFloat('0.00;-0.00;0',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsFloat);
|
|
|
end;
|
|
|
memtbl.FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString:=FieldByName('װ<><D7B0><EFBFBD><EFBFBD>').AsString;
|
|
|
memtbl.FieldByName('ж<><D0B6><EFBFBD><EFBFBD>').AsString:=FieldByName('ж<><D0B6><EFBFBD><EFBFBD>').AsString;
|
|
|
|
|
|
memtbl.FieldByName('<27><>Դ<EFBFBD><D4B4>ϸ').AsString:=FieldByName('<27><>Դ<EFBFBD><D4B4>ϸ').AsString;
|
|
|
frm_rp_op_ttl.Caption:='ҵ<><D2B5>ͳ<EFBFBD><CDB3>:'+FieldByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').AsString;
|
|
|
|
|
|
|
|
|
memtbl.Post;
|
|
|
Next;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
frm_sys_progress.close;
|
|
|
frm_sys_progress:=nil;
|
|
|
memtbl.EnableControls; //mtbl.IndexName:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;<3B><><EFBFBD><EFBFBD>';
|
|
|
memtbl.Refresh;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
}
|
|
|
|
|
|
procedure Tfrm_rp_op_ttl.bsSkinButton4Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_op_ttl.bsSkinButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
with SaveDialog do
|
|
|
begin
|
|
|
DefaultExt :='xls';
|
|
|
Filter := '(*.xls)|*.xls';
|
|
|
FileName := '<27>ۺ<EFBFBD>ͳ<EFBFBD><CDB3>.xls';
|
|
|
if Execute then
|
|
|
dxDBGrid2.SaveToXLS(FileName,true);
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
function Tfrm_rp_op_ttl.GetsubMblprofit(mblno:string):double;
|
|
|
var connstr:string;
|
|
|
selsubComp:string;
|
|
|
begin
|
|
|
Result:=0;
|
|
|
connstr:='';
|
|
|
with frm_data_share.t_code_subcomp do
|
|
|
begin
|
|
|
open;First;
|
|
|
while not eof do
|
|
|
begin
|
|
|
connstr:=frm_data_share.t_code_subcomp.FieldByName('<27><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
selsubComp:=frm_data_share.t_code_subcomp.FieldByName('<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
if (connstr<>'') and (selsubComp<>subComp) then
|
|
|
begin
|
|
|
try
|
|
|
ADOQuerysum.Close;
|
|
|
dbsub.Close;
|
|
|
dbsub.ConnectionString:=connstr;
|
|
|
dbsub.Close;
|
|
|
dbsub.Open;
|
|
|
except
|
|
|
on E: Exception do
|
|
|
begin
|
|
|
ShowMessage(e.Message);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
with ADOQuerysum do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select');
|
|
|
SQL.Add('sum(ë<><C3AB><EFBFBD><EFBFBD>) ë<><C3AB><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('from v_op_bscard');
|
|
|
SQL.Add('where <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>=:<3A><><EFBFBD>ᵥ<EFBFBD><E1B5A5> and <20><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>''');
|
|
|
Parameters.ParamByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').Value:=mblno;
|
|
|
Open;First;
|
|
|
//ShowMessage(FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsString+''+connstr+#13#10+frm_main.db.ConnectionString);
|
|
|
Result:=Result+FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
end;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
|
|
|
{
|
|
|
function Tfrm_rp_op_ttl.GetsubMblprofit(mblno:string):double;
|
|
|
var connstr:string;
|
|
|
selsubComp:string;
|
|
|
begin
|
|
|
Result:=0;
|
|
|
connstr:='';
|
|
|
begin
|
|
|
with frm_data_share.t_code_subcomp do
|
|
|
begin
|
|
|
open;First;
|
|
|
while not eof do
|
|
|
begin
|
|
|
connstr:=frm_data_share.t_code_subcomp.FieldByName('<27><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
selsubComp:=frm_data_share.t_code_subcomp.FieldByName('<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>').AsString;
|
|
|
if (subComp='<27>ൺ<EFBFBD>۽<EFBFBD>') then
|
|
|
begin
|
|
|
if selsubComp<>'<27>ൺ<EFBFBD>۽<EFBFBD>' then
|
|
|
begin
|
|
|
if (connstr<>'') then
|
|
|
begin
|
|
|
try
|
|
|
ADOQuerysum.Close;
|
|
|
dbsub.Close;
|
|
|
dbsub.ConnectionString:=connstr;
|
|
|
dbsub.Close;
|
|
|
dbsub.Open;
|
|
|
except
|
|
|
on E: Exception do
|
|
|
begin
|
|
|
ShowMessage(e.Message);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
with ADOQuerysum do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select');
|
|
|
SQL.Add('sum(ë<><C3AB><EFBFBD><EFBFBD>) ë<><C3AB><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('from v_op_bscard');
|
|
|
SQL.Add('where <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>=:<3A><><EFBFBD>ᵥ<EFBFBD><E1B5A5> and <20><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>''');
|
|
|
Parameters.ParamByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').Value:=mblno;
|
|
|
Open;First;
|
|
|
//ShowMessage(FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsString+''+connstr+#13#10+frm_main.db.ConnectionString);
|
|
|
Result:=Result+FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
end
|
|
|
else
|
|
|
if subComp<>selsubComp then
|
|
|
begin
|
|
|
if (connstr<>'') then
|
|
|
begin
|
|
|
try
|
|
|
ADOQuerysum.Close;
|
|
|
dbsub.Close;
|
|
|
dbsub.ConnectionString:=connstr;
|
|
|
dbsub.Close;
|
|
|
dbsub.Open;
|
|
|
except
|
|
|
on E: Exception do
|
|
|
begin
|
|
|
ShowMessage(e.Message);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
with ADOQuerysum do
|
|
|
begin
|
|
|
Close;SQL.Clear;
|
|
|
SQL.Add('Select');
|
|
|
SQL.Add('sum(ë<><C3AB><EFBFBD><EFBFBD>) ë<><C3AB><EFBFBD><EFBFBD>');
|
|
|
SQL.Add('from v_op_bscard');
|
|
|
SQL.Add('where <20><><EFBFBD>ᵥ<EFBFBD><E1B5A5>=:<3A><><EFBFBD>ᵥ<EFBFBD><E1B5A5> and <20><><EFBFBD><EFBFBD>״̬=''<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>''');
|
|
|
Parameters.ParamByName('<27><><EFBFBD>ᵥ<EFBFBD><E1B5A5>').Value:=mblno;
|
|
|
Open;First;
|
|
|
//ShowMessage(FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsString+''+connstr+#13#10+frm_main.db.ConnectionString);
|
|
|
Result:=Result+FieldByName('ë<><C3AB><EFBFBD><EFBFBD>').AsFloat;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
Next;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_op_ttl.bsSkinButton3Click(Sender: TObject);
|
|
|
begin
|
|
|
sys_print('<27>ۺ<EFBFBD>ͳ<EFBFBD><CDB3>',2,nil,nil,nil,nil,memtbl1,nil,nil,nil,nil,nil,nil);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end.
|