727 lines
20 KiB
ObjectPascal
727 lines
20 KiB
ObjectPascal
![]() |
unit U_RSFormPas;
|
|||
|
|
|||
|
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,
|
|||
|
cxTreeView, cxGrid,cxDBLookupComboBox,cxCalendar, cxCurrencyEdit,cxExportGrid4Link,
|
|||
|
ExtCtrls, Buttons,DBClient,FTComboBox,cxDropDownEdit,RM_GridReport;
|
|||
|
type
|
|||
|
TA = class(TComponent)
|
|||
|
public
|
|||
|
S:string;
|
|||
|
end;
|
|||
|
procedure InitTree(ADOQueryTemp:TADOQuery;TreeView1:TcxTreeView);
|
|||
|
procedure InitChildTree(ADOQueryTemp:TADOQuery;TreeView1:TcxTreeView);
|
|||
|
function GetRoot(node:TTreeNode):TTreeNode;
|
|||
|
function TreeFiltered(ADOQueryTemp:TADOQuery;TreeStr:string):string;
|
|||
|
function TreeSelect(TreeStr:string;ADOQueryTemp:TADOQuery):string;
|
|||
|
procedure Dofilter(ADOQueryMain:TADOQuery;TreeFilter:string);
|
|||
|
procedure InitCombox(ADOQueryTemp: TADOQuery;FState:Integer;CB1:TComboBox;FFlag:string);
|
|||
|
function DelData(ADOQueryMain,ADOQueryCmd:TADOQuery;FStr:String):Boolean;
|
|||
|
//procedure InitData(ADOQueryMain:TADOQuery);
|
|||
|
//procedure KeyPress(Sender: TObject;Key: Char);
|
|||
|
procedure InitData(ADOQueryMain:TADOQuery;mParent:TWinControl;FTag:Integer);
|
|||
|
procedure Initcomponents(mParent:TWinControl);
|
|||
|
function GetDate(FDate:TDateTime):TDateTime;
|
|||
|
procedure GetDate10(FPanel:TWinControl);
|
|||
|
procedure SetDataNull(mParent:TWinControl);
|
|||
|
procedure Setsavedata(ADOQueryCmd:TADOQuery;MyTable:string;
|
|||
|
Myparent:TWinControl;MyTag:integer);
|
|||
|
procedure SelMember(Selmem:TBtnEditA);
|
|||
|
procedure Seldept(Selmem:TBtnEditA);
|
|||
|
function GetTime(FTime:TDateTime):TTime;
|
|||
|
procedure InitCDSData30(fromADO:TADOQuery;toCDS:TClientDataSet;
|
|||
|
ProgressBar1:TProgressBar);
|
|||
|
procedure InitFtComBoxByCustCode(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TFtComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean;
|
|||
|
isClearOld:boolean
|
|||
|
);
|
|||
|
procedure InitComBoxByCustCode(ADOQueryTmp:TADOQuery;
|
|||
|
cb: TComboBox;FlagType:string;
|
|||
|
Boxtype:integer;
|
|||
|
showMsg:string;
|
|||
|
emptyFlag:Boolean
|
|||
|
);
|
|||
|
procedure PrintRM(ADOQueryMain:TADOQuery;RMname:string;RM1:TRMGridReport);
|
|||
|
|
|||
|
implementation
|
|||
|
uses U_global,U_StuffHelp,U_frameHelp;
|
|||
|
///////////////////////////////////////////////////////
|
|||
|
///// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ʼ<EFBFBD><CABC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////////////////////////
|
|||
|
procedure InitTree(ADOQueryTemp:TADOQuery;TreeView1:TcxTreeView);
|
|||
|
var
|
|||
|
aNode:TTreeNode;
|
|||
|
j:integer;
|
|||
|
kind:string;
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('select * from Xc_CustCode where Flag=''PStatus''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
ADOQueryTemp.First;
|
|||
|
for j:=0 to ADOQueryTemp.RecordCount-1 do
|
|||
|
begin
|
|||
|
kind:='<27><><EFBFBD><EFBFBD>'+Trim(ADOQueryTemp.FieldByName('name').AsString)+'Ա<><D4B1>';
|
|||
|
aNode:=TreeView1.Items.AddChild(nil,kind) ;
|
|||
|
ADOQueryTemp.Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////////////////////////
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitChildTree(ADOQueryTemp:TADOQuery;TreeView1:TcxTreeView);
|
|||
|
var
|
|||
|
kind:string;
|
|||
|
Node:TTreeNode;
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
if TreeView1.Selected.HasChildren then
|
|||
|
begin
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
Node:=TreeView1.Selected;
|
|||
|
i:=0;
|
|||
|
while((Node<>nil)and(Node.Parent<>nil)) do
|
|||
|
begin
|
|||
|
Node:=Node.Parent;
|
|||
|
i:=i+1;
|
|||
|
end;
|
|||
|
if TreeView1.Selected.Parent<>nil then
|
|||
|
begin
|
|||
|
kind:=Trim(TreeView1.Selected.Text);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('select * from Yc_Frame where framename='''+kind+'''');
|
|||
|
Open;
|
|||
|
kind:=Trim(fieldbyname('frameno').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('select * from Yc_Frame where frameLevel=:i');
|
|||
|
Parameters.ParamByName('i').Value:=i+1;
|
|||
|
if TreeView1.Selected.Parent<>nil then
|
|||
|
SQL.Add('and frameno like '+QuotedStr('%'+kind+'%'));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
kind:='';
|
|||
|
kind:=fieldbyname('framename').AsString;
|
|||
|
node:=TreeView1.Items.AddChild(TreeView1.Selected,kind);
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////////////////
|
|||
|
//// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ø<EFBFBD><C3B8>ڵ<EFBFBD>
|
|||
|
///////////////////////////////
|
|||
|
function GetRoot(node:TTreeNode):TTreeNode;
|
|||
|
begin
|
|||
|
Result:=node;
|
|||
|
while((Result <> nil) and (Result.Parent <> nil)) do
|
|||
|
Result:= Result.Parent;
|
|||
|
end;
|
|||
|
//////////////////////////////////////
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>й<EFBFBD><D0B9><EFBFBD>
|
|||
|
/////////////////////////////////////
|
|||
|
function TreeFiltered(ADOQueryTemp:TADOQuery;TreeStr:string):string;
|
|||
|
var
|
|||
|
TreeFilter:string;
|
|||
|
begin
|
|||
|
result:='';
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('select * from Yc_Frame where framename='''+TreeStr+'''');
|
|||
|
Open;
|
|||
|
TreeStr:=Trim(fieldbyname('frameNo').AsString);
|
|||
|
end;
|
|||
|
TreeFilter:=' and Dept like'+' '+'%'+TreeStr+'%';
|
|||
|
//TreeFilter:=' and Dept like'''+'%'+TreeStr+'%'+'''';
|
|||
|
result:=TreeFilter;
|
|||
|
end;
|
|||
|
function GetDate(FDate:TDateTime):TDateTime;
|
|||
|
begin
|
|||
|
result:=StrToDate(FormatDateTime('yyyy-MM-dd',FDate));
|
|||
|
end;
|
|||
|
function GetTime(FTime:TDateTime):TTime;
|
|||
|
begin
|
|||
|
result:=StrTotime(FormatDateTime('HH:mm:ss',FTime));
|
|||
|
end;
|
|||
|
/////////////////////////////
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ø<EFBFBD><C3B8>ڵ<EFBFBD>
|
|||
|
///////////////////////////
|
|||
|
function TreeSelect(TreeStr:string;ADOQueryTemp:TADOQuery):string;
|
|||
|
var
|
|||
|
TreeFilter:string;
|
|||
|
begin
|
|||
|
result:='';
|
|||
|
TreeStr:=Copy(TreeStr,5,4);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add('select * from Xc_CustCode where name='''+TreeStr+''' and flag=''PStatus''');
|
|||
|
Open;
|
|||
|
TreeStr:=Trim(fieldbyname('code').AsString);
|
|||
|
end;
|
|||
|
TreeFilter:=' PStatus='''+TreeStr+'''';
|
|||
|
result:=TreeFilter;
|
|||
|
end;
|
|||
|
////////////////////////////
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///////////////////////////
|
|||
|
procedure Dofilter(ADOQueryMain:TADOQuery;TreeFilter:string);
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
if Trim(TreeFilter)='' then
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
EnableControls;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Filter:=TreeFilter;
|
|||
|
Filtered:=True;
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
/////////////////////////////////////////////
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ʼ<EFBFBD><CABC>combobox <20><>XC_CustCode<64><65>
|
|||
|
////////////////////////////////////////////
|
|||
|
procedure InitCombox(ADOQueryTemp: TADOQuery;FState:Integer;CB1:TComboBox;FFlag:string);
|
|||
|
var
|
|||
|
A:TA;
|
|||
|
begin
|
|||
|
CB1.Items.Clear;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add(' select * from XC_CustCode');
|
|||
|
SQL.Add(' where Flag='''+trim(FFlag)+''' ');
|
|||
|
SQL.Add(' And Valid=''Y''');
|
|||
|
SQL.Add(' order by orderno ');
|
|||
|
Open;
|
|||
|
if IsEmpty then
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('<27><><EFBFBD><EFBFBD>XC_CustCode Flag='+FFlag),'<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
A:=TA.Create(nil);
|
|||
|
A.S:=trim(fieldByName('Code').AsString);
|
|||
|
if FState=0 then
|
|||
|
begin
|
|||
|
CB1.Items.AddObject((Trim(fieldbyname('name').AsString)),TObject(a));
|
|||
|
Next;
|
|||
|
end else
|
|||
|
begin
|
|||
|
CB1.Items.AddObject((Trim(fieldbyname('code').AsString)),TObject(a));
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
//////////////////////////////////////////////
|
|||
|
//////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////////////////
|
|||
|
function DelData(ADOQueryMain,ADOQueryCmd:TADOQuery;FStr:String):Boolean;
|
|||
|
begin
|
|||
|
try
|
|||
|
result:=False;
|
|||
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',MB_YESNO+MB_ICONSTOP)<>IDYES then
|
|||
|
begin
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
SQL.Add(FStr);
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
result:=True;
|
|||
|
except
|
|||
|
result:=False;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
//////////////////////////////////
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////
|
|||
|
procedure InitData(ADOQueryMain:TADOQuery;mParent:TWinControl;FTag:Integer);
|
|||
|
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].Tag=FTag then
|
|||
|
begin
|
|||
|
if (Controls[i] is TEdit) then
|
|||
|
begin
|
|||
|
if Controls[i].Name='name1' then
|
|||
|
TEdit(Controls[i]).Text:=Trim(ADOQueryMain.fieldbyname('name').AsString)
|
|||
|
else
|
|||
|
TEdit(Controls[i]).Text:=Trim(ADOQueryMain.fieldbyname(Controls[i].Name).AsString);
|
|||
|
end else
|
|||
|
if (Controls[i] is TRichEdit) then
|
|||
|
begin
|
|||
|
TRichEdit(Controls[i]).Text:=Trim(ADOQueryMain.fieldbyname(Controls[i].Name).AsString);
|
|||
|
end else
|
|||
|
if (Controls[i] is TFTComboBox) then
|
|||
|
begin
|
|||
|
TFTComboBox(Controls[i]).ItemIndex:=TFTComboBox(Controls[i]).IndexOfItem2(Trim(ADOQueryMain.fieldbyname(Controls[i].Name).AsString));
|
|||
|
end else
|
|||
|
if (Controls[i] is TComboBox) then
|
|||
|
begin
|
|||
|
TComboBox(Controls[i]).ItemIndex:=TComboBox(Controls[i]).Items.IndexOf(Trim(ADOQueryMain.fieldbyname(Controls[i].Name).AsString));
|
|||
|
end else
|
|||
|
if (Controls[i] is TDateTimePicker) then
|
|||
|
begin
|
|||
|
if Trim(ADOQueryMain.fieldbyname(Controls[i].Name).AsString)<>'' then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
|||
|
TDateTimePicker(Controls[i]).Checked:=True;
|
|||
|
TDateTimePicker(Controls[i]).DateTime:=ADOQueryMain.fieldbyname(Controls[i].Name).AsDateTime;
|
|||
|
end else
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
|||
|
TDateTimePicker(Controls[i]).Checked:=False;
|
|||
|
end;
|
|||
|
end else
|
|||
|
if (Controls[i] is TBtnEditA) then
|
|||
|
begin
|
|||
|
if Controls[i].Name='name1' then
|
|||
|
TBtnEditA(Controls[i]).Text:=Trim(ADOQueryMain.fieldbyname('name').AsString)
|
|||
|
else
|
|||
|
if Controls[i].Name='code' then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).Text:=Trim(ADOQueryMain.fieldbyname('code').AsString);
|
|||
|
TBtnEditA(Controls[i]).TxtCode:=Trim(ADOQueryMain.fieldbyname('code').AsString);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).TxtCode:=Trim(ADOQueryMain.fieldbyname(Controls[i].Name).AsString);
|
|||
|
TBtnEditA(Controls[i]).Text:=Trim(ADOQueryMain.fieldbyname(Controls[i].Name+'1').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure SetDataNull(mParent:TWinControl);
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
begin
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
//if Controls[i].Tag=1 then
|
|||
|
//begin
|
|||
|
if Controls[i] is TLabel 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 TComboBox) then
|
|||
|
begin
|
|||
|
TComboBox(Controls[i]).ItemIndex:=-1;
|
|||
|
end else
|
|||
|
if (Controls[i] is TDateTimePicker) then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Kind=dtkdate then
|
|||
|
TDateTimePicker(Controls[i]).DateTime:=GetDate(Now)
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).Time:=GetTime(Now);
|
|||
|
end else
|
|||
|
if (Controls[i] is TBtnEditA) then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).Text:='';
|
|||
|
TBtnEditA(Controls[i]).TxtCode:='';
|
|||
|
end;
|
|||
|
//end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////////////////////
|
|||
|
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ؼ<EFBFBD>
|
|||
|
///////////////////////////////////
|
|||
|
{procedure KeyPress(Sender: TObject;Key: Char);
|
|||
|
begin
|
|||
|
if Key=#13 then
|
|||
|
begin
|
|||
|
FindNextControl(TWinControl(sender),True,True,False).SetFocus;
|
|||
|
end;
|
|||
|
end;}
|
|||
|
/////////////////////////////////////
|
|||
|
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ؼ<EFBFBD>״̬
|
|||
|
////////////////////////////////////
|
|||
|
procedure Initcomponents(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 TEdit) then
|
|||
|
begin
|
|||
|
TEdit(Controls[i]).Enabled:=False;
|
|||
|
end else
|
|||
|
if (Controls[i] is TRichEdit) then
|
|||
|
begin
|
|||
|
TRichEdit(Controls[i]).Enabled:=False;
|
|||
|
end else
|
|||
|
if (Controls[i] is TComboBox) then
|
|||
|
begin
|
|||
|
TComboBox(Controls[i]).Enabled:=False;
|
|||
|
end else
|
|||
|
if (Controls[i] is TDateTimePicker) then
|
|||
|
begin
|
|||
|
TDateTimePicker(Controls[i]).Enabled:=False;
|
|||
|
end else
|
|||
|
if (Controls[i] is TButton) then
|
|||
|
begin
|
|||
|
TButton(Controls[i]).Enabled:=False;
|
|||
|
end else
|
|||
|
if (Controls[i] is TToolButton) then
|
|||
|
begin
|
|||
|
TToolButton(Controls[i]).Visible:=False;
|
|||
|
end else
|
|||
|
if (Controls[i] is TBtnEditA) then
|
|||
|
begin
|
|||
|
TBtnEditA(Controls[i]).Enabled:=False;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure GetDate10(FPanel:TWinControl);
|
|||
|
var
|
|||
|
i:Integer;
|
|||
|
begin
|
|||
|
with FPanel do
|
|||
|
begin
|
|||
|
for i:=0 to ControlCount-1 do
|
|||
|
begin
|
|||
|
if not(Controls[i] is TLabel) then Continue;
|
|||
|
if (Controls[i] is TDateTimePicker) then
|
|||
|
begin
|
|||
|
if TDateTimePicker(Controls[i]).Kind=dtkdate then
|
|||
|
begin
|
|||
|
TDateTimePicker(Controls[i]).DateTime:=StrToDate(FormatDateTime('yyyy-MM-dd',now));
|
|||
|
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
|||
|
TDateTimePicker(Controls[i]).Checked:=False;
|
|||
|
end
|
|||
|
else
|
|||
|
TDateTimePicker(Controls[i]).Time:=StrToTime(FormatDateTime('HH:mm:ss',now));
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
///////////////////////////////////
|
|||
|
/////<2F><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>ֶθ<D6B6>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>
|
|||
|
//////////////////////////////////
|
|||
|
procedure Setsavedata(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 Controls[i].Name='name1' then
|
|||
|
ADOQueryCmd.FieldByName('name').Value:=Trim(TEdit(Controls[i]).Text)
|
|||
|
else
|
|||
|
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 TFTComboBox then
|
|||
|
begin
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TFTComboBox(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:=GetDate(TDateTimePicker(Controls[i]).DateTime);
|
|||
|
end else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=GetDate(TDateTimePicker(Controls[i]).DateTime);
|
|||
|
end else
|
|||
|
if Controls[i] is TBtnEditA then
|
|||
|
begin
|
|||
|
if Controls[i].Name='name1' then
|
|||
|
ADOQueryCmd.FieldByName('name').Value:=Trim(TBtnEditA(Controls[i]).Text)
|
|||
|
else
|
|||
|
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditA(Controls[i]).TxtCode);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure SelMember(Selmem:TBtnEditA);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmStuffHelp:=TfrmStuffHelp.Create(Application);
|
|||
|
with frmStuffHelp do
|
|||
|
begin
|
|||
|
frmStuffHelp.Position:=poScreenCenter;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
Selmem.TxtCode:=Trim(ADOQueryHelp.fieldbyname('code').AsString);
|
|||
|
Selmem.Text:=Trim(ADOQueryHelp.fieldbyname('name').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmStuffHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure Seldept(Selmem:TBtnEditA);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmFrameHelp:=TfrmFrameHelp.Create(Application);
|
|||
|
with frmFrameHelp do
|
|||
|
begin
|
|||
|
frmFrameHelp.Position:=poScreenCenter;
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
Selmem.TxtCode:=Trim(ADOQueryHelp.fieldbyname('frameno').AsString);
|
|||
|
Selmem.Text:=Trim(ADOQueryHelp.fieldbyname('framename').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmFrameHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
////////////////////////
|
|||
|
//<2F><><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
///////////////////////
|
|||
|
procedure InitCDSData30(fromADO:TADOQuery;toCDS:TClientDataSet;
|
|||
|
ProgressBar1:TProgressBar);
|
|||
|
var
|
|||
|
i:integer;
|
|||
|
k:integer;
|
|||
|
j:Integer;
|
|||
|
begin
|
|||
|
if fromADO.IsEmpty then exit;
|
|||
|
fromADO.first;
|
|||
|
j:=1;
|
|||
|
K:=1;
|
|||
|
try
|
|||
|
toCDS.DisableControls;
|
|||
|
toCDS.Filtered:=false;
|
|||
|
ProgressBar1.Min:=0;
|
|||
|
|
|||
|
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;
|
|||
|
ProgressBar1.Visible:=True;
|
|||
|
ProgressBar1.Max:=fromADO.FieldCount*10;
|
|||
|
ProgressBar1.Position:=j;
|
|||
|
fieldByName('flag').AsString :='1';
|
|||
|
fieldByName('index').value :=k;
|
|||
|
fieldByName('sel').value :=false;
|
|||
|
//Application.ProcessMessages;
|
|||
|
sleep(1);
|
|||
|
inc(k);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
fromADO.Next;
|
|||
|
j:=j+1;
|
|||
|
end;
|
|||
|
ProgressBar1.Visible:=False;
|
|||
|
if not toCDS.IsEmpty then
|
|||
|
begin
|
|||
|
toCDS.First ;
|
|||
|
end;
|
|||
|
finally
|
|||
|
toCDS.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure PrintRM(ADOQueryMain:TADOQuery;RMname:string;RM1:TRMGridReport);
|
|||
|
var
|
|||
|
fPrintFile:string;
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then Exit;
|
|||
|
fPrintFile := ExtractFilePath(Application.ExeName)+RMname ;
|
|||
|
begin
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM1.Clear;
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
RM1.ShowReport;
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1>ʽ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɴ<EFBFBD>ӡ' + #13+ fPrintFile),'<27><>ʾ',0);
|
|||
|
Exit ;
|
|||
|
end ;
|
|||
|
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;
|
|||
|
//emptyFlag<61><67><EFBFBD>Ƿ<EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ<EFBFBD><CEAA>
|
|||
|
//isClearOld:<3A><><EFBFBD><EFBFBD>ԭ<EFBFBD>е<EFBFBD><D0B5><EFBFBD>Ŀ
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitFtComBoxByCustCode(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_Custcode');
|
|||
|
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('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_CustCode<64><65><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
//Boxtype:0; <20><><EFBFBD><EFBFBD><EFBFBD>ţ<EFBFBD>1;
|
|||
|
//////////////////////////////////////////////
|
|||
|
procedure InitComBoxByCustCode(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('δ<>ҵ<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;
|
|||
|
end.
|
|||
|
|