You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

346 lines
9.9 KiB
Plaintext

11 months ago
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]='<27><><EFBFBD><EFBFBD><EBB7A2>') then
AColor :=clwhite
else if (ANode.strings[dxDBGrid1Column2.Index]='<27><EFBFBD><E1BDBB><EFBFBD><EFBFBD>') then
AColor :=clyellow
else if (ANode.strings[dxDBGrid1Column2.Index]='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>')then
AColor :=clred
else if (ANode.strings[dxDBGrid1Column2.Index]='ȷ<>Ϸ<EFBFBD><CFB7><EFBFBD>') 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:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end;
procedure Tfrm_op_cnt_remind.N4Click(Sender: TObject);
var
afield : variant;
i: Integer;
begin
if t_op_ctn_remind.IsEmpty then
begin
showmessage('û<>и<EFBFBD><D0B8><EFBFBD>ĸ<EFBFBD><EFBFBD><E5A3AC><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>');
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<>'<27><><EFBFBD><EFBFBD>')
and (t_op_ctn_remind.fields[i].FieldName<>'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
t_op_ctn_remind.fields[i].value := afield[i] ;
end;
// Notebook1.PageIndex:=1;
//bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
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('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring=''then
begin
t_op_ctn_remind['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=get_no(t_op_ctn_remind.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').AsDateTime,'WH');
t_op_ctn_remind['<27><><EFBFBD><EFBFBD>']:=get_id;
end;
t_op_ctn_remind['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_ctn_remind['<27><><EFBFBD><EFBFBD>'];
t_op_ctn_remind['ҵ<><D2B5>״̬']:='<27><><EFBFBD><EFBFBD>ί<EFBFBD><CEAF>';
t_op_ctn_remind['<27><><EFBFBD><EFBFBD>״̬']:='¼<><C2BC>״̬';
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['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=date;
t_op_ctn_remind['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_op_ctn_remind['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_ctn_remind['<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>']:=subComp;
t_op_ctn_remind['<27><><EFBFBD><EFBFBD>Ա']:=employee;
end;
procedure Tfrm_op_cnt_remind.bsSkinButton8Click(Sender: TObject);
begin
frm_main.view_momo(t_op_ctn_remind1,'<27><><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_op_cnt_remind.bsSkinButton4Click(Sender: TObject);
begin
if t_op_ctn_remind.IsEmpty then
exit;
// if t_op_ctn_remind.fieldbyname('<27><><EFBFBD><EFBFBD>״̬').asstring='ȷ<>Ϸ<EFBFBD><CFB7><EFBFBD>' then
// exit;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',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.<2E><><EFBFBD><EFBFBD>','ģ<><C4A3>',Edit1.text);
str:=query_tiaojian(1,str,'t_op_ctn_remind.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>','<27><><EFBFBD><EFBFBD>',wwDBDateTimePicker18.text);
str:=query_tiaojian(1,str,'t_op_ctn_remind.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>','С<><D0A1>',wwDBDateTimePicker19.text);
str:='select * from t_op_ctn_remind where <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 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('û<>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>');
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.