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.

423 lines
12 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_op_cnt_maintain;
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, Grids, Wwdbigrd, Wwdbgrid,
cxGridBandedTableView, cxGridDBBandedTableView, dxDBTL;
type
Tfrm_op_cnt_maintain = 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;
dxDBGrid1Column1: TdxDBGridMaskColumn;
bsSkinButton19: TbsSkinButton;
XPMenu1: TXPMenu;
PopupMenu3: TPopupMenu;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
t_op_ctn_tainmain: TADOQuery;
t_op_ctn_tainmain1: TDataSource;
Panel1: TPanel;
bsSkinPanel1: TbsSkinPanel;
Label1: TLabel;
Label36: TLabel;
DBEdit1: TDBEdit;
DBEdit7: TDBEdit;
Label18: TLabel;
PopupMenu2: TPopupMenu;
N10: TMenuItem;
N11: TMenuItem;
N14: TMenuItem;
N13: TMenuItem;
N12: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
dxDBGrid1Column2: TdxDBGridColumn;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
bsSkinTabSheet3: TbsSkinTabSheet;
t_op_ctn_tainmain_Item: TADOQuery;
t_op_ctn_tainmain_Item1: TDataSource;
t_op_ctn_tainmain_inspect1: TDataSource;
t_op_ctn_tainmain_inspect: TADOQuery;
t_op_ctn_tainmain_clear1: TDataSource;
t_op_ctn_tainmain_clear: TADOQuery;
bsSkinPanel9: TbsSkinPanel;
Label116: TLabel;
Edit1: TEdit;
bsSkinButton44: TbsSkinButton;
Label210: TLabel;
wwDBDateTimePicker18: TwwDBDateTimePicker;
wwDBDateTimePicker19: TwwDBDateTimePicker;
wwDBGrid1: TwwDBGrid;
wwDBGrid2: TwwDBGrid;
wwDBGrid3: TwwDBGrid;
wwDBLookupCombo3: TwwDBLookupCombo;
wwDBLookupCombo1: TwwDBLookupCombo;
wwDBLookupCombo2: TwwDBLookupCombo;
wwDBGrid4: TwwDBGrid;
cxGrid1: TcxGrid;
cxGrid1DBTableView1: TcxGridDBTableView;
cxGrid1DBTableView3: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1Level2: TcxGridLevel;
cxGrid1DBTableView1DBColumn2: TcxGridDBColumn;
cxGrid1DBTableView3DBColumn1: TcxGridDBColumn;
cxGrid1DBTableView3DBColumn2: TcxGridDBColumn;
cxGrid1DBTableView3DBColumn3: TcxGridDBColumn;
cxGrid1DBTableView1DBColumn3: TcxGridDBColumn;
cxGrid1DBTableView3DBColumn4: TcxGridDBColumn;
cxGrid1DBTableView1DBColumn4: TcxGridDBColumn;
cxGrid1DBTableView1DBColumn5: TcxGridDBColumn;
cxGrid1DBTableView1DBColumn8: TcxGridDBColumn;
cxGrid1DBTableView1DBColumn9: TcxGridDBColumn;
cxGrid1DBTableView1DBColumn10: TcxGridDBColumn;
cxGrid1DBTableView1DBColumn1: TcxGridDBColumn;
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton11Click(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_tainmainBeforePost(DataSet: TDataSet);
procedure bsSkinButton2Click(Sender: TObject);
procedure t_op_ctn_tainmainAfterInsert(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 t_op_ctn_tainmain_ItemAfterInsert(DataSet: TDataSet);
procedure t_op_ctn_tainmain_inspectAfterInsert(DataSet: TDataSet);
procedure t_op_ctn_tainmain_clearAfterInsert(DataSet: TDataSet);
procedure bsSkinButton44Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_op_cnt_maintain: Tfrm_op_cnt_maintain;
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_maintain.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_maintain.bsSkinButton11Click(Sender: TObject);
var
answer:TModalResult;
begin
if bsSkinButton11.Caption='<27><EFBFBD>޸<EFBFBD>' then
begin
if t_op_ctn_tainmain.IsEmpty then
exit;
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
end
else
begin
if (t_op_ctn_tainmain.State=dsinsert)or(t_op_ctn_tainmain.State=dsedit) then
BEGIN
answer:=messagedlg( '<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE>޸ģ<DEB8><C4A3>Ƿ񱣴棿',mtWarning,mbYesNoCancel,0);
if answer=mrYes then
begin
t_op_ctn_tainmain.post;
end;
if answer=mrNo then
begin
t_op_ctn_tainmain.cancel;
end;
if answer=mrCancel then
begin
exit;
end;
END;
Notebook1.PageIndex:=0;
bsSkinButton11.Caption:='<27><EFBFBD>޸<EFBFBD>';
end;
end;
procedure Tfrm_op_cnt_maintain.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_op_cnt_maintain.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption);
frm_op_cnt_maintain.Hide;
frm_op_cnt_maintain.ManualFloat(frm_op_cnt_maintain.BoundsRect);
frm_main.freeTabs('frm_op_cnt_maintain');
action:=cafree;
frm_op_cnt_maintain:=nil;
end;
procedure Tfrm_op_cnt_maintain.FormShow(Sender: TObject);
begin
Notebook1.PageIndex:=0;
t_op_ctn_tainmain.Close;
t_op_ctn_tainmain.open;
t_op_ctn_tainmain_Item.Close;
t_op_ctn_tainmain_Item.Open;
t_op_ctn_tainmain_inspect.Close;
t_op_ctn_tainmain_inspect.Open;
t_op_ctn_tainmain_clear.Close;
t_op_ctn_tainmain_clear.Open;
loadreggrid(dxdbgrid1,false,caption);
end;
procedure Tfrm_op_cnt_maintain.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_maintain.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_maintain.N2Click(Sender: TObject);
begin
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
t_op_ctn_tainmain.insert;
end;
procedure Tfrm_op_cnt_maintain.N4Click(Sender: TObject);
var
afield : variant;
i: Integer;
begin
Notebook1.PageIndex:=1;
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
if t_op_ctn_tainmain.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_tainmain.fieldcount-1],varvariant);
for i := 0 to (t_op_ctn_tainmain.fieldcount-1) do
begin
afield[i] :=t_op_ctn_tainmain.fields[i].value ;
end;
t_op_ctn_tainmain.append;
for i := 0 to (t_op_ctn_tainmain.fieldcount-1) do
begin
if (t_op_ctn_tainmain.fields[i].FieldName<>'<27><><EFBFBD><EFBFBD>')
and (t_op_ctn_tainmain.fields[i].FieldName<>'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
t_op_ctn_tainmain.fields[i].value := afield[i] ;
end;
end;
procedure Tfrm_op_cnt_maintain.t_op_ctn_tainmainBeforePost(DataSet: TDataSet);
begin
if t_op_ctn_tainmain.State=dsinsert then
begin
if t_op_ctn_tainmain.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring=''then
begin
t_op_ctn_tainmain['ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=get_no(t_op_ctn_tainmain.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>').AsDateTime,'WH');
t_op_ctn_tainmain['<27><><EFBFBD><EFBFBD>']:=get_id;
end;
t_op_ctn_tainmain['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_ctn_tainmain['<27><><EFBFBD><EFBFBD>'];
t_op_ctn_tainmain['ҵ<><D2B5>״̬']:='<27><><EFBFBD><EFBFBD>ί<EFBFBD><CEAF>';
t_op_ctn_tainmain['<27><><EFBFBD><EFBFBD>״̬']:='¼<><C2BC>״̬';
end;
end;
procedure Tfrm_op_cnt_maintain.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_op_ctn_tainmain);
end;
procedure Tfrm_op_cnt_maintain.t_op_ctn_tainmainAfterInsert(DataSet: TDataSet);
begin
t_op_ctn_tainmain['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=date;
t_op_ctn_tainmain['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
t_op_ctn_tainmain['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
t_op_ctn_tainmain['<27>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>']:=subComp;
t_op_ctn_tainmain['<27><><EFBFBD><EFBFBD>Ա']:=employee;
end;
procedure Tfrm_op_cnt_maintain.bsSkinButton8Click(Sender: TObject);
begin
frm_main.view_momo(t_op_ctn_tainmain1,'<27><><EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_op_cnt_maintain.bsSkinButton4Click(Sender: TObject);
begin
if t_op_ctn_tainmain.IsEmpty then
exit;
// if t_op_ctn_tainmain.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_tainmain.delete;
end;
procedure Tfrm_op_cnt_maintain.N10Click(Sender: TObject);
begin
update_grid_view_no(dxdbgrid1);
end;
procedure Tfrm_op_cnt_maintain.N14Click(Sender: TObject);
begin
update_grid_view_all(dxdbgrid1);
end;
procedure Tfrm_op_cnt_maintain.N12Click(Sender: TObject);
begin
update_grid(dxdbgrid1,212);
end;
procedure Tfrm_op_cnt_maintain.N16Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid1);
end;
procedure Tfrm_op_cnt_maintain.bsSkinButton3Click(Sender: TObject);
begin
if t_op_ctn_tainmain=nil then
exit;
if (t_op_ctn_tainmain.State=dsinsert)or(t_op_ctn_tainmain.State=dsedit) then
t_op_ctn_tainmain.cancel;
end;
procedure Tfrm_op_cnt_maintain.t_op_ctn_tainmain_ItemAfterInsert(
DataSet: TDataSet);
begin
t_op_ctn_tainmain_Item['<27><><EFBFBD><EFBFBD>']:=t_op_ctn_tainmain['<27><><EFBFBD><EFBFBD>'];
end;
procedure Tfrm_op_cnt_maintain.t_op_ctn_tainmain_inspectAfterInsert(
DataSet: TDataSet);
begin
t_op_ctn_tainmain_inspect['<27><><EFBFBD><EFBFBD>']:=t_op_ctn_tainmain['<27><><EFBFBD><EFBFBD>'];
end;
procedure Tfrm_op_cnt_maintain.t_op_ctn_tainmain_clearAfterInsert(
DataSet: TDataSet);
begin
t_op_ctn_tainmain_clear['<27><><EFBFBD><EFBFBD>']:=t_op_ctn_tainmain['<27><><EFBFBD><EFBFBD>'];
end;
procedure Tfrm_op_cnt_maintain.bsSkinButton44Click(Sender: TObject);
var
str:widestring;
begin
str:='';
str:=query_tiaojian(1,str,'t_op_ctn_tainmain.<2E><><EFBFBD><EFBFBD>','ģ<><C4A3>',Edit1.text);
str:=query_tiaojian(1,str,'t_op_ctn_tainmain.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>','<27><><EFBFBD><EFBFBD>',wwDBDateTimePicker18.text);
str:=query_tiaojian(1,str,'t_op_ctn_tainmain.<2E><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>','С<><D0A1>',wwDBDateTimePicker19.text);
str:='select * from t_op_ctn_tainmain where <20><><EFBFBD><EFBFBD> in (select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_op_ctn_tainmain '
+str+')';
t_op_ctn_tainmain.close;
t_op_ctn_tainmain.sql.clear;
t_op_ctn_tainmain.sql.add(str);
t_op_ctn_tainmain.Open;
if t_op_ctn_tainmain.IsEmpty then
begin
showmessage('û<>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>');
exit;
end;
end;
end.