unit u_rp_zou_seae; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, ComCtrls, bsSkinTabs, bsSkinCtrls, DB, ADODB, TeEngine, Series, TeeProcs, Chart, DbChart, XPMenu, Menus,teeprevi, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner, dxDBTLCl, dxGrClms, ExtDlgs; type Tfrm_rp_zou_seae = class(TForm) Panel1: TPanel; p_lirun11: TADOStoredProc; PopupMenu1: TPopupMenu; N11: TMenuItem; N4: TMenuItem; N5: TMenuItem; XPMenu1: TXPMenu; N1: TMenuItem; N2: TMenuItem; bsSkinPanel2: TbsSkinPanel; bsSkinButton10: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; bsSkinCheckRadioBox2: TbsSkinCheckRadioBox; Panel2: TPanel; dxDBGrid1: TdxDBGrid; p_lirun1: TDataSource; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridColumn; dxDBGrid1TEU: TdxDBGridColumn; dxDBGrid1Column4: TdxDBGridColumn; bsSkinButton1: TbsSkinButton; SaveDialog1: TSaveDialog; p_lirun: TADOQuery; p_lirunDSDesigner: TStringField; p_lirunDSDesigner2: TBCDField; p_lirunDSDesigner3: TIntegerField; Chart1: TChart; Chart2: TChart; Chart3: TChart; p_lirunTEU: TBCDField; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure N11Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure Panel2Resize(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinPanel2Resize(Sender: TObject); private procedure getlrchart; procedure getxlchart; procedure getpshchart; { Private declarations } public { Public declarations } end; var frm_rp_zou_seae: Tfrm_rp_zou_seae; implementation uses u_main, my_sys_function; {$R *.dfm} procedure Tfrm_rp_zou_seae.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_rp_zou_seae.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_rp_zou_seae.Hide; frm_rp_zou_seae.ManualFloat(frm_rp_zou_seae.BoundsRect ); frm_main.freeTabs('frm_rp_zou_seae'); action:=cafree; frm_rp_zou_seae:=nil; end; procedure Tfrm_rp_zou_seae.bsSkinButton10Click(Sender: TObject); begin query_seae(7,'0037'); getlrchart; getpshchart; getxlchart; // DBChart3.RefreshData; end; procedure Tfrm_rp_zou_seae.bsSkinButton9Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height)); PopupMenu1.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_rp_zou_seae.N11Click(Sender: TObject); begin chartpreview(frm_rp_zou_seae,chart2); end; procedure Tfrm_rp_zou_seae.N5Click(Sender: TObject); begin chartpreview(frm_rp_zou_seae,chart1); end; procedure Tfrm_rp_zou_seae.N2Click(Sender: TObject); begin chartpreview(frm_rp_zou_seae,chart3); end; procedure Tfrm_rp_zou_seae.Panel2Resize(Sender: TObject); var i:integer; begin i:=round((Panel2.Height)/3); Chart3.Height:=i; Chart2.Height:=i; end; procedure Tfrm_rp_zou_seae.bsSkinButton1Click(Sender: TObject); begin if SaveDialog1.Execute then frm_rp_zou_seae.GetFormImage.SaveToFile(SaveDialog1.FileName+'.bmp'); end; procedure Tfrm_rp_zou_seae.bsSkinPanel2Resize(Sender: TObject); var i:integer; begin i:=round(bsSkinPanel2.width/6); bsSkinCheckRadioBox2.width:=i; bsSkinCheckRadioBox1.width:=i; bsSkinButton10.width:=i; bsSkinButton9.width:=i; bsSkinButton1.width:=i; end; procedure Tfrm_rp_zou_seae.getlrchart; var barse:TBarSeries; lbarse:TlineSeries; begin if p_lirun.IsEmpty then exit; Chart3.SeriesList.Clear; if p_lirun.Recordset.RecordCount=1 then begin p_lirun.First; barse:=TBarSeries.Create(self); while not p_lirun.Eof do begin barse.Add(p_lirun.fieldbyname('毛利润').AsFloat,p_lirun.fieldbyname('月份').Asstring); p_lirun.Next; end; Chart3.AddSeries(barse); end else begin p_lirun.First; lbarse:=TLineSeries.Create(self); while not p_lirun.Eof do begin lbarse.Add(p_lirun.fieldbyname('毛利润').AsFloat,p_lirun.fieldbyname('月份').Asstring); p_lirun.Next; end; Chart3.AddSeries(lbarse); end; // barse.Add(0,''); Chart3.Repaint; end; procedure Tfrm_rp_zou_seae.getpshchart; var barse:TBarSeries; lbarse:TlineSeries; begin if p_lirun.IsEmpty then exit; Chart1.SeriesList.Clear; if p_lirun.Recordset.RecordCount=1 then begin p_lirun.First; barse:=TBarSeries.Create(self); while not p_lirun.Eof do begin barse.Add(p_lirun.fieldbyname('票数').AsFloat,p_lirun.fieldbyname('月份').Asstring); p_lirun.Next; end; Chart1.AddSeries(barse); end else begin p_lirun.First; lbarse:=TLineSeries.Create(self); while not p_lirun.Eof do begin lbarse.Add(p_lirun.fieldbyname('票数').AsFloat,p_lirun.fieldbyname('月份').Asstring); p_lirun.Next; end; Chart1.AddSeries(lbarse); end; // barse.Add(0,''); Chart1.Repaint; end; procedure Tfrm_rp_zou_seae.getxlchart; var barse:TBarSeries; lbarse:TlineSeries; begin if p_lirun.IsEmpty then exit; Chart2.SeriesList.Clear; if p_lirun.Recordset.RecordCount=1 then begin p_lirun.First; barse:=TBarSeries.Create(self); while not p_lirun.Eof do begin barse.Add(p_lirun.fieldbyname('箱TEU').AsFloat,p_lirun.fieldbyname('月份').Asstring); p_lirun.Next; end; Chart2.AddSeries(barse); end else begin p_lirun.First; lbarse:=TLineSeries.Create(self); while not p_lirun.Eof do begin lbarse.Add(p_lirun.fieldbyname('箱TEU').AsFloat,p_lirun.fieldbyname('月份').Asstring); p_lirun.Next; end; Chart2.AddSeries(lbarse); end; // barse.Add(0,''); Chart2.Repaint; end; end.