|
|
|
|
unit u_crm_client_pet;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, bsSkinCtrls, StdCtrls, wwdbdatetimepicker, dxExEdtr, dxCntner,
|
|
|
|
|
dxTL, dxDBCtrl, dxDBGrid, Mask, DBCtrls, jpeg, ExtCtrls, BusinessSkinForm,
|
|
|
|
|
DB, ADODB, wwdbedit, Wwdotdot, Wwdbcomb, RxMemDS;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
Tfrm_crm_client_pet = class(TForm)
|
|
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
Label2: TLabel;
|
|
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
|
|
bsSkinPanel4: TbsSkinPanel;
|
|
|
|
|
bsSkinPanel5: TbsSkinPanel;
|
|
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
|
|
Image1: TImage;
|
|
|
|
|
Label3: TLabel;
|
|
|
|
|
Label4: TLabel;
|
|
|
|
|
Label5: TLabel;
|
|
|
|
|
Label6: TLabel;
|
|
|
|
|
DBEdit1: TDBEdit;
|
|
|
|
|
DBEdit2: TDBEdit;
|
|
|
|
|
Label7: TLabel;
|
|
|
|
|
Label8: TLabel;
|
|
|
|
|
Label9: TLabel;
|
|
|
|
|
Label10: TLabel;
|
|
|
|
|
Label11: TLabel;
|
|
|
|
|
p_client_pet: TADOStoredProc;
|
|
|
|
|
t_client_pet1: TDataSource;
|
|
|
|
|
wwDBComboBox1: TwwDBComboBox;
|
|
|
|
|
Label13: TLabel;
|
|
|
|
|
Label14: TLabel;
|
|
|
|
|
DBEdit3: TDBEdit;
|
|
|
|
|
Label15: TLabel;
|
|
|
|
|
DBEdit4: TDBEdit;
|
|
|
|
|
DBEdit5: TDBEdit;
|
|
|
|
|
Label16: TLabel;
|
|
|
|
|
t_client_pet: TRxMemoryData;
|
|
|
|
|
dxDBGrid1Column1: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column2: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column3: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column4: TdxDBGridMaskColumn;
|
|
|
|
|
dxDBGrid1Column5: TdxDBGridMaskColumn;
|
|
|
|
|
Label17: TLabel;
|
|
|
|
|
DBEdit6: TDBEdit;
|
|
|
|
|
dxDBGrid1Column6: TdxDBGridColumn;
|
|
|
|
|
Memo1: TMemo;
|
|
|
|
|
procedure bsSkinPanel2Resize(Sender: TObject);
|
|
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
|
|
function get_client_pet():string;
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
|
|
procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
procedure wwDBComboBox1KeyPress(Sender: TObject; var Key: Char);
|
|
|
|
|
private
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
public
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frm_crm_client_pet: Tfrm_crm_client_pet;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses u_main, u_data_share, my_sys_function;
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
function Tfrm_crm_client_pet.get_client_pet():string;
|
|
|
|
|
begin
|
|
|
|
|
if p_client_pet.FieldByName('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat>=
|
|
|
|
|
frm_data_share.t_code_client_parameter.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat then
|
|
|
|
|
begin
|
|
|
|
|
if p_client_pet.FieldByName('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat>=
|
|
|
|
|
(frm_data_share.t_code_client_parameter.FieldByName('<27><><EFBFBD><D7BC><EFBFBD><EFBFBD>').asfloat
|
|
|
|
|
+frm_data_share.t_code_client_parameter.FieldByName('<27>ϲ<EFBFBD><CFB2><EFBFBD>').asfloat) then
|
|
|
|
|
begin
|
|
|
|
|
result:='<27><>ë<EFBFBD><C3AB>';
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
if p_client_pet.FieldByName('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat>=
|
|
|
|
|
(frm_data_share.t_code_client_parameter.FieldByName('<27><><EFBFBD><D7BC><EFBFBD><EFBFBD>').asfloat
|
|
|
|
|
-frm_data_share.t_code_client_parameter.FieldByName('<27>ϲ<EFBFBD><CFB2><EFBFBD>').asfloat) then
|
|
|
|
|
result:='<27><>'
|
|
|
|
|
else
|
|
|
|
|
result:='<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
if p_client_pet.FieldByName('ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asfloat>=
|
|
|
|
|
frm_data_share.t_code_client_parameter.FieldByName('<27><><EFBFBD><D7BC><EFBFBD><EFBFBD>').asfloat then
|
|
|
|
|
begin
|
|
|
|
|
result:='è';
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
result:='<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_crm_client_pet.bsSkinPanel2Resize(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
i:integer;
|
|
|
|
|
begin
|
|
|
|
|
i:=round((bsSkinPanel2.Width-bsSkinPanel3.Width)/5);
|
|
|
|
|
bsSkinCheckRadioBox2.Width:=i;
|
|
|
|
|
bsSkinCheckRadioBox1.Width:=i;
|
|
|
|
|
bsSkinButton10.Width:=i;
|
|
|
|
|
bsSkinButton9.Width:=i;
|
|
|
|
|
bsSkinButton5.Width:=i;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_crm_client_pet.FormClose(Sender: TObject;
|
|
|
|
|
var Action: TCloseAction);
|
|
|
|
|
begin
|
|
|
|
|
frm_crm_client_pet.Hide;
|
|
|
|
|
frm_crm_client_pet.ManualFloat(frm_crm_client_pet.BoundsRect );
|
|
|
|
|
frm_main.freeTabs('frm_crm_client_pet');
|
|
|
|
|
action:=cafree;
|
|
|
|
|
frm_crm_client_pet:=nil;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_crm_client_pet.bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_crm_client_pet.bsSkinButton10Click(Sender: TObject);
|
|
|
|
|
var
|
|
|
|
|
str:widestring;
|
|
|
|
|
i:real;
|
|
|
|
|
begin
|
|
|
|
|
if (wwDBDateTimePicker1.text='')or(wwDBDateTimePicker2.text='') then
|
|
|
|
|
begin
|
|
|
|
|
showmessage('<27>뽫<EFBFBD><EBBDAB>ʼ<EFBFBD><CABC><EFBFBD>ںͽ<DABA>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
i:=wwDBDateTimePicker2.date-wwDBDateTimePicker1.date;
|
|
|
|
|
i:=i/30;
|
|
|
|
|
|
|
|
|
|
str:='SELECT v_op_no.ί<>е<EFBFBD>λ, AVG(v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) AS ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
|
|
+'AVG(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>) AS ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,sum(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>/'+floattostr(i)+') AS ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
|
|
+'AVG(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD> / v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) AS ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
|
|
+'FROM v_op_no INNER JOIN '
|
|
|
|
|
+'t_op_gain ON v_op_no.<2E><><EFBFBD><EFBFBD> = t_op_gain.<2E><><EFBFBD><EFBFBD> '
|
|
|
|
|
+'where (v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <> 0)';
|
|
|
|
|
str:=str+' and '+open_data('8003','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no');
|
|
|
|
|
if bsSkinCheckRadioBox2.Checked then
|
|
|
|
|
begin
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker1.text+'''';
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker2.text+'''';
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker1.text+'''';
|
|
|
|
|
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker2.text+'''';
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if wwDBComboBox1.text<>''then
|
|
|
|
|
str:=str+' and ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+wwDBComboBox1.text+'''';
|
|
|
|
|
|
|
|
|
|
str:=str+' GROUP BY v_op_no.ί<>е<EFBFBD>λ';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
p_client_pet.close;
|
|
|
|
|
p_client_pet.Parameters.ParamByName('SQLStr').Value:=str;
|
|
|
|
|
p_client_pet.open;
|
|
|
|
|
|
|
|
|
|
p_client_pet.first;
|
|
|
|
|
t_client_pet.close;
|
|
|
|
|
t_client_pet.open;
|
|
|
|
|
while not p_client_pet.eof do
|
|
|
|
|
begin
|
|
|
|
|
t_client_pet.insert;
|
|
|
|
|
t_client_pet['<27><><EFBFBD><EFBFBD>']:=frm_crm_client_pet.get_client_pet();
|
|
|
|
|
t_client_pet['ί<>е<EFBFBD>λ']:=p_client_pet['ί<>е<EFBFBD>λ'];
|
|
|
|
|
t_client_pet['ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=p_client_pet['ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
|
|
t_client_pet['ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=p_client_pet['ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
|
|
t_client_pet['ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=p_client_pet['ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
|
|
t_client_pet['ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=p_client_pet['ƽ<><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
|
|
|
|
|
t_client_pet.post;
|
|
|
|
|
|
|
|
|
|
p_client_pet.next;
|
|
|
|
|
end;
|
|
|
|
|
dxDBGrid1.FullExpand;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_crm_client_pet.FormShow(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
wwDBDateTimePicker1.date:=date-30;
|
|
|
|
|
wwDBDateTimePicker2.date:=date;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_crm_client_pet.bsSkinButton9Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
sys_print('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',2,nil,nil,nil,nil,t_client_pet1,nil,nil,nil,nil,nil,nil);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_crm_client_pet.wwDBDateTimePicker1KeyPress(Sender: TObject;
|
|
|
|
|
var Key: Char);
|
|
|
|
|
begin
|
|
|
|
|
key_wwDBDateTimePicker(Key,wwDBDateTimePicker2);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_crm_client_pet.wwDBDateTimePicker2KeyPress(Sender: TObject;
|
|
|
|
|
var Key: Char);
|
|
|
|
|
begin
|
|
|
|
|
key_wwDBComboBox(Key,wwDBComboBox1);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_crm_client_pet.wwDBComboBox1KeyPress(Sender: TObject;
|
|
|
|
|
var Key: Char);
|
|
|
|
|
begin
|
|
|
|
|
if key=#13 then
|
|
|
|
|
begin
|
|
|
|
|
key:=#0;
|
|
|
|
|
frm_crm_client_pet.bsSkinButton10Click(Sender);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|