1949 lines
56 KiB
ObjectPascal
1949 lines
56 KiB
ObjectPascal
![]() |
unit U_FormPas;
|
|||
|
|
|||
|
interface
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, 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,
|
|||
|
cxGrid,cxDBLookupComboBox,cxCalendar, cxCurrencyEdit,cxExportGrid4Link,
|
|||
|
ExtCtrls, Buttons,DBClient,FTComboBox,cxDropDownEdit;
|
|||
|
type
|
|||
|
TA = class(TComponent)
|
|||
|
public
|
|||
|
S:string;
|
|||
|
end;
|
|||
|
procedure ClearWinData(mParent:TWinControl);
|
|||
|
procedure InitComBoxBySql(ADOQueryTmp:TADOQuery;cb: TComboBox;
|
|||
|
sqlstr:string;Boxtype:integer;showMsg:string;emptyFlag:Boolean);
|
|||
|
procedure SplitCtrName(ms:string;mvg:string;var mtable:string;var mfield:string);
|
|||
|
procedure InitComBoxByCode(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
procedure InitFtComBoxByCode(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
procedure InitFtComBoxByCode10(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean;
|
|||
|
isClearOld:boolean
|
|||
|
);
|
|||
|
procedure SetWinData(ADOQueryTmp:TADOQuery;mParent:TWinControl);
|
|||
|
procedure SetWinData_CDS(mCDS:TclientDataset;mParent:TWinControl);
|
|||
|
procedure CreateCDS(SADOqry:TADOQuery; mClientDataset:TclientDataSet);
|
|||
|
procedure CreateCDS20(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
|||
|
procedure InitCDSData(fromADO:TADOQuery;toCDS:TclientDataSet);
|
|||
|
procedure InitCDSData20(fromADO:TADOQuery;toCDS:TclientDataSet);
|
|||
|
procedure CreateCxGridCol(ADOQueryTmp:TADOQuery;tv1:TcxGridDBTableView;HasFooter:Boolean);
|
|||
|
procedure CreateFooterCol(tv1:TcxGridTableView;tcol:TcxGriddbColumn;mcolName:string;FooterType:string);
|
|||
|
function getCombIdx(cobBox:TComboBox;k:integer;vv:string):integer;
|
|||
|
procedure SaveTocxGridColSet(ADOQueryCmd:TADOQuery;winCode:string;gridName:string;cxGrid:TcxGridTableView);
|
|||
|
procedure SaveToQrycxGridColSet(ADOQueryCmd:TADOQuery;winCode:string;cxGrid:TcxGridTableView);
|
|||
|
procedure SaveTodbGridColSet(ADOQueryCmd:TADOQuery;winCode:string;gridName:string;dbGrid:TDbgrid);
|
|||
|
procedure SaveToQrydbGridColSet(ADOQueryCmd:TADOQuery;winCode:string;dbGrid:TDbgrid);
|
|||
|
procedure CreateCxGridCol10(ADOQueryTmp:TADOQuery;
|
|||
|
tv1:TcxGridDBTableView;
|
|||
|
HasFooter:Boolean);
|
|||
|
procedure TcxGridToExcel(mfileName:string;gridName:TcxGrid);
|
|||
|
|
|||
|
function GetMaxNo(ADOStoredProc1:TADOStoredProc;
|
|||
|
var mMaxNo:string;
|
|||
|
mFlag:string):Boolean;
|
|||
|
function GetMaxNo20(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mTable:string;
|
|||
|
mFlag:string;
|
|||
|
hasTp:integer;lsLen:integer=3):Boolean;
|
|||
|
function GetMaxGangNo(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mTable:string;
|
|||
|
mFlag:string;
|
|||
|
hasTp:integer;
|
|||
|
lsLen:integer=3;
|
|||
|
BhType:integer=0):Boolean;
|
|||
|
procedure InitComBoxByUnit(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
procedure InitComBoxByUnit10(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
procedure InitFtComBoxByUnit(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
procedure InitFtComBoxByUnit10(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
procedure InitFtComBoxBySql(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean;
|
|||
|
mSql:string
|
|||
|
);
|
|||
|
procedure GetServerTime(ADOQueryTmp:TADOQuery);
|
|||
|
function GetNameByBh(ADOQueryTmp:TADOQuery;mBhType:string;
|
|||
|
mValue:string;var mCode:string;var mName:string):Boolean;
|
|||
|
function GetNameByBh10(ADOQueryTmp:TADOQuery;mBhType:string;mValue:string):Boolean;
|
|||
|
function GetServerTime10(ADOQueryTmp:TADOQuery):TdateTime;
|
|||
|
procedure InitCxGridComboBoxByCode(ADOQueryTmp:TADOQuery;c3:TcxGriddbColumn;FlagType:string);
|
|||
|
procedure GetDll(DllName:string;StrFormid:integer;Str:string);
|
|||
|
procedure GetDll10(DllName:string;sFormid:integer;sDatabase:string;sTitle:string;sDef1:string;sDef2:string);
|
|||
|
|
|||
|
function KillNoFuncWinForm(formName:string;formTitle:string;formId:integer=0):boolean;
|
|||
|
function GetMaxPlanNo(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mTable:string;
|
|||
|
mFlag:string;
|
|||
|
hasTp:integer;
|
|||
|
lsLen:integer=3;
|
|||
|
BhType:integer=0):Boolean;
|
|||
|
procedure Dofilter(ADOQry:TADOQuery;FilterStr:string);
|
|||
|
procedure DisableCtrl(mParent:TWinControl);
|
|||
|
procedure DofilterNew(ADOQry:TADOQuery;FilterStr:string);
|
|||
|
function GetNoDateMaxNo(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mTable:string;
|
|||
|
mFlag:string;
|
|||
|
lsLen:integer=3):Boolean;
|
|||
|
procedure DofilterCDS(Cds_Sub:TClientDataSet;FilterStr:string);
|
|||
|
var
|
|||
|
newh:hwnd;
|
|||
|
implementation
|
|||
|
uses U_global;
|
|||
|
//////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////////////////////////
|
|||
|
procedure ClearWinData(mParent:TWinControl);
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
//EDIT
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
TEdit(Controls[i]).Text:='';
|
|||
|
end
|
|||
|
//combobox
|
|||
|
else if Controls[i] is TComboBox then
|
|||
|
begin
|
|||
|
TComboBox(Controls[i]).Text:='';
|
|||
|
end
|
|||
|
//checkBox
|
|||
|
else if Controls[i] is TCheckBox then
|
|||
|
begin
|
|||
|
TCheckBox(Controls[i]).Checked :=false;
|
|||
|
end
|
|||
|
//TBtnEdit
|
|||
|
else if (Controls[i] is TBtnEditA) or (Controls[i] is TBtnEditB)
|
|||
|
or (Controls[i] is TBtnEditC) then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).text:='';
|
|||
|
end
|
|||
|
else if Controls[i] is TdateTimePicker then
|
|||
|
TdateTimePicker(Controls[i]).DateTime :=Date()
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
Tmemo(Controls[i]).Text :=''
|
|||
|
else if Controls[i] is TcxDateEdit then
|
|||
|
begin
|
|||
|
TcxDateEdit(Controls[i]).Clear ;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTimeEdit then
|
|||
|
begin
|
|||
|
TcxTimeEdit(Controls[i]).Clear ;
|
|||
|
end
|
|||
|
else if Controls[i] is TcxCurrencyEdit then
|
|||
|
begin
|
|||
|
TcxCurrencyEdit(Controls[i]).Clear;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////////////////////////
|
|||
|
procedure DisableCtrl(mParent:TWinControl);
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then continue;
|
|||
|
if Controls[i] is Tmemo then
|
|||
|
Tmemo(Controls[i]).ReadOnly :=true
|
|||
|
else
|
|||
|
Controls[i].Enabled :=false;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
procedure SetWinData(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:=Controls[i].Name;
|
|||
|
|
|||
|
///////////////////////////
|
|||
|
//EDIT
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Controls[i].Tag =999 then
|
|||
|
continue
|
|||
|
else
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TFTComboBox then
|
|||
|
begin
|
|||
|
if Controls[i].Tag =99 then
|
|||
|
begin
|
|||
|
idx:=TftComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
idx:=TftComboBox(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));
|
|||
|
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
|
|||
|
if TBtnEditC(Controls[i]).Tag=1 then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(mfield+'Name').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
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;
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F><><EFBFBD><EFBFBD>ԴΪTclientDataset
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
procedure SetWinData_CDS(mCDS:TclientDataset;mParent:TWinControl);
|
|||
|
var
|
|||
|
i,idx:integer;
|
|||
|
mfield:string;
|
|||
|
ma:TA;
|
|||
|
begin
|
|||
|
with mCDS do
|
|||
|
begin
|
|||
|
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
|
|||
|
TEdit(Controls[i]).Text:=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
//ftcombobox
|
|||
|
else if Controls[i] is TFTComboBox then
|
|||
|
begin
|
|||
|
if Controls[i].Tag =99 then
|
|||
|
begin
|
|||
|
idx:=TftComboBox(Controls[i]).Items.IndexOf(trim(fieldByName(mfield).AsString));
|
|||
|
TComboBox(Controls[i]).ItemIndex:=idx;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
idx:=TftComboBox(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));
|
|||
|
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
|
|||
|
if TBtnEditC(Controls[i]).Tag=1 then
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(mfield+'Name').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TBtnEditC(Controls[i]).TxtCode := trim(fieldByName(mfield).AsString);
|
|||
|
TBtnEditC(Controls[i]).text:= trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
end
|
|||
|
else if Controls[i] is Tmemo then
|
|||
|
begin
|
|||
|
Tmemo(Controls[i]).Text :=trim(fieldByName(mfield).AsString);
|
|||
|
end
|
|||
|
else if Controls[i] is TDateTimePicker then
|
|||
|
begin
|
|||
|
if IsEmpty or fieldByName(mfield).IsNull then
|
|||
|
TDateTimePicker(Controls[i]).Date:=strToDate('1990-01-01')
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).Date:=fieldByName(mfield).AsDateTime;
|
|||
|
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;
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
|
|||
|
end;
|
|||
|
//////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>combobox objects <20><> idx
|
|||
|
//////////////////////////////////////////
|
|||
|
function getCombIdx(cobBox:TComboBox;k:integer;vv:string):integer;
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
mm:string;
|
|||
|
rv:integer;
|
|||
|
begin
|
|||
|
rv:=-1;
|
|||
|
for i:=0 to cobBox.Items.Count-1 do
|
|||
|
begin
|
|||
|
if TA(cobBox.Items.Objects[i])=nil then
|
|||
|
begin
|
|||
|
rv:=cobBox.Items.IndexOf(vv);
|
|||
|
break;
|
|||
|
end;
|
|||
|
mm:=trim(TA(cobBox.Items.Objects[i]).s);
|
|||
|
if mm=vv then
|
|||
|
begin
|
|||
|
rv:=i;
|
|||
|
break;
|
|||
|
end;
|
|||
|
end;
|
|||
|
result:=rv;
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>combox<6F>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:0: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;1:<3A><>;
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitComBoxBySql(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TComboBox;sqlstr:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
var
|
|||
|
A:TA;
|
|||
|
begin
|
|||
|
cb.Items.Clear ;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(sqlstr);
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('δ<>ҵ<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;
|
|||
|
//////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>combox<6F>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F><>XC_Code<64><65><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:0; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>1;
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitComBoxByCode(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_code');
|
|||
|
sql.Add(quotedStr(trim(flagType)));
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('δ<>ҵ<EFBFBD><D2B5><EFBFBD>'+showMsg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
if Boxtype=0 then
|
|||
|
begin
|
|||
|
cb.Items.Add(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
A := TA.Create(Nil);
|
|||
|
A.s:= trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|||
|
cb.Items.AddObject(trim(fieldByName('<27><><EFBFBD><EFBFBD>').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;
|
|||
|
//////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>combox<6F>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F><>XC_Code<64><65><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:0; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>1;
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitFtComBoxByCode(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;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_code');
|
|||
|
sql.Add(quotedStr(trim(flagType)));
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
//A := TA.Create(Nil);
|
|||
|
//A.s:= trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|||
|
//cb.Items.AddObject(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString),TObject(a));
|
|||
|
cb.AddItem2(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString),nil,trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
|
|||
|
if not emptyFlag then
|
|||
|
cb.Items.Add('');
|
|||
|
|
|||
|
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_Code<64><65><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:0; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>1;
|
|||
|
//emptyFlag<61><67><EFBFBD>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ<EFBFBD><CEAA>
|
|||
|
//isClearOld:<3A><><EFBFBD><EFBFBD>ԭ<EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ŀ
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitFtComBoxByCode10(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean;
|
|||
|
isClearOld:boolean
|
|||
|
);
|
|||
|
var
|
|||
|
A:TA;
|
|||
|
begin
|
|||
|
if isClearOld then
|
|||
|
cb.Items.Clear ;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add('exec P_Get_XC_code');
|
|||
|
sql.Add(quotedStr(trim(flagType)));
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
//A := TA.Create(Nil);
|
|||
|
//A.s:= trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|||
|
//cb.Items.AddObject(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString),TObject(a));
|
|||
|
cb.AddItem2(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString),nil,trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
|
|||
|
if not emptyFlag then
|
|||
|
cb.Items.Add('');
|
|||
|
|
|||
|
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_Code<64><65><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:0; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>1;
|
|||
|
//emptyFlag<61><67><EFBFBD>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ<EFBFBD><CEAA>
|
|||
|
//mSql:sql<71><6C><EFBFBD>䣻
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitFtComBoxBySql(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean;
|
|||
|
mSql:string
|
|||
|
);
|
|||
|
var
|
|||
|
A:TA;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(mSql);
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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
|
|||
|
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;
|
|||
|
|
|||
|
//////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>combox<6F>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F><>XC_unit<69><74><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:1; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitComBoxByUnit(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_Unit');
|
|||
|
sql.Add(quotedStr(trim(flagType)));
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('δ<>ҵ<EFBFBD><D2B5><EFBFBD>'+showMsg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
if Boxtype=0 then
|
|||
|
begin
|
|||
|
cb.Items.Add(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
A := TA.Create(Nil);
|
|||
|
A.s:= trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|||
|
cb.Items.AddObject(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString),TObject(a));
|
|||
|
end;
|
|||
|
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>,<2C>ӵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ȡ
|
|||
|
//<2F><>XC_unit<69><74><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:1; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitComBoxByUnit10(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_Unit');
|
|||
|
sql.Add(quotedStr(trim(flagType)));
|
|||
|
sql.Add(',9');
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('δ<>ҵ<EFBFBD><D2B5><EFBFBD>'+showMsg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
if Boxtype=0 then
|
|||
|
begin
|
|||
|
cb.Items.Add(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
A := TA.Create(Nil);
|
|||
|
A.s:= trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString);
|
|||
|
cb.Items.AddObject(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString),TObject(a));
|
|||
|
end;
|
|||
|
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_unit<69><74><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:1; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitFtComBoxByUnit(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;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_Unit');
|
|||
|
sql.Add(quotedStr(trim(flagType)));
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('δ<>ҵ<EFBFBD><D2B5><EFBFBD>'+showMsg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
if Boxtype=0 then
|
|||
|
begin
|
|||
|
cb.Items.Add(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
cb.AddItem2(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString),nil,trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end;
|
|||
|
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_unit<69><74><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ӵ<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ȡ
|
|||
|
//Boxtype:1; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitFtComBoxByUnit10(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;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_Unit');
|
|||
|
sql.Add(quotedStr(trim(flagType)));
|
|||
|
sql.Add(',9');
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
application.MessageBox(pChar('δ<>ҵ<EFBFBD><D2B5><EFBFBD>'+showMsg),'',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
if Boxtype=0 then
|
|||
|
begin
|
|||
|
cb.Items.Add(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
cb.AddItem2(trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString),nil,trim(fieldByName('<27><><EFBFBD><EFBFBD>').AsString));
|
|||
|
end;
|
|||
|
next;
|
|||
|
end;
|
|||
|
if emptyFlag and (cb.Items.Count >0) then
|
|||
|
cb.ItemIndex :=0;
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>ClientDataSet
|
|||
|
///////////////////////////////////////////
|
|||
|
procedure CreateCDS(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('flag',ftString,1);
|
|||
|
mClientDataset.FieldDefs.Add('index',ftInteger,0);
|
|||
|
mClientDataset.Close;
|
|||
|
mClientDataset.CreateDataSet;
|
|||
|
end;
|
|||
|
////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>ClientDataSet,<2C><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
|
|||
|
///////////////////////////////////////////
|
|||
|
procedure CreateCDS20(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
mfieldName:string;
|
|||
|
mSize:integer;
|
|||
|
begin
|
|||
|
mfieldName:='';
|
|||
|
mClientDataset.FieldDefs.Clear;
|
|||
|
SADOQry.DisableControls;
|
|||
|
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;
|
|||
|
SADOQry.EnableControls;
|
|||
|
mClientDataset.FieldDefs.Add('flag',ftString,1);
|
|||
|
mClientDataset.FieldDefs.Add('index',ftInteger,0);
|
|||
|
mClientDataset.FieldDefs.Add('sel',ftBoolean,0);
|
|||
|
mClientDataset.FieldDefs.Add('DefNote',ftString,50);
|
|||
|
mClientDataset.Close;
|
|||
|
mClientDataset.CreateDataSet;
|
|||
|
end;
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//FooterType:
|
|||
|
/////////////////////////////////////////////////////
|
|||
|
procedure CreateFooterCol(tv1:TcxGridTableView;
|
|||
|
tcol:TcxGridDBColumn;
|
|||
|
mcolName:string;
|
|||
|
FooterType:string);
|
|||
|
begin
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
with tv1.DataController.Summary do
|
|||
|
begin
|
|||
|
BeginUpdate;
|
|||
|
try
|
|||
|
with FooterSummaryItems.Add as TcxGridDBTableSummaryItem do
|
|||
|
begin
|
|||
|
Column := tcol;
|
|||
|
//Column.Styles.Footer:=cxstyle1;
|
|||
|
fieldName:=trim(mcolName);
|
|||
|
if lowerCase(trim(FooterType))='sum' then
|
|||
|
Kind := skSum
|
|||
|
else if lowerCase(trim(FooterType))='max' then
|
|||
|
kind:=skMax
|
|||
|
else if lowerCase(trim(FooterType))='min' then
|
|||
|
kind:=skMin
|
|||
|
else if lowerCase(trim(FooterType))='avg' then
|
|||
|
kind:=skAverage
|
|||
|
else if lowerCase(trim(FooterType))='count' then
|
|||
|
kind:=skCount
|
|||
|
else
|
|||
|
kind:=skNone;
|
|||
|
Position:=spFooter;
|
|||
|
end;
|
|||
|
|
|||
|
finally
|
|||
|
EndUpdate;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>CxGrid<69><64>
|
|||
|
///////////////////////////////////////////////////////////
|
|||
|
procedure CreateCxGridCol(ADOQueryTmp:TADOQuery;
|
|||
|
tv1:TcxGridDBTableView;
|
|||
|
HasFooter:Boolean);
|
|||
|
var
|
|||
|
ADBColumn: TcxGridDBColumn;
|
|||
|
strField,strCaption:string;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if recordCount>0 then
|
|||
|
tv1.ClearItems;
|
|||
|
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
if trim(fieldByName('fieldName').AsString)='' then
|
|||
|
begin
|
|||
|
next;
|
|||
|
continue;
|
|||
|
end;
|
|||
|
ADBColumn := tv1.CreateColumn;
|
|||
|
ADBColumn.DataBinding.FieldName :=trim(fieldByName('fieldName').AsString);
|
|||
|
ADBColumn.Caption:=trim(fieldByName('Caption').AsString);
|
|||
|
//if fieldByName('width').AsInteger>5 then
|
|||
|
// ADBColumn.Width :=fieldByName('width').AsInteger;
|
|||
|
ADBColumn.Visible:=fieldByName('visible').AsBoolean;
|
|||
|
ADBColumn.HeaderAlignmentHorz:=taCenter;
|
|||
|
ADBColumn.Name :='tv1'+trim(fieldByName('fieldName').AsString);
|
|||
|
|
|||
|
ADBColumn.Options.Editing :=not fieldByName('ReadOnly').AsBoolean;
|
|||
|
ADBColumn.Options.Focusing :=not fieldByName('ReadOnly').AsBoolean;
|
|||
|
////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD>footer
|
|||
|
if HasFooter then
|
|||
|
begin
|
|||
|
if fieldByName('FooterFlag').AsBoolean then
|
|||
|
begin
|
|||
|
CreateFooterCol(tv1,ADBColumn,ADBColumn.DataBinding.FieldName
|
|||
|
,trim(fieldByName('FooterType').AsString));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Next;
|
|||
|
|
|||
|
end;
|
|||
|
tv1.OptionsView.Footer:=HasFooter;
|
|||
|
|
|||
|
|
|||
|
close;
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>̬<EFBFBD><CCAC><EFBFBD><EFBFBD>CxGrid<69><64> (<28><>ѯģ<D1AF><C4A3><EFBFBD><EFBFBD>cxgrid<69><64><EFBFBD><EFBFBD>)
|
|||
|
///////////////////////////////////////////////////////////
|
|||
|
procedure CreateCxGridCol10(ADOQueryTmp:TADOQuery;
|
|||
|
tv1:TcxGridDBTableView;
|
|||
|
HasFooter:Boolean);
|
|||
|
var
|
|||
|
ADBColumn: TcxGridDBColumn;
|
|||
|
strField,strCaption:string;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if recordCount>0 then
|
|||
|
tv1.ClearItems;
|
|||
|
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
if trim(fieldByName('fieldName').AsString)='' then
|
|||
|
begin
|
|||
|
next;
|
|||
|
continue;
|
|||
|
end;
|
|||
|
ADBColumn := tv1.CreateColumn;
|
|||
|
ADBColumn.DataBinding.FieldName :=trim(fieldByName('fieldName').AsString);
|
|||
|
ADBColumn.Caption:=trim(fieldByName('Caption').AsString);
|
|||
|
if fieldByName('width').AsInteger>5 then
|
|||
|
ADBColumn.Width :=fieldByName('width').AsInteger;
|
|||
|
ADBColumn.Visible:=fieldByName('visible').AsBoolean;
|
|||
|
ADBColumn.HeaderAlignmentHorz:=taCenter;
|
|||
|
ADBColumn.Name :=tv1.Name+trim(fieldByName('fieldName').AsString);
|
|||
|
|
|||
|
ADBColumn.Options.Editing :=not fieldByName('ReadOnly').AsBoolean;
|
|||
|
ADBColumn.Options.Focusing :=not fieldByName('ReadOnly').AsBoolean;
|
|||
|
////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD>footer
|
|||
|
if HasFooter then
|
|||
|
begin
|
|||
|
if fieldByName('FooterFlag').AsBoolean then
|
|||
|
begin
|
|||
|
CreateFooterCol(tv1,ADBColumn,ADBColumn.DataBinding.FieldName
|
|||
|
,trim(fieldByName('FooterType').AsString));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
Next;
|
|||
|
|
|||
|
end;
|
|||
|
tv1.OptionsView.Footer:=HasFooter;
|
|||
|
|
|||
|
|
|||
|
close;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///////////////////////////////////////////////////
|
|||
|
procedure SplitCtrName(ms:string;mvg:string;
|
|||
|
var mtable:string;
|
|||
|
var mfield:string);
|
|||
|
var
|
|||
|
ps:integer;
|
|||
|
begin
|
|||
|
if (trim(ms)='') or (trim(mvg)='') then
|
|||
|
begin
|
|||
|
mtable:='';
|
|||
|
mfield:='';
|
|||
|
exit;
|
|||
|
end;
|
|||
|
ps:=Pos(mvg,ms);
|
|||
|
if ps<=0 then
|
|||
|
begin
|
|||
|
mtable:='';
|
|||
|
mfield:=ms;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
mtable:=leftStr(ms,ps-1);
|
|||
|
mfield:=MidStr(ms,ps+1,length(ms));
|
|||
|
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////////
|
|||
|
//
|
|||
|
//////////////////////////////////////////////////////////
|
|||
|
procedure InitCDSData(fromADO:TADOQuery;toCDS:TclientDataSet);
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
k:integer;
|
|||
|
begin
|
|||
|
fromADO.first;
|
|||
|
K:=1;
|
|||
|
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('flag').AsString :='1';
|
|||
|
fieldByName('index').value :=k;
|
|||
|
inc(k);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
fromADO.Next;
|
|||
|
end;
|
|||
|
if not toCDS.IsEmpty then
|
|||
|
begin
|
|||
|
toCDS.First ;
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////////
|
|||
|
//<2F><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////////////////////////////
|
|||
|
procedure InitCDSData20(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('flag').AsString :='1';
|
|||
|
fieldByName('index').value :=k;
|
|||
|
fieldByName('sel').value :=false;
|
|||
|
inc(k);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
fromADO.Next;
|
|||
|
end;
|
|||
|
if not toCDS.IsEmpty then
|
|||
|
begin
|
|||
|
toCDS.First ;
|
|||
|
end;
|
|||
|
finally
|
|||
|
toCDS.EnableControls;
|
|||
|
end;
|
|||
|
fromADO.EnableControls;
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3>ӱ<EFBFBD><D3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|||
|
///////////////////////////////////////////////////
|
|||
|
function GetMaxNo(ADOStoredProc1:TADOStoredProc;
|
|||
|
var mMaxNo:string;
|
|||
|
mFlag:string):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOStoredProc1 do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
Parameters.ParamByName('@sysclass').Value :=mFlag;
|
|||
|
Prepared;
|
|||
|
ExecProc;
|
|||
|
if (trim(Parameters.ParamByName('@theCoder').Value) = 'ERROR')
|
|||
|
or (Trim(Parameters.ParamByName('@theCoder').Value) = '') then
|
|||
|
begin
|
|||
|
application.MessageBox(Pchar('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
Close;
|
|||
|
result:=false;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
mMaxNo := trim(Parameters.ParamByName('@theCoder').Value);
|
|||
|
Close;
|
|||
|
end;
|
|||
|
result:=true;
|
|||
|
Except
|
|||
|
result:=false;
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>µı<C2B5><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|||
|
//hasTp:<3A>Ƿ<EFBFBD><C7B7><EFBFBD>ǰ<C7B0><D7BA>mTable:<3A><><EFBFBD><EFBFBD>
|
|||
|
//lsLen:<3A><>ˮ<EFBFBD>ų<EFBFBD><C5B3><EFBFBD>
|
|||
|
///////////////////////////////////////////////////
|
|||
|
function GetMaxNo20(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mTable:string;
|
|||
|
mFlag:string;
|
|||
|
hasTp:integer;
|
|||
|
lsLen:integer=3):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('exec XC_TableDH10 ');
|
|||
|
sql.Add(intTostr(hasTp));
|
|||
|
sql.Add(','+quotedStr(mTable));
|
|||
|
sql.Add(','+quotedStr(mFlag));
|
|||
|
sql.Add(','+intTostr(LsLen));
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
begin
|
|||
|
mMaxNo:=trim(fieldByName('DepotShow').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><D4B6><EFBFBD><EFBFBD><EFBFBD>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
Except
|
|||
|
result:=false;
|
|||
|
application.MessageBox(Pchar('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>µı<C2B5><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|||
|
//hasTp:<3A>Ƿ<EFBFBD><C7B7><EFBFBD>ǰ<C7B0><D7BA>mTable:<3A><><EFBFBD><EFBFBD>
|
|||
|
//lsLen:<3A><>ˮ<EFBFBD>ų<EFBFBD><C5B3><EFBFBD>
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1>Ÿ<EFBFBD>ʽ --0:yyyy-MM-dd,1:yy-mm
|
|||
|
///////////////////////////////////////////////////
|
|||
|
function GetMaxGangNo(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mTable:string;
|
|||
|
mFlag:string;
|
|||
|
hasTp:integer;
|
|||
|
lsLen:integer=3;
|
|||
|
BhType:integer=0):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('exec P_GET_GangNo');
|
|||
|
sql.Add(intTostr(hasTp));
|
|||
|
sql.Add(','+quotedStr(mTable));
|
|||
|
sql.Add(','+quotedStr(mFlag));
|
|||
|
sql.Add(','+intTostr(LsLen));
|
|||
|
sql.Add(','+intTostr(BhType));
|
|||
|
Open;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
begin
|
|||
|
mMaxNo:=trim(fieldByName('DepotShow').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><D4B6><EFBFBD><EFBFBD><EFBFBD>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
Except
|
|||
|
result:=false;
|
|||
|
application.MessageBox(Pchar('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
///////////////////////////////////////////////////
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ļƻ<C4BC><C6BB><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>µı<C2B5><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|||
|
//hasTp:<3A>Ƿ<EFBFBD><C7B7><EFBFBD>ǰ<C7B0><D7BA>mTable:<3A><><EFBFBD><EFBFBD>
|
|||
|
//lsLen:<3A><>ˮ<EFBFBD>ų<EFBFBD><C5B3><EFBFBD>
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>˱<EFBFBD><CBB1>Ÿ<EFBFBD>ʽ --0:yyyy-MM-dd,1:yy-mm
|
|||
|
///////////////////////////////////////////////////
|
|||
|
function GetMaxPlanNo(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mTable:string;
|
|||
|
mFlag:string;
|
|||
|
hasTp:integer;
|
|||
|
lsLen:integer=3;
|
|||
|
BhType:integer=0):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('exec P_GET_MaxPlanNo');
|
|||
|
sql.Add(intTostr(hasTp));
|
|||
|
sql.Add(','+quotedStr(mTable));
|
|||
|
sql.Add(','+quotedStr(mFlag));
|
|||
|
sql.Add(','+intTostr(LsLen));
|
|||
|
sql.Add(','+intTostr(BhType));
|
|||
|
Open;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
begin
|
|||
|
mMaxNo:=trim(fieldByName('DepotShow').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><D4B6><EFBFBD><EFBFBD><EFBFBD>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
Except
|
|||
|
result:=false;
|
|||
|
application.MessageBox(Pchar('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
//////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>cxgrid<69>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure SaveTocxGridColSet(ADOQueryCmd:TADOQuery;winCode:string;gridName:string;cxGrid:TcxGridTableView);
|
|||
|
var
|
|||
|
mgridName:string;
|
|||
|
mCaption:string;
|
|||
|
mfieldName:string;
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
mgridName:=trim(cxGrid.Name) ;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('select * from XD_GridCustomSet');
|
|||
|
sql.Add('where winCode='''+winCode+'''');
|
|||
|
sql.Add('and GridName='''+mgridName+'''');
|
|||
|
Open;
|
|||
|
for i:=0 to cxGrid.ColumnCount-1 do
|
|||
|
begin
|
|||
|
//mCaption:=trim(cxGrid.Columns[i].Caption);
|
|||
|
mfieldName:=TcxGridDBColumn(cxGrid.Columns[i]).DataBinding.FieldName;
|
|||
|
|
|||
|
filtered:=false;
|
|||
|
filter:='fieldName='''+mfieldName+'''';
|
|||
|
filtered:=true;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
Edit
|
|||
|
else
|
|||
|
begin
|
|||
|
Append;
|
|||
|
fieldByName('winCode').value:=winCode;
|
|||
|
fieldByName('GridName').value:=mgridName;
|
|||
|
end;
|
|||
|
fieldByName('GridIndex').value:=1;
|
|||
|
fieldByName('FieldName').value:=trim(TcxGridDBColumn(cxGrid.Columns[i]).DataBinding.FieldName);
|
|||
|
fieldByName('Caption').value:=mCaption;
|
|||
|
fieldByName('ColType').value:=trim(TcxGridDBColumn(cxGrid.Columns[i]).DataBinding.ValueType);
|
|||
|
fieldByName('Visible').value:=1;
|
|||
|
fieldByName('Width').value:=cxGrid.Columns[i].Width;
|
|||
|
fieldByName('IsOrder').value:=1;
|
|||
|
fieldByName('FieldOrder').value:=intTostr(i);
|
|||
|
fieldByName('Valid').value:=1;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
//////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯģ<D1AF><C4A3>cxgrid<69>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure SaveToQrycxGridColSet(ADOQueryCmd:TADOQuery;winCode:string;cxGrid:TcxGridTableView);
|
|||
|
var
|
|||
|
mgridName:string;
|
|||
|
mCaption:string;
|
|||
|
mfieldName:string;
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
mgridName:=trim(cxGrid.Name) ;
|
|||
|
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans ;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('select * from XD_QryGridCustomSet');
|
|||
|
sql.Add('where winCode='''+winCode+'''');
|
|||
|
sql.Add('and GridName='''+mgridName+'''');
|
|||
|
Open;
|
|||
|
for i:=0 to cxGrid.ColumnCount-1 do
|
|||
|
begin
|
|||
|
mfieldName:=TcxGridDBColumn(cxGrid.Columns[i]).DataBinding.FieldName;
|
|||
|
//mCaption:=trim(cxGrid.Columns[i].DataBinding);
|
|||
|
filtered:=false;
|
|||
|
filter:='fieldName='''+mfieldName+'''';
|
|||
|
filtered:=true;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
Edit
|
|||
|
else
|
|||
|
begin
|
|||
|
Append;
|
|||
|
fieldByName('winCode').value:=winCode;
|
|||
|
fieldByName('GridName').value:=mgridName;
|
|||
|
end;
|
|||
|
fieldByName('GridIndex').value:=1;
|
|||
|
fieldByName('FieldName').value:=trim(TcxGridDBColumn(cxGrid.Columns[i]).DataBinding.FieldName);
|
|||
|
fieldByName('Caption').value:=mCaption;
|
|||
|
fieldByName('ColType').value:=trim(TcxGridDBColumn(cxGrid.Columns[i]).DataBinding.ValueType);
|
|||
|
fieldByName('Visible').value:=1;
|
|||
|
fieldByName('Width').value:=cxGrid.Columns[i].Width;
|
|||
|
fieldByName('IsOrder').value:=1;
|
|||
|
fieldByName('FieldOrder').value:=intTostr(i);
|
|||
|
fieldByName('Valid').value:=1;
|
|||
|
post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
ADOQueryCmd.Connection.CommitTrans ;
|
|||
|
except
|
|||
|
ADOQueryCmd.Connection.RollbackTrans ;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
//////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>dbgrid<69>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure SaveTodbGridColSet(ADOQueryCmd:TADOQuery;winCode:string;gridName:string;dbGrid:TDbgrid);
|
|||
|
var
|
|||
|
mgridName:string;
|
|||
|
mFieldName:string;
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
mgridName:=trim(dbGrid.Name) ;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('select * from XD_GridCustomSet');
|
|||
|
sql.Add('where winCode='''+winCode+'''');
|
|||
|
sql.Add('and GridName='''+mgridName+'''');
|
|||
|
Open;
|
|||
|
for i:=0 to dbGrid.Columns.Count -1 do
|
|||
|
begin
|
|||
|
mFieldName:=trim(dbGrid.Columns[i].FieldName);
|
|||
|
filtered:=false;
|
|||
|
filter:='fieldName='''+mFieldName+'''';
|
|||
|
filtered:=true;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
Edit
|
|||
|
else
|
|||
|
begin
|
|||
|
Append;
|
|||
|
fieldByName('winCode').value:=winCode;
|
|||
|
fieldByName('GridName').value:=mgridName;
|
|||
|
end;
|
|||
|
fieldByName('GridIndex').value:=1;
|
|||
|
fieldByName('FieldName').value:=mFieldName;
|
|||
|
fieldByName('Caption').value:=trim(dbGrid.Columns[i].Title.Caption) ;
|
|||
|
fieldByName('ColType').value:=dbGrid.Columns[i].Field.DataType;
|
|||
|
fieldByName('Visible').value:=dbGrid.Columns[i].Visible ;
|
|||
|
fieldByName('Width').value:=dbGrid.Columns[i].Width;
|
|||
|
fieldByName('IsOrder').value:=1;
|
|||
|
fieldByName('FieldOrder').value:=intTostr(i);
|
|||
|
fieldByName('Valid').value:=1;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>dbgrid<69>е<EFBFBD><D0B5><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD>
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure SaveToQrydbGridColSet(ADOQueryCmd:TADOQuery;winCode:string;dbGrid:TDbgrid);
|
|||
|
var
|
|||
|
mgridName:string;
|
|||
|
mFieldName:string;
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
mgridName:=trim(dbGrid.Name) ;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('select * from XD_QryGridCustomSet');
|
|||
|
sql.Add('where winCode='''+winCode+'''');
|
|||
|
sql.Add('and GridName='''+mgridName+'''');
|
|||
|
Open;
|
|||
|
for i:=0 to dbGrid.Columns.Count -1 do
|
|||
|
begin
|
|||
|
mFieldName:=trim(dbGrid.Columns[i].FieldName);
|
|||
|
filtered:=false;
|
|||
|
filter:='fieldName='''+mFieldName+'''';
|
|||
|
filtered:=true;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
Edit
|
|||
|
else
|
|||
|
begin
|
|||
|
Append;
|
|||
|
fieldByName('winCode').value:=winCode;
|
|||
|
fieldByName('GridName').value:=mgridName;
|
|||
|
end;
|
|||
|
fieldByName('GridIndex').value:=1;
|
|||
|
fieldByName('FieldName').value:=mFieldName;
|
|||
|
fieldByName('Caption').value:=trim(dbGrid.Columns[i].Title.Caption) ;
|
|||
|
fieldByName('ColType').value:=dbGrid.Columns[i].Field.DataType;
|
|||
|
fieldByName('Visible').value:=dbGrid.Columns[i].Visible ;
|
|||
|
fieldByName('Width').value:=dbGrid.Columns[i].Width;
|
|||
|
fieldByName('IsOrder').value:=1;
|
|||
|
fieldByName('FieldOrder').value:=intTostr(i);
|
|||
|
fieldByName('Valid').value:=1;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
//////////////////////////////////////////////////
|
|||
|
//
|
|||
|
///////////////////////////////////////////////////
|
|||
|
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;
|
|||
|
gServerDate:=ADOQueryTmp.fieldByName('dt').AsDatetime;
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ط<EFBFBD><D8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///////////////////////////////////////////////////
|
|||
|
function GetServerTime10(ADOQueryTmp:TADOQuery):TdateTime;
|
|||
|
begin
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
try
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select getDate()as dt');
|
|||
|
open;
|
|||
|
result:=fieldByName('dt').AsDatetime;
|
|||
|
close;
|
|||
|
end;
|
|||
|
except
|
|||
|
application.MessageBox('<27><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ʱ<EFBFBD>䷢<EFBFBD><E4B7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>cxGrid<69>Դ<EFBFBD><D4B4>Ĺ<EFBFBD><C4B9>ܵ<EFBFBD><DCB5><EFBFBD><EFBFBD><EFBFBD>excel<65><6C>
|
|||
|
//////////////////////////////////////////////////////////////////
|
|||
|
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
|
|||
|
|
|||
|
ExportGrid4ToExcel(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;
|
|||
|
//////////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1>Ż<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////////////////////////////////////
|
|||
|
function GetNameByBh(ADOQueryTmp:TADOQuery;mBhType:string;mValue:string;var mCode:string;var mName:string):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQuerytmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('exec P_get_NameByBh');
|
|||
|
sql.Add(quotedStr(mBhType));
|
|||
|
sql.Add(','+quotedStr(mValue));
|
|||
|
Open;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
begin
|
|||
|
mName:=trim(fieldByName('Name').AsString);
|
|||
|
mCode:=trim(fieldByName('code').AsString);
|
|||
|
end;
|
|||
|
close;
|
|||
|
end;
|
|||
|
Result:=true;
|
|||
|
except
|
|||
|
Result:=false;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ݱ<EFBFBD><DDB1>Ż<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////////////////////////////////////
|
|||
|
function GetNameByBh10(ADOQueryTmp:TADOQuery;mBhType:string;mValue:string):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQuerytmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('exec P_get_NameByBh');
|
|||
|
sql.Add(quotedStr(mBhType));
|
|||
|
sql.Add(','+quotedStr(mValue));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
Result:=true;
|
|||
|
except
|
|||
|
Result:=false;
|
|||
|
end;
|
|||
|
end;
|
|||
|
//////////////////////////////////////////////////////////////
|
|||
|
//
|
|||
|
//////////////////////////////////////////////////////////////
|
|||
|
procedure InitCxGridComboBoxByCode(ADOQueryTmp:TADOQuery;c3:TcxGriddbColumn;FlagType:string);
|
|||
|
var
|
|||
|
A:TA;
|
|||
|
begin
|
|||
|
{
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.Clear ;
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add(' select * from XC_Code '+
|
|||
|
' where Flag='''+trim(FlagType)+''' '+
|
|||
|
' order by orderno ');
|
|||
|
Open;
|
|||
|
if isEmpty then
|
|||
|
begin
|
|||
|
exit;
|
|||
|
end;
|
|||
|
while not EOF do
|
|||
|
begin
|
|||
|
A := TA.Create(Nil);
|
|||
|
A.s:= trim(fieldByName('Code').AsString);
|
|||
|
(c3.Properties as TcxComboBoxProperties).Items.AddObject(trim(fieldByName('name').AsString),TObject(a));
|
|||
|
//fieldByName(mField).value:=TA(c3.Properties as TcxComboBoxProperties).Items.Objects[idx]).s;
|
|||
|
next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
}
|
|||
|
end;
|
|||
|
/////////////////////////////////////////////////////////////
|
|||
|
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>DLL
|
|||
|
/////////////////////////////////////////////////////////////
|
|||
|
procedure GetDll(DllName:string;StrFormid:integer;Str:string);
|
|||
|
type
|
|||
|
TMyFunc = function(App: Tapplication; FormH: hwnd; FormID: Integer; Language: integer; WinStyle: integer;
|
|||
|
UserID: String; UserName: String; dataBase:string): HWND; stdcall;
|
|||
|
var
|
|||
|
Tf: TMyFunc;
|
|||
|
Tp: TFarProc;
|
|||
|
Th:Thandle;
|
|||
|
begin
|
|||
|
Th := LoadLibrary(Pchar(trim(DllName)));
|
|||
|
if Th > 0 then
|
|||
|
begin
|
|||
|
try
|
|||
|
Tp := GetProcAddress(Th, 'GetForm');
|
|||
|
if Tp <> nil then
|
|||
|
begin
|
|||
|
Tf := TMyFunc(Tp);
|
|||
|
newh:=Tf(Application,0,StrFormid,0,0,
|
|||
|
gUserID,gUserName,trim(Str));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
finally
|
|||
|
//<2F>ͷŴ<CDB7><C5B4><EFBFBD>FreeLibrary(Th);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> '+trim(DllName)+' <20>ļ<EFBFBD><C4BC><EFBFBD>'),'<27><>ʾ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD>ܣ<EFBFBD>ɾ<EFBFBD><C9BE>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>title<6C>Ĵ<EFBFBD><C4B4><EFBFBD>
|
|||
|
//formId:<3A><><EFBFBD><EFBFBD>
|
|||
|
////////////////////////////////////////////////
|
|||
|
function KillNoFuncWinForm(formName:string;formTitle:string;formId:integer=0):boolean;
|
|||
|
var
|
|||
|
bFound:boolean;
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
bFound := FALSE;
|
|||
|
try
|
|||
|
for i := (application.MainForm.MDIChildCount - 1) downto 0 do
|
|||
|
begin
|
|||
|
//<2F>Ѵ<EFBFBD><D1B4><EFBFBD>
|
|||
|
if (application.MainForm.MDIChildren[i].Name =formName) and
|
|||
|
(application.MainForm.MDIChildren[i].Caption = formTitle) then
|
|||
|
begin
|
|||
|
bFound:=true;
|
|||
|
application.MainForm.MDIChildren[i].BringToFront;
|
|||
|
break;
|
|||
|
end;
|
|||
|
//ͬ<><CDAC><EFBFBD><EFBFBD>ͬtitle
|
|||
|
if (application.MainForm.MDIChildren[i].Name =formName) and
|
|||
|
(application.MainForm.MDIChildren[i].Caption <> formTitle) then
|
|||
|
begin
|
|||
|
application.MainForm.MDIChildren[i].Free;
|
|||
|
//application.MainForm.MDIChildren[i]:=nil;
|
|||
|
break;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
result:=bFound;
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD>ù<EFBFBD><C3B9>˺<EFBFBD><CBBA><EFBFBD>
|
|||
|
////////////////////////////////////////////////////////////
|
|||
|
procedure Dofilter(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;
|
|||
|
////////////////////////////////////////////////////////////
|
|||
|
//<2F><><EFBFBD>ù<EFBFBD><C3B9>˺<EFBFBD><CBBA><EFBFBD>
|
|||
|
////////////////////////////////////////////////////////////
|
|||
|
procedure DofilterNew(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 DofilterCDS(Cds_Sub:TClientDataSet;FilterStr:string);
|
|||
|
begin
|
|||
|
try
|
|||
|
Cds_Sub.DisableControls;
|
|||
|
with Cds_Sub do
|
|||
|
begin
|
|||
|
if Trim(FilterStr)='' then
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Filter:=FilterStr;
|
|||
|
Filtered:=True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
Cds_Sub.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////////////
|
|||
|
// //<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>DLL <20>½ӿ<C2BD> getForm10
|
|||
|
///////////////////////////////////////////////////////
|
|||
|
procedure GetDll10(DllName:string;sFormid:integer;sDatabase:string;sTitle:string;sDef1:string;sDef2:string);
|
|||
|
type
|
|||
|
TMyFunc = function(App:Tapplication; FormH:hwnd; FormID:integer;
|
|||
|
Language: integer; WinStyle:integer;
|
|||
|
UID: String; UName: String; dataBase:String;
|
|||
|
Title:String;Def1: String;Def2: String):HWND; stdcall;
|
|||
|
var
|
|||
|
Tf: TMyFunc;
|
|||
|
Tp: TFarProc;
|
|||
|
Th:Thandle;
|
|||
|
begin
|
|||
|
Th := LoadLibrary(Pchar(trim(DllName)));
|
|||
|
if Th > 0 then
|
|||
|
begin
|
|||
|
try
|
|||
|
Tp := GetProcAddress(Th, 'GetForm10');
|
|||
|
if Tp <> nil then
|
|||
|
begin
|
|||
|
Tf := TMyFunc(Tp);
|
|||
|
newh:=Tf(Application,0,SFormid,0,0,
|
|||
|
gUserID,gUserName,trim(sdatabase),trim(sTitle),trim(sDef1),trim(sDef2));
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
|
|||
|
end;
|
|||
|
finally
|
|||
|
//<2F>ͷŴ<CDB7><C5B4><EFBFBD>FreeLibrary(Th);
|
|||
|
end;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
application.MessageBox(Pchar('<27>Ҳ<EFBFBD><D2B2><EFBFBD> '+trim(DllName)+' <20>ļ<EFBFBD><C4BC><EFBFBD>'),'<27><>ʾ');
|
|||
|
end;
|
|||
|
end;
|
|||
|
function GetNoDateMaxNo(ADOQueryTmp:TADOQuery;
|
|||
|
var mMaxNo:string;
|
|||
|
mTable:string;
|
|||
|
mFlag:string;
|
|||
|
lsLen:integer=3):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear ;
|
|||
|
sql.Add('exec XC_TableNoDateDH');
|
|||
|
sql.Add(quotedStr(mTable));
|
|||
|
sql.Add(','+quotedStr(mFlag));
|
|||
|
sql.Add(','+intTostr(LsLen));
|
|||
|
Open;
|
|||
|
|
|||
|
if RecordCount>0 then
|
|||
|
begin
|
|||
|
mMaxNo:=trim(fieldByName('DepotShow').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><D4B6><EFBFBD><EFBFBD><EFBFBD>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
Except
|
|||
|
result:=false;
|
|||
|
application.MessageBox(Pchar('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>('+mflag+')'),'<27><>ʾ<EFBFBD><CABE>Ϣ',MB_ICONINFORMATION);
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|