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.

403 lines
14 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_rp_cx_total;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, RxMemDS, DB, ADODB, Menus, XPMenu, TeEngine, Series, TeeProcs,
Chart, DbChart, bsSkinCtrls, ExtCtrls,teeprevi, Mask, wwdbedit, Wwdotdot,
Wwdbcomb, StdCtrls, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner,
ComCtrls, bsSkinTabs, dxDBTLCl, dxGrClms, kbmMemTable, wwdbdatetimepicker;
type
Tfrm_rp_cx_total = class(TForm)
XPMenu1: TXPMenu;
bsSkinPanel1: TbsSkinPanel;
memtotal: TkbmMemTable;
memtotal1: TDataSource;
memtotalField: TStringField;
memtotalField2: TFloatField;
memtotalField3: TFloatField;
memtotalField4: TFloatField;
bsSkinButton10: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinPanel2: TbsSkinPanel;
Label1: TLabel;
Label2: TLabel;
PopupMenu1: TPopupMenu;
EXCEL1: TMenuItem;
memtotalField5: TStringField;
memtotalField6: TStringField;
memtotalField7: TStringField;
memtotalField8: TStringField;
memtotalField9: TStringField;
t_op_gain_cx1: TDataSource;
t_op_gain_cx: TADOQuery;
Edit1: TEdit;
Label3: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBDateTimePicker2: TwwDBDateTimePicker;
bsSkinButton9: TbsSkinButton;
Label4: TLabel;
wwDBDateTimePicker3: TwwDBDateTimePicker;
Label5: TLabel;
wwDBDateTimePicker4: TwwDBDateTimePicker;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column64: TdxDBGridMaskColumn;
dxDBGrid1Column23: TdxDBGridColumn;
dxDBGrid1Column22: TdxDBGridColumn;
dxDBGrid1Column14: TdxDBGridMaskColumn;
dxDBGrid1Column15: TdxDBGridMaskColumn;
dxDBGrid1Column16: TdxDBGridDateColumn;
dxDBGrid1Column20: TdxDBGridColumn;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column19: TdxDBGridColumn;
dxDBGrid1Column21: TdxDBGridColumn;
dxDBGrid1Column24: TdxDBGridColumn;
dxDBGrid1Column25: TdxDBGridColumn;
dxDBGrid1Column26: TdxDBGridColumn;
dxDBGrid1Column27: TdxDBGridColumn;
dxDBGrid1Column63: TdxDBGridMaskColumn;
dxDBGrid1Column12: TdxDBGridColumn;
dxDBGrid1Column13: TdxDBGridColumn;
dxDBGrid1Column65: TdxDBGridDateColumn;
dxDBGrid1Column17: TdxDBGridColumn;
dxDBGrid1Column18: TdxDBGridColumn;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
dxDBGridMaskColumn2: TdxDBGridMaskColumn;
dxDBGridColumn1: TdxDBGridColumn;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGridMaskColumn3: TdxDBGridMaskColumn;
dxDBGridMaskColumn4: TdxDBGridMaskColumn;
dxDBGridDateColumn1: TdxDBGridDateColumn;
dxDBGridColumn3: TdxDBGridColumn;
dxDBGridColumn4: TdxDBGridColumn;
dxDBGridColumn5: TdxDBGridColumn;
dxDBGridColumn6: TdxDBGridColumn;
dxDBGridColumn7: TdxDBGridColumn;
dxDBGridColumn8: TdxDBGridColumn;
dxDBGridColumn9: TdxDBGridColumn;
dxDBGridColumn10: TdxDBGridColumn;
dxDBGridMaskColumn5: TdxDBGridMaskColumn;
dxDBGridColumn11: TdxDBGridColumn;
dxDBGridColumn12: TdxDBGridColumn;
dxDBGridDateColumn2: TdxDBGridDateColumn;
dxDBGridColumn13: TdxDBGridColumn;
dxDBGridColumn14: TdxDBGridColumn;
t_op_gain_cx21: TDataSource;
t_op_gain_cx2: TADOQuery;
PopupMenu2: TPopupMenu;
MenuItem1: TMenuItem;
bsSkinTabSheet3: TbsSkinTabSheet;
dxDBGrid3: TdxDBGrid;
dxDBGridMaskColumn6: TdxDBGridMaskColumn;
dxDBGridMaskColumn7: TdxDBGridMaskColumn;
dxDBGridColumn15: TdxDBGridColumn;
dxDBGridColumn16: TdxDBGridColumn;
dxDBGridMaskColumn8: TdxDBGridMaskColumn;
dxDBGridMaskColumn9: TdxDBGridMaskColumn;
dxDBGridDateColumn3: TdxDBGridDateColumn;
dxDBGridColumn17: TdxDBGridColumn;
dxDBGridColumn18: TdxDBGridColumn;
dxDBGridColumn19: TdxDBGridColumn;
dxDBGridColumn20: TdxDBGridColumn;
dxDBGridColumn21: TdxDBGridColumn;
dxDBGridMaskColumn10: TdxDBGridMaskColumn;
dxDBGridColumn25: TdxDBGridColumn;
dxDBGridColumn26: TdxDBGridColumn;
dxDBGridDateColumn4: TdxDBGridDateColumn;
dxDBGridColumn27: TdxDBGridColumn;
dxDBGridColumn28: TdxDBGridColumn;
t_op_gain_cx31: TDataSource;
t_op_gain_cx3: TADOQuery;
dxDBGrid3Column19: TdxDBGridColumn;
dxDBGrid3Column20: TdxDBGridColumn;
dxDBGrid3Column21: TdxDBGridColumn;
dxDBGrid3Column22: TdxDBGridColumn;
dxDBGrid3Column23: TdxDBGridColumn;
dxDBGrid3Column24: TdxDBGridColumn;
dxDBGrid1Column28: TdxDBGridColumn;
dxDBGrid2Column22: TdxDBGridColumn;
dxDBGrid3Column25: TdxDBGridColumn;
dxDBGrid3Column26: TdxDBGridColumn;
dxDBGrid3Column27: TdxDBGridColumn;
dxDBGrid3Column28: TdxDBGridColumn;
PopupMenu3: TPopupMenu;
N10: TMenuItem;
N11: TMenuItem;
N14: TMenuItem;
N13: TMenuItem;
N16: TMenuItem;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure EXCEL1Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure dxDBGrid1Column4CustomDraw(Sender: TObject; ACanvas: TCanvas;
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
AFocused: Boolean; var ADone: Boolean);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure dxDBGrid1Column24CustomDraw(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
var AColor: TColor; ASelected, AFocused: Boolean;
var ADone: Boolean);
procedure N10Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N16Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_cx_total: Tfrm_rp_cx_total;
fen_total_str:widestring;
implementation
uses my_sys_function, u_main;
{$R *.dfm}
procedure Tfrm_rp_cx_total.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_cx_total.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption);
savereggrid(dxdbgrid2,caption);
savereggrid(dxdbgrid3,caption);
frm_rp_cx_total.Hide;
frm_rp_cx_total.ManualFloat(frm_rp_cx_total.BoundsRect );
frm_main.freeTabs('frm_rp_cx_total');
action:=cafree;
frm_rp_cx_total:=nil;
end;
procedure Tfrm_rp_cx_total.FormShow(Sender: TObject);
begin
//
wwDBDateTimePicker1.Date:=Date;
wwDBDateTimePicker1.Date:=Date;
loadreggrid(dxdbgrid1,false,caption);
loadreggrid(dxdbgrid2,false,caption);
loadreggrid(dxdbgrid3,false,caption);
end;
procedure Tfrm_rp_cx_total.EXCEL1Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid1);
end;
procedure Tfrm_rp_cx_total.bsSkinButton1Click(Sender: TObject);
begin
if (bsSkinPageControl1.ActivePageIndex=1) then
grid_save_xls(dxdbgrid2)
else if (bsSkinPageControl1.ActivePageIndex=2) then
grid_save_xls(dxdbgrid3)
else grid_save_xls(dxdbgrid1);
end;
procedure Tfrm_rp_cx_total.dxDBGrid1Column4CustomDraw(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
begin
if strtofloatdef(AText,0)<0 then
AColor:=clRed;
end;
procedure Tfrm_rp_cx_total.bsSkinButton10Click(Sender: TObject);
var
str:widestring;
begin
str:=str+' where 1=1 ';
if Edit1.text<>''then
str:=str+' and a.<2E><><EFBFBD><EFBFBD><E1B5A5> like '+''''+'%'+Edit1.text+'%'+'''';
if wwDBDateTimePicker1.text<>''then
begin
str:=str+' and a.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>>='+''''+wwDBDateTimePicker1.text+'''';
end;
if wwDBDateTimePicker2.text<>''then
begin
str:=str+' and a.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><='+''''+wwDBDateTimePicker2.text+'''';
end;
if wwDBDateTimePicker3.text<>''then
begin
str:=str+' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker3.text+'''';
end;
if wwDBDateTimePicker4.text<>''then
begin
str:=str+' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker4.text+'''';
end;
t_op_gain_cx.close;
t_op_gain_cx.sql.clear;
t_op_gain_cx.sql.add('select t.*,g.<2E><><EFBFBD><EFBFBD>RMB <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RMB,g.<2E><><EFBFBD><EFBFBD>USD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD,g.ë<><C3AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>,a.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>,e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,tt.<2E><><EFBFBD><EFBFBD>RMB <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>RMB,tt.<2E><><EFBFBD><EFBFBD>USD <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>USD,tt.ë<><C3AB><EFBFBD><EFBFBD> <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>,t.<2E><>ע <20><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD> ');
t_op_gain_cx.sql.add('from t_op_gain_cx t left join t_op_gain g on (g.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_gain_cx.sql.add('left join t_op_seae a on (a.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) left join t_sys_employee e on (e.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_gain_cx.sql.add('left join (select <20><><EFBFBD><EFBFBD><E1B5A5>,sum(<28><><EFBFBD><EFBFBD>RMB) <20><><EFBFBD><EFBFBD>RMB,sum(<28><><EFBFBD><EFBFBD>USD) <20><><EFBFBD><EFBFBD>USD,sum(ë<><C3AB><EFBFBD><EFBFBD>) ë<><C3AB><EFBFBD><EFBFBD> from v_op_bscard group by <20><><EFBFBD><EFBFBD><E1B5A5>)tt on (tt.<2E><><EFBFBD><EFBFBD><E1B5A5>=t.<2E><><EFBFBD><EFBFBD><E1B5A5>) ');
t_op_gain_cx.sql.add(str);
t_op_gain_cx.sql.add(' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
t_op_gain_cx.open;
t_op_gain_cx2.close;
t_op_gain_cx2.sql.clear;
t_op_gain_cx2.sql.add('select t.*,g.<2E><><EFBFBD><EFBFBD>RMB <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RMB,g.<2E><><EFBFBD><EFBFBD>USD <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD,g.ë<><C3AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>,a.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>,case when e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (''<27><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>'',''<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD>'',''<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD>2'',''<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD>4<EFBFBD><34>'') ');
t_op_gain_cx2.sql.add('then ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' else e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> end <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,tt.<2E><><EFBFBD><EFBFBD>RMB <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>RMB,tt.<2E><><EFBFBD><EFBFBD>USD <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>USD,tt.ë<><C3AB><EFBFBD><EFBFBD> <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>,t.<2E><>ע <20><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD> ');
t_op_gain_cx2.sql.add('from t_op_gain_cx t left join t_op_gain g on (g.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_gain_cx2.sql.add('left join t_op_seae a on (a.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) left join t_sys_employee e on (e.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_gain_cx2.sql.add('left join (select <20><><EFBFBD><EFBFBD><E1B5A5>,sum(<28><><EFBFBD><EFBFBD>RMB) <20><><EFBFBD><EFBFBD>RMB,sum(<28><><EFBFBD><EFBFBD>USD) <20><><EFBFBD><EFBFBD>USD,sum(ë<><C3AB><EFBFBD><EFBFBD>) ë<><C3AB><EFBFBD><EFBFBD> from v_op_bscard group by <20><><EFBFBD><EFBFBD><E1B5A5>)tt on (tt.<2E><><EFBFBD><EFBFBD><E1B5A5>=t.<2E><><EFBFBD><EFBFBD><E1B5A5>) ');
t_op_gain_cx2.sql.add(str);
t_op_gain_cx2.sql.add(' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> not in (''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',''<27><><EFBFBD>󲻱<EFBFBD>'',''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
t_op_gain_cx2.sql.add(' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
t_op_gain_cx2.open;
t_op_gain_cx3.close;
t_op_gain_cx3.sql.clear;
t_op_gain_cx3.sql.add('select t.[LE_ID],t.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],t.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],t.[<5B><><EFBFBD><EFBFBD><E1B5A5>],t.[<5B><><EFBFBD><EFBFBD>],t.[<5B><><EFBFBD><EFBFBD>],t.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],t.[װ<><D7B0><EFBFBD><EFBFBD>],t.[ж<><D0B6><EFBFBD><EFBFBD>],t.[<5B><>װ<EFBFBD><D7B0>],t.[<5B><><EFBFBD><EFBFBD>]');
t_op_gain_cx3.sql.add(',t.[<5B>Ƿ<EFBFBD><C7B7><EFBFBD>ӡ],t.[<5B><>ע],t.[ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],t.[<5B><><EFBFBD>ĵ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],t.[<5B><><EFBFBD>ĵ<EFBFBD>ί<EFBFBD>б<EFBFBD><D0B1><EFBFBD>],t.[״̬],t.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],t.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],t.[<5B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>],t.[<5B><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>]');
t_op_gain_cx3.sql.add(',(CASE WHEN F.<2E><><EFBFBD><EFBFBD>=''<27><>'' and <20>ұ<EFBFBD>=''RMB'' then F.<2E><><EFBFBD><EFBFBD> ELSE CASE WHEN F.<2E><><EFBFBD><EFBFBD>=''<27><>'' and <20>ұ<EFBFBD>=''RMB'' then -F.<2E><><EFBFBD><EFBFBD> ELSE 0 END END ) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RMB');
t_op_gain_cx3.sql.add(',(CASE WHEN F.<2E><><EFBFBD><EFBFBD>=''<27><>'' and <20>ұ<EFBFBD>=''USD'' then F.<2E><><EFBFBD><EFBFBD> ELSE CASE WHEN F.<2E><><EFBFBD><EFBFBD>=''<27><>'' and <20>ұ<EFBFBD>=''USD'' then -F.<2E><><EFBFBD><EFBFBD> ELSE 0 END END ) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD');
t_op_gain_cx3.sql.add(',(CASE WHEN F.<2E><><EFBFBD><EFBFBD>=''<27><>'' then F.<2E><><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD> ELSE -F.<2E><><EFBFBD><EFBFBD>*<2A><><EFBFBD><EFBFBD> END ) <20><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>,t.<2E><>ע <20><><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD>');
t_op_gain_cx3.sql.add(',a.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>,case when e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> in (''<27><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>'',''<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD>'',''<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD>2'',''<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD>4<EFBFBD><34>'') ');
t_op_gain_cx3.sql.add('then ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' else e.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> end <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,f.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,f.CH_ID,f.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,(select <20><><EFBFBD><EFBFBD> from t_crm_client where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=f.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>) <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,f.<2E><><EFBFBD><EFBFBD>,f.<2E>ұ<EFBFBD>,f.<2E><><EFBFBD><EFBFBD> ');
t_op_gain_cx3.sql.add(',tt.<2E><><EFBFBD><EFBFBD>RMB <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>RMB,tt.<2E><><EFBFBD><EFBFBD>USD <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD>USD,tt.ë<><C3AB><EFBFBD><EFBFBD> <20>ϼ<EFBFBD><CFBC><EFBFBD><EFBFBD><EFBFBD> ');
t_op_gain_cx3.sql.add('from t_op_gain_cx t left join t_op_gain g on (g.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_gain_cx3.sql.add('left join t_op_seae a on (a.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) left join t_sys_employee e on (e.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_gain_cx3.sql.add('left join t_ch_fee f on (f.<2E><><EFBFBD><EFBFBD>=t.<2E><><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>) ');
t_op_gain_cx3.sql.add('left join (select <20><><EFBFBD><EFBFBD><E1B5A5>,sum(<28><><EFBFBD><EFBFBD>RMB) <20><><EFBFBD><EFBFBD>RMB,sum(<28><><EFBFBD><EFBFBD>USD) <20><><EFBFBD><EFBFBD>USD,sum(ë<><C3AB><EFBFBD><EFBFBD>) ë<><C3AB><EFBFBD><EFBFBD> from v_op_bscard group by <20><><EFBFBD><EFBFBD><E1B5A5>)tt on (tt.<2E><><EFBFBD><EFBFBD><E1B5A5>=t.<2E><><EFBFBD><EFBFBD><E1B5A5>) ');
t_op_gain_cx3.sql.add(str);
t_op_gain_cx3.sql.add(' and t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> not in (''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',''<27><><EFBFBD>󲻱<EFBFBD>'',''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'') ');
t_op_gain_cx3.sql.add(' order by <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> desc');
t_op_gain_cx3.open;
end;
procedure Tfrm_rp_cx_total.bsSkinButton9Click(Sender: TObject);
begin
sys_print('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>',2,nil,nil,nil,nil,t_op_gain_cx1,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_rp_cx_total.dxDBGrid1Column24CustomDraw(Sender: TObject;
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
var
ttllr:Double;
begin
if (Trim(ANode.Strings[dxDBGrid1Column23.Index])='<27><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>') or (Trim(ANode.Strings[dxDBGrid1Column23.Index])='<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD>') or (Trim(ANode.Strings[dxDBGrid1Column23.Index])='<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD>2') then begin
if strtofloatdef(AText,0)<=-5000 then
AColor:=clRed
else if strtofloatdef(AText,0)<=-2000 then
AColor:=clyellow;
end else begin
ttllr:=StrToFloatDef(Trim(ANode.Strings[dxDBGrid1Column27.Index]),0);
if ttllr<0 then begin
if strtofloatdef(AText,0)<=-1500 then
AColor:=clRed
else if strtofloatdef(AText,0)<=-800 then
AColor:=clyellow;
end else begin
if strtofloatdef(AText,0)<=-4000 then
AColor:=clRed
else if strtofloatdef(AText,0)<=-2000 then
AColor:=clyellow;
end;
end;
end;
procedure Tfrm_rp_cx_total.N10Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
update_grid_view_no(dxdbgrid1);
exit;
end;
if bsSkinTabSheet2.showing then
begin
update_grid_view_no(dxdbgrid2);
exit;
end;
if bsSkinTabSheet3.showing then
begin
update_grid_view_no(dxdbgrid3);
exit;
end;
end;
procedure Tfrm_rp_cx_total.N14Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
update_grid_view_all(dxdbgrid1);
exit;
end;
if bsSkinTabSheet2.showing then
begin
update_grid_view_all(dxdbgrid2);
exit;
end;
if bsSkinTabSheet3.showing then
begin
update_grid_view_all(dxdbgrid3);
exit;
end;
end;
procedure Tfrm_rp_cx_total.N16Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
grid_save_xls(dxdbgrid1);
exit;
end;
if bsSkinTabSheet2.showing then
begin
grid_save_xls(dxdbgrid2);
exit;
end;
if bsSkinTabSheet3.showing then
begin
grid_save_xls(dxdbgrid3);
exit;
end;
end;
end.