unit u_code_state; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, BusinessSkinForm, bsSkinCtrls, dxExEdtr, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxDBGrid, dxCntner, bsColorCtrls, StdCtrls, Dialogs, ExtCtrls, Grids, Wwdbigrd, Wwdbgrid, wwdblook; type Tfrm_code_state = class(TForm) bsSkinColorDialog1: TColorDialog; Panel1: TPanel; Panel5: TPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridButtonColumn; dxDBGrid1Column7: TdxDBGridCheckColumn; dxDBGrid1Column4: TdxDBGridColumn; RadioGroup1: TbsSkinRadioGroup; Panel3: TPanel; Panel4: TPanel; bsSkinButton6: TbsSkinButton; bsSkinButton7: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton5: TbsSkinButton; dxDBGrid2: TdxDBGrid; bsSkinPanel3: TbsSkinPanel; bsSkinPanel4: TbsSkinPanel; bsSkinButton15: TbsSkinButton; bsSkinButton16: TbsSkinButton; dxDBGrid3: TdxDBGrid; dxDBGrid2Column1: TdxDBGridMaskColumn; dxDBGrid2Column2: TdxDBGridMaskColumn; dxDBGrid2Column3: TdxDBGridDateColumn; dxDBGrid3Column1: TdxDBGridMaskColumn; dxDBGrid3Column2: TdxDBGridColumn; dxDBGrid2Column4: TdxDBGridColumn; procedure FormShow(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure dxDBGrid1Column2ButtonClick(Sender: TObject; AbsoluteIndex: Integer); procedure dxDBGrid1Column2CustomDraw(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 bsSkinButton6Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure RadioGroup1Click(Sender: TObject); procedure Panel4Resize(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton15Click(Sender: TObject); procedure bsSkinButton16Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_code_state: Tfrm_code_state; implementation uses u_data_share, my_sys_function, u_main; {$R *.dfm} procedure Tfrm_code_state.FormShow(Sender: TObject); begin frm_data_share.t_code_state.Filtered:=false; frm_data_share.t_code_state.requery; frm_data_share.t_code_state.Filter:='业务种类='+''''+'海运出口'+''''; frm_data_share.t_code_state.Filtered:=true; frm_data_share.t_code_state_project.Filtered:=false; frm_data_share.t_code_state_project.requery; frm_data_share.t_code_state_project.Filter:='业务种类='+''''+'海运出口'+''''; frm_data_share.t_code_state_project.Filtered:=true; end; procedure Tfrm_code_state.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(frm_data_share.t_code_state); end; procedure Tfrm_code_state.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_code_state.bsSkinButton3Click(Sender: TObject); begin table_cancel(frm_data_share.t_code_state); end; procedure Tfrm_code_state.bsSkinButton2Click(Sender: TObject); begin table_post(frm_data_share.t_code_state); end; procedure Tfrm_code_state.bsSkinButton4Click(Sender: TObject); begin table_delete(frm_data_share.t_code_state); end; procedure Tfrm_code_state.bsSkinButton1Click(Sender: TObject); begin frm_data_share.t_code_state.Insert; end; procedure Tfrm_code_state.dxDBGrid1Column2ButtonClick(Sender: TObject; AbsoluteIndex: Integer); begin if bsSkinColorDialog1.Execute then begin frm_data_share.t_code_state.edit; frm_data_share.t_code_state['颜色']:=ColorToString(bsSkinColorDialog1.Color); end; end; procedure Tfrm_code_state.dxDBGrid1Column2CustomDraw(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 ANode.strings[dxDBGrid1Column2.Index]<>'' then begin try AColor:=StringToColor(ANode.strings[dxDBGrid1Column2.Index]); finally AFont.Color:=clblack; end; end; end; procedure Tfrm_code_state.bsSkinButton6Click(Sender: TObject); begin frm_data_share.t_code_state_project.Insert; end; procedure Tfrm_code_state.bsSkinButton7Click(Sender: TObject); begin table_post(frm_data_share.t_code_state_project); end; procedure Tfrm_code_state.bsSkinButton8Click(Sender: TObject); begin table_delete(frm_data_share.t_code_state_project); end; procedure Tfrm_code_state.bsSkinButton9Click(Sender: TObject); begin table_cancel(frm_data_share.t_code_state_project); end; procedure Tfrm_code_state.RadioGroup1Click(Sender: TObject); begin case RadioGroup1.ItemIndex of 0: begin frm_data_share.t_code_state.Filtered:=false; frm_data_share.t_code_state.requery; frm_data_share.t_code_state.Filter:='业务种类='+''''+'海运出口'+''''; frm_data_share.t_code_state.Filtered:=true; frm_data_share.t_code_state_project.Filtered:=false; frm_data_share.t_code_state_project.requery; frm_data_share.t_code_state_project.Filter:='业务种类='+''''+'海运出口'+''''; frm_data_share.t_code_state_project.Filtered:=true; end; 1: begin frm_data_share.t_code_state.Filtered:=false; frm_data_share.t_code_state.requery; frm_data_share.t_code_state.Filter:='业务种类='+''''+'海运进口'+''''; frm_data_share.t_code_state.Filtered:=true; frm_data_share.t_code_state_project.Filtered:=false; frm_data_share.t_code_state_project.requery; frm_data_share.t_code_state_project.Filter:='业务种类='+''''+'海运进口'+''''; frm_data_share.t_code_state_project.Filtered:=true; end; 2: begin frm_data_share.t_code_state.Filtered:=false; frm_data_share.t_code_state.requery; frm_data_share.t_code_state.Filter:='业务种类='+''''+'空运出口'+''''; frm_data_share.t_code_state.Filtered:=true; frm_data_share.t_code_state_project.Filtered:=false; frm_data_share.t_code_state_project.requery; frm_data_share.t_code_state_project.Filter:='业务种类='+''''+'空运出口'+''''; frm_data_share.t_code_state_project.Filtered:=true; end; 3: begin frm_data_share.t_code_state.Filtered:=false; frm_data_share.t_code_state.requery; frm_data_share.t_code_state.Filter:='业务种类='+''''+'空运进口'+''''; frm_data_share.t_code_state.Filtered:=true; frm_data_share.t_code_state_project.Filtered:=false; frm_data_share.t_code_state_project.requery; frm_data_share.t_code_state_project.Filter:='业务种类='+''''+'空运进口'+''''; frm_data_share.t_code_state_project.Filtered:=true; end; 4: begin frm_data_share.t_code_state.Filtered:=false; frm_data_share.t_code_state.requery; frm_data_share.t_code_state.Filter:='业务种类='+''''+'监管车'+''''; frm_data_share.t_code_state.Filtered:=true; frm_data_share.t_code_state_project.Filtered:=false; frm_data_share.t_code_state_project.requery; frm_data_share.t_code_state_project.Filter:='业务种类='+''''+'监管车'+''''; frm_data_share.t_code_state_project.Filtered:=true; end; 5: begin frm_data_share.t_code_state.Filtered:=false; frm_data_share.t_code_state.requery; frm_data_share.t_code_state.Filter:='业务种类='+''''+'铁路运输'+''''; frm_data_share.t_code_state.Filtered:=true; frm_data_share.t_code_state_project.Filtered:=false; frm_data_share.t_code_state_project.requery; frm_data_share.t_code_state_project.Filter:='业务种类='+''''+'铁路运输'+''''; frm_data_share.t_code_state_project.Filtered:=true; end; end; end; procedure Tfrm_code_state.Panel4Resize(Sender: TObject); var i:integer; begin i:=round(Panel4.Width/5); bsSkinButton6.Width:=i; bsSkinButton7.Width:=i; bsSkinButton8.Width:=i; bsSkinButton9.Width:=i; end; procedure Tfrm_code_state.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_code_state.Hide; frm_code_state.ManualFloat(frm_code_state.BoundsRect ); frm_main.freeTabs('frm_code_state'); action:=cafree; frm_code_state:=nil; end; procedure Tfrm_code_state.bsSkinButton15Click(Sender: TObject); begin if frm_data_share.t_code_state_project.IsEmpty then exit; if frm_data_share.t_code_state.IsEmpty then exit; frm_data_share.t_code_state_project_de.insert; frm_data_share.t_code_state_project_de['状态名称']:=frm_data_share.t_code_state['业务状态']; frm_data_share.t_code_state_project_de['顺序']:=frm_data_share.t_code_state['顺序']; frm_data_share.t_code_state_project_de.post; end; procedure Tfrm_code_state.bsSkinButton16Click(Sender: TObject); begin table_delete(frm_data_share.t_code_state_project_de); end; end.