unit u_info_plan_manage; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, dxDBGrid, dxTL, dxDBCtrl, dxCntner, StdCtrls, ComCtrls, DBCtrls, Mask, bsSkinCtrls, DB, ADODB, bsdbctrls, dxDBTLCl, dxGrClms, ExtCtrls, wwmonthcalendar, wwdbedit, Wwdotdot, Wwdbcomb,DateUtils, RxLookup, wwdbdatetimepicker, bsSkinTabs; type Tfrm_info_plan_manage = class(TForm) bsSkinPanel1: TbsSkinPanel; bsSkinPanel2: TbsSkinPanel; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; DBEdit1: TDBEdit; DBEdit2: TDBEdit; DBEdit3: TDBEdit; DBEdit4: TDBEdit; DBEdit5: TDBEdit; Notebook1: TbsSkinNotebook; bsSkinPanel3: TbsSkinPanel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label17: TLabel; DBEdit6: TDBEdit; DBEdit13: TDBEdit; DBEdit14: TDBEdit; wwDBComboBox1: TwwDBComboBox; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; bsSkinGroupBox2: TbsSkinGroupBox; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; bsSkinCheckRadioBox2: TbsSkinCheckRadioBox; bsSkinCheckRadioBox3: TbsSkinCheckRadioBox; bsSkinCheckRadioBox4: TbsSkinCheckRadioBox; bsSkinCheckRadioBox7: TbsSkinCheckRadioBox; bsSkinCheckRadioBox6: TbsSkinCheckRadioBox; bsSkinCheckRadioBox5: TbsSkinCheckRadioBox; bsSkinPanel4: TbsSkinPanel; Label9: TLabel; Label10: TLabel; Label11: TLabel; Label16: TLabel; DBEdit7: TDBEdit; DBEdit8: TDBEdit; DBEdit12: TDBEdit; wwDBComboBox2: TwwDBComboBox; bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox; wwDBMonthCalendar2: TwwDBMonthCalendar; bsSkinPanel5: TbsSkinPanel; Label12: TLabel; Label13: TLabel; Label14: TLabel; Label15: TLabel; DBEdit9: TDBEdit; wwDBComboBox3: TwwDBComboBox; DBEdit10: TDBEdit; bsSkinDBCheckRadioBox3: TbsSkinDBCheckRadioBox; DBEdit11: TDBEdit; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridDateColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridColumn; dxDBGrid1Column10: TdxDBGridColumn; Panel1: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton11: TbsSkinButton; t_info_plan: TADOQuery; t_info_plan1: TDataSource; t_info_plan_detail1: TDataSource; t_info_plan_detail: TADOQuery; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinPanel6: TbsSkinPanel; t_crm_client_link: TADOQuery; t_crm_client_link1: TDataSource; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; DBMemo1: TDBMemo; bsSkinTabSheet2: TbsSkinTabSheet; DBMemo4: TDBMemo; bsSkinTabSheet3: TbsSkinTabSheet; bsSkinPanel7: TbsSkinPanel; Label55: TLabel; Label18: TLabel; Label57: TLabel; Label58: TLabel; Label54: TLabel; Label56: TLabel; Label60: TLabel; Label61: TLabel; DBEdit49: TDBEdit; wwDBDateTimePicker5: TwwDBDateTimePicker; RxDBLookupCombo2: TRxDBLookupCombo; DBEdit46: TDBEdit; wwDBComboBox4: TwwDBComboBox; DBEdit47: TDBEdit; RxDBLookupCombo8: TRxDBLookupCombo; wwDBComboBox5: TwwDBComboBox; bsSkinGroupBox1: TbsSkinGroupBox; DBMemo5: TDBMemo; bsSkinPanel8: TbsSkinPanel; bsSkinPageControl2: TbsSkinPageControl; bsSkinTabSheet4: TbsSkinTabSheet; DBMemo2: TDBMemo; bsSkinTabSheet5: TbsSkinTabSheet; DBMemo6: TDBMemo; bsSkinTabSheet6: TbsSkinTabSheet; bsSkinPanel9: TbsSkinPanel; Label19: TLabel; Label20: TLabel; Label21: TLabel; Label22: TLabel; Label23: TLabel; Label24: TLabel; Label25: TLabel; Label26: TLabel; DBEdit15: TDBEdit; wwDBDateTimePicker1: TwwDBDateTimePicker; RxDBLookupCombo1: TRxDBLookupCombo; DBEdit16: TDBEdit; wwDBComboBox6: TwwDBComboBox; DBEdit17: TDBEdit; RxDBLookupCombo3: TRxDBLookupCombo; wwDBComboBox7: TwwDBComboBox; bsSkinGroupBox3: TbsSkinGroupBox; DBMemo7: TDBMemo; bsSkinPanel10: TbsSkinPanel; bsSkinPageControl3: TbsSkinPageControl; bsSkinTabSheet7: TbsSkinTabSheet; DBMemo3: TDBMemo; bsSkinTabSheet8: TbsSkinTabSheet; DBMemo8: TDBMemo; bsSkinTabSheet9: TbsSkinTabSheet; bsSkinPanel11: TbsSkinPanel; Label27: TLabel; Label28: TLabel; Label29: TLabel; Label30: TLabel; Label31: TLabel; Label32: TLabel; Label33: TLabel; Label34: TLabel; DBEdit18: TDBEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; RxDBLookupCombo4: TRxDBLookupCombo; DBEdit19: TDBEdit; wwDBComboBox8: TwwDBComboBox; DBEdit20: TDBEdit; RxDBLookupCombo5: TRxDBLookupCombo; wwDBComboBox9: TwwDBComboBox; bsSkinGroupBox4: TbsSkinGroupBox; DBMemo9: TDBMemo; procedure bsSkinButton5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton10Click(Sender: TObject); procedure Panel1Resize(Sender: TObject); procedure t_info_planAfterScroll(DataSet: TDataSet); procedure bsSkinCheckRadioBox1Click(Sender: TObject); procedure bsSkinCheckRadioBox2Click(Sender: TObject); procedure bsSkinCheckRadioBox3Click(Sender: TObject); procedure bsSkinCheckRadioBox4Click(Sender: TObject); procedure bsSkinCheckRadioBox5Click(Sender: TObject); procedure bsSkinCheckRadioBox6Click(Sender: TObject); procedure bsSkinCheckRadioBox7Click(Sender: TObject); procedure wwDBMonthCalendar2Change(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure dxDBGrid1Column1CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); private { Private declarations } public { Public declarations } end; var frm_info_plan_manage: Tfrm_info_plan_manage; implementation uses u_main, u_info_plan_query, my_sys_function; {$R *.dfm} procedure Tfrm_info_plan_manage.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_info_plan_manage.FormShow(Sender: TObject); begin t_info_plan.Close; t_info_plan.sql.clear; t_info_plan.sql.add('select * from t_info_plan where ' +open_data('9001','录入人','no','no','no','no') +' and 计划状态 in ('+''''+'提交审核'+''''+','+''''+'审核通过'+''''+')' +' order by 录入日期'); t_info_plan.open; t_info_plan_detail.open; t_crm_client_link.open; end; procedure Tfrm_info_plan_manage.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_info_plan_manage.Hide; frm_info_plan_manage.ManualFloat(frm_info_plan_manage.BoundsRect ); frm_main.freeTabs('frm_info_plan_manage'); action:=cafree; frm_info_plan_manage:=nil; end; procedure Tfrm_info_plan_manage.bsSkinButton10Click(Sender: TObject); begin try frm_info_plan_query:=tfrm_info_plan_query.Create (self); frm_info_plan_query.Hint:='1'; frm_info_plan_query.ShowModal; finally frm_info_plan_query.Free; end; end; procedure Tfrm_info_plan_manage.Panel1Resize(Sender: TObject); var i:integer; begin i:=round(panel1.Width/8); bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton9.Width:=i; bsSkinButton11.Width:=i; bsSkinButton2.Width:=i; bsSkinButton1.Width:=i; bsSkinButton10.Width:=i; end; procedure Tfrm_info_plan_manage.t_info_planAfterScroll(DataSet: TDataSet); begin if t_info_plan['计划类型']='' then Notebook1.Visible:=false else Notebook1.Visible:=true; if t_info_plan['计划类型']='天计划' then begin Notebook1.PageIndex:=0; end; if t_info_plan['计划类型']='周计划' then begin Notebook1.PageIndex:=1; bsSkinCheckRadioBox1.Checked:=true; end; if t_info_plan['计划类型']='月计划' then begin Notebook1.PageIndex:=2; wwDBMonthCalendar2.Date:= strtodate(t_info_plan.fieldbyname('年').asstring+'-' +copy(t_info_plan.fieldbyname('计划周期').asstring,1, pos('月',t_info_plan.fieldbyname('计划周期').asstring)-1)+'-'+'01'); end; end; procedure Tfrm_info_plan_manage.bsSkinCheckRadioBox1Click(Sender: TObject); begin if t_info_plan_detail.IsEmpty then exit; t_info_plan_detail.First; end; procedure Tfrm_info_plan_manage.bsSkinCheckRadioBox2Click(Sender: TObject); begin if t_info_plan_detail.IsEmpty then exit; t_info_plan_detail.First; t_info_plan_detail.Next; end; procedure Tfrm_info_plan_manage.bsSkinCheckRadioBox3Click(Sender: TObject); begin if t_info_plan_detail.IsEmpty then exit; t_info_plan_detail.First; t_info_plan_detail.Next; t_info_plan_detail.Next; end; procedure Tfrm_info_plan_manage.bsSkinCheckRadioBox4Click(Sender: TObject); begin if t_info_plan_detail.IsEmpty then exit; t_info_plan_detail.First; t_info_plan_detail.Next; t_info_plan_detail.Next; t_info_plan_detail.Next; end; procedure Tfrm_info_plan_manage.bsSkinCheckRadioBox5Click(Sender: TObject); begin if t_info_plan_detail.IsEmpty then exit; t_info_plan_detail.First; t_info_plan_detail.Next; t_info_plan_detail.Next; t_info_plan_detail.Next; t_info_plan_detail.Next; end; procedure Tfrm_info_plan_manage.bsSkinCheckRadioBox6Click(Sender: TObject); begin if t_info_plan_detail.IsEmpty then exit; t_info_plan_detail.First; t_info_plan_detail.Next; t_info_plan_detail.Next; t_info_plan_detail.Next; t_info_plan_detail.Next; t_info_plan_detail.Next; end; procedure Tfrm_info_plan_manage.bsSkinCheckRadioBox7Click(Sender: TObject); begin if t_info_plan_detail.IsEmpty then exit; t_info_plan_detail.last; end; procedure Tfrm_info_plan_manage.wwDBMonthCalendar2Change(Sender: TObject); var i,j:integer; begin if t_info_plan_detail.IsEmpty then exit; if (round(yearof(wwDBMonthCalendar2.date))<>strtoint(t_info_plan.FieldByName('年').AsString)) or (round(monthof(wwDBMonthCalendar2.date))<>strtoint(copy(t_info_plan.fieldbyname('计划周期').asstring,1, pos('月',t_info_plan.fieldbyname('计划周期').asstring)-1))) then begin showmessage('输入的日期超出计划范围!!'); wwDBMonthCalendar2.Date:= strtodate(t_info_plan.fieldbyname('年').asstring+'-' +copy(t_info_plan.fieldbyname('计划周期').asstring,1, pos('月',t_info_plan.fieldbyname('计划周期').asstring)-1)+'-'+'01'); exit; end; t_info_plan_detail.First; j:=round(wwDBMonthCalendar2.Date-strtodate(t_info_plan.fieldbyname('年').asstring+'-' +copy(t_info_plan.fieldbyname('计划周期').asstring,1, pos('月',t_info_plan.fieldbyname('计划周期').asstring)-1)+'-'+'01')); if j>1 then begin for i:=0 to j-2 do begin t_info_plan_detail.Next; end; end; end; procedure Tfrm_info_plan_manage.bsSkinButton9Click(Sender: TObject); begin if (not if_open('019')) then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if t_info_plan.IsEmpty then exit; if t_info_plan.FieldByName('计划状态').asstring<>'提交审核' then begin showmessage('计划当前状态不能审核!!'); exit; end; try t_info_plan.Edit; t_info_plan['计划状态']:='审核通过'; t_info_plan['审核人']:=employee; t_info_plan['审核日期']:=date; t_info_plan.post; finally ; end; end; procedure Tfrm_info_plan_manage.bsSkinButton11Click(Sender: TObject); begin if (not if_open('213')) then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; if t_info_plan.IsEmpty then exit; if (t_info_plan.FieldByName('计划状态').asstring<>'提交审核') and(t_info_plan.FieldByName('计划状态').asstring<>'审核通过') then begin showmessage('计划当前状态不能审核!!'); exit; end; try t_info_plan.Edit; if (t_info_plan.FieldByName('计划状态').asstring='提交审核') then begin t_info_plan['计划状态']:='复核通过'; t_info_plan['审核人']:=employee; t_info_plan['审核日期']:=date; t_info_plan['复核人']:=employee; t_info_plan['复核日期']:=date; end; if (t_info_plan.FieldByName('计划状态').asstring='审核通过') then begin t_info_plan['计划状态']:='复核通过'; t_info_plan['复核人']:=employee; t_info_plan['复核日期']:=date; end; t_info_plan.post; finally ; end; end; procedure Tfrm_info_plan_manage.bsSkinButton2Click(Sender: TObject); begin t_info_plan.close; t_info_plan.sql.clear; t_info_plan.SQL.add('select * from t_info_plan where ' +open_data('9001','录入人','no','no','no','no')+ ' and 计划状态='+''''+'提交审核'+'''' +' order by 录入日期'); t_info_plan.open; end; procedure Tfrm_info_plan_manage.bsSkinButton1Click(Sender: TObject); begin t_info_plan.close; t_info_plan.sql.clear; t_info_plan.SQL.add('select * from t_info_plan where ' +open_data('9001','录入人','no','no','no','no')+ ' and 计划状态 in('+''''+'提交审核'+'''' +','+''''+'审核通过'+''''+')'+' order by 录入日期'); t_info_plan.open; end; procedure Tfrm_info_plan_manage.dxDBGrid1Column1CustomDraw(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[dxDBGrid1Column1.Index]='录入状态' then AColor:=clWhite; if ANode.Strings[dxDBGrid1Column1.Index]='提交审核' then AColor:=$0080FFFF; if ANode.Strings[dxDBGrid1Column1.Index]='审核通过' then AColor:=$0000FF80; if ANode.Strings[dxDBGrid1Column1.Index]='复核通过' then AColor:=clAqua; AFont.Color:=clblack; end; end.