unit u_rp_fen_seae; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, RxMemDS, bsSkinCtrls, TeEngine, Series, TeeProcs, Chart, DbChart, DB, ADODB, Menus, XPMenu, ExtCtrls,teeprevi, StdCtrls, Dialogs, ExtDlgs, Mask, wwdbedit, Wwdotdot, Wwdbcomb, dxExEdtr, dxTL, dxDBCtrl, dxDBGrid, dxCntner; type Tfrm_rp_fen_seae = class(TForm) Panel1: TPanel; bsSkinPanel2: TbsSkinPanel; p_client: TADOStoredProc; 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; Edit1: TEdit; Label2: TLabel; DBChart1: TDBChart; LineSeries2: TBarSeries; wwDBComboBox1: TwwDBComboBox; p_client1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridColumn; dxDBGrid1Column2: TdxDBGridColumn; bsSkinCheckRadioBox10: TbsSkinCheckRadioBox; bsSkinCheckRadioBox9: TbsSkinCheckRadioBox; bsSkinButton1: TbsSkinButton; SaveDialog1: TSaveDialog; dxDBGrid1Column3: TdxDBGridColumn; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure Panel1Resize(Sender: TObject); procedure bsSkinCheckRadioBox1Click(Sender: TObject); procedure bsSkinPanel1Resize(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_rp_fen_seae: Tfrm_rp_fen_seae; fen_seae_str:widestring; implementation uses u_main, my_sys_function, u_sys_progress; {$R *.dfm} procedure Tfrm_rp_fen_seae.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_rp_fen_seae.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_rp_fen_seae.Hide; frm_rp_fen_seae.ManualFloat(frm_rp_fen_seae.BoundsRect ); frm_main.freeTabs('frm_rp_fen_seae'); action:=cafree; frm_rp_fen_seae:=nil; end; procedure Tfrm_rp_fen_seae.bsSkinButton9Click(Sender: TObject); begin chartpreview(frm_rp_fen_seae,dbchart1); end; procedure Tfrm_rp_fen_seae.bsSkinButton10Click(Sender: TObject); VAR i:integer; begin try i:=strtoint(Edit1.text); if i<1 then begin showmessage('名次必须大于0!!'); exit; end; except showmessage('请正确输入名次!!'); exit; end; query_seae(8,'0037'); frm_rp_fen_seae.bsSkinCheckRadioBox1Click(Sender); end; procedure Tfrm_rp_fen_seae.Panel1Resize(Sender: TObject); var i:integer; begin i:=round(bsSkinPanel2.Width/8); bsSkinCheckRadioBox1.Width:=i; bsSkinCheckRadioBox2.Width:=i; bsSkinCheckRadioBox3.Width:=i; bsSkinCheckRadioBox4.Width:=i; bsSkinCheckRadioBox5.Width:=i; bsSkinCheckRadioBox6.Width:=i; bsSkinCheckRadioBox7.Width:=i; bsSkinCheckRadioBox8.Width:=i; end; procedure Tfrm_rp_fen_seae.bsSkinCheckRadioBox1Click(Sender: TObject); var str,tongji,paixu:string; i:integer; begin try i:=strtoint(Edit1.text); if i<1 then begin showmessage('名次必须大于0!!'); exit; end; except showmessage('请正确输入名次!!'); exit; end; if wwDBComboBox1.ItemIndex=-1 then begin showmessage('请正确排序方式!!'); exit; end; if wwDBComboBox1.ItemIndex=0 then paixu:='desc' else paixu:=''; if fen_seae_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; if bsSkinCheckRadioBox6.Checked then str:=bsSkinCheckRadioBox6.Caption; if bsSkinCheckRadioBox7.Checked then str:=bsSkinCheckRadioBox7.Caption; if bsSkinCheckRadioBox8.Checked then str:=bsSkinCheckRadioBox8.Caption; if bsSkinCheckRadioBox9.checked then begin tongji:='t_op_gain_main.毛利润'; DBChart1.Title.Text.Clear; DBChart1.Title.Text.add('出口业务应得毛利润前'+edit1.text+'名'); end else begin tongji:='t_op_seae.箱TEU'; DBChart1.Title.Text.Clear; DBChart1.Title.Text.add('出口业务箱TEU前'+edit1.text+'名'); end; if (str='委托单位') then begin p_client.close; p_client.Parameters.ParamByName('SQLStr').value:= 'SELECT top ' +Edit1.text+' sum('+tongji+') as 数量' +',t_op_seae.'+str+' as 标准,t_crm_client_class.客户等级' +' FROM t_op_seae inner JOIN t_op_gain_main ON ' +'t_op_seae.编号 =t_op_gain_main.编号 ' +' left join t_crm_client_class on t_op_seae.委托单位=t_crm_client_class.客户简称 and t_crm_client_class.开始日期<=t_op_seae.预抵日期 and t_op_seae.预抵日期<=t_crm_client_class.结束日期 and t_crm_client_class.状态=''审核'' ' +fen_seae_str +' group by t_op_seae.'+str+',t_crm_client_class.客户等级' +' order by sum('+tongji+') '+paixu; p_client.Open; end else begin p_client.close; p_client.Parameters.ParamByName('SQLStr').value:= 'SELECT top ' +Edit1.text+' sum('+tongji+') as 数量' +',t_op_seae.'+str+' as 标准' +' FROM t_op_seae inner JOIN t_op_gain_main ON ' +'t_op_seae.编号 =t_op_gain_main.编号 ' +fen_seae_str +' group by t_op_seae.'+str +' order by sum('+tongji+') '+paixu; p_client.Open; end; end; procedure Tfrm_rp_fen_seae.bsSkinPanel1Resize(Sender: TObject); var i:integer; begin i:=round((bsSkinPanel1.Width-bsSkinPanel3.Width)/6); bsSkinCheckRadioBox10.Width:=i; bsSkinCheckRadioBox9.Width:=i; bsSkinButton10.Width:=i; bsSkinButton9.Width:=i; bsSkinButton1.Width:=i; wwDBComboBox1.ItemIndex:=0; end; procedure Tfrm_rp_fen_seae.bsSkinButton1Click(Sender: TObject); begin if SaveDialog1.Execute then frm_rp_fen_seae.GetFormImage.SaveToFile(SaveDialog1.FileName+'.bmp'); end; end.