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.

329 lines
9.4 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_seae_ctn;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, DB, ADODB, dxTL, dxDBCtrl, dxDBGrid, dxCntner,
TeEngine, Series, TeeProcs, Chart, DbChart, Mask, wwdbedit, Wwdotdot,
Wwdbcomb, StdCtrls, bsSkinCtrls, ExtCtrls, wwdblook, RxLookup, ComCtrls,
bsSkinTabs,teeprevi;
type
Tfrm_rp_fen_seae_ctn = class(TForm)
Panel1: TPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox4: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox5: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox6: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox7: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox8: TbsSkinCheckRadioBox;
bsSkinPanel1: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinPanel3: TbsSkinPanel;
Label1: TLabel;
bsSkinButton1: TbsSkinButton;
p_one: TADOStoredProc;
p_one1: TDataSource;
SaveDialog1: TSaveDialog;
RxDBLookupCombo2: TRxDBLookupCombo;
bsSkinCheckRadioBox10: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox9: TbsSkinCheckRadioBox;
wwDBComboBox1: TwwDBComboBox;
Label2: TLabel;
Edit1: TEdit;
Label3: TLabel;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
DBChart1: TDBChart;
LineSeries2: TBarSeries;
Series1: TPieSeries;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
bsSkinTabSheet2: TbsSkinTabSheet;
DBChart2: TDBChart;
BarSeries1: TBarSeries;
PieSeries1: TPieSeries;
dxDBGrid2: TdxDBGrid;
p_all: TADOStoredProc;
p_all1: TDataSource;
dxDBGrid2Column1: TdxDBGridMaskColumn;
dxDBGrid21: TdxDBGridColumn;
dxDBGrid22: TdxDBGridColumn;
dxDBGrid23: TdxDBGridColumn;
dxDBGrid24: TdxDBGridColumn;
dxDBGrid25: TdxDBGridColumn;
dxDBGrid26: TdxDBGridColumn;
dxDBGrid27: TdxDBGridColumn;
dxDBGrid28: TdxDBGridColumn;
dxDBGrid29: TdxDBGridColumn;
dxDBGrid210: TdxDBGridColumn;
dxDBGrid2Column22: TdxDBGridColumn;
dxDBGrid2TEU: TdxDBGridColumn;
bsSkinCheckRadioBox11: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox12: TbsSkinCheckRadioBox;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinPanel2Resize(Sender: TObject);
procedure bsSkinCheckRadioBox1Click(Sender: TObject);
procedure bsSkinPanel1Resize(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinCheckRadioBox9Click(Sender: TObject);
procedure bsSkinCheckRadioBox10Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_fen_seae_ctn: Tfrm_rp_fen_seae_ctn;
fen_seae_ctn_str:widestring;
implementation
uses u_data_share, u_main, my_sys_function;
{$R *.dfm}
procedure Tfrm_rp_fen_seae_ctn.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_fen_seae_ctn.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_fen_seae_ctn.Hide;
frm_rp_fen_seae_ctn.ManualFloat(frm_rp_fen_seae_ctn.BoundsRect );
frm_main.freeTabs('frm_rp_fen_seae_ctn');
action:=cafree;
frm_rp_fen_seae_ctn:=nil;
end;
procedure Tfrm_rp_fen_seae_ctn.bsSkinButton10Click(Sender: TObject);
VAR
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><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>');
exit;
end;
query_seae(10,'0037');
frm_rp_fen_seae_ctn.bsSkinCheckRadioBox1Click(Sender);
end;
procedure Tfrm_rp_fen_seae_ctn.bsSkinPanel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsSkinPanel2.Width/10);
bsSkinCheckRadioBox1.Width:=i;
bsSkinCheckRadioBox2.Width:=i;
bsSkinCheckRadioBox3.Width:=i;
bsSkinCheckRadioBox4.Width:=i;
bsSkinCheckRadioBox5.Width:=i;
bsSkinCheckRadioBox6.Width:=i;
bsSkinCheckRadioBox7.Width:=i;
bsSkinCheckRadioBox8.Width:=i;
bsSkinCheckRadioBox11.Width:=i;
bsSkinCheckRadioBox12.Width:=i;
end;
procedure Tfrm_rp_fen_seae_ctn.bsSkinCheckRadioBox1Click(Sender: TObject);
var
str,paixu:string;
i:integer;
begin
if fen_seae_ctn_str='' then
exit;
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 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;
if bsSkinCheckRadioBox6.Checked then
str:=bsSkinCheckRadioBox6.Caption;
if bsSkinCheckRadioBox7.Checked then
str:=bsSkinCheckRadioBox7.Caption;
if bsSkinCheckRadioBox8.Checked then
str:=bsSkinCheckRadioBox8.Caption;
if bsSkinCheckRadioBox11.Checked then
str:=bsSkinCheckRadioBox11.Caption;
if bsSkinCheckRadioBox12.Checked then
str:=bsSkinCheckRadioBox12.Caption;
dxDBGrid1Column1.Caption:=str;
dxDBGrid2Column1.Caption:=str;
DBChart1.Title.Text.Clear;
if RxDBLookupCombo2.DisplayValue<>''then
begin
DBChart1.Title.Text.add('<27><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>'+str+RxDBLookupCombo2.DisplayValues[1]+':'+edit1.text+'<27><>');
dxDBGrid1Column2.Caption:=RxDBLookupCombo2.DisplayValues[1];
end
else
begin
DBChart1.Title.Text.add('<27><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>'+str+'<27><><EFBFBD><EFBFBD>TEU:'+edit1.text+'<27><>');
dxDBGrid1Column2.Caption:='<27><><EFBFBD><EFBFBD>TEU';
end;
DBChart2.Title.Text.Clear;
DBChart2.Title.Text.add('<27><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>'+str+'<27><><EFBFBD><EFBFBD>TEU:'+edit1.text+'<27><>');
if RxDBLookupCombo2.DisplayValue<>''then
begin
p_one.close;
p_one.Parameters.ParamByName('SQLStr').value:=
'SELECT top '
+Edit1.text+' sum(t_op_ctn.<2E><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>'
+',t_op_seae.'+str+' as <20><>׼'
+' FROM t_op_seae INNER JOIN t_op_ctn ON '
+'t_op_seae.<2E><><EFBFBD><EFBFBD>=t_op_ctn.<2E><><EFBFBD><EFBFBD> '
+fen_seae_ctn_str+' and t_op_ctn.<2E><><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo2.DisplayValues[0]+''''
+' group by t_op_seae.'+str
+' order by sum(t_op_ctn.<2E><><EFBFBD><EFBFBD>) '+paixu;
p_one.Open;
end
else
begin
p_one.close;
p_one.Parameters.ParamByName('SQLStr').value:=
'SELECT top '
+Edit1.text+' sum(<28><>TEU) as <20><><EFBFBD><EFBFBD>'
+','+str+' as <20><>׼'
+' FROM t_op_seae '
+fen_seae_ctn_str
+' group by '+str
+' order by sum(<28><>TEU) '+paixu;
p_one.Open;
end;
p_all.close;
p_all.Parameters.ParamByName('SQLStr').value:=
'SELECT top '
+Edit1.text+' sum(<28><><EFBFBD><EFBFBD>1) as <20><><EFBFBD><EFBFBD>1,sum( <20><><EFBFBD><EFBFBD>2) as <20><><EFBFBD><EFBFBD>2,'
+'sum( <20><><EFBFBD><EFBFBD>3) as <20><><EFBFBD><EFBFBD>3,sum(<28><><EFBFBD><EFBFBD>4) as <20><><EFBFBD><EFBFBD>4,sum(<28><><EFBFBD><EFBFBD>5) as <20><><EFBFBD><EFBFBD>5,'
+'sum( <20><><EFBFBD><EFBFBD>6) as <20><><EFBFBD><EFBFBD>6,sum( <20><><EFBFBD><EFBFBD>7) as <20><><EFBFBD><EFBFBD>7,'
+'sum(<28><><EFBFBD><EFBFBD>8) as <20><><EFBFBD><EFBFBD>8,sum( <20><><EFBFBD><EFBFBD>9) as <20><><EFBFBD><EFBFBD>9,sum( <20><><EFBFBD><EFBFBD>10) as <20><><EFBFBD><EFBFBD>10,'
+'sum(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,sum(<28><>TEU) as <20><>TEU '
+','+str+' as <20><>׼'
+' FROM t_op_seae '
+fen_seae_ctn_str
+' group by '+str
+' order by sum(<28><>TEU) '+paixu;
p_all.Open;
end;
procedure Tfrm_rp_fen_seae_ctn.bsSkinPanel1Resize(Sender: TObject);
var
i:integer;
begin
i:=round((bsSkinPanel1.Width-bsSkinPanel3.Width)/4);
bsSkinButton10.Width:=i;
bsSkinButton9.Width:=i;
bsSkinButton1.Width:=i;
wwDBComboBox1.ItemIndex:=0;
end;
procedure Tfrm_rp_fen_seae_ctn.bsSkinButton1Click(Sender: TObject);
begin
if SaveDialog1.Execute then
frm_rp_fen_seae_ctn.GetFormImage.SaveToFile(SaveDialog1.FileName+'.bmp');
end;
procedure Tfrm_rp_fen_seae_ctn.bsSkinButton9Click(Sender: TObject);
begin
if bsSkinTabSheet1.Showing then
chartpreview(frm_rp_fen_seae_ctn,dbchart1)
else
chartpreview(frm_rp_fen_seae_ctn,dbchart2);
end;
procedure Tfrm_rp_fen_seae_ctn.FormShow(Sender: TObject);
var
i:integer;
begin
for i:=1 to 10 do
begin
try
if trim(frm_data_share.t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>'+inttostr(i)).asstring)<>'' then
begin
if frm_data_share.t_code_ctn.locate('<27><><EFBFBD><EFBFBD>',trim(frm_data_share.t_code_ctn_de.fieldbyname('<27><><EFBFBD><EFBFBD>'+inttostr(i)).asstring),[]) then
begin
dxDBGrid2.ColumnByFieldName('<27><><EFBFBD><EFBFBD>'+inttostr(i)).Caption:=
trim(frm_data_share.t_code_ctn.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').asstring);
end;
end
else
begin
dxDBGrid2.ColumnByFieldName('<27><><EFBFBD><EFBFBD>'+inttostr(i)).Visible:=false;
end;
except
;
end;
end;
end;
procedure Tfrm_rp_fen_seae_ctn.bsSkinCheckRadioBox9Click(Sender: TObject);
begin
DBChart1.Series[0].Active:=true;
DBChart1.Series[1].Active:=false;
DBChart2.Series[0].Active:=true;
DBChart2.Series[1].Active:=false;
end;
procedure Tfrm_rp_fen_seae_ctn.bsSkinCheckRadioBox10Click(Sender: TObject);
begin
DBChart1.Series[1].Active:=true;
DBChart1.Series[0].Active:=false;
DBChart2.Series[1].Active:=true;
DBChart2.Series[0].Active:=false;
end;
end.