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.

203 lines
5.3 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_fen_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;
type
Tfrm_rp_fen_total = class(TForm)
Panel1: TPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox4: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox5: TbsSkinCheckRadioBox;
XPMenu1: TXPMenu;
PopupMenu1: TPopupMenu;
N3: TMenuItem;
N2: TMenuItem;
N1: TMenuItem;
bsSkinPanel3: TbsSkinPanel;
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
wwDBComboBox1: TwwDBComboBox;
p_client: TADOStoredProc;
p_total: TADOStoredProc;
p_client1: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
Panel2: TPanel;
DBChart1: TDBChart;
LineSeries2: TBarSeries;
DBChart2: TDBChart;
BarSeries1: TBarSeries;
SaveDialog1: TSaveDialog;
bsSkinButton1: TbsSkinButton;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton9Click(Sender: TObject);
procedure Panel1Resize(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure bsSkinCheckRadioBox1Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_fen_total: Tfrm_rp_fen_total;
fen_total_str:widestring;
implementation
uses u_main, u_sys_progress, u_rp_query;
{$R *.dfm}
procedure Tfrm_rp_fen_total.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_fen_total.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_fen_total.Hide;
frm_rp_fen_total.ManualFloat(frm_rp_fen_total.BoundsRect );
frm_main.freeTabs('frm_rp_fen_total');
action:=cafree;
frm_rp_fen_total:=nil;
end;
procedure Tfrm_rp_fen_total.bsSkinButton9Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height));
PopupMenu1.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_rp_fen_total.Panel1Resize(Sender: TObject);
var
i:integer;
begin
i:=round((Panel1.Height-24)/2);
DBChart1.Height:=i;
i:=round((bsSkinPanel2.Width-bsSkinPanel3.Width)/9);
bsSkinCheckRadioBox1.Width:=i;
bsSkinCheckRadioBox2.Width:=i;
bsSkinCheckRadioBox3.Width:=i;
bsSkinCheckRadioBox4.Width:=i;
bsSkinCheckRadioBox5.Width:=i;
bsSkinButton10.Width:=i;
bsSkinButton9.Width:=i;
bsSkinButton1.Width:=i;
wwDBComboBox1.ItemIndex:=0;
end;
procedure Tfrm_rp_fen_total.N3Click(Sender: TObject);
begin
chartpreview(frm_rp_fen_total,dbchart1);
end;
procedure Tfrm_rp_fen_total.N1Click(Sender: TObject);
begin
chartpreview(frm_rp_fen_total,dbchart2);
end;
procedure Tfrm_rp_fen_total.bsSkinCheckRadioBox1Click(Sender: TObject);
var
str,paixu:string;
i:integer;
begin
try
i:=strtoint(Edit1.text);
if i<1 then
begin
showmessage('<27><><EFBFBD>α<EFBFBD><CEB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD>');
exit;
end;
except
showmessage('<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD><CEA3><EFBFBD>');
exit;
end;
if wwDBComboBox1.ItemIndex=-1 then
begin
showmessage('<27><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>');
exit;
end;
if wwDBComboBox1.ItemIndex=0 then
paixu:='desc'
else
paixu:='';
if fen_total_str='' then
exit;
if bsSkinCheckRadioBox1.Checked then
str:=bsSkinCheckRadioBox1.Caption;
if bsSkinCheckRadioBox2.Checked then
str:=bsSkinCheckRadioBox2.Caption;
if bsSkinCheckRadioBox3.Checked then
str:=bsSkinCheckRadioBox3.Caption;
if bsSkinCheckRadioBox4.Checked then
str:=bsSkinCheckRadioBox4.Caption;
if bsSkinCheckRadioBox5.Checked then
str:=bsSkinCheckRadioBox5.Caption;
p_client.close;
p_client.Parameters.ParamByName('SQLStr').value:=
'SELECT top '
+Edit1.text+' sum(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>'
+',v_op_no.'+str+' as <20><>׼'
+' FROM v_op_no left JOIN t_op_gain ON '
+'v_op_no.<2E><><EFBFBD><EFBFBD> =t_op_gain.<2E><><EFBFBD><EFBFBD> '
+fen_total_str
+' group by v_op_no.'+str
+' order by sum(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>) '+paixu;
p_client.Open;
p_total.close;
p_total.Parameters.ParamByName('SQLStr').value:=
'SELECT sum(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>'
+',v_op_no.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> as <20><>׼'
+' FROM v_op_no left JOIN t_op_gain ON '
+'v_op_no.<2E><><EFBFBD><EFBFBD> =t_op_gain.<2E><><EFBFBD><EFBFBD> '
+fen_total_str
+' group by v_op_no.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
p_total.Open;
end;
procedure Tfrm_rp_fen_total.bsSkinButton10Click(Sender: TObject);
begin
try
frm_rp_query:=tfrm_rp_query.Create (self);
rp_query_limited:='0037';
rp_query_bs:=4;
frm_rp_query.ShowModal;
finally
frm_rp_query.Free;
end;
frm_rp_fen_total.bsSkinCheckRadioBox1Click(Sender);
end;
procedure Tfrm_rp_fen_total.bsSkinButton1Click(Sender: TObject);
begin
if SaveDialog1.Execute then
frm_rp_fen_total.GetFormImage.SaveToFile(SaveDialog1.FileName+'.bmp');
end;
end.