222 lines
5.4 KiB
ObjectPascal
222 lines
5.4 KiB
ObjectPascal
unit U_GYSSelList;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, StdCtrls, ExtCtrls, ComCtrls, ToolWin, cxStyles, cxCustomData,
|
||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxClasses,
|
||
cxControls, cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
||
cxGridDBTableView, cxGrid, DBClient, cxCheckBox, cxCalendar, cxSplitter,
|
||
RM_Dataset, RM_System, RM_Common, RM_Class, RM_GridReport, RM_e_Xls,
|
||
Menus, cxButtonEdit, cxDropDownEdit;
|
||
|
||
type
|
||
TfrmGYSSelList = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
Tv1: TcxGridDBTableView;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
cxGrid1: TcxGrid;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ADOQueryTemp: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Order_Main: TClientDataSet;
|
||
ToolButton1: TToolButton;
|
||
Panel1: TPanel;
|
||
Label9: TLabel;
|
||
KHNameJC: TEdit;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column6: TcxGridDBColumn;
|
||
Label2: TLabel;
|
||
KHCode: TEdit;
|
||
v1Column1: TcxGridDBColumn;
|
||
Label34: TLabel;
|
||
v1Column7: TcxGridDBColumn;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
KHType: TEdit;
|
||
v1Column4: TcxGridDBColumn;
|
||
Label1: TLabel;
|
||
TJKHName: TEdit;
|
||
PopupMenu1: TPopupMenu;
|
||
N2: TMenuItem;
|
||
N1: TMenuItem;
|
||
TBFind: TToolButton;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBFindClick(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure CheckBox1Click(Sender: TObject);
|
||
procedure CheckBox2Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure CustomerNoNameChange(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
private
|
||
canshu1:string;
|
||
DQdate:TDateTime;
|
||
procedure InitGrid();
|
||
procedure InitForm();
|
||
function DelData():Boolean;
|
||
{ Private declarations }
|
||
public
|
||
FFInt,FCloth:Integer;
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmGYSSelList: TfrmGYSSelList;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_RTFun,U_ZDYHelp, U_GYSInPutTab, U_ZDYHelpSel;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmGYSSelList.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmGYSSelList:=nil;
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.FormCreate(Sender: TObject);
|
||
begin
|
||
cxgrid1.Align:=alClient;
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('<27><>Ӧ<EFBFBD>̵Ǽ<CCB5>',Tv1,'<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
||
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.InitGrid();
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* ');
|
||
sql.Add(' from ZH_KH_Info A ');
|
||
sql.Add(' where Type=''GYS'' ');
|
||
sql.Add(' and Valid=''Y'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TfrmGYSSelList.InitForm();
|
||
begin
|
||
ReadCxGrid('<27><>Ӧ<EFBFBD>̵Ǽ<CCB5>',Tv1,'<27><>Ӧ<EFBFBD>̹<EFBFBD><CCB9><EFBFBD>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.TBFindClick(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active=False then Exit;
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
end;
|
||
|
||
function TfrmGYSSelList.DelData():Boolean;
|
||
begin
|
||
try
|
||
Result:=false;
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update ZH_KH_Info Set Valid=''N'' where ZKId='''+Trim(Order_Main.fieldbyname('ZKId').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Result:=False;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.FormShow(Sender: TObject);
|
||
begin
|
||
InitForm();
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.CheckBox1Click(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.CheckBox2Click(Sender: TObject);
|
||
begin
|
||
TBRafresh.Click;
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.CustomerNoNameChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active=False then Exit;
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,Order_Main);
|
||
SInitCDSData20(ADOQueryMain,Order_Main);
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Main,True);
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(Order_Main,False);
|
||
end;
|
||
|
||
procedure TfrmGYSSelList.Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||
AShift: TShiftState; var AHandled: Boolean);
|
||
begin
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
end.
|