unit u_op_cnt_remind; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms, StdCtrls, Mask, DBCtrls, wwdbdatetimepicker, ComCtrls, bsSkinTabs, RxLookup, Menus, XPMenu, wwdbedit, Wwdotdot, Wwdbcomb, cxTextEdit, cxDBEdit, cxControls, cxContainer, cxEdit, cxLabel, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, wwdblook, DBCtrlsEh,DateUtils, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxDBData, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxGridCustomView, cxGrid, cxCalendar, cxMemo, cxCurrencyEdit, cxNavigator, cxTimeEdit; type Tfrm_op_cnt_remind = class(TForm) Panel2: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; Notebook1: TNotebook; dxDBGrid1: TdxDBGrid; bsSkinButton19: TbsSkinButton; XPMenu1: TXPMenu; PopupMenu3: TPopupMenu; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; t_op_ctn_remind: TADOQuery; t_op_ctn_remind1: TDataSource; Label18: TLabel; bsSkinPanel9: TbsSkinPanel; Label116: TLabel; Edit1: TEdit; bsSkinButton44: TbsSkinButton; Label210: TLabel; wwDBDateTimePicker18: TwwDBDateTimePicker; wwDBDateTimePicker19: TwwDBDateTimePicker; dxDBGrid1Column3: TdxDBGridDateColumn; dxDBGrid1Column4: TdxDBGridDateColumn; dxDBGrid1Column5: TdxDBGridDateColumn; dxDBGrid1Column6: TdxDBGridDateColumn; dxDBGrid1Column2: TdxDBGridDateColumn; dxDBGrid1Column7: TdxDBGridColumn; procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure Panel2Resize(Sender: TObject); 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 N2Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure t_op_ctn_remindBeforePost(DataSet: TDataSet); procedure bsSkinButton2Click(Sender: TObject); procedure t_op_ctn_remindAfterInsert(DataSet: TDataSet); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton44Click(Sender: TObject); procedure dxDBGrid1Column4CustomDraw(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 dxDBGrid1Column6CustomDraw(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_op_cnt_remind: Tfrm_op_cnt_remind; implementation uses u_main, u_data_share, my_sys_function, u_code_send_address, u_op_kuaidi_query, my_sys_chat; {$R *.dfm} procedure Tfrm_op_cnt_remind.bsSkinButton1Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_cnt_remind.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_cnt_remind.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_cnt_remind.Hide; frm_op_cnt_remind.ManualFloat(frm_op_cnt_remind.BoundsRect); frm_main.freeTabs('frm_op_cnt_remind'); action:=cafree; frm_op_cnt_remind:=nil; end; procedure Tfrm_op_cnt_remind.FormShow(Sender: TObject); begin t_op_ctn_remind.Close; t_op_ctn_remind.open; Notebook1.PageIndex:=0; loadreggrid(dxdbgrid1,false,caption); end; procedure Tfrm_op_cnt_remind.Panel2Resize(Sender: TObject); var i:integer; begin i:=round(Panel2.Width/10); bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton9.Width:=i; bsSkinButton1.Width:=i; bsSkinButton11.Width:=i; bsSkinButton2.Width:=i; bsSkinButton4.Width:=i; bsSkinButton3.Width:=i; bsSkinButton19.Width:=i; end; procedure Tfrm_op_cnt_remind.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 AColor :=clwhite else if (ANode.strings[dxDBGrid1Column2.Index]='提交申请') then AColor :=clyellow else if (ANode.strings[dxDBGrid1Column2.Index]='驳回申请')then AColor :=clred else if (ANode.strings[dxDBGrid1Column2.Index]='确认发出') then AColor :=$00DDF21C; AFont.Color:=clblack; end; procedure Tfrm_op_cnt_remind.N2Click(Sender: TObject); begin t_op_ctn_remind.insert; Notebook1.PageIndex:=0; // bsSkinButton11.Caption:='返回列表'; end; procedure Tfrm_op_cnt_remind.N4Click(Sender: TObject); var afield : variant; i: Integer; begin if t_op_ctn_remind.IsEmpty then begin showmessage('没有复制母体,不能复制新建!'); exit; end; afield := vararraycreate([0,t_op_ctn_remind.fieldcount-1],varvariant); for i := 0 to (t_op_ctn_remind.fieldcount-1) do begin afield[i] :=t_op_ctn_remind.fields[i].value ; end; t_op_ctn_remind.append; for i := 0 to (t_op_ctn_remind.fieldcount-1) do begin if (t_op_ctn_remind.fields[i].FieldName<>'编号') and (t_op_ctn_remind.fields[i].FieldName<>'业务编号') then t_op_ctn_remind.fields[i].value := afield[i] ; end; // Notebook1.PageIndex:=1; //bsSkinButton11.Caption:='返回列表'; end; procedure Tfrm_op_cnt_remind.t_op_ctn_remindBeforePost(DataSet: TDataSet); begin if t_op_ctn_remind.State=dsinsert then begin if t_op_ctn_remind.fieldbyname('业务编号').asstring=''then begin t_op_ctn_remind['业务编号']:=get_no(t_op_ctn_remind.fieldbyname('会计期间').AsDateTime,'WH'); t_op_ctn_remind['编号']:=get_id; end; t_op_ctn_remind['主编号']:=t_op_ctn_remind['编号']; t_op_ctn_remind['业务状态']:='接受委托'; t_op_ctn_remind['费用状态']:='录入状态'; end; end; procedure Tfrm_op_cnt_remind.bsSkinButton2Click(Sender: TObject); begin table_post(t_op_ctn_remind); end; procedure Tfrm_op_cnt_remind.t_op_ctn_remindAfterInsert(DataSet: TDataSet); begin t_op_ctn_remind['会计期间']:=date; t_op_ctn_remind['录入人']:=employee; t_op_ctn_remind['录入日期']:=date; t_op_ctn_remind['分部名称']:=subComp; t_op_ctn_remind['操作员']:=employee; end; procedure Tfrm_op_cnt_remind.bsSkinButton8Click(Sender: TObject); begin frm_main.view_momo(t_op_ctn_remind1,'进口货物名称'); end; procedure Tfrm_op_cnt_remind.bsSkinButton4Click(Sender: TObject); begin if t_op_ctn_remind.IsEmpty then exit; // if t_op_ctn_remind.fieldbyname('申请状态').asstring='确认发出' then // exit; if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)<>IDOK then exit; t_op_ctn_remind.delete; end; procedure Tfrm_op_cnt_remind.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_cnt_remind.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_cnt_remind.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,212); end; procedure Tfrm_op_cnt_remind.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_cnt_remind.bsSkinButton3Click(Sender: TObject); begin if t_op_ctn_remind=nil then exit; if (t_op_ctn_remind.State=dsinsert)or(t_op_ctn_remind.State=dsedit) then t_op_ctn_remind.cancel; end; procedure Tfrm_op_cnt_remind.bsSkinButton44Click(Sender: TObject); var str:widestring; begin str:=''; str:=query_tiaojian(1,str,'t_op_ctn_remind.箱号','模糊',Edit1.text); str:=query_tiaojian(1,str,'t_op_ctn_remind.会计期间','大于',wwDBDateTimePicker18.text); str:=query_tiaojian(1,str,'t_op_ctn_remind.会计期间','小于',wwDBDateTimePicker19.text); str:='select * from t_op_ctn_remind where 编号 in (select 主编号 from t_op_ctn_remind ' +str+')'; t_op_ctn_remind.close; t_op_ctn_remind.sql.clear; t_op_ctn_remind.sql.add(str); t_op_ctn_remind.Open; if t_op_ctn_remind.IsEmpty then begin showmessage('没有检索出所需数据!!'); exit; end; end; procedure Tfrm_op_cnt_remind.dxDBGrid1Column4CustomDraw(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 Trim(ANode.Strings[dxDBGrid1Column4.Index])<>'' then begin if StrToDate(ANode.Strings[dxDBGrid1Column4.Index])+30>Date then AColor:=clred; AFont.Color:=clblack; end; end; procedure Tfrm_op_cnt_remind.dxDBGrid1Column6CustomDraw(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 Trim(ANode.Strings[dxDBGrid1Column6.Index])<>'' then begin if StrToDate(ANode.Strings[dxDBGrid1Column6.Index])+30>Date then AColor:=clred; AFont.Color:=clblack; end; end; end.