224 lines
5.3 KiB
ObjectPascal
224 lines
5.3 KiB
ObjectPascal
![]() |
unit U_XcCustCodeHelp_dx;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, CheckLst, Buttons, DB, ADODB, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
|
|||
|
cxDropDownEdit, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
|||
|
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
|
|||
|
cxLookAndFeels, DBClient, cxCheckBox;
|
|||
|
|
|||
|
type
|
|||
|
TfrmXcCustCodeHelp_dx = class(TForm)
|
|||
|
ADOQueryHelp: TADOQuery;
|
|||
|
btOk: TBitBtn;
|
|||
|
btNo: TBitBtn;
|
|||
|
dbGrid1: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
Tv1code: TcxGridDBColumn;
|
|||
|
Tv1Name: TcxGridDBColumn;
|
|||
|
dbGrid1Level1: TcxGridLevel;
|
|||
|
DataSource1: TDataSource;
|
|||
|
ADOConnection1: TADOConnection;
|
|||
|
cxLookAndFeelController1: TcxLookAndFeelController;
|
|||
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
cxStyle1: TcxStyle;
|
|||
|
cxStyle2: TcxStyle;
|
|||
|
cxStyle_gridRow: TcxStyle;
|
|||
|
cxStyle_gridFoot: TcxStyle;
|
|||
|
cxStyle_gridHead: TcxStyle;
|
|||
|
cxStyle_gridGroupBox: TcxStyle;
|
|||
|
cxStyle_yellow: TcxStyle;
|
|||
|
cxStyle_Red: TcxStyle;
|
|||
|
cxStyle_fontBlack: TcxStyle;
|
|||
|
cxStyle_fontclFuchsia: TcxStyle;
|
|||
|
cxStyle_fontclPurple: TcxStyle;
|
|||
|
cxStyle_fontclGreen: TcxStyle;
|
|||
|
cxStyle_fontclBlue: TcxStyle;
|
|||
|
cxStyle_fontclTeal: TcxStyle;
|
|||
|
cxStyle_fontclOlive: TcxStyle;
|
|||
|
CDSHELP: TClientDataSet;
|
|||
|
v1sel: TcxGridDBColumn;
|
|||
|
CheckBox1: TCheckBox;
|
|||
|
procedure btNoClick(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure btOkClick(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure Tv1DblClick(Sender: TObject);
|
|||
|
procedure CheckBox1Click(Sender: TObject);
|
|||
|
private
|
|||
|
procedure InitData();
|
|||
|
public
|
|||
|
Fflag:string; //<2F><><EFBFBD>ͱ<EFBFBD>־
|
|||
|
fDivChar:string;
|
|||
|
pColumns:integer;
|
|||
|
fSelResult:string;
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmXcCustCodeHelp_dx: TfrmXcCustCodeHelp_dx;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_global,U_FormPas;
|
|||
|
{$R *.dfm}
|
|||
|
procedure InitCDSData20(fromADO:TADOQuery;toCDS:TclientDataSet);
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
k:integer;
|
|||
|
begin
|
|||
|
if fromADO.IsEmpty then exit;
|
|||
|
fromADO.first;
|
|||
|
K:=1;
|
|||
|
try
|
|||
|
toCDS.DisableControls;
|
|||
|
toCDS.Filtered:=false;
|
|||
|
|
|||
|
while not fromADO.Eof do
|
|||
|
begin
|
|||
|
with toCDS do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
for i:=0 to fromADO.FieldCount-1 do
|
|||
|
begin
|
|||
|
fields[i].value:=fromADO.Fields[i].Value ;
|
|||
|
end;
|
|||
|
fieldByName('index').value :=k;
|
|||
|
fieldByName('sel').value :=false;
|
|||
|
inc(k);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
fromADO.Next;
|
|||
|
end;
|
|||
|
if not toCDS.IsEmpty then
|
|||
|
begin
|
|||
|
toCDS.First ;
|
|||
|
end;
|
|||
|
finally
|
|||
|
toCDS.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure CreateCDS20(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
mfieldName:string;
|
|||
|
mSize:integer;
|
|||
|
begin
|
|||
|
mfieldName:='';
|
|||
|
mClientDataset.FieldDefs.Clear;
|
|||
|
with SADOQry do
|
|||
|
begin
|
|||
|
for i:=0 to fieldCount-1 do //
|
|||
|
begin
|
|||
|
if (Fields[i].DataType=ftString) and (Fields[i].Size=0) then
|
|||
|
begin
|
|||
|
msize:=1;
|
|||
|
end
|
|||
|
else
|
|||
|
msize:=Fields[i].Size;
|
|||
|
mfieldName:=trim(fields[i].FieldName);
|
|||
|
mClientDataset.FieldDefs.Add(mfieldName,
|
|||
|
Fields[i].DataType,msize);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
mClientDataset.FieldDefs.Add('index',ftInteger,0);
|
|||
|
mClientDataset.FieldDefs.Add('sel',ftBoolean,0);
|
|||
|
mClientDataset.FieldDefs.Add('DefNote',ftString,20);
|
|||
|
mClientDataset.Close;
|
|||
|
mClientDataset.CreateDataSet;
|
|||
|
end;
|
|||
|
procedure TfrmXcCustCodeHelp_dx.btNoClick(Sender: TObject);
|
|||
|
begin
|
|||
|
ModalResult:=-1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmXcCustCodeHelp_dx.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
with ADOConnection1 do
|
|||
|
begin
|
|||
|
Connected:=false;
|
|||
|
ConnectionString:=gConString;
|
|||
|
Connected:=true;
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
////////////////////////////////////////////////
|
|||
|
procedure TfrmXcCustCodeHelp_dx.InitData();
|
|||
|
begin
|
|||
|
with ADOQueryHelp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add('select * from XC_Custcode');
|
|||
|
sql.Add('where flag='''+Fflag+'''');
|
|||
|
sql.Add('and Valid=''Y''');
|
|||
|
sql.Add('order by orderNo');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
CreateCDS20(ADOQueryHelp,cdsHelp);
|
|||
|
InitCDSData20(ADOQueryHelp,cdsHelp);
|
|||
|
end;
|
|||
|
procedure TfrmXcCustCodeHelp_dx.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
self.Caption :='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+FFlag+')';
|
|||
|
InitData();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmXcCustCodeHelp_dx.btOkClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if cdshelp.IsEmpty then exit;
|
|||
|
fSelResult:='';
|
|||
|
if trim(fDivChar)='' then fDivChar:=';';
|
|||
|
with cdshelp do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if fieldbyname('sel').AsBoolean then
|
|||
|
fSelResult:=fSelResult+Trim(Fieldbyname('Name').AsString)+Trim(fDivChar);
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
ModalResult:=1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmXcCustCodeHelp_dx.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmXcCustCodeHelp_dx.Tv1DblClick(Sender: TObject);
|
|||
|
begin
|
|||
|
btOk.Click ;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmXcCustCodeHelp_dx.CheckBox1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if cdshelp.IsEmpty then exit;
|
|||
|
with cdshelp do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
edit;
|
|||
|
fieldbyname('sel').AsBoolean:=checkbox1.Checked;
|
|||
|
post;
|
|||
|
next;
|
|||
|
end;
|
|||
|
First;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|