4042 lines
130 KiB
ObjectPascal
4042 lines
130 KiB
ObjectPascal
|
unit U_Fun;
|
|||
|
|
|||
|
interface
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils,dxCore, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, ComCtrls, ToolWin, StdCtrls, BtnEdit, cxStyles, cxCustomData,
|
|||
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit,DBGrids, DB, cxDBData,
|
|||
|
cxGridLevel, cxClasses, cxControls, cxGridCustomView, ADODB,StrUtils,
|
|||
|
Midas,cxGridCustomTableView, cxGridTableView, cxGridDBTableView,cxTimeEdit,
|
|||
|
cxTreeView, cxGrid,cxDBLookupComboBox,cxCalendar, cxCurrencyEdit,cxGridExportLink,
|
|||
|
ExtCtrls, Buttons,DBClient,RTComboBox,cxDropDownEdit,cxGridBandedTableView,
|
|||
|
cxGridDBBandedTableView,cxRichEdit,cxButtonEdit,IniFiles,WinSock,IdHTTP;
|
|||
|
//Function sendarp(ipaddr:ulong;temp:dword;ulmacaddr:pointer;ulmacaddrleng:pointer) : DWord; StdCall; External 'Iphlpapi.dll' Name 'SendARP';
|
|||
|
type
|
|||
|
TA = class(TComponent)
|
|||
|
public
|
|||
|
S:string;
|
|||
|
end;
|
|||
|
|
|||
|
function SGetMaxId(AdoQueryTemp:TADOQuery;MyTable:string;MyField:string;Var MaxId:Integer):Boolean;
|
|||
|
function SIsRepeated(AdoQueryTemp:TADOQuery;MyTable:string;MyField:string;MyCode:String):Boolean;
|
|||
|
function SSetSaveDataCDS(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
function SSetSaveDataCDS10(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBBandedTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
function SGetServerDate(ADOQueryTmp:TADOQuery):TdateTime;
|
|||
|
procedure SSetsavedata(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
procedure SSetWinData(ADOQueryTmp:TADOQuery;mParent:TWinControl);
|
|||
|
function SDelData(ADOQueryCmd:TADOQuery;mDelStr:String):Boolean;
|
|||
|
function SGetFilters(TMPanel:TPanel;EquTag,LikeTag:Integer):string;
|
|||
|
function SGetFiltersHint(TMPanel:TPanel;EquTag,LikeTag:Integer):string;
|
|||
|
procedure SDofilter(ADOQry:TADOQuery;FilterStr:string);
|
|||
|
function SGetMaxNo(MyAdoQuery:TADOQuery;MyTable:string;MyField:string;MyFlag:string):String;
|
|||
|
procedure SCreateCDS20(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
|||
|
procedure SInitCDSData20(fromADO:TADOQuery;toCDS:TclientDataSet);
|
|||
|
procedure SInitFtComBoxBySql(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TRTComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean;
|
|||
|
mSql:string
|
|||
|
);
|
|||
|
procedure SInitComBoxBySql(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TComboBox;
|
|||
|
emptyFlag:Boolean;
|
|||
|
mSql:string
|
|||
|
);
|
|||
|
procedure SInitComBoxByCustCode(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
procedure SInitCxGridComboBoxByCustCode(ADOQueryTmp:TADOQuery;c3:TcxGriddbColumn;
|
|||
|
FlagType:string;PState:Integer;IsNull:Boolean;Shmeg:string);
|
|||
|
procedure SSetsavedata10(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
procedure SSetWinData10(ADOQueryTmp:TADOQuery;mParent:TWinControl);
|
|||
|
procedure SInitCxGridComboBoxBySql(ADOQueryTmp:TADOQuery;c3:TcxGriddbColumn;FSql:string;
|
|||
|
PState:Integer;IsNull:Boolean;Shmeg:string);
|
|||
|
function SSWR(s: real): real; //*****<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *****//
|
|||
|
procedure SSetWinData20(ADOQueryTmp:TADOQuery;mParent:TWinControl);
|
|||
|
procedure SSetWinData30(ADOQueryTmp:TADOQuery;mParent:TWinControl;FTag:Integer);
|
|||
|
procedure SCSHData(ADOQueryTmp:TADOQuery;mParent:TWinControl;FTag:Integer);
|
|||
|
procedure SSetsavedataNew(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
function SGetServerDate10(ADOQueryTmp:TADOQuery):TDateTime;
|
|||
|
function SGetServerDateTime(ADOQueryTmp:TADOQuery):TDateTime;
|
|||
|
procedure SCreateCDSSel(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
|||
|
procedure SInitCDSDataSel(fromADO:TADOQuery;toCDS:TclientDataSet);
|
|||
|
procedure CopyAddRow(Tv1:TcxGridDBTableView;CDS_Sub:TClientDataSet); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD>groupformat<61><74><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>
|
|||
|
procedure CopyAddRowBand(Tv1:TcxGridDBBandedTableView;CDS_Sub:TClientDataSet);
|
|||
|
procedure OneKeyPost(Tv1:TcxGridDBTableView;CDS_Sub:TClientDataSet); //һ<><D2BB><EFBFBD>滻ճ<E6BBBB><D5B3>
|
|||
|
procedure CopyAddRowCDS(CDS_Sub:TClientDataSet);
|
|||
|
function SSetSaveDataCDSNew(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
function SGetFinds(TMPanel:TPanel;EquTag,LikeTag:Integer):string;
|
|||
|
function SSetSaveDataCDSBandNew(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBBandedTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
function GetLSNo(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mFlag:string;
|
|||
|
mTable:string;
|
|||
|
mlen:integer;
|
|||
|
mtype:integer=0):Boolean;
|
|||
|
procedure SSetsaveSql(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
procedure ReadCxGrid(fileName:string;cxgrid:TcxGridDBTableView;filePack:string='<27><><EFBFBD><EFBFBD>');
|
|||
|
procedure ReadCxBandedGrid(fileName:string;cxgrid:TcxGridDBBandedTableView;filePack:string='<27><><EFBFBD><EFBFBD>');
|
|||
|
procedure WriteCxGrid(fileName:string;cxgrid:TcxGridDBTableView;filePack:string='<27><><EFBFBD><EFBFBD>');
|
|||
|
procedure WriteCxBandedGrid(fileName:string;cxgrid:TcxGridDBBandedTableView;filePack:string='<27><><EFBFBD><EFBFBD>');
|
|||
|
procedure CreateGroupSummarry(tv1:TcxGridDBTableView);
|
|||
|
procedure TcxGridToExcel(mfileName:string;gridName:TcxGrid);
|
|||
|
function ReadINIFileStr(ininame,TypeName:string;ValueName,ValueMR:String):string;
|
|||
|
procedure SClearData(mParent:TWinControl;FTag:Integer);
|
|||
|
procedure SelExportData(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTile:string);
|
|||
|
procedure SDofilter10(cds_Main:TClientDataSet;FilterStr:string);
|
|||
|
procedure SInitCxBandGridComboBoxBySql(ADOQueryTmp:TADOQuery;c3:TcxGridDBBandedColumn;FSql:string;
|
|||
|
PState:Integer;IsNull:Boolean;Shmeg:string);
|
|||
|
procedure ColumnView(AdoQueryTemp:TADOQuery;Tv1:TcxGridDBTableView;MKName10:string);
|
|||
|
procedure ColumnSet(TV10:TcxGridDBTableView;MKName10:String);
|
|||
|
procedure ColumnBandSet(TV10:TcxGridDBBandedTableView;MKName10:String);
|
|||
|
procedure ColumnBandView(AdoQueryTemp:TADOQuery;Tv1:TcxGridDBBandedTableView;MKName10:string);
|
|||
|
procedure SCSHDataWTag(ADOQueryTmp:TADOQuery;mParent:TWinControl);
|
|||
|
procedure GetSWLDZ(IPStr:string);
|
|||
|
procedure SCSHDataCDS(CDS_Main:TClientDataSet;mParent:TWinControl;FTag:Integer);
|
|||
|
procedure SelPrintData(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTitle:string
|
|||
|
;FLTitle:string;FRTile:string);
|
|||
|
procedure SelPrintDataMore(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTitle:string
|
|||
|
;FLTitle:string;FRTile:string;FKK:Integer;FiniName:string);
|
|||
|
procedure SelExportDataBand(FTv:TcxGridDBBandedTableView;FAdoQry:TADOQuery;FTile:string);
|
|||
|
procedure SSetsaveSqlNew(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
procedure SCSHDataNew(ADOQueryTmp:TADOQuery;mParent:TWinControl;FTag:Integer);
|
|||
|
function RTSetSaveDataCDS(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
function RTSetSaveDataCDSBand(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBBandedTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
procedure SCreateCDSOnly(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
|||
|
procedure SInitCDSDataOnly(fromADO:TADOQuery;toCDS:TclientDataSet);
|
|||
|
procedure SelOKNo(CDS_MainSel:TClientDataSet;FSel:Boolean);
|
|||
|
function num2cengnum(strArabic:string):string;
|
|||
|
function num2ceng(strArabic:string):string;
|
|||
|
procedure RTSetsavedata(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
procedure InitOrderColor(OrdMainId:string;Combox:TComboBox;FAdoQry:TADOQuery);
|
|||
|
procedure InitBCGangNo(OrdSubId:string;Combox:TComboBox;FAdoQry:TADOQuery);
|
|||
|
procedure InitRCGangNo(OrdSubId:string;Combox:TComboBox;FAdoQry:TADOQuery);
|
|||
|
procedure DelCDS(ClientDataSet1:TClientDataSet;ADOCmd:TADOQuery;DelSql:string);
|
|||
|
function GetKw(ADOQueryTmp:TADOQuery;C_CodeName,C_Color:string):string;
|
|||
|
procedure InitCDSToCDS(fromADO:TclientDataSet;toCDS:TclientDataSet);
|
|||
|
procedure HJ(mClientDataset:TclientDataSet;Label1:TLabel;mfieldName:double);
|
|||
|
function ExportFtErpFile(mFileName:string;ADORead:TADOQuery):boolean;
|
|||
|
procedure GetFileInfo(mFile:string;var mfileSize:integer;var CreationTime:tdatetime;var WriteTime:tdatetime);
|
|||
|
procedure UpdateFileTime(FileName:string; CreationTime, LastAccessTime, LastWriteTime:TDateTime);
|
|||
|
procedure SelExportDataSel(FTv:TcxGridDBTableView;FClient:TClientDataSet;FTile:string);
|
|||
|
function CovFileDate(Fd:_FileTime):TDateTime;
|
|||
|
function RoundFloat(f: double; i: integer): double;
|
|||
|
procedure SSetEditDataCDSNew(yClientDataset:TclientDataSet; mClientDataset:TclientDataSet );
|
|||
|
procedure GetHTTP(FUrl:string);
|
|||
|
function WriteCloseWin(AdoCmd:TadoQuery;mCaption:string;formId:integer;mDllName:string):Boolean;
|
|||
|
|
|||
|
procedure GetServerTime(ADOQueryTmp:TADOQuery);
|
|||
|
implementation
|
|||
|
uses U_DataLink,U_SelExportField,U_ColumnSet,U_ColumnBandSet,U_SelPrintFieldNew;
|
|||
|
|
|||
|
|
|||
|
function WriteCloseWin(AdoCmd:TadoQuery;mCaption:string;formId:integer;mDllName:string):Boolean;
|
|||
|
begin
|
|||
|
result:=false;
|
|||
|
try
|
|||
|
GetServerTime(AdoCmd);
|
|||
|
with AdoCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('select *');
|
|||
|
sql.Add('from SY_CloseFormInfo');
|
|||
|
sql.Add('where UserId='+quotedStr(DCode));
|
|||
|
sql.Add('and formCaption='+quotedStr(mCaption));
|
|||
|
Open;
|
|||
|
|
|||
|
if Recordcount>0 then
|
|||
|
begin
|
|||
|
edit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
append;
|
|||
|
fieldByName('UserId').Value :=DCode;
|
|||
|
fieldByName('formCaption').Value :=mCaption;
|
|||
|
fieldByName('formId').Value :=formId;
|
|||
|
fieldByName('dllfileName').Value :=mDllName;
|
|||
|
end ;
|
|||
|
fieldByName('filltime').Value :=DServerDate;
|
|||
|
post;
|
|||
|
end ;
|
|||
|
result:=true;
|
|||
|
except
|
|||
|
application.MessageBox('д<>ر<EFBFBD><D8B1><EFBFBD>Ϣʱ<CFA2><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////////
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
///////////////////////////////////////////////////
|
|||
|
procedure GetServerTime(ADOQueryTmp:TADOQuery);
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select getDate()as dt');
|
|||
|
open;
|
|||
|
end;
|
|||
|
DServerDate:=ADOQueryTmp.fieldByName('dt').AsDatetime;
|
|||
|
end;
|
|||
|
procedure GetHTTP(FUrl:string);
|
|||
|
var
|
|||
|
IdHttp: TIdHTTP;
|
|||
|
ResponseStream : TStringStream; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
ResponseStr : string;
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD>IDHTTP<54>ؼ<EFBFBD>
|
|||
|
IdHttp := TIdHTTP.Create(nil);
|
|||
|
IdHttp.HTTPOptions:=IdHttp.HTTPOptions+[hoKeepOrigProtocol];
|
|||
|
//TStringStream<61><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>Ϣ
|
|||
|
ResponseStream := TStringStream.Create('');
|
|||
|
try
|
|||
|
try
|
|||
|
IdHttp.Get(FUrl,ResponseStream); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|||
|
except
|
|||
|
on e : Exception do
|
|||
|
begin
|
|||
|
ShowMessage(e.Message);
|
|||
|
end;
|
|||
|
end;
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1>ҳ<EFBFBD><D2B3><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>Ϣ
|
|||
|
ResponseStr := ResponseStream.DataString;
|
|||
|
//<2F><>ҳ<EFBFBD>еĴ<D0B5><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>UTF8<46><38><EFBFBD><EFBFBD>
|
|||
|
ResponseStr := UTF8Decode(ResponseStr);
|
|||
|
//ShowMessage(ResponseStr);
|
|||
|
finally
|
|||
|
IdHttp.Free;
|
|||
|
ResponseStream.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SSetEditDataCDSNew(yClientDataset:TclientDataSet; mClientDataset:TclientDataSet );
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
k:integer;
|
|||
|
mfieldName:string;
|
|||
|
begin
|
|||
|
if yClientDataset.IsEmpty then exit;
|
|||
|
K:=1;
|
|||
|
try
|
|||
|
mClientDataset.DisableControls;
|
|||
|
mClientDataset.Filtered:=false;
|
|||
|
with mClientDataset do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
for i:=0 to yClientDataset.FieldCount-1 do
|
|||
|
begin
|
|||
|
mfieldName:=trim(yClientDataset.fields[i].FieldName);
|
|||
|
fieldbyname(mfieldName).Value:=yClientDataset.Fields[i].Value;
|
|||
|
end;
|
|||
|
post;
|
|||
|
inc(k);
|
|||
|
end;
|
|||
|
if not mClientDataset.IsEmpty then
|
|||
|
begin
|
|||
|
mClientDataset.First;
|
|||
|
end;
|
|||
|
finally
|
|||
|
mClientDataset.First;
|
|||
|
mClientDataset.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure SelExportDataSel(FTv:TcxGridDBTableView;FClient:TClientDataSet;FTile:string);
|
|||
|
var
|
|||
|
i,j:Integer;
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if FClient.IsEmpty then Exit;
|
|||
|
try
|
|||
|
frmSelExportField:=TfrmSelExportField.Create(Application);
|
|||
|
with frmSelExportField do
|
|||
|
begin
|
|||
|
with frmSelExportField.ExpGrid do
|
|||
|
begin
|
|||
|
// ExpGrid.Columns.Clear;
|
|||
|
ExpGrid.ClearItems;
|
|||
|
frmSelExportField.IniName:=FTile;
|
|||
|
ExpGrid.OptionsView.Footer:=FTv.OptionsView.Footer;
|
|||
|
for i:=0 to FTv.ColumnCount-1 do
|
|||
|
begin
|
|||
|
//if FTv.Columns[i].Visible=True then
|
|||
|
begin
|
|||
|
ExpGrid.CreateColumn;
|
|||
|
j:=ExpGrid.ColumnCount-1;
|
|||
|
ExpGrid.Columns[j].Caption:=FTv.Columns[i].Caption;
|
|||
|
ExpGrid.Columns[i].Visible:=FTv.Columns[i].Visible;
|
|||
|
ExpGrid.Columns[j].DataBinding.FieldName:=FTv.Columns[i].DataBinding.FieldName;
|
|||
|
ExpGrid.Columns[j].Width:=FTv.Columns[i].Width;
|
|||
|
ExpGrid.Columns[i].Summary.FooterKind:=FTv.Columns[i].Summary.FooterKind;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ExportDataSource.DataSet:=FClient;
|
|||
|
FClient.Open;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
frmSelExportField.Free;
|
|||
|
except
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function RoundFloat(f: double; i: integer): double;
|
|||
|
var
|
|||
|
s: string;
|
|||
|
ef: Extended;
|
|||
|
begin
|
|||
|
if f = 0 then
|
|||
|
begin
|
|||
|
Result := 0;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
s := '#.' + StringOfChar('0', i);
|
|||
|
if s = '#.' then
|
|||
|
s := '#';
|
|||
|
ef := StrToFloat(FloatToStr(f)); //<2F><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
result := StrToFloat(FormatFloat(s, ef));
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3>ӷ<EFBFBD><D3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
///////////////////////////////////////////////////////
|
|||
|
function ExportFtErpFile(mFileName:string;ADORead:TADOQuery):boolean;
|
|||
|
var
|
|||
|
Stream : TMemoryStream;
|
|||
|
ff:TADOBlobstream;
|
|||
|
mfileSize:integer;
|
|||
|
mCreationTime:TdateTime;
|
|||
|
mWriteTime:TdateTime;
|
|||
|
IsFileHas:boolean;
|
|||
|
mChildPath:string;
|
|||
|
mFilePath:string;
|
|||
|
begin
|
|||
|
try
|
|||
|
result:=false;
|
|||
|
mChildPath:='';
|
|||
|
///////////////////////////////////////////////
|
|||
|
//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>·<EFBFBD><C2B7>
|
|||
|
with ADORead do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('select FilePath ');
|
|||
|
sql.Add('from RT_FileUpdate');
|
|||
|
sql.Add('where FileName='+quotedStr(mFileName));
|
|||
|
Open;
|
|||
|
if RecordCount>0 then
|
|||
|
begin
|
|||
|
// if not fieldByName('valid').AsBoolean then exit;
|
|||
|
if trim(fieldByName('FilePath').AsString)<>'' then
|
|||
|
mChildPath:=trim(fieldByName('FilePath').AsString)+'\';
|
|||
|
end;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>
|
|||
|
mFilePath:= ExtractFilePath(Paramstr(0))+mChildPath;
|
|||
|
IsFileHas:= FileExists(mFilePath+mFileName);
|
|||
|
if IsFileHas then
|
|||
|
begin
|
|||
|
//////////////////////////
|
|||
|
//<2F><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ϣ
|
|||
|
GetFileInfo(mFilePath+mFileName,mfileSize,mCreationTime,mWriteTime);
|
|||
|
end;
|
|||
|
//////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|||
|
if IsFileHas then
|
|||
|
begin
|
|||
|
with ADORead do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('select count(FileName) as cnt ');
|
|||
|
sql.Add('from RT_FileUpdate');
|
|||
|
sql.Add('where FileName='+quotedStr(mFileName));
|
|||
|
// sql.Add('and fileEditDate>'''+formatDateTime('yyyy-MM-dd hh:mm',mWriteTime)+'''');
|
|||
|
sql.Add(' and DATEDIFF(minute,'+ quotedStr(formatDateTime('yyyy-MM-dd hh:mm',mWriteTime))+',fileEditDate)>0');
|
|||
|
Open;
|
|||
|
|
|||
|
|
|||
|
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5>ļ<EFBFBD>
|
|||
|
if fieldByName('cnt').AsInteger>0 then
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('select * ');
|
|||
|
sql.Add('from RT_FileUpdate');
|
|||
|
sql.Add('where FileName='+quotedStr(mFileName));
|
|||
|
|
|||
|
Open;
|
|||
|
|
|||
|
ff := TADOBlobstream.Create(fieldByName('Files') as TblobField, bmRead);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
if trim(fieldByName('FilePath').AsString)<>'' then
|
|||
|
mChildPath:=trim(fieldByName('FilePath').AsString)+'\';
|
|||
|
end;
|
|||
|
end
|
|||
|
//////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
else
|
|||
|
begin
|
|||
|
with ADORead do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('select * ');
|
|||
|
sql.Add('from RT_FileUpdate');
|
|||
|
sql.Add('where FileName='+quotedStr(mFileName));
|
|||
|
Open;
|
|||
|
|
|||
|
if recordCount>0 then
|
|||
|
begin
|
|||
|
ff := TADOBlobstream.Create(fieldByName('Files') as TblobField, bmRead);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
if trim(fieldByName('FilePath').AsString)<>'' then
|
|||
|
mChildPath:=trim(fieldByName('FilePath').AsString)+'\';
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
if ff<>nil then
|
|||
|
begin
|
|||
|
try
|
|||
|
mfileName:=trim(ADORead.fieldByName('FileName').asString);
|
|||
|
if not DirectoryExists(ExtractFileDir(mFilePath+mfileName)) then
|
|||
|
ForceDirectories(ExtractFileDir(mFilePath+mfileName));
|
|||
|
Stream:= TMemoryStream.Create ;
|
|||
|
//OleContainer1.SaveToStream(Stream);
|
|||
|
//ADOQuery1FileContent.SaveToFile('tmp'); //<2F><><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD>
|
|||
|
//OleContainer1.LoadFromFile('tmp'); //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD>ļ<EFBFBD><C4BC>ж<EFBFBD>ȡOLE<4C><45><EFBFBD><EFBFBD>
|
|||
|
ff.SaveToStream(Stream);
|
|||
|
//OleContainer1.SaveToFile(ExtractFilePath(Paramstr(0))+mfielName)
|
|||
|
Stream.SaveToFile(mFilePath+mfileName); //+'\tmpFile\'
|
|||
|
|
|||
|
//OleContainer1.SaveToFile('tmp');
|
|||
|
finally
|
|||
|
Stream.Free ;
|
|||
|
end;
|
|||
|
end;
|
|||
|
UpdateFileTime(mFilePath+mfileName,ADORead.fieldByName('FileCreateDate').AsDateTime,ADORead.fieldByName('FileEditDate').AsDateTime,ADORead.fieldByName('FileEditDate').AsDateTime);
|
|||
|
Result:=true;
|
|||
|
except
|
|||
|
application.MessageBox(pchar('<27><>ȡ<EFBFBD>ļ<EFBFBD>'+mfileName+'ʧ<><CAA7>!'),'<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////////////////////////////////////////
|
|||
|
//
|
|||
|
///////////////////////////////////////////////////////
|
|||
|
procedure GetFileInfo(mFile:string;var mfileSize:integer;var CreationTime:tdatetime;var WriteTime:tdatetime);
|
|||
|
var
|
|||
|
vSearchRec: TSearchRec;
|
|||
|
begin
|
|||
|
FindFirst(mFile,faAnyFile,vSearchRec);
|
|||
|
mfileSize:=vSearchRec.Size;
|
|||
|
CreationTime:=CovFileDate(vSearchRec.FindData.ftCreationTime);//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
//vSearchRec.FindData.ftLastAccessTime//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
WriteTime:=CovFileDate(vSearchRec.FindData.ftLastWriteTime);//<2F><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
FindClose(vSearchRec);
|
|||
|
end;
|
|||
|
|
|||
|
procedure GetFileEditTime(mFile:string;var editTime:tdatetime);
|
|||
|
var
|
|||
|
vSearchRec: TSearchRec;
|
|||
|
begin
|
|||
|
FindFirst(mFile,faAnyFile,vSearchRec);
|
|||
|
//mfileSize:=vSearchRec.Size;
|
|||
|
// CreationTime:=CovFileDate(vSearchRec.FindData.ftCreationTime);//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
//vSearchRec.FindData.ftLastAccessTime//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
editTime:=CovFileDate(vSearchRec.FindData.ftLastWriteTime);//<2F><EFBFBD>ʱ<EFBFBD><CAB1>
|
|||
|
FindClose(vSearchRec);
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////
|
|||
|
//
|
|||
|
/////////////////////////////////////////////
|
|||
|
function CovFileDate(Fd:_FileTime):TDateTime;
|
|||
|
var
|
|||
|
Tct:_SystemTime;
|
|||
|
Temp:_FileTime;
|
|||
|
begin
|
|||
|
FileTimeToLocalFileTime(Fd,Temp);
|
|||
|
FileTimeToSystemTime(Temp,Tct);
|
|||
|
CovFileDate:=SystemTimeToDateTime(Tct);
|
|||
|
end;
|
|||
|
procedure UpdateFileTime(FileName:string; CreationTime, LastAccessTime, LastWriteTime:TDateTime);
|
|||
|
var
|
|||
|
FileHnd : Integer;
|
|||
|
SysTime : TSystemTime;
|
|||
|
tTzi: TTimezoneInformation;
|
|||
|
FCreationTime, FLastAccessTime, FLastWriteTime: TFileTime;
|
|||
|
begin
|
|||
|
GetTimezoneInformation(tTzi) ;
|
|||
|
CreationTime := CreationTime+Ttzi.Bias/1440;
|
|||
|
DateTimeToSystemTime(CreationTime,SysTime);
|
|||
|
SystemTimeToFileTime(SysTime,FCreationTime);
|
|||
|
//LastAccessTime := LastAccessTime + Ttzi.Bias/1440;
|
|||
|
//DateTimeToSystemTime(LastAccessTime,SysTime);
|
|||
|
//SystemTimeToFileTime(SysTime,FLastAccessTime);
|
|||
|
LastWriteTime := LastWriteTime + Ttzi.Bias/1440;
|
|||
|
DateTimeToSystemTime(LastWriteTime,SysTime);
|
|||
|
SystemTimeToFileTime(SysTime,FLastWriteTime);
|
|||
|
try
|
|||
|
FileHnd := FileOpen(FileName, fmOpenWrite or fmShareDenyNone);
|
|||
|
SetFileTime(FileHnd, @FCreationTime, nil, @FLastWriteTime);
|
|||
|
finally
|
|||
|
FileClose(FileHnd);
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure HJ(mClientDataset:TclientDataSet;Label1:TLabel;mfieldName:double);
|
|||
|
begin
|
|||
|
if mClientDataset.IsEmpty then exit;
|
|||
|
with mClientDataset do
|
|||
|
begin
|
|||
|
if fieldbyname('Ssel').AsBoolean=true then
|
|||
|
Label1.Caption:=currtostr(strtoCurr(Label1.Caption)+mfieldName)
|
|||
|
else
|
|||
|
Label1.Caption:=currtostr(strtoCurr(Label1.Caption)-mfieldName);
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure InitCDSToCDS(fromADO:TclientDataSet;toCDS:TclientDataSet);
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
with toCDS do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
for i:=0 to fromADO.FieldCount-1 do
|
|||
|
begin
|
|||
|
fields[i].value:=fromADO.Fields[i].Value ;
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
finally
|
|||
|
end;
|
|||
|
end;
|
|||
|
function GetKw(ADOQueryTmp:TADOQuery;C_CodeName,C_Color:string):string;
|
|||
|
var
|
|||
|
kw:string;
|
|||
|
begin
|
|||
|
kw:='';
|
|||
|
try
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
SQL.Clear;
|
|||
|
sql.add(' select zdyCode from KH_Zdy_Attachment ');
|
|||
|
sql.add(' where defstr1='+quotedstr(trim(C_CodeName)));
|
|||
|
sql.add(' and defstr2='+quotedstr(trim(C_Color)));
|
|||
|
sql.add(' and Type=''CPKW'' ');
|
|||
|
sql.add(' and isnull(DEFstr3,'''')=''<27>̶<EFBFBD><CCB6><EFBFBD>'' ');
|
|||
|
open;
|
|||
|
IF not isEmpty then
|
|||
|
kw:=trim(fieldbyname('zdyCode').asstring);
|
|||
|
end;
|
|||
|
result:=kw;
|
|||
|
except
|
|||
|
result:=kw;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
///////////////////ȡ<><C8A1><EFBFBD><EFBFBD>Int<6E><74><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD>ֵ///////////////////////////////////////
|
|||
|
function SGetMaxId(AdoQueryTemp:TADOQuery;MyTable:string;MyField:string;Var MaxId:Integer):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with AdoQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('select Max('+MyField+')+1 MaxId from '+MyTable);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with AdoQueryTemp do
|
|||
|
begin
|
|||
|
if (Trim(FieldByName('MaxId').AsString)='') or
|
|||
|
(Trim(FieldByName('MaxId').AsString)=NULL) then
|
|||
|
MaxId:=1
|
|||
|
else
|
|||
|
MaxId:=(fieldbyname('MaxId').AsInteger);
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ֵʧ<D6B5>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure InitBCGangNo(OrdSubId:string;Combox:TComboBox;FAdoQry:TADOQuery);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
fsj:='select distinct(MJstr4) Code from WFB_MJJY '+
|
|||
|
' where Subid='''+Trim(OrdSubId)+'''';
|
|||
|
with FAdoQry do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(fsj);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
Combox.Clear;
|
|||
|
with FAdoQry do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
Combox.Items.Add(Trim(FAdoQry.fieldbyname('Code').AsString));
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Combox.Items.Add('');
|
|||
|
end;
|
|||
|
procedure InitRCGangNo(OrdSubId:string;Combox:TComboBox;FAdoQry:TADOQuery);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
fsj:='select distinct(gangno) Code from JYOrder_Sub_AnPai '+
|
|||
|
' where Subid='''+Trim(OrdSubId)+'''';
|
|||
|
with FAdoQry do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(fsj);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
Combox.Clear;
|
|||
|
with FAdoQry do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
Combox.Items.Add(Trim(FAdoQry.fieldbyname('Code').AsString));
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Combox.Items.Add('');
|
|||
|
end;
|
|||
|
procedure InitOrderColor(OrdMainId:string;Combox:TComboBox;FAdoQry:TADOQuery);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
fsj:='select distinct(PRTColor) Code from JYOrder_Sub '+
|
|||
|
' where Mainid='''+Trim(OrdMainId)+'''';
|
|||
|
with FAdoQry do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(fsj);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
Combox.Clear;
|
|||
|
with FAdoQry do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
Combox.Items.Add(Trim(FAdoQry.fieldbyname('Code').AsString));
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Combox.Items.Add('');
|
|||
|
end;
|
|||
|
////<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ӡ
|
|||
|
procedure SelPrintData(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTitle:string
|
|||
|
;FLTitle:string;FRTile:string);
|
|||
|
var
|
|||
|
i,j,k,KK:Integer;
|
|||
|
fsj:string;
|
|||
|
FOrder,fcolumnName:string;
|
|||
|
begin
|
|||
|
if FAdoQry.IsEmpty then Exit;
|
|||
|
try
|
|||
|
frmSelPrintFieldNew:=TfrmSelPrintFieldNew.Create(Application);
|
|||
|
with frmSelPrintFieldNew do
|
|||
|
begin
|
|||
|
with frmSelPrintFieldNew.PrnGrid do
|
|||
|
begin
|
|||
|
PrnGrid.Columns.Clear;
|
|||
|
frmSelPrintFieldNew.IniName:=FTitle;
|
|||
|
for i:=0 to FTv.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if FTv.Columns[i].Visible=True then
|
|||
|
begin
|
|||
|
PrnGrid.Columns.Add;
|
|||
|
j:=PrnGrid.Columns.Count-1;
|
|||
|
PrnGrid.Columns[j].Title.Caption:=FTv.Columns[i].Caption;
|
|||
|
PrnGrid.Columns[j].FieldName:=FTv.Columns[i].DataBinding.FieldName;
|
|||
|
PrnGrid.Columns[j].Width:=FTv.Columns[i].Width;
|
|||
|
if FTv.Columns[i].SortOrder=soAscending then
|
|||
|
begin
|
|||
|
FOrder:=' '+FTv.Columns[i].DataBinding.FieldName+' ';
|
|||
|
end else
|
|||
|
if FTv.Columns[i].SortOrder=soDescending then
|
|||
|
begin
|
|||
|
FOrder:=' '+FTv.Columns[i].DataBinding.FieldName+' DESC';
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
FAdoQry.Sort:=FOrder;
|
|||
|
frmSelPrintFieldNew.RMPrintDBGrid1.PageCaptionMsg.TitleMemo.Add(FTitle);
|
|||
|
frmSelPrintFieldNew.RMPrintDBGrid1.PageCaptionMsg.CaptionMsg.LeftMemo.Add(FLTitle);
|
|||
|
frmSelPrintFieldNew.RMPrintDBGrid1.PageCaptionMsg.CaptionMsg.RightMemo.Add(FRTile);
|
|||
|
SCreatecds20(FAdoQry,frmSelPrintFieldNew.ClientDataSet1);
|
|||
|
SInitCDSData20(FAdoQry,frmSelPrintFieldNew.ClientDataSet1);
|
|||
|
if FTv.OptionsView.Footer=True then
|
|||
|
begin
|
|||
|
if FTv.DataController.Summary.FooterSummaryItems.Count>0 then
|
|||
|
begin
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.Append;
|
|||
|
//frmSelPrintFieldNew.ClientDataSet1.FieldByName('Sindex').Value:=frmSelPrintFieldNew.ClientDataSet1.RecNo+1;
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.Post;
|
|||
|
KK:=0;
|
|||
|
for i:=0 to FTv.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if FTv.Columns[i].Visible=False then Continue;
|
|||
|
|
|||
|
fcolumnName:=FTv.Columns[i].Name;
|
|||
|
if FTv.Columns[i].Summary.FooterKind<>sknone then
|
|||
|
begin
|
|||
|
for k:=0 to FTv.DataController.Summary.FooterSummaryItems.Count-1 do
|
|||
|
begin
|
|||
|
if TcxGridDBTableSummaryItem(FTv.DataController.Summary.FooterSummaryItems.Items[k]).Column.Name=fcolumnName then
|
|||
|
begin
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.edit;
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.FieldByName(FTv.Columns[i].DataBinding.FieldName).Value:=
|
|||
|
FTv.DataController.Summary.FooterSummaryValues[k];
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
finally
|
|||
|
frmSelPrintFieldNew.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
////<2F>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ӡ
|
|||
|
procedure SelPrintDataMore(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTitle:string
|
|||
|
;FLTitle:string;FRTile:string;FKK:Integer;FiniName:string);
|
|||
|
var
|
|||
|
i,j,k,KK:Integer;
|
|||
|
fsj:string;
|
|||
|
FOrder,fcolumnName:string;
|
|||
|
begin
|
|||
|
if FAdoQry.IsEmpty then Exit;
|
|||
|
try
|
|||
|
frmSelPrintFieldNew:=TfrmSelPrintFieldNew.Create(Application);
|
|||
|
with frmSelPrintFieldNew do
|
|||
|
begin
|
|||
|
with frmSelPrintFieldNew.PrnGrid do
|
|||
|
begin
|
|||
|
PrnGrid.Columns.Clear;
|
|||
|
frmSelPrintFieldNew.IniName:=FiniName;
|
|||
|
for i:=0 to FTv.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if FTv.Columns[i].Visible=True then
|
|||
|
begin
|
|||
|
PrnGrid.Columns.Add;
|
|||
|
j:=PrnGrid.Columns.Count-1;
|
|||
|
PrnGrid.Columns[j].Title.Caption:=FTv.Columns[i].Caption;
|
|||
|
PrnGrid.Columns[j].FieldName:=FTv.Columns[i].DataBinding.FieldName;
|
|||
|
PrnGrid.Columns[j].Width:=FTv.Columns[i].Width;
|
|||
|
if FTv.Columns[i].SortOrder=soAscending then
|
|||
|
begin
|
|||
|
FOrder:=' '+FTv.Columns[i].DataBinding.FieldName+' ';
|
|||
|
end else
|
|||
|
if FTv.Columns[i].SortOrder=soDescending then
|
|||
|
begin
|
|||
|
FOrder:=' '+FTv.Columns[i].DataBinding.FieldName+' DESC';
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
FAdoQry.Sort:=FOrder;
|
|||
|
frmSelPrintFieldNew.RMPrintDBGrid1.PageCaptionMsg.TitleMemo.Add(FTitle);
|
|||
|
frmSelPrintFieldNew.RMPrintDBGrid1.PageCaptionMsg.CaptionMsg.LeftMemo.Add(FLTitle);
|
|||
|
frmSelPrintFieldNew.RMPrintDBGrid1.PageCaptionMsg.CaptionMsg.RightMemo.Add(FRTile);
|
|||
|
|
|||
|
SCreatecds20(FAdoQry,frmSelPrintFieldNew.ClientDataSet1);
|
|||
|
SInitCDSData20(FAdoQry,frmSelPrintFieldNew.ClientDataSet1);
|
|||
|
if FTv.OptionsView.Footer=True then
|
|||
|
begin
|
|||
|
if FTv.DataController.Summary.FooterSummaryItems.Count>0 then
|
|||
|
begin
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.Append;
|
|||
|
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.Post;
|
|||
|
KK:=0;
|
|||
|
for i:=0 to FTv.ColumnCount-1 do
|
|||
|
begin
|
|||
|
|
|||
|
|
|||
|
fcolumnName:=FTv.Columns[i].Name;
|
|||
|
if FTv.Columns[i].Summary.FooterKind<>sknone then
|
|||
|
begin
|
|||
|
if KK=0 then
|
|||
|
begin
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.edit;
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.FieldByName(FTv.Columns[i-FKK].DataBinding.FilterFieldName).Value:='Total';
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.Post;
|
|||
|
KK:=99;
|
|||
|
end;
|
|||
|
for k:=0 to FTv.DataController.Summary.FooterSummaryItems.Count-1 do
|
|||
|
begin
|
|||
|
if TcxGridDBTableSummaryItem(FTv.DataController.Summary.FooterSummaryItems.Items[k]).Column.Name=fcolumnName then
|
|||
|
begin
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.edit;
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.FieldByName(FTv.Columns[i].DataBinding.FieldName).Value:=
|
|||
|
FTv.DataController.Summary.FooterSummaryValues[k];
|
|||
|
frmSelPrintFieldNew.ClientDataSet1.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
finally
|
|||
|
frmSelPrintFieldNew.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////<2F>жϱ<D0B6><CFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>ظ<EFBFBD>///////////////////////////////////
|
|||
|
function SIsRepeated(AdoQueryTemp:TADOQuery;MyTable:string;MyField:string;MyCode:String):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result:=False;
|
|||
|
with AdoQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('select * from '+MyTable+' where '+MyField+'='''+Trim(MyCode)+'''');
|
|||
|
Open;
|
|||
|
if IsEmpty then Result:=True;
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
end;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><D6B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////<2F><><EFBFBD><EFBFBD>ClientDataSet<65>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>Ϣ/////////////////////////////
|
|||
|
function SSetSaveDataCDS(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result:=False;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if Tv1.Columns[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).AsString)<>'' then
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=
|
|||
|
CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).Value;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Cds<64><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>!','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////<2F><><EFBFBD><EFBFBD>ClientDataSet<65>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>Ϣ/////////////////////////////
|
|||
|
function SSetSaveDataCDSNew(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result:=False;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if Tv1.Columns[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Tv1.Columns[i].Visible=True then
|
|||
|
begin
|
|||
|
if Trim(Tv1.Columns[i].Summary.GroupFooterFormat)<>'1' then
|
|||
|
begin
|
|||
|
if Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).AsString)<>'' then
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=
|
|||
|
CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).Value;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=null;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(Tv1.Columns[i].Summary.GroupFormat)<>'' then
|
|||
|
begin
|
|||
|
if Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].Summary.GroupFormat).AsString)<>'' then
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].Summary.GroupFormat).Value:=
|
|||
|
CDS_Sub.fieldbyname(Tv1.Columns[i].Summary.GroupFormat).Value;
|
|||
|
end;{ else
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=null;
|
|||
|
end; }
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Cds<64><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>!','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
function RTSetSaveDataCDS(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result:=False;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if Tv1.Columns[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
IF trim(Tv1.Columns[i].DataBinding.FieldName)<>'' then
|
|||
|
begin
|
|||
|
if Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).AsString)<>'' then
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=
|
|||
|
CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).Value;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
if Trim(Tv1.Columns[i].Summary.GroupFooterFormat)='0' then
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=0;
|
|||
|
end else
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=null;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Cds<64><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>!','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
function RTSetSaveDataCDSBand(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBBandedTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result:=False;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if Tv1.Columns[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
|
|||
|
begin
|
|||
|
if Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).AsString)<>'' then
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=
|
|||
|
CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).Value;
|
|||
|
end else
|
|||
|
begin
|
|||
|
if Trim(Tv1.Columns[i].Summary.GroupFooterFormat)<>'' then
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=0
|
|||
|
else
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=Trim(Tv1.Columns[i].Summary.GroupFooterFormat);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Cds<64><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>!','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function SSetSaveDataCDSBandNew(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBBandedTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result:=False;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if Tv1.Columns[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Tv1.Columns[i].Visible=True then
|
|||
|
begin
|
|||
|
if Trim(Tv1.Columns[i].Summary.GroupFooterFormat)<>'1' then
|
|||
|
begin
|
|||
|
if Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).AsString)<>'' then
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=
|
|||
|
CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).Value;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=null;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(Tv1.Columns[i].Summary.GroupFormat)<>'' then
|
|||
|
begin
|
|||
|
if Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].Summary.GroupFormat).AsString)<>'' then
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].Summary.GroupFormat).Value:=
|
|||
|
CDS_Sub.fieldbyname(Tv1.Columns[i].Summary.GroupFormat).Value;
|
|||
|
end;{ else
|
|||
|
begin
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=null;
|
|||
|
end; }
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Cds<64><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>!','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////<2F><><EFBFBD><EFBFBD>ClientDataSet<65>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>Ϣ/////////////////////////////
|
|||
|
function SSetSaveDataCDS10(AdoQueryCmd:TADOQuery;Tv1:TcxGridDBBandedTableView;
|
|||
|
CDS_Sub:TClientDataSet;MyTable:string;MyTag:Integer):Boolean;
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
Result:=False;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if Tv1.Columns[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).AsString)<>'' then
|
|||
|
AdoQueryCmd.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=
|
|||
|
CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).Value;
|
|||
|
end;
|
|||
|
end;
|
|||
|
Result:=True;
|
|||
|
except
|
|||
|
Result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>Cds<64><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣʧ<CFA2><CAA7>!','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>//////////////////////////////////////
|
|||
|
function SGetServerDate(ADOQueryTmp:TADOQuery):TdateTime;
|
|||
|
var
|
|||
|
FSetting : TFormatSettings;
|
|||
|
begin
|
|||
|
try
|
|||
|
FSetting := TFormatSettings.Create(LOCALE_USER_DEFAULT);
|
|||
|
FSetting.ShortDateFormat:='yyyy-MM-dd';
|
|||
|
FSetting.DateSeparator:='-';
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select getDate()as dt');
|
|||
|
open;
|
|||
|
result:=StrToDateTime(formatdatetime('yyyy-MM-dd',fieldByName('dt').AsDatetime),FSetting);
|
|||
|
close;
|
|||
|
SQL.Clear;
|
|||
|
end;
|
|||
|
except
|
|||
|
application.MessageBox('<27><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
function SGetServerDateTime(ADOQueryTmp:TADOQuery):TdateTime;
|
|||
|
begin
|
|||
|
try
|
|||
|
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select getDate()as dt');
|
|||
|
open;
|
|||
|
result:=fieldByName('dt').AsDatetime;
|
|||
|
close;
|
|||
|
SQL.Clear;
|
|||
|
end;
|
|||
|
except
|
|||
|
application.MessageBox('<27><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
function SGetServerDate10(ADOQueryTmp:TADOQuery):TdateTime;
|
|||
|
var
|
|||
|
FSetting : TFormatSettings;
|
|||
|
begin
|
|||
|
try
|
|||
|
FSetting := TFormatSettings.Create(LOCALE_USER_DEFAULT);
|
|||
|
FSetting.ShortDateFormat:='yyyy-MM-dd';
|
|||
|
FSetting.DateSeparator:='-';
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select getDate()as dt');
|
|||
|
open;
|
|||
|
result:=StrToDateTime(formatdatetime('yyyy-MM-dd',fieldByName('dt').AsDatetime),FSetting);
|
|||
|
close;
|
|||
|
SQL.Clear;
|
|||
|
end;
|
|||
|
except
|
|||
|
application.MessageBox('<27><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ֶθ<D6B6>ֵ
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
procedure SSetsavedata(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
with Myparent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TEdit(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TRichEdit(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TcxRichEdit(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TMemo then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TMemo(Controls[i]).Text;
|
|||
|
end;
|
|||
|
if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if (TRTComboBox(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TRTComboBox(Controls[i]).Item2);
|
|||
|
end else
|
|||
|
if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TComboBox(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TCheckBox then
|
|||
|
begin
|
|||
|
if TCheckBox(Controls[i]).Checked=True then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=1
|
|||
|
else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=0;
|
|||
|
end else
|
|||
|
if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
if TBtnEditA(Controls[i]).Hint='<27><><EFBFBD><EFBFBD>' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditA(Controls[i]).Text)
|
|||
|
else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditA(Controls[i]).TxtCode);
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditC(Controls[i]).TxtCode);
|
|||
|
end else
|
|||
|
if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TcxTimeEdit(Controls[i]).Text);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SSetsavedataNew(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
with Myparent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TEdit(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TRichEdit(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TMemo then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TMemo(Controls[i]).Text;
|
|||
|
end;
|
|||
|
if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if (TRTComboBox(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TRTComboBox(Controls[i]).Item2);
|
|||
|
end else
|
|||
|
if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TComboBox(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditA(Controls[i]).TxtCode);
|
|||
|
if (TBtnEditA(Controls[i]).Hint<>'') and (TBtnEditA(Controls[i]).ParentCtl3D=True) then
|
|||
|
ADOQueryCmd.FieldByName(Trim(TBtnEditA(Controls[i]).Hint)).Value:=Trim(TBtnEditA(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditC(Controls[i]).TxtCode);
|
|||
|
//if (TBtnEditC(Controls[i]).Hint<>'') and (TBtnEditC(Controls[i]).ParentCtl3D=True)then
|
|||
|
//ADOQueryCmd.FieldByName(Trim(TBtnEditC(Controls[i]).Hint)).Value:=Trim(TBtnEditC(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TcxTimeEdit(Controls[i]).Text);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure RTSetsavedata(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
with Myparent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TEdit(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TRichEdit(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TMemo then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TMemo(Controls[i]).Text;
|
|||
|
end;
|
|||
|
if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if (TRTComboBox(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TRTComboBox(Controls[i]).Item2);
|
|||
|
end else
|
|||
|
if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TComboBox(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditA(Controls[i]).Text);
|
|||
|
if (TBtnEditA(Controls[i]).Hint<>'') then
|
|||
|
ADOQueryCmd.FieldByName(Trim(TBtnEditA(Controls[i]).Hint)).Value:=Trim(TBtnEditA(Controls[i]).TxtCode);
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditC(Controls[i]).Text);
|
|||
|
if (TBtnEditC(Controls[i]).Hint<>'') then
|
|||
|
ADOQueryCmd.FieldByName(Trim(TBtnEditC(Controls[i]).Hint)).Value:=Trim(TBtnEditC(Controls[i]).TxtCode);
|
|||
|
end else
|
|||
|
if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TcxTimeEdit(Controls[i]).Text);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SSetsaveSql(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
MCode:String;
|
|||
|
begin
|
|||
|
with Myparent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TEdit(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TRichEdit(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TcxRichEdit(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TMemo then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TMemo(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if (TRTComboBox(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TRTComboBox(Controls[i]).Item2);
|
|||
|
end else
|
|||
|
if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TComboBox(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditA(Controls[i]).TxtCode);
|
|||
|
if (TBtnEditA(Controls[i]).Hint<>'') and (TBtnEditA(Controls[i]).ParentCtl3D=True) then
|
|||
|
ADOQueryCmd.FieldByName(Trim(TBtnEditA(Controls[i]).Hint)).Value:=Trim(TBtnEditA(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditC(Controls[i]).TxtCode);
|
|||
|
//if (TBtnEditC(Controls[i]).Hint<>'') and (TBtnEditC(Controls[i]).ParentCtl3D=True)then
|
|||
|
//ADOQueryCmd.FieldByName(Trim(TBtnEditC(Controls[i]).Hint)).Value:=Trim(TBtnEditC(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TcxTimeEdit(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TcxButtonEdit then
|
|||
|
begin
|
|||
|
if (TcxButtonEdit(Controls[i]).BeepOnEnter=True) or (TcxButtonEdit(Controls[i]).ParentShowHint=True) then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TcxButtonEdit(Controls[i]).Text);
|
|||
|
if TcxButtonEdit(Controls[i]).ParentShowHint=False then
|
|||
|
begin
|
|||
|
MCode:=Copy(Trim(Controls[i].Name),1,Length(Trim(Controls[i].Name))-4);
|
|||
|
ADOQueryCmd.FieldByName(MCode).Value:=Trim(TcxButtonEdit(Controls[i]).Hint);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SSetsaveSqlNew(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
MCode:String;
|
|||
|
begin
|
|||
|
with Myparent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TEdit(Controls[i]).Text)
|
|||
|
else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Null;
|
|||
|
end else
|
|||
|
if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TRichEdit(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TCheckBox then
|
|||
|
begin
|
|||
|
if TCheckBox(Controls[i]).Checked=True then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=1
|
|||
|
else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=0;
|
|||
|
end else
|
|||
|
if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TcxRichEdit(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TMemo then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TMemo(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if (TRTComboBox(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TRTComboBox(Controls[i]).Item2);
|
|||
|
end else
|
|||
|
if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TComboBox(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime
|
|||
|
else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=null;
|
|||
|
end else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditA(Controls[i]).Text);
|
|||
|
if (TBtnEditA(Controls[i]).Hint<>'') then
|
|||
|
ADOQueryCmd.FieldByName(Trim(TBtnEditA(Controls[i]).Hint)).Value:=Trim(TBtnEditA(Controls[i]).TxtCode);
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditC(Controls[i]).Text);
|
|||
|
if (TBtnEditC(Controls[i]).Hint<>'') then
|
|||
|
begin
|
|||
|
if Pos('/',TBtnEditC(Controls[i]).Hint)>0 then
|
|||
|
begin
|
|||
|
|
|||
|
end else
|
|||
|
ADOQueryCmd.FieldByName(Trim(TBtnEditC(Controls[i]).Hint)).Value:=Trim(TBtnEditC(Controls[i]).TxtCode);
|
|||
|
end;
|
|||
|
end else
|
|||
|
if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TcxTimeEdit(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=strtofloatdef((TcxCurrencyEdit(Controls[i]).Text),0);
|
|||
|
end else
|
|||
|
if Controls[i] is TcxButtonEdit then
|
|||
|
begin
|
|||
|
if (TcxButtonEdit(Controls[i]).BeepOnEnter=True) or (TcxButtonEdit(Controls[i]).ParentShowHint=True) then
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TcxButtonEdit(Controls[i]).Text);
|
|||
|
if TcxButtonEdit(Controls[i]).ParentShowHint=False then
|
|||
|
begin
|
|||
|
MCode:=Copy(Trim(Controls[i].Name),1,Length(Trim(Controls[i].Name))-4);
|
|||
|
ADOQueryCmd.FieldByName(MCode).Value:=Trim(TcxButtonEdit(Controls[i]).Hint);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SSetsavedata10(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
FFName:string;
|
|||
|
begin
|
|||
|
with Myparent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
FFName:=Trim(Copy(Controls[i].Name,1,(Length(Controls[i].Name)-1)));
|
|||
|
if Controls[i].Tag=MyTag then
|
|||
|
begin
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(FFName).Value:=Trim(TEdit(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(FFName).Value:=TRichEdit(Controls[i]).Text;
|
|||
|
end else
|
|||
|
if Controls[i] is TMemo then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(FFName).Value:=TMemo(Controls[i]).Text;
|
|||
|
end;
|
|||
|
if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if (TRTComboBox(Controls[i]).Text)<>'' then
|
|||
|
ADOQueryCmd.FieldByName(FFName).Value:=Trim(TRTComboBox(Controls[i]).Item2);
|
|||
|
end else
|
|||
|
if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(FFName).Value:=Trim(TComboBox(Controls[i]).Text);
|
|||
|
end else
|
|||
|
if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
ADOQueryCmd.FieldByName(FFName).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
ADOQueryCmd.FieldByName(FFName).Value:=TDateTimePicker(Controls[i]).DateTime;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(FFName).Value:=Trim(TBtnEditA(Controls[i]).TxtCode);
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(FFName).Value:=Trim(TBtnEditC(Controls[i]).TxtCode);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
procedure SSetWinData(ADOQueryTmp:TADOQuery;mParent:TWinControl);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
mfield:string;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if isEmpty then exit;
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
if Controls[i].Tag >=999 then continue;
|
|||
|
mfield:=Controls[i].Name;
|
|||
|
|
|||
|
///////////////////////////
|
|||
|
//EDIT
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
{ if Trim(Controls[i].Hint)='<27><>ֵ' then
|
|||
|
continue
|
|||
|
else }
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end else
|
|||
|
if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
{ if Trim(Controls[i].Hint)='<27><>ֵ' then
|
|||
|
continue
|
|||
|
else }
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if Controls[i].Tag =99 then
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).IndexOfItem2(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end;
|
|||
|
end
|
|||
|
//combobox
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if TComboBox(Controls[i]).Items.Count>0 then
|
|||
|
begin
|
|||
|
//idx:=getCombIdx(TComboBox(Controls[i]),i,trim(fieldByName(mfield).AsString));
|
|||
|
idx:=TComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
idx:=-1;
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
if TBtnEditA(Controls[i]).Tag=1 then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(mfield+'Name').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(mfield).AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(mfield+'Name').AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if IsEmpty or fieldByName(mfield).IsNull then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
TDateTimePicker(Controls[i]).Date:=strToDate('1990-01-01');
|
|||
|
end
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).Date:=fieldByName(mfield).AsDateTime;
|
|||
|
end
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
begin
|
|||
|
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
TcxRichEdit(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxDateEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and not fieldByName(mfield).IsNull then
|
|||
|
TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and ( fieldByName(mfield).AsString<>'') then
|
|||
|
TcxTimeEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
TcxCurrencyEdit(Controls[i]).Text:=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcheckBox then
|
|||
|
begin
|
|||
|
TcheckBox(Controls[i]).Checked:=fieldByName(mfield).asBoolean;
|
|||
|
end;
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure SSetWinData30(ADOQueryTmp:TADOQuery;mParent:TWinControl;FTag:Integer);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
mfield:string;
|
|||
|
ma:TA;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if isEmpty then exit;
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
if Controls[i].Tag<>FTag then continue;
|
|||
|
mfield:=Controls[i].Name;
|
|||
|
|
|||
|
///////////////////////////
|
|||
|
//EDIT
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).IndexOfItem2(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TcxRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//combobox
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if TComboBox(Controls[i]).Items.Count>0 then
|
|||
|
begin
|
|||
|
idx:=TComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
idx:=-1;
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditA(Controls[i]).Hint)<>'' then
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(Trim(TBtnEditA(Controls[i]).Hint)).AsString);
|
|||
|
end else if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditC(Controls[i]).Hint)<>'' then
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(Trim(TBtnEditC(Controls[i]).Hint)).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if IsEmpty or fieldByName(mfield).IsNull then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
TDateTimePicker(Controls[i]).Date:=strToDate('1990-01-01');
|
|||
|
end
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).DateTime:=fieldByName(mfield).AsDateTime;
|
|||
|
end
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
begin
|
|||
|
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxDateEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and not fieldByName(mfield).IsNull then
|
|||
|
TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and ( fieldByName(mfield).AsString<>'') then
|
|||
|
TcxTimeEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
TcxCurrencyEdit(Controls[i]).Text:=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcheckBox then
|
|||
|
begin
|
|||
|
TcheckBox(Controls[i]).Checked:=fieldByName(mfield).asBoolean;
|
|||
|
end else if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
TRichEdit(Controls[i]).Text:=fieldbyname(mfield).AsString;
|
|||
|
end;
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
procedure SClearData(mParent:TWinControl;FTag:Integer);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
begin
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
if Controls[i].Tag<>FTag then continue;
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
TEdit(Controls[i]).Text:='';
|
|||
|
end
|
|||
|
else if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
TRichEdit(Controls[i]).Text:='';
|
|||
|
end
|
|||
|
else if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
TcxRichEdit(Controls[i]).Text:='';
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).Text:='';
|
|||
|
TBtnEditC(Controls[i]).TxtCode:='';
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).Text:='';
|
|||
|
TBtnEditA(Controls[i]).TxtCode:='';
|
|||
|
end
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
idx:=-1;
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SCSHData(ADOQueryTmp:TADOQuery;mParent:TWinControl;FTag:Integer);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
mfield,mfieldCode:string;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if isEmpty then exit;
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
if Controls[i].Tag<>FTag then continue;
|
|||
|
mfield:=Controls[i].Name;
|
|||
|
|
|||
|
///////////////////////////
|
|||
|
//EDIT
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).IndexOfItem2(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TcxRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//combobox
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if TComboBox(Controls[i]).Items.Count>0 then
|
|||
|
begin
|
|||
|
idx:=TComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
idx:=-1;
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditA(Controls[i]).Hint)<>'' then
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(Trim(TBtnEditA(Controls[i]).Hint)).AsString);
|
|||
|
end else if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditC(Controls[i]).Hint)<>'' then
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(Trim(TBtnEditC(Controls[i]).Hint)).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)='' then
|
|||
|
begin
|
|||
|
TDateTimePicker(Controls[i]).Checked:=False;
|
|||
|
end
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).DateTime:=fieldByName(mfield).AsDateTime;
|
|||
|
end
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
begin
|
|||
|
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxDateEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and not fieldByName(mfield).IsNull then
|
|||
|
TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and ( fieldByName(mfield).AsString<>'') then
|
|||
|
TcxTimeEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
TcxCurrencyEdit(Controls[i]).Text:=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcheckBox then
|
|||
|
begin
|
|||
|
TcheckBox(Controls[i]).Checked:=fieldByName(mfield).asBoolean;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxButtonEdit then
|
|||
|
begin
|
|||
|
TcxButtonEdit(Controls[i]).Text:=Trim(fieldbyname(mfield).AsString);
|
|||
|
if TcxButtonEdit(Controls[i]).ParentShowHint=False then
|
|||
|
begin
|
|||
|
mfieldCode:=Trim(Copy(mfield,1,Length(mfield)-4));
|
|||
|
TcxButtonEdit(Controls[i]).Hint:=Trim(fieldbyname(mfieldCode).AsString);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
procedure SCSHDataNew(ADOQueryTmp:TADOQuery;mParent:TWinControl;FTag:Integer);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
mfield,mfieldCode:string;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if isEmpty then exit;
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
if Controls[i].Tag<>FTag then continue;
|
|||
|
mfield:=Controls[i].Name;
|
|||
|
|
|||
|
///////////////////////////
|
|||
|
//EDIT
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString)
|
|||
|
else
|
|||
|
TEdit(Controls[i]).Text:='';
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).IndexOfItem2(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TcxRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//combobox
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if TComboBox(Controls[i]).Items.Count>0 then
|
|||
|
begin
|
|||
|
idx:=TComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
idx:=-1;
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).Text := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditA(Controls[i]).Hint)<>'' then
|
|||
|
TBtnEditA(Controls[i]).TxtCode:= trim(fieldByName(Trim(TBtnEditA(Controls[i]).Hint)).AsString);
|
|||
|
end else if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).Text := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditC(Controls[i]).Hint)<>'' then
|
|||
|
begin
|
|||
|
if Pos('/',TBtnEditC(Controls[i]).Hint)>0 then
|
|||
|
begin
|
|||
|
|
|||
|
end else
|
|||
|
TBtnEditC(Controls[i]).TxtCode:= trim(fieldByName(Trim(TBtnEditC(Controls[i]).Hint)).AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)='' then
|
|||
|
begin
|
|||
|
TDateTimePicker(Controls[i]).Checked:=False;
|
|||
|
end
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).DateTime:=fieldByName(mfield).AsDateTime;
|
|||
|
end
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
begin
|
|||
|
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxDateEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and not fieldByName(mfield).IsNull then
|
|||
|
TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and ( fieldByName(mfield).AsString<>'') then
|
|||
|
TcxTimeEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
TcxCurrencyEdit(Controls[i]).Text:=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcheckBox then
|
|||
|
begin
|
|||
|
if FieldByName(mfield).Value=null then
|
|||
|
TcheckBox(Controls[i]).Checked:=False
|
|||
|
else
|
|||
|
TcheckBox(Controls[i]).Checked:=fieldByName(mfield).asBoolean;
|
|||
|
end else if Controls[i] is TcxButtonEdit then
|
|||
|
begin
|
|||
|
TcxButtonEdit(Controls[i]).Text:=Trim(fieldbyname(mfield).AsString);
|
|||
|
if TcxButtonEdit(Controls[i]).ParentShowHint=False then
|
|||
|
begin
|
|||
|
mfieldCode:=Trim(Copy(mfield,1,Length(mfield)-4));
|
|||
|
TcxButtonEdit(Controls[i]).Hint:=Trim(fieldbyname(mfieldCode).AsString);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
procedure SCSHDataCDS(CDS_Main:TClientDataSet;mParent:TWinControl;FTag:Integer);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
mfield,mfieldCode:string;
|
|||
|
begin
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
if isEmpty then exit;
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
if Controls[i].Tag<>FTag then continue;
|
|||
|
mfield:=Controls[i].Name;
|
|||
|
|
|||
|
///////////////////////////
|
|||
|
//EDIT
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).IndexOfItem2(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TcxRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//combobox
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if TComboBox(Controls[i]).Items.Count>0 then
|
|||
|
begin
|
|||
|
idx:=TComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
idx:=-1;
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditA(Controls[i]).Hint)<>'' then
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(Trim(TBtnEditA(Controls[i]).Hint)).AsString);
|
|||
|
end else if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditC(Controls[i]).Hint)<>'' then
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(Trim(TBtnEditC(Controls[i]).Hint)).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)='' then
|
|||
|
begin
|
|||
|
TDateTimePicker(Controls[i]).Checked:=False;
|
|||
|
end
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).DateTime:=fieldByName(mfield).AsDateTime;
|
|||
|
end
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
begin
|
|||
|
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxDateEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and not fieldByName(mfield).IsNull then
|
|||
|
TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and ( fieldByName(mfield).AsString<>'') then
|
|||
|
TcxTimeEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
TcxCurrencyEdit(Controls[i]).Text:=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcheckBox then
|
|||
|
begin
|
|||
|
TcheckBox(Controls[i]).Checked:=fieldByName(mfield).asBoolean;
|
|||
|
end else if Controls[i] is TcxButtonEdit then
|
|||
|
begin
|
|||
|
TcxButtonEdit(Controls[i]).Text:=Trim(fieldbyname(mfield).AsString);
|
|||
|
if TcxButtonEdit(Controls[i]).ParentShowHint=False then
|
|||
|
begin
|
|||
|
mfieldCode:=Trim(Copy(mfield,1,Length(mfield)-4));
|
|||
|
TcxButtonEdit(Controls[i]).Hint:=Trim(fieldbyname(mfieldCode).AsString);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
procedure SCSHDataWTag(ADOQueryTmp:TADOQuery;mParent:TWinControl);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
mfield,mfieldCode:string;
|
|||
|
ma:TA;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if isEmpty then exit;
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
//if Controls[i].Tag<>FTag then continue;
|
|||
|
mfield:=Controls[i].Name;
|
|||
|
|
|||
|
///////////////////////////
|
|||
|
//EDIT
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).IndexOfItem2(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxRichEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TcxRichEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//combobox
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if TComboBox(Controls[i]).Items.Count>0 then
|
|||
|
begin
|
|||
|
idx:=TComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
idx:=-1;
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditA(Controls[i]).Hint)<>'' then
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(Trim(TBtnEditA(Controls[i]).Hint)).AsString);
|
|||
|
end else if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
if Trim(TBtnEditC(Controls[i]).Hint)<>'' then
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(Trim(TBtnEditC(Controls[i]).Hint)).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)='' then
|
|||
|
begin
|
|||
|
TDateTimePicker(Controls[i]).Checked:=False;
|
|||
|
end
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).DateTime:=fieldByName(mfield).AsDateTime;
|
|||
|
end
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
begin
|
|||
|
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxDateEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and not fieldByName(mfield).IsNull then
|
|||
|
TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and ( fieldByName(mfield).AsString<>'') then
|
|||
|
TcxTimeEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
TcxCurrencyEdit(Controls[i]).Text:=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcheckBox then
|
|||
|
begin
|
|||
|
TcheckBox(Controls[i]).Checked:=fieldByName(mfield).asBoolean;
|
|||
|
end else if Controls[i] is TcxButtonEdit then
|
|||
|
begin
|
|||
|
TcxButtonEdit(Controls[i]).Text:=Trim(fieldbyname(mfield).AsString);
|
|||
|
if TcxButtonEdit(Controls[i]).ParentShowHint=False then
|
|||
|
begin
|
|||
|
mfieldCode:=Trim(Copy(mfield,1,Length(mfield)-4));
|
|||
|
TcxButtonEdit(Controls[i]).Hint:=Trim(fieldbyname(mfieldCode).AsString);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure SSetWinData10(ADOQueryTmp:TADOQuery;mParent:TWinControl);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
mfield:string;
|
|||
|
ma:TA;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if isEmpty then exit;
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
if Controls[i].Tag >=999 then continue;
|
|||
|
//mfield:=Copy(Trim(Controls[i].Name),1,(Length(Trim(Controls[i].Name))-1));
|
|||
|
mfield:=Trim(Controls[i].Name);
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if Controls[i].Tag =99 then
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).IndexOfItem2(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end;
|
|||
|
end
|
|||
|
//combobox
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if TComboBox(Controls[i]).Items.Count>0 then
|
|||
|
begin
|
|||
|
idx:=TComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
idx:=-1;
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
if TBtnEditA(Controls[i]).Tag=1 then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(mfield+'Name').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(mfield).AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(mfield+'Name').AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if IsEmpty or fieldByName(mfield).IsNull then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
TDateTimePicker(Controls[i]).Date:=strToDate('1990-01-01');
|
|||
|
end
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).Date:=fieldByName(mfield).AsDateTime;
|
|||
|
end
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
begin
|
|||
|
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxDateEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and not fieldByName(mfield).IsNull then
|
|||
|
TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and ( fieldByName(mfield).AsString<>'') then
|
|||
|
TcxTimeEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
TcxCurrencyEdit(Controls[i]).Text:=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcheckBox then
|
|||
|
begin
|
|||
|
TcheckBox(Controls[i]).Checked:=fieldByName(mfield).asBoolean;
|
|||
|
end
|
|||
|
{else if Controls[i] is TcxLookupComboBox then
|
|||
|
begin
|
|||
|
TcxLookupComboBox(Controls[i]).EditValue:=fieldByName(mfield).AsString;
|
|||
|
TcxLookupComboBox(Controls[i]).EditingText:=fieldByName(mfield+'name').AsString;
|
|||
|
end};
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
procedure SSetWinData20(ADOQueryTmp:TADOQuery;mParent:TWinControl);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
mfield:string;
|
|||
|
ma:TA;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if isEmpty then exit;
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
if Controls[i].Tag >=999 then continue;
|
|||
|
mfield:=Copy(Trim(Controls[i].Name),1,(Length(Trim(Controls[i].Name))-1));
|
|||
|
//mfield:=Trim(Controls[i].Name);
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString)<>'' then
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if Controls[i].Tag =99 then
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
idx:=TRTComboBox(Controls[i]).IndexOfItem2(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end;
|
|||
|
end
|
|||
|
//combobox
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if TComboBox(Controls[i]).Items.Count>0 then
|
|||
|
begin
|
|||
|
idx:=TComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
idx:=-1;
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
if TBtnEditA(Controls[i]).Tag=1 then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(mfield+'Name').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditA(Controls[i]).text:= trim(fieldByName(mfield).AsString);
|
|||
|
end;
|
|||
|
end
|
|||
|
else if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(mfield+'Name').AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if IsEmpty or fieldByName(mfield).IsNull then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Checked then
|
|||
|
TDateTimePicker(Controls[i]).Date:=strToDate('1990-01-01');
|
|||
|
end
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).Date:=fieldByName(mfield).AsDateTime;
|
|||
|
end
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
begin
|
|||
|
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TcxDateEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and not fieldByName(mfield).IsNull then
|
|||
|
TcxDateEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
if not IsEmpty and ( fieldByName(mfield).AsString<>'') then
|
|||
|
TcxTimeEdit(Controls[i]).text :=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
TcxCurrencyEdit(Controls[i]).Text:=fieldByName(mfield).AsString;
|
|||
|
end
|
|||
|
else if Controls[i] is TcheckBox then
|
|||
|
begin
|
|||
|
TcheckBox(Controls[i]).Checked:=fieldByName(mfield).asBoolean;
|
|||
|
end
|
|||
|
{else if Controls[i] is TcxLookupComboBox then
|
|||
|
begin
|
|||
|
TcxLookupComboBox(Controls[i]).EditValue:=fieldByName(mfield).AsString;
|
|||
|
TcxLookupComboBox(Controls[i]).EditingText:=fieldByName(mfield+'name').AsString;
|
|||
|
end};
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
//////////////////////////////////////////////
|
|||
|
//////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////////////////
|
|||
|
function SDelData(ADOQueryCmd:TADOQuery;mDelStr:String):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
result:=False;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add(mDelStr);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
result:=True;
|
|||
|
except
|
|||
|
result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
////////////////////////////////////////////
|
|||
|
////************<2A><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>***********/////
|
|||
|
////////////////////////////////////////////
|
|||
|
function SGetFilters(TMPanel:TPanel;EquTag,LikeTag:Integer):string;
|
|||
|
var
|
|||
|
i,j,k:Integer;
|
|||
|
fsj,fsj1:String;
|
|||
|
begin
|
|||
|
Result:='';
|
|||
|
with TMPanel do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then Continue;
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
begin
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TEdit(Controls[i]).Text))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
begin
|
|||
|
j:=Pos(' ',Trim(TEdit(Controls[i]).Text));
|
|||
|
if j>0 then
|
|||
|
begin
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Copy(Trim(TEdit(Controls[i]).Text),1,j-1 )+'%');
|
|||
|
fsj1:=Copy(Trim(TEdit(Controls[i]).Text),j+1,Length(Trim(TEdit(Controls[i]).Text)));
|
|||
|
while Trim(fsj1)<>'' do
|
|||
|
begin
|
|||
|
j:=Pos(' ',Trim(fsj1));
|
|||
|
if j>0 then
|
|||
|
begin
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Copy(Trim(fsj1),1,j-1 )+'%');
|
|||
|
fsj1:=Copy(Trim(fsj1),j+1,Length(Trim(fsj1)));
|
|||
|
end else
|
|||
|
begin
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(fsj1)+'%');
|
|||
|
fsj1:='';
|
|||
|
end;
|
|||
|
end;
|
|||
|
end else
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TEdit(Controls[i]).Text)+'%');
|
|||
|
end;
|
|||
|
end;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
if Trim(TBtnEditA(Controls[i]).Text)<>'' then
|
|||
|
begin
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TBtnEditA(Controls[i]).Text))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'Name'+' like '+QuotedStr('%'+Trim(TBtnEditA(Controls[i]).Text)+'%')
|
|||
|
else if Controls[i].Tag=99 then
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TBtnEditA(Controls[i]).TxtCode)+'%')
|
|||
|
else if Controls[i].Tag=100 then
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TBtnEditA(Controls[i]).Text)+'%');
|
|||
|
end;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
if Trim(TBtnEditC(Controls[i]).TxtCode)<>'' then
|
|||
|
begin
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TBtnEditC(Controls[i]).TxtCode))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'Name'+' like '+QuotedStr('%'+Trim(TBtnEditC(Controls[i]).Text)+'%');
|
|||
|
end;
|
|||
|
end else
|
|||
|
if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if Trim(TRTComboBox(Controls[i]).Text)<>'' then
|
|||
|
begin
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TRTComboBox(Controls[i]).Item2))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TRTComboBox(Controls[i]).Item2)+'%');
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if (Trim(TComboBox(Controls[i]).Text)<>'') then
|
|||
|
begin
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TComboBox(Controls[i]).Text))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TComboBox(Controls[i]).Text)+'%');
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(Result)<>'' then
|
|||
|
Result:=Trim(RightBStr(Result,Length(Result)-4));
|
|||
|
end;
|
|||
|
function SGetFiltersHint(TMPanel:TPanel;EquTag,LikeTag:Integer):string;
|
|||
|
var
|
|||
|
i,j,k:Integer;
|
|||
|
fsj,fsj1:String;
|
|||
|
begin
|
|||
|
Result:='';
|
|||
|
with TMPanel do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then Continue;
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
begin
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Hint+'='+QuotedStr(Trim(TEdit(Controls[i]).Text))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
begin
|
|||
|
j:=Pos(' ',Trim(TEdit(Controls[i]).Text));
|
|||
|
if j>0 then
|
|||
|
begin
|
|||
|
Result:=Result+'and '+Controls[i].Hint+' like '+QuotedStr('%'+Copy(Trim(TEdit(Controls[i]).Text),1,j-1 )+'%');
|
|||
|
fsj1:=Copy(Trim(TEdit(Controls[i]).Text),j+1,Length(Trim(TEdit(Controls[i]).Text)));
|
|||
|
while Trim(fsj1)<>'' do
|
|||
|
begin
|
|||
|
j:=Pos(' ',Trim(fsj1));
|
|||
|
if j>0 then
|
|||
|
begin
|
|||
|
Result:=Result+'and '+Controls[i].Hint+' like '+QuotedStr('%'+Copy(Trim(fsj1),1,j-1 )+'%');
|
|||
|
fsj1:=Copy(Trim(fsj1),j+1,Length(Trim(fsj1)));
|
|||
|
end else
|
|||
|
begin
|
|||
|
Result:=Result+'and '+Controls[i].Hint+' like '+QuotedStr('%'+Trim(fsj1)+'%');
|
|||
|
fsj1:='';
|
|||
|
end;
|
|||
|
end;
|
|||
|
end else
|
|||
|
Result:=Result+'and '+Controls[i].Hint+' like '+QuotedStr('%'+Trim(TEdit(Controls[i]).Text)+'%');
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if Trim(Result)<>'' then
|
|||
|
Result:=Trim(RightBStr(Result,Length(Result)-4));
|
|||
|
end;
|
|||
|
|
|||
|
function SGetFinds(TMPanel:TPanel;EquTag,LikeTag:Integer):string;
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
Result:='';
|
|||
|
with TMPanel do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then Continue;
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(TEdit(Controls[i]).Text)<>'' then
|
|||
|
begin
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TEdit(Controls[i]).Text))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TEdit(Controls[i]).Text)+'%');
|
|||
|
end;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
if Trim(TBtnEditA(Controls[i]).Text)<>'' then
|
|||
|
begin
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TBtnEditA(Controls[i]).TxtCode))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'Name'+' like '+QuotedStr('%'+Trim(TBtnEditA(Controls[i]).Text)+'%');
|
|||
|
end;
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditC then
|
|||
|
begin
|
|||
|
if Trim(TBtnEditC(Controls[i]).TxtCode)<>'' then
|
|||
|
begin
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TBtnEditC(Controls[i]).TxtCode))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'Name'+' like '+QuotedStr('%'+Trim(TBtnEditC(Controls[i]).Text)+'%');
|
|||
|
end;
|
|||
|
end else
|
|||
|
if Controls[i] is TRTComboBox then
|
|||
|
begin
|
|||
|
if Trim(TRTComboBox(Controls[i]).Text)<>'' then
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TRTComboBox(Controls[i]).Item2))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TRTComboBox(Controls[i]).Item2)+'%');
|
|||
|
end else
|
|||
|
if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
if Trim(TComboBox(Controls[i]).Text)<>'' then
|
|||
|
if Controls[i].Tag=EquTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TComboBox(Controls[i]).Text))
|
|||
|
else if Controls[i].Tag=LikeTag then
|
|||
|
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TComboBox(Controls[i]).Text)+'%');
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD>ù<EFBFBD><C3B9>˺<EFBFBD><CBBA><EFBFBD>
|
|||
|
////////////////////////////////////////////////////////////
|
|||
|
procedure SDofilter(ADOQry:TADOQuery;FilterStr:string);
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQry.DisableControls;
|
|||
|
with ADOQry do
|
|||
|
begin
|
|||
|
if Trim(FilterStr)='' then
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Filter:=FilterStr;
|
|||
|
Filtered:=True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
ADOQry.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SDofilter10(cds_Main:TClientDataSet;FilterStr:string);
|
|||
|
begin
|
|||
|
try
|
|||
|
cds_Main.DisableControls;
|
|||
|
with cds_Main do
|
|||
|
begin
|
|||
|
if Trim(FilterStr)='' then
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Filter:=FilterStr;
|
|||
|
Filtered:=True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
cds_Main.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
function SGetMaxNo(MyAdoQuery:TADOQuery;MyTable:string;MyField:string;MyFlag:string):String;
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
result:='';
|
|||
|
fsj:=Trim(Formatdatetime('yyyyMMdd',Now));
|
|||
|
i:=Length(Trim(MyFlag));
|
|||
|
with MyAdoQuery do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select Max('+MyField+') MaxNo from '+MyTable);
|
|||
|
SQL.Add('where '+MyField+' like '+QuotedStr('%'+fsj+'%'));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with MyAdoQuery do
|
|||
|
begin
|
|||
|
if Trim(fieldbyname('MaxNo').AsString)='' then
|
|||
|
begin
|
|||
|
Result:=Trim(MyFlag)+Trim(Formatdatetime('yyyyMMdd',Now))+'1001';
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
end;
|
|||
|
fsj:=Trim(MyAdoQuery.fieldbyname('MaxNo').AsString);
|
|||
|
result:=Trim(MyFlag)+Trim(Formatdatetime('yyyyMMdd',Now))+IntToStr(StrtoInt(Copy(fsj,i+9,Length(fsj)-i-8))+1);
|
|||
|
|
|||
|
except
|
|||
|
Result:='';
|
|||
|
Application.MessageBox(PChar('<27>ֶ<EFBFBD>ȡֵMaxNo<4E><6F><EFBFBD>鿴<F3A3ACB2><E9BFB4><'+Trim(MyTable)+'><3E><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD><'+MyField+'>'),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SCreateCDS20(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
mfieldName:string;
|
|||
|
mSize:integer;
|
|||
|
begin
|
|||
|
mfieldName:='';
|
|||
|
// mClientDataset.Close;
|
|||
|
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('Sflag',ftString,1);
|
|||
|
mClientDataset.FieldDefs.Add('Sindex',ftInteger,0);
|
|||
|
mClientDataset.FieldDefs.Add('Ssel',ftBoolean,0);
|
|||
|
mClientDataset.FieldDefs.Add('SDefNote',ftString,20);
|
|||
|
mClientDataset.Close;
|
|||
|
mClientDataset.CreateDataSet;
|
|||
|
end;
|
|||
|
procedure SCreateCDSOnly(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.Close;
|
|||
|
mClientDataset.CreateDataSet;
|
|||
|
end;
|
|||
|
procedure SInitCDSData20(fromADO:TADOQuery;toCDS:TclientDataSet);
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
k:integer;
|
|||
|
begin
|
|||
|
if fromADO.IsEmpty then exit;
|
|||
|
fromADO.DisableControls;
|
|||
|
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('Sflag').AsString :='1';
|
|||
|
fieldByName('Sindex').value :=k;
|
|||
|
fieldByName('Ssel').value :=false;
|
|||
|
fieldByName('SDefNote').value :='';
|
|||
|
inc(k);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
fromADO.Next;
|
|||
|
end;
|
|||
|
if not toCDS.IsEmpty then
|
|||
|
begin
|
|||
|
toCDS.First ;
|
|||
|
end;
|
|||
|
finally
|
|||
|
toCDS.First;
|
|||
|
toCDS.EnableControls;
|
|||
|
fromADO.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SInitCDSDataOnly(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;
|
|||
|
inc(k);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
fromADO.Next;
|
|||
|
end;
|
|||
|
if not toCDS.IsEmpty then
|
|||
|
begin
|
|||
|
toCDS.First ;
|
|||
|
end;
|
|||
|
finally
|
|||
|
toCDS.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SInitFtComBoxBySql(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TRTComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean;
|
|||
|
mSql:string
|
|||
|
);
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(mSql);
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar(showMsg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
cb.Clear;
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
if Boxtype=0 then
|
|||
|
begin
|
|||
|
cb.Items.Add(trim(fieldByName('Name').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
cb.AddItem2(trim(fieldByName('Name').AsString),nil,trim(fieldByName('code').AsString));
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
|
|||
|
if not emptyFlag then
|
|||
|
cb.Items.Add('');
|
|||
|
|
|||
|
if emptyFlag and (cb.Items.Count >0) then
|
|||
|
cb.ItemIndex :=0;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SInitComBoxBySql(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TComboBox;
|
|||
|
emptyFlag:Boolean;
|
|||
|
mSql:string
|
|||
|
);
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(mSql);
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
//plication.MessageBox(pChar(showMsg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
cb.Clear;
|
|||
|
if not emptyFlag then
|
|||
|
cb.Items.Add('');
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
cb.Items.Add(trim(fieldByName('Name').AsString));
|
|||
|
next;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
if emptyFlag and (cb.Items.Count >0) then
|
|||
|
cb.ItemIndex :=0;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>combox<6F>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F><>XC_CustCode<64><65><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:0; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>1;
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure SInitComBoxByCustCode(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
var
|
|||
|
A:TA;
|
|||
|
begin
|
|||
|
cb.Items.Clear ;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add('exec P_Get_XC_Custcode');
|
|||
|
sql.Add(quotedStr(trim(flagType)));
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣά<CFA2><CEAC>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>'+showMsg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
if Boxtype=0 then
|
|||
|
begin
|
|||
|
cb.Items.Add(trim(fieldByName('name').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
A := TA.Create(Nil);
|
|||
|
A.s:= trim(fieldByName('code').AsString);
|
|||
|
cb.Items.AddObject(trim(fieldByName('name').AsString),TObject(a));
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
|
|||
|
if not emptyFlag then
|
|||
|
cb.Items.Add('');
|
|||
|
|
|||
|
if emptyFlag and (cb.Items.Count >0) then
|
|||
|
cb.ItemIndex :=0;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SInitCxGridComboBoxByCustCode(ADOQueryTmp:TADOQuery;c3:TcxGriddbColumn;
|
|||
|
FlagType:string;PState:Integer;IsNull:Boolean;Shmeg:string);
|
|||
|
var
|
|||
|
A:TA;
|
|||
|
begin
|
|||
|
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Clear ;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(' select * from XC_CustCode '+
|
|||
|
' where Flag='''+trim(FlagType)+''' '+
|
|||
|
' order by orderno ');
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣά<CFA2><CEAC>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD>:'+shmeg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
A := TA.Create(Nil);
|
|||
|
A.s:= trim(fieldByName('Code').AsString);
|
|||
|
if PState=1 then
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.AddObject(trim(fieldByName('name').AsString),TObject(A))
|
|||
|
else if PState=0 then
|
|||
|
begin
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Add(trim(fieldByName('name').AsString));
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
if not IsNull then
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Add('');
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure SInitCxGridComboBoxBySql(ADOQueryTmp:TADOQuery;c3:TcxGriddbColumn;FSql:string;
|
|||
|
PState:Integer;IsNull:Boolean;Shmeg:string);
|
|||
|
var
|
|||
|
A:TA;
|
|||
|
begin
|
|||
|
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Clear ;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(FSql);
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
//Application.MessageBox(PChar('δ<>ҵ<EFBFBD>:'+shmeg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
A := TA.Create(Nil);
|
|||
|
A.s:= trim(fieldByName('Code').AsString);
|
|||
|
if PState=1 then
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.AddObject(trim(fieldByName('name').AsString),TObject(A))
|
|||
|
else if PState=0 then
|
|||
|
begin
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Add(trim(fieldByName('name').AsString));
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
if not IsNull then
|
|||
|
begin
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Add('');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
procedure SInitCxBandGridComboBoxBySql(ADOQueryTmp:TADOQuery;c3:TcxGridDBBandedColumn;FSql:string;
|
|||
|
PState:Integer;IsNull:Boolean;Shmeg:string);
|
|||
|
var
|
|||
|
A:TA;
|
|||
|
begin
|
|||
|
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Clear ;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(FSql);
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('δ<>ҵ<EFBFBD>:'+shmeg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
A := TA.Create(Nil);
|
|||
|
A.s:= trim(fieldByName('Code').AsString);
|
|||
|
if PState=1 then
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.AddObject(trim(fieldByName('name').AsString),TObject(A))
|
|||
|
else if PState=0 then
|
|||
|
begin
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Add(trim(fieldByName('name').AsString));
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
if not IsNull then
|
|||
|
begin
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Add('');
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
///////////////////////////////////////////////////
|
|||
|
//*****<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ***** //
|
|||
|
/////////////////////////////////////////////////
|
|||
|
function SSWR(s: real): real;
|
|||
|
var
|
|||
|
r1, r2: real;
|
|||
|
s1, s2: string;
|
|||
|
begin
|
|||
|
r1:= int(s);
|
|||
|
r2:= frac(s);
|
|||
|
s1:= copy(floattostr(r1), 1, length(floattostr(r1)));
|
|||
|
if length(floattostr(r2)) >= 5 then
|
|||
|
begin
|
|||
|
if strtoint(copy((floattostr(r2)), 5, 1)) >= 5 then
|
|||
|
if strtoint(copy((floattostr(r2)), 4, 1)) = 9 then
|
|||
|
if strtoint(copy((floattostr(r2)), 3, 1)) = 9 then
|
|||
|
begin
|
|||
|
s1:= inttostr(strtoint(s1) + 1);
|
|||
|
s2:= '';
|
|||
|
end
|
|||
|
else
|
|||
|
S2:= inttostr(strtoint(copy((floattostr(r2)), 3, 1)) + 1)
|
|||
|
else
|
|||
|
if copy((floattostr(r2)), 3, 1) = '0' then
|
|||
|
S2:= '0' + inttostr(strtoint(copy(floattostr(r2), 3, 2)) + 1)
|
|||
|
else
|
|||
|
s2:= inttostr(strtoint(copy(floattostr(r2), 3, 2)) + 1)
|
|||
|
else
|
|||
|
s2:= copy(floattostr(r2), 3, 2);
|
|||
|
end
|
|||
|
else
|
|||
|
s2:= copy(floattostr(r2), 3, 2);
|
|||
|
result := strtofloat(s1 + '.' + s2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure SInitCDSDataSel(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('Sflag').AsString :='1';
|
|||
|
//fieldByName('Sindex').value :=k;
|
|||
|
fieldByName('Ssel').value :=false;
|
|||
|
inc(k);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
fromADO.Next;
|
|||
|
end;
|
|||
|
if not toCDS.IsEmpty then
|
|||
|
begin
|
|||
|
toCDS.First ;
|
|||
|
end;
|
|||
|
finally
|
|||
|
toCDS.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure SCreateCDSSel(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('Sflag',ftString,1);
|
|||
|
mClientDataset.FieldDefs.Add('Sindex',ftInteger,0);
|
|||
|
mClientDataset.FieldDefs.Add('Ssel',ftBoolean,0);
|
|||
|
mClientDataset.FieldDefs.Add('SDefNote',ftString,10);
|
|||
|
mClientDataset.Close;
|
|||
|
mClientDataset.CreateDataSet;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
procedure CopyAddRow(Tv1:TcxGridDBTableView;CDS_Sub:TClientDataSet);
|
|||
|
var
|
|||
|
AA:array[0..50] of string;
|
|||
|
i,j:Integer;
|
|||
|
begin
|
|||
|
if CDS_Sub.IsEmpty then
|
|||
|
begin
|
|||
|
CDS_Sub.Append;
|
|||
|
CDS_Sub.Post;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
AA[i]:=Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).AsString);
|
|||
|
end;
|
|||
|
with CDS_Sub do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if AA[i]<>'' then
|
|||
|
begin
|
|||
|
CDS_Sub.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=AA[i];
|
|||
|
end;
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure CopyAddRowBand(Tv1:TcxGridDBBandedTableView;CDS_Sub:TClientDataSet);
|
|||
|
var
|
|||
|
AA:array[0..50] of string;
|
|||
|
i,j:Integer;
|
|||
|
begin
|
|||
|
if CDS_Sub.IsEmpty then
|
|||
|
begin
|
|||
|
CDS_Sub.Append;
|
|||
|
CDS_Sub.Post;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
AA[i]:=Trim(CDS_Sub.fieldbyname(Tv1.Columns[i].DataBinding.FieldName).AsString);
|
|||
|
end;
|
|||
|
with CDS_Sub do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
for i:=0 to Tv1.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if AA[i]<>'' then
|
|||
|
begin
|
|||
|
CDS_Sub.FieldByName(Tv1.Columns[i].DataBinding.FieldName).Value:=AA[i];
|
|||
|
end;
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
procedure CopyAddRowCDS(CDS_Sub:TClientDataSet);
|
|||
|
var
|
|||
|
AA:array[0..100] of string;
|
|||
|
i,j:Integer;
|
|||
|
begin
|
|||
|
|
|||
|
if CDS_Sub.IsEmpty then Exit;
|
|||
|
for i:=0 to CDS_Sub.FieldCount-1 do
|
|||
|
begin
|
|||
|
AA[i]:=Trim(CDS_Sub.fieldbyname(CDS_Sub.Fields[i].FieldName).AsString);
|
|||
|
end;
|
|||
|
with CDS_Sub do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
for i:=0 to CDS_Sub.FieldCount-1 do
|
|||
|
begin
|
|||
|
if AA[i]<>'' then
|
|||
|
begin
|
|||
|
CDS_Sub.FieldByName(CDS_Sub.Fields[i].FieldName).Value:=AA[i];
|
|||
|
end;
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure OneKeyPost(Tv1:TcxGridDBTableView;CDS_Sub:TClientDataSet);
|
|||
|
var
|
|||
|
FValue,FFValue,FColumn,FFColumn:String;
|
|||
|
begin
|
|||
|
//FColumn:=tv1.Columns[Tv1.Controller.FocusedColumnIndex].DataBinding.FieldName;
|
|||
|
//FFColumn:=Tv1.Columns[Tv1.Controller.FocusedColumnIndex].Summary.GroupFormat;
|
|||
|
FColumn:=Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
|||
|
FFColumn:=Tv1.Controller.FocusedColumn.Summary.GroupFormat;
|
|||
|
FValue:=Trim(CDS_Sub.fieldbyname(FColumn).AsString);
|
|||
|
if Trim(FFColumn)<>'' then
|
|||
|
begin
|
|||
|
FFValue:=Trim(CDS_Sub.fieldbyname(FFColumn).AsString);
|
|||
|
end;
|
|||
|
with CDS_Sub do
|
|||
|
begin
|
|||
|
DisableControls;
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
if FValue='' then
|
|||
|
begin
|
|||
|
CDS_Sub.FieldByName(FColumn).Value:=null;
|
|||
|
end else
|
|||
|
begin
|
|||
|
CDS_Sub.FieldByName(FColumn).Value:=FValue;
|
|||
|
end;
|
|||
|
if Trim(FFColumn)<>'' then
|
|||
|
begin
|
|||
|
if FFValue='' then
|
|||
|
begin
|
|||
|
CDS_Sub.FieldByName(FFColumn).Value:=null;
|
|||
|
end else
|
|||
|
begin
|
|||
|
CDS_Sub.FieldByName(FFColumn).Value:=FFValue;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Post;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
///////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>ȡ<EFBFBD><C8A1>ˮ<EFBFBD><CBAE>
|
|||
|
//mFlag:ǰ<C7B0><D7BA>mTable:<3A><><EFBFBD><EFBFBD>
|
|||
|
//mlen:<3A><>ˮ<EFBFBD>ų<EFBFBD><C5B3><EFBFBD>; mtype:<3A>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<><31><EFBFBD><EFBFBD> 0 <20><><EFBFBD><EFBFBD>
|
|||
|
///////////////////////////////////////////////////
|
|||
|
function GetLSNo(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mFlag:string;
|
|||
|
mTable:string;
|
|||
|
mlen:integer;
|
|||
|
mtype:integer=0):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('exec Get_SY_MaxBH ');
|
|||
|
sql.Add(' '+quotedStr(trim(mFlag)));
|
|||
|
sql.Add(','+quotedStr(trim(mTable)));
|
|||
|
sql.Add(','+intTostr(mlen));
|
|||
|
sql.Add(','+intTostr(mtype));
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
begin
|
|||
|
mMaxNo:=trim(fieldByName('MaxBH').AsString) ;
|
|||
|
if mMaxNo<>'' then
|
|||
|
result:=true
|
|||
|
else
|
|||
|
Result:=false;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
result:=false;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
if not Result then
|
|||
|
application.MessageBox(Pchar('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
Except
|
|||
|
result:=false;
|
|||
|
application.MessageBox(Pchar('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure ReadCxGrid(fileName:string;cxgrid:TcxGridDBTableView;filePack:string='<27><><EFBFBD><EFBFBD>');
|
|||
|
var
|
|||
|
mFileName:string;
|
|||
|
begin
|
|||
|
mFileName := ExtractFilePath(Application.ExeName)+'Layout\' +filePack+'\'+trim(fileName)+ '.dbg';
|
|||
|
//<2F>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>лָ<D0BB>
|
|||
|
if FileExists(mFileName) then
|
|||
|
cxgrid.RestoreFromIniFile(mFileName,false,false);
|
|||
|
CreateGroupSummarry(cxgrid);
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ж<EFBFBD>ȡcxGridCol<6F><6C><EFBFBD><EFBFBD>
|
|||
|
//fileName <20>Ƽ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ڵ<EFBFBD>caption<6F><6E><EFBFBD><EFBFBD>caption<6F><6E><EFBFBD><EFBFBD>
|
|||
|
///////////////////////////////////////////////////////////////
|
|||
|
procedure ReadCxBandedGrid(fileName:string;cxgrid:TcxGridDBBandedTableView;filePack:string='<27><><EFBFBD><EFBFBD>');
|
|||
|
var
|
|||
|
mFileName:string;
|
|||
|
begin
|
|||
|
mFileName := ExtractFilePath(Application.ExeName)+'Layout\' +filePack+'\'+trim(fileName)+ '.dbg';
|
|||
|
//<2F>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>лָ<D0BB>
|
|||
|
if FileExists(mFileName) then
|
|||
|
cxgrid.RestoreFromIniFile(mFileName,false,false);
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>дcxGridCol<6F><6C><EFBFBD>õ<EFBFBD>.dbg<62>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
//Ĭ<><C4AC><EFBFBD>Ƽ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ڵ<EFBFBD>caption<6F><6E><EFBFBD><EFBFBD>
|
|||
|
///////////////////////////////////////////////////////////////
|
|||
|
procedure WriteCxGrid(fileName:string;cxgrid:TcxGridDBTableView;filePack:string='<27><><EFBFBD><EFBFBD>');
|
|||
|
var
|
|||
|
mFileName:string;
|
|||
|
begin
|
|||
|
mFileName := ExtractFilePath(Application.ExeName)+'Layout\' +filePack+'\'+trim(fileName)+ '.dbg';
|
|||
|
if not DirectoryExists(ExtractFileDir(mFileName)) then
|
|||
|
CreateDir(ExtractFileDir(mFileName));
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|||
|
cxgrid.StoreToIniFile(mFileName);
|
|||
|
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>дcxGridCol<6F><6C><EFBFBD>õ<EFBFBD>.dbg<62>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
//Ĭ<><C4AC><EFBFBD>Ƽ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ڵ<EFBFBD>caption<6F><6E><EFBFBD><EFBFBD>
|
|||
|
///////////////////////////////////////////////////////////////
|
|||
|
procedure WriteCxBandedGrid(fileName:string;cxgrid:TcxGridDBBandedTableView;filePack:string='<27><><EFBFBD><EFBFBD>');
|
|||
|
var
|
|||
|
mFileName:string;
|
|||
|
begin
|
|||
|
mFileName := ExtractFilePath(Application.ExeName)+'Layout\' +filePack+'\'+trim(fileName)+ '.dbg';
|
|||
|
if not DirectoryExists(ExtractFileDir(mFileName)) then
|
|||
|
CreateDir(ExtractFileDir(mFileName));
|
|||
|
//<2F><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|||
|
cxgrid.StoreToIniFile(mFileName);
|
|||
|
end;
|
|||
|
|
|||
|
procedure CreateGroupSummarry(tv1:TcxGridDBTableView);
|
|||
|
var
|
|||
|
csg : TcxDataSummaryGroup;
|
|||
|
csglink : TcxDataSummaryGroupItemLink;
|
|||
|
csgItem : TcxDataSummaryItem;
|
|||
|
i:integer;
|
|||
|
mFieldName:string;
|
|||
|
begin
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
with tv1.DataController.Summary do
|
|||
|
begin
|
|||
|
try
|
|||
|
csg := DataController.Summary.SummaryGroups.Add; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
csg.Links.Clear;
|
|||
|
for i:= 0 to tv1.ColumnCount -1 do
|
|||
|
begin
|
|||
|
if not tv1.Columns[i].Visible then continue;
|
|||
|
mFieldName:=tv1.Columns[i].DataBinding.FieldName;
|
|||
|
|
|||
|
if tv1.Columns[i].Summary.FooterKind=skSum then
|
|||
|
begin
|
|||
|
// (tv1.DataController.DataSet.Fields[i] as TNumericField).DisplayFormat := '#,0.00;-#,0.00;#';
|
|||
|
//tv1.Columns[i].Summary.FooterFormat:='0.0';
|
|||
|
//tv1.Columns[i].Summary.FooterKind := skSum;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Group Row<6F>ϵĻ<CFB5><C4BB><EFBFBD>ͬʱʹ<CAB1><CAB9>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ч
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵĻ<CFB5><C4BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
csgitem := csg.SummaryItems.Add;
|
|||
|
csgitem.ItemLink := tv1.Columns[i]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>1
|
|||
|
csgitem.Position :=spGroup;
|
|||
|
csgitem.Kind := skSum;
|
|||
|
csgItem.Format := trim(tv1.Columns[i].Caption) +'С<><D0A1>=#,0.0';
|
|||
|
|
|||
|
tv1.Columns[i].Summary.GroupFooterKind := skSum;
|
|||
|
tv1.Columns[i].Summary.GroupFooterFormat := '#,0.00';
|
|||
|
|
|||
|
end
|
|||
|
else if tv1.Columns[i].Summary.FooterKind=skCount then
|
|||
|
begin
|
|||
|
// (tv1.DataController.DataSet.Fields[i] as TNumericField).DisplayFormat := '#,0.00;-#,0.00;#';
|
|||
|
//tv1.Columns[i].Summary.FooterFormat:='0.0';
|
|||
|
tv1.Columns[i].Summary.FooterKind := skCount;
|
|||
|
|
|||
|
tv1.Columns[i].Summary.GroupFooterKind := skCount;
|
|||
|
|
|||
|
//tv1.Columns[i].Summary.GroupFooterFormat := '#,0.00';
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Group Row<6F>ϵĻ<CFB5><C4BB><EFBFBD>ͬʱʹ<CAB1><CAB9>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ч
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>з<EFBFBD><D0B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵĻ<CFB5><C4BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
csgitem := csg.SummaryItems.Add;
|
|||
|
csgitem.ItemLink := tv1.Columns[i]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>1
|
|||
|
csgitem.Kind := skCount;
|
|||
|
//csgItem.Format := 'С<><D0A1>=#,0.0';
|
|||
|
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
csglink := csg.Links.Add;
|
|||
|
csglink.ItemLink := tv1.Columns[i]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
|||
|
//<2F><><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><DCB5>ж<EFBFBD><D0B6>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>飬<EFBFBD><E9A3AC><EFBFBD>뽫<EFBFBD><EBBDAB>Щ<EFBFBD>м<EFBFBD><D0BC>뵽
|
|||
|
//SummaryGroupItemLink<6E>У<EFBFBD>û<EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|||
|
//<2F><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
finally
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TcxGridToExcel(mfileName:string;gridName:TcxGrid);
|
|||
|
var
|
|||
|
saveDialog:TSaveDialog;
|
|||
|
begin
|
|||
|
try
|
|||
|
saveDialog:=TSaveDialog.Create(nil);
|
|||
|
saveDialog.Filter:='xls(*.xls)|*.xls|ȫ<><C8AB>(*.*)|*.*';
|
|||
|
saveDialog.Options:=[ofOverwritePrompt];
|
|||
|
saveDialog.FileName:=mfileName;
|
|||
|
if saveDialog.Execute then
|
|||
|
if Assigned(gridName) then
|
|||
|
begin
|
|||
|
try
|
|||
|
|
|||
|
ExportGridToExcel(saveDialog.FileName,gridName);
|
|||
|
except
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>,Դ<>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ܴ<EFBFBD><DCB4>ڱ༭״̬!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
application.MessageBox('<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
end
|
|||
|
else
|
|||
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
finally
|
|||
|
saveDialog.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
function ReadINIFileStr(ininame,TypeName:string;ValueName,ValueMR:String):string;
|
|||
|
var
|
|||
|
programIni:Tinifile; //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
FileName,ValueZS:string;
|
|||
|
begin
|
|||
|
FileName:=ExtractFilePath(Paramstr(0))+ininame;
|
|||
|
programIni:=Tinifile.create(FileName);
|
|||
|
ValueZS:=programIni.ReadString(TypeName,ValueName,ValueMR);
|
|||
|
Result:=ValueZS;
|
|||
|
programIni.Free;
|
|||
|
end;
|
|||
|
|
|||
|
procedure SelExportData(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTile:string);
|
|||
|
var
|
|||
|
i,j:Integer;
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if FAdoQry.IsEmpty then Exit;
|
|||
|
try
|
|||
|
frmSelExportField:=TfrmSelExportField.Create(Application);
|
|||
|
with frmSelExportField do
|
|||
|
begin
|
|||
|
with frmSelExportField.ExpGrid do
|
|||
|
begin
|
|||
|
// ExpGrid.Columns.Clear;
|
|||
|
ExpGrid.ClearItems;
|
|||
|
frmSelExportField.IniName:=FTile;
|
|||
|
{if FTv.OptionsView.Footer=true then
|
|||
|
begin
|
|||
|
ExpGrid.OptionsView.Footer:=True;
|
|||
|
end else
|
|||
|
begin
|
|||
|
ExpGrid.OptionsView.Footer:=False;
|
|||
|
end; }
|
|||
|
ExpGrid.OptionsView.Footer:=FTv.OptionsView.Footer;
|
|||
|
for i:=0 to FTv.ColumnCount-1 do
|
|||
|
begin
|
|||
|
//if FTv.Columns[i].Visible=True then
|
|||
|
begin
|
|||
|
ExpGrid.CreateColumn;
|
|||
|
j:=ExpGrid.ColumnCount-1;
|
|||
|
ExpGrid.Columns[j].Caption:=FTv.Columns[i].Caption;
|
|||
|
ExpGrid.Columns[i].Visible:=FTv.Columns[i].Visible;
|
|||
|
ExpGrid.Columns[j].DataBinding.FieldName:=FTv.Columns[i].DataBinding.FieldName;
|
|||
|
ExpGrid.Columns[j].Width:=FTv.Columns[i].Width;
|
|||
|
ExpGrid.Columns[i].Summary.FooterKind:=FTv.Columns[i].Summary.FooterKind;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ExportDataSource.DataSet:=FAdoQry;
|
|||
|
FAdoQry.Open;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
frmSelExportField.Free;
|
|||
|
except
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SelExportDataBand(FTv:TcxGridDBBandedTableView;FAdoQry:TADOQuery;FTile:string);
|
|||
|
var
|
|||
|
i,j:Integer;
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
if FAdoQry.IsEmpty then Exit;
|
|||
|
try
|
|||
|
frmSelExportField:=TfrmSelExportField.Create(Application);
|
|||
|
with frmSelExportField do
|
|||
|
begin
|
|||
|
with frmSelExportField.ExpGrid do
|
|||
|
begin
|
|||
|
// ExpGrid.Columns.Clear;
|
|||
|
ExpGrid.ClearItems;
|
|||
|
frmSelExportField.IniName:=FTile;
|
|||
|
{if FTv.OptionsView.Footer=true then
|
|||
|
begin
|
|||
|
ExpGrid.OptionsView.Footer:=True;
|
|||
|
end else
|
|||
|
begin
|
|||
|
ExpGrid.OptionsView.Footer:=False;
|
|||
|
end; }
|
|||
|
ExpGrid.OptionsView.Footer:=FTv.OptionsView.Footer;
|
|||
|
for i:=0 to FTv.ColumnCount-1 do
|
|||
|
begin
|
|||
|
if FTv.Columns[i].Visible=True then
|
|||
|
begin
|
|||
|
ExpGrid.CreateColumn;
|
|||
|
j:=ExpGrid.ColumnCount-1;
|
|||
|
ExpGrid.Columns[j].Caption:=FTv.Columns[i].Caption;
|
|||
|
ExpGrid.Columns[j].DataBinding.FieldName:=FTv.Columns[i].DataBinding.FieldName;
|
|||
|
ExpGrid.Columns[j].Width:=FTv.Columns[i].Width;
|
|||
|
ExpGrid.Columns[i].Summary.FooterKind:=FTv.Columns[i].Summary.FooterKind;
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ExportDataSource.DataSet:=FAdoQry;
|
|||
|
FAdoQry.Open;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
frmSelExportField.Free;
|
|||
|
except
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure ColumnView(AdoQueryTemp:TADOQuery;Tv1:TcxGridDBTableView;MKName10:string);
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Table_Column where CxTabName='''+Trim(MKName10)+''' and Owner='''+Trim(DCode)+'''');
|
|||
|
sql.Add(' and TCNotVisble=1 ');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
|
|||
|
TV1.GetColumnByFieldName(ADOQueryTemp.fieldbyname('ColName').AsString).Visible:=False;
|
|||
|
TV1.GetColumnByFieldName(ADOQueryTemp.fieldbyname('ColName').AsString).Hidden:=True;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure ColumnBandView(AdoQueryTemp:TADOQuery;Tv1:TcxGridDBBandedTableView;MKName10:string);
|
|||
|
var
|
|||
|
fsj:string;
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Table_Column where CxTabName='''+Trim(MKName10)+''' and Owner='''+Trim(DCode)+'''');
|
|||
|
sql.Add(' and TCNotVisble=1 ');
|
|||
|
open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
fsj:=Trim(ADOQueryTemp.fieldbyname('ColName').AsString);
|
|||
|
// Tv1.Controller.ge
|
|||
|
Tv1.GetColumnByFieldName(fsj).Visible:=False;
|
|||
|
Tv1.GetColumnByFieldName(fsj).Hidden:=True;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure ColumnSet(TV10:TcxGridDBTableView;MKName10:String);
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmColumnSet:=TfrmColumnSet.Create(Application);
|
|||
|
with frmColumnSet do
|
|||
|
begin
|
|||
|
ADOQuery2.DisableControls;
|
|||
|
with ADOQuery2 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Table_Column where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery2,ClientDataSet2);
|
|||
|
SInitCDSData20(ADOQuery2,ClientDataSet2);
|
|||
|
ADOQuery2.EnableControls;
|
|||
|
MKName:=MKName10;
|
|||
|
for i:=0 to TV10.ColumnCount-1 do
|
|||
|
begin
|
|||
|
with ClientDataSet2 do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CxTabName').Value:=MKName;
|
|||
|
FieldByName('CxColName').Value:=Trim(TV10.Columns[i].Caption);
|
|||
|
FieldByName('ColName').Value:=Trim(TV10.Columns[i].DataBinding.FieldName);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmColumnSet.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure ColumnBandSet(TV10:TcxGridDBBandedTableView;MKName10:String);
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
try
|
|||
|
frmColumnBandSet:=TfrmColumnBandSet.Create(Application);
|
|||
|
with frmColumnBandSet do
|
|||
|
begin
|
|||
|
ADOQuery2.DisableControls;
|
|||
|
with ADOQuery2 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Table_Column where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery2,ClientDataSet2);
|
|||
|
SInitCDSData20(ADOQuery2,ClientDataSet2);
|
|||
|
ADOQuery2.EnableControls;
|
|||
|
MKName:=MKName10;
|
|||
|
for i:=0 to TV10.ColumnCount-1 do
|
|||
|
begin
|
|||
|
with ClientDataSet2 do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CxTabName').Value:=Trim(TV10.Bands[TV10.Columns[i].Position.BandIndex].Caption);
|
|||
|
FieldByName('CxColName').Value:=Trim(TV10.Columns[i].Caption);
|
|||
|
FieldByName('ColName').Value:=Trim(TV10.Columns[i].DataBinding.FieldName);
|
|||
|
FieldByName('OrderNo').Value:=i;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQuery5.DisableControls;
|
|||
|
with ADOQuery5 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from Table_Name where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQuery5,CDSName);
|
|||
|
SInitCDSData20(ADOQuery5,CDSName);
|
|||
|
ADOQuery2.EnableControls;
|
|||
|
MKName:=MKName10;
|
|||
|
for i:=0 to TV10.Bands.Count-1 do
|
|||
|
begin
|
|||
|
with CDSName do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('CxTabName').Value:=Trim(TV10.Bands[i].Caption);
|
|||
|
FieldByName('OrderNo').Value:=i;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmColumnBandSet.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure GetSWLDZ(IPStr:string);
|
|||
|
var
|
|||
|
myip:ulong;
|
|||
|
mymac:array[0..5] of byte;
|
|||
|
mymaclength:ulong;
|
|||
|
r:integer;
|
|||
|
begin
|
|||
|
{myip:=inet_addr(PChar(Trim(IPStr)));
|
|||
|
mymaclength:=length(mymac);
|
|||
|
r:=sendarp(myip,0,@mymac,@mymaclength);
|
|||
|
IpCall:=r;
|
|||
|
IpWLDZStr:=format('%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x',[mymac[0],mymac[1],mymac[2],mymac[3],mymac[4],mymac[5]]);}
|
|||
|
end;
|
|||
|
procedure SelOKNo(CDS_MainSel:TClientDataSet;FSel:Boolean);
|
|||
|
begin
|
|||
|
if CDS_MainSel.IsEmpty then Exit;
|
|||
|
CDS_MainSel.DisableControls;
|
|||
|
with CDS_MainSel do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if FieldByName('SSel').AsBoolean=not FSel then
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SSel').Value:=FSel;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_MainSel.EnableControls;
|
|||
|
end;
|
|||
|
function num2ceng(strArabic:String):String;//<2F><><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ӣ<EFBFBD><D3A2>
|
|||
|
const
|
|||
|
sw:array[2..9]of string=('twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety');
|
|||
|
gw:array[1..19] of string=('one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen');
|
|||
|
exp:array[1..4] of string=('','thousand','million','billion');
|
|||
|
var
|
|||
|
t,j,glb,t1 :integer;
|
|||
|
ts:string;
|
|||
|
tmp1:AnsiString;
|
|||
|
rtnStr:AnsiString;
|
|||
|
function readu1000(ss:string):string;
|
|||
|
var
|
|||
|
t,code:integer;
|
|||
|
rtvStr:AnsiString ;
|
|||
|
begin
|
|||
|
rtvStr := '';
|
|||
|
while ss[1]='0' do
|
|||
|
begin
|
|||
|
delete(ss,1,1);
|
|||
|
if length(ss)=0 then exit;//<2F><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>0<EFBFBD><30><EFBFBD><EFBFBD>
|
|||
|
end;
|
|||
|
if length(ss)=3 then
|
|||
|
begin
|
|||
|
tmp1:= gw[ord(ss[1])-ord('0')];
|
|||
|
appendstr(rtvStr ,tmp1);
|
|||
|
//appendstr(result,' hundred ');
|
|||
|
appendstr(rtvStr,' hundred ');
|
|||
|
delete(ss,1,1);
|
|||
|
end;
|
|||
|
while ss[1]='0' do
|
|||
|
begin
|
|||
|
delete(ss,1,1);
|
|||
|
if length(ss)=0 then exit;
|
|||
|
end;
|
|||
|
if length(ss)<>0 then
|
|||
|
if rtvStr <> '' then appendstr(AnsiString(rtvStr),AnsiString('and '));
|
|||
|
if (glb = 1) and (t1<>1) then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λʱ<CEBB><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>3λ
|
|||
|
if rtvStr='' then appendstr(rtvStr,'and ');
|
|||
|
begin
|
|||
|
val(ss,t,code);
|
|||
|
if t<20 then rtvStr :=rtvStr+gw[t]
|
|||
|
else if t mod 10=0 then rtvStr:=rtvStr+sw[t div 10]
|
|||
|
else
|
|||
|
//result := result+sw[trunc(t/10)]+'-'+gw[t mod 10];
|
|||
|
rtvStr := rtvStr+sw[trunc(t/10)]+' '+gw[t mod 10];
|
|||
|
end;
|
|||
|
|
|||
|
result:=rtvStr;
|
|||
|
|
|||
|
end;
|
|||
|
begin
|
|||
|
|
|||
|
rtnStr :='';
|
|||
|
t := pos('.',strArabic);
|
|||
|
if t=0 then t:=length(strArabic)+1;
|
|||
|
while (t mod 3<>1)do
|
|||
|
begin
|
|||
|
t:=t+1;
|
|||
|
strArabic:='0'+ strArabic;
|
|||
|
end;
|
|||
|
t1:=(t-1) div 3;
|
|||
|
for glb:=t1 downto 1 do
|
|||
|
begin
|
|||
|
ts:='';
|
|||
|
for j:=1 to 3 do
|
|||
|
begin
|
|||
|
ts:=ts+ strArabic[1];
|
|||
|
delete(strArabic,1,1);
|
|||
|
end;
|
|||
|
result := rtnStr + readu1000(ts);
|
|||
|
if ts<>'000' then rtnStr := rtnStr+' '+exp[glb]+' ';
|
|||
|
end;
|
|||
|
if length(strArabic)<>0 then
|
|||
|
begin
|
|||
|
delete(strArabic,1,1);
|
|||
|
appendstr(rtnStr,'and ');
|
|||
|
rtnStr :=rtnStr + readu1000(strArabic);
|
|||
|
end;
|
|||
|
end;
|
|||
|
function num2cengnum(strArabic:string):string;
|
|||
|
const
|
|||
|
gw:array[1..10] of string =('0','one','two','three','four','five','six','seven','eight','nine');
|
|||
|
var
|
|||
|
p,i,j,x:integer;
|
|||
|
s:string;
|
|||
|
begin
|
|||
|
result := '';
|
|||
|
s := strarabic;
|
|||
|
p := pos('.',strarabic);
|
|||
|
if p = 0 then
|
|||
|
begin
|
|||
|
result := num2ceng(strarabic)+'Only';
|
|||
|
exit;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
i := length(s)-p;//<2F><><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD>λ
|
|||
|
delete(strarabic,p,i+1);//ɾ<><C9BE>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
result := num2ceng(strarabic)+'Point';
|
|||
|
end;
|
|||
|
for x:=1 to i do //ת<><D7AA>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
begin
|
|||
|
j:= strtoint(copy(s,p+x,1));
|
|||
|
case j of
|
|||
|
0: result := result +' '+gw[1];
|
|||
|
1: result := result +' '+gw[2];
|
|||
|
2: result := result +' '+gw[3];
|
|||
|
3: result := result +' '+gw[4];
|
|||
|
4: result := result +' '+gw[5];
|
|||
|
5: result := result +' '+gw[6];
|
|||
|
6: result := result +' '+gw[7];
|
|||
|
7: result := result +' '+gw[8];
|
|||
|
8: result := result +' '+gw[9];
|
|||
|
9: result := result +' '+gw[10];
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure DelCDS(ClientDataSet1:TClientDataSet;ADOCmd:TADOQuery;DelSql:string);
|
|||
|
begin
|
|||
|
if ClientDataSet1.IsEmpty then Exit;
|
|||
|
if Trim(ClientDataSet1.fieldbyname('ZSID').AsString)<>'' then
|
|||
|
begin
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
|||
|
with ADOCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add(DelSql);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ClientDataSet1.Delete;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|