1177 lines
34 KiB
ObjectPascal
1177 lines
34 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);
|
||
procedure InitChildTree10(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);
|
||
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);
|
||
function SDelData(ADOQueryCmd:TADOQuery;FStr:String):Boolean;
|
||
procedure InitData30(ADOQueryMain:TADOQuery;TreeView1:TcxTreeView);
|
||
procedure SInitGrid(ADOQueryMain:TADOQuery;TreeView1:TTreeView;
|
||
FProcedure:String;BegDate,EndDate:TDateTime);
|
||
|
||
procedure SelPrintData(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTile:string);
|
||
procedure SelPrintData10(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTitle:string
|
||
;FLTitle:string;FRTile:string);
|
||
procedure SelExportData(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTile:string);
|
||
procedure GetDate20(FPanel:TWinControl;AdoQuery:TADOQuery);
|
||
function DelData10(ADOQueryMain,ADOQueryCmd:TADOQuery;FStr:String):Boolean;
|
||
implementation
|
||
uses U_global,U_StuffHelp,U_frameHelp,U_SelPrintField,U_SelExportField,U_FormPas;
|
||
///////////////////////////////////////////////////////
|
||
///// <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;
|
||
procedure InitData30(ADOQueryMain:TADOQuery;TreeView1:TcxTreeView);
|
||
var
|
||
fsj:String;
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('exec P_Select_Yc_Stuff_Main20 :FCode,0 ,:Def1,:UserId,:DeptCode');
|
||
if Length(Trim(gDef1))<2 then
|
||
begin
|
||
if Trim(gDef1)<>'' then
|
||
Parameters.ParamByName('Def1').Value:=StrToInt(gDef1);
|
||
end;
|
||
Parameters.ParamByName('UserId').Value:=Trim(gUserID);
|
||
Parameters.ParamByName('DeptCode').Value:=Trim(TreeView1.Selected.Text);
|
||
Open;
|
||
end;
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
procedure SInitGrid(ADOQueryMain:TADOQuery;TreeView1:TTreeView;
|
||
FProcedure:String;BegDate,EndDate:TDateTime);
|
||
begin
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
//FProcedure:='';
|
||
SQL.Add(FProcedure);
|
||
Parameters.ParamByName('begindate').Value:=BegDate;
|
||
Parameters.ParamByName('enddate').Value:=EndDate;
|
||
Parameters.ParamByName('UserId').Value:=Trim(gUserID);
|
||
Parameters.ParamByName('DeptName').Value:=Trim(TreeView1.Selected.Text);
|
||
if Length(Trim(gDef1))<2 then
|
||
begin
|
||
if Trim(gDef1)<>'' then
|
||
Parameters.ParamByName('CtrlFlag').Value:=StrToInt(gDef1);
|
||
end;
|
||
Open;
|
||
end;
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
procedure InitChildTree10(ADOQueryTemp:TADOQuery;TreeView1:TcxTreeView);
|
||
var
|
||
kind:string;
|
||
node,Pnode:TTreeNode;
|
||
ii:Integer;
|
||
begin
|
||
if TreeView1.Selected.HasChildren then
|
||
begin
|
||
Exit;
|
||
end;
|
||
ii:=0;
|
||
Pnode:=TreeView1.Selected;
|
||
while((Pnode<>nil)and(Pnode.Parent<>nil)) do
|
||
begin
|
||
Pnode:=Pnode.Parent;
|
||
ii:=ii+1;
|
||
end;
|
||
if ii=0 then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from Yc_Frame where framelevel=0');
|
||
Open;
|
||
end;
|
||
end else
|
||
if ii=1 then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from Yc_Frame where framelevel=1');
|
||
Open;
|
||
end;
|
||
end else
|
||
if ii>1 then
|
||
begin
|
||
kind:=Trim(TreeView1.Selected.Text);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from Yc_Frame where ');
|
||
sql.Add(' framename='''+kind+'''');
|
||
Open;
|
||
kind:=Trim(fieldbyname('frameno').AsString);
|
||
end;
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
SQL.Add('select * from Yc_Frame where framelevel=:ii');
|
||
sql.Add(' and frametop='''+kind+'''');
|
||
Parameters.ParamByName('ii').Value:=IntToStr(ii);
|
||
Open;
|
||
end;
|
||
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+'<'+Trim(Cb1.Hint)+'>'),'<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;
|
||
function DelData10(ADOQueryMain,ADOQueryCmd:TADOQuery;FStr:String):Boolean;
|
||
begin
|
||
try
|
||
result:=False;
|
||
if ADOQueryMain.IsEmpty then Exit;
|
||
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;
|
||
function SDelData(ADOQueryCmd:TADOQuery;FStr:String):Boolean;
|
||
begin
|
||
try
|
||
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 TcxDateEdit) then
|
||
begin
|
||
TcxDateEdit(Controls[i]).Date:=ADOQueryMain.fieldbyname(Controls[i].Name).AsDateTime;
|
||
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);
|
||
if TDateTimePicker(Controls[i]).ShowCheckbox=True then
|
||
begin
|
||
TDateTimePicker(Controls[i]).Checked:=False;
|
||
end;
|
||
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]).ReadOnly:=True;
|
||
end else
|
||
if (Controls[i] is TRichEdit) then
|
||
begin
|
||
TRichEdit(Controls[i]).ReadOnly:=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;
|
||
procedure GetDate20(FPanel:TWinControl;AdoQuery:TADOQuery);
|
||
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',GetServerTime10(AdoQuery)));
|
||
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 if Trim(TEdit(Controls[i]).Text)<>'' then
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TEdit(Controls[i]).Text);
|
||
end else
|
||
if Controls[i] is TRichEdit then
|
||
begin
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TRichEdit(Controls[i]).Text;
|
||
end else
|
||
if Controls[i] is 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 TcxDateEdit then
|
||
begin
|
||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TcxDateEdit(Controls[i]).Date;
|
||
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
|
||
);
|
||
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;
|
||
|
||
{procedure SelPrintData(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTile:string);
|
||
var
|
||
i,j:Integer;
|
||
fsj:string;
|
||
begin
|
||
if FAdoQry.IsEmpty then Exit;
|
||
try
|
||
frmSelPrintField:=TfrmSelPrintField.Create(Application);
|
||
with frmSelPrintField do
|
||
begin
|
||
with frmSelPrintField.PrnGrid do
|
||
begin
|
||
PrnGrid.Columns.Clear;
|
||
frmSelPrintField.IniName:=FTile;
|
||
for i:=0 to FTv.ColumnCount-1 do
|
||
begin
|
||
if FTv.Columns[i].Visible=True then
|
||
begin
|
||
PrnGrid.Columns.Add;
|
||
j:=PrnGrid.Columns.Count-1;
|
||
PrnGrid.Columns[j].Title.Caption:=FTv.Columns[i].Caption;
|
||
PrnGrid.Columns[j].FieldName:=FTv.Columns[i].DataBinding.FieldName;
|
||
PrnGrid.Columns[j].Width:=FTv.Columns[i].Width;
|
||
end;
|
||
end;
|
||
end;
|
||
PrintDataSource.DataSet:=FAdoQry;
|
||
FAdoQry.Open;
|
||
frmSelPrintField.RMPrintDBGrid1.PageCaptionMsg.TitleMemo.Add(FTile);
|
||
//frmSelPrintField.RMPrintDBGrid1.PageHeaderMsg.CenterMemo.Add(FTile);
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
//frmSelPrintField.RMPrintDBGrid1.PageCaptionMsg.TitleMemo.Add(FTile);
|
||
frmSelPrintField.Free;
|
||
except
|
||
|
||
end;
|
||
end;}
|
||
procedure SelPrintData10(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTitle:string
|
||
;FLTitle:string;FRTile:string);
|
||
var
|
||
i,j,k:Integer;
|
||
fsj:string;
|
||
FOrder,fcolumnName:string;
|
||
begin
|
||
if FAdoQry.IsEmpty then Exit;
|
||
try
|
||
frmSelPrintField:=TfrmSelPrintField.Create(Application);
|
||
with frmSelPrintField do
|
||
begin
|
||
with frmSelPrintField.PrnGrid do
|
||
begin
|
||
PrnGrid.Columns.Clear;
|
||
frmSelPrintField.IniName:=FTitle;
|
||
for i:=0 to FTv.ColumnCount-1 do
|
||
begin
|
||
if FTv.Columns[i].Visible=True then
|
||
begin
|
||
PrnGrid.Columns.Add;
|
||
j:=PrnGrid.Columns.Count-1;
|
||
PrnGrid.Columns[j].Title.Caption:=FTv.Columns[i].Caption;
|
||
PrnGrid.Columns[j].FieldName:=FTv.Columns[i].DataBinding.FieldName;
|
||
PrnGrid.Columns[j].Width:=FTv.Columns[i].Width;
|
||
if FTv.Columns[i].SortOrder=soAscending then
|
||
begin
|
||
FOrder:=' '+FTv.Columns[i].DataBinding.FieldName+' ';
|
||
end else
|
||
if FTv.Columns[i].SortOrder=soDescending then
|
||
begin
|
||
FOrder:=' '+FTv.Columns[i].DataBinding.FieldName+' DESC';
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
FAdoQry.Open;
|
||
FAdoQry.Sort:=FOrder;
|
||
frmSelPrintField.RMPrintDBGrid1.PageCaptionMsg.TitleMemo.Add(FTitle);
|
||
frmSelPrintField.RMPrintDBGrid1.PageCaptionMsg.CaptionMsg.LeftMemo.Add(FLTitle);
|
||
frmSelPrintField.RMPrintDBGrid1.PageCaptionMsg.CaptionMsg.RightMemo.Add(FRTile);
|
||
CreateCDS20(FAdoQry,frmSelPrintField.ClientDataSet1);
|
||
InitCDSData20(FAdoQry,frmSelPrintField.ClientDataSet1);
|
||
if FTv.OptionsView.Footer=True then
|
||
begin
|
||
if FTv.DataController.Summary.FooterSummaryItems.Count>0 then
|
||
begin
|
||
frmSelPrintField.ClientDataSet1.Append;
|
||
frmSelPrintField.ClientDataSet1.FieldByName('index').Value:=frmSelPrintField.ClientDataSet1.RecNo+1;
|
||
frmSelPrintField.ClientDataSet1.Post;
|
||
for i:=0 to FTv.ColumnCount-1 do
|
||
begin
|
||
if FTv.Columns[i].Visible=False then Continue;
|
||
fcolumnName:=FTv.Columns[i].Name;
|
||
if FTv.Columns[i].Summary.FooterKind<>sknone then
|
||
begin
|
||
for k:=0 to FTv.DataController.Summary.FooterSummaryItems.Count-1 do
|
||
begin
|
||
if TcxGridDBTableSummaryItem(FTv.DataController.Summary.FooterSummaryItems.Items[k]).Column.Name=fcolumnName then
|
||
begin
|
||
frmSelPrintField.ClientDataSet1.edit;
|
||
frmSelPrintField.ClientDataSet1.FieldByName(FTv.Columns[i].DataBinding.FieldName).Value:=
|
||
FTv.DataController.Summary.FooterSummaryValues[k];
|
||
frmSelPrintField.ClientDataSet1.Post;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
//frmSelPrintField.RMPrintDBGrid1.PageCaptionMsg.TitleMemo.Add(FTile);
|
||
frmSelPrintField.Free;
|
||
except
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure SelPrintData(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTile:string);
|
||
var
|
||
i,j,k:Integer;
|
||
fsj:string;
|
||
FOrder:string;
|
||
FSum:Double;
|
||
fcolumnName:string;
|
||
begin
|
||
//ShowMessage('2');
|
||
if FAdoQry.IsEmpty then Exit;
|
||
try
|
||
frmSelPrintField:=TfrmSelPrintField.Create(Application);
|
||
with frmSelPrintField do
|
||
begin
|
||
with frmSelPrintField.PrnGrid do
|
||
begin
|
||
PrnGrid.Columns.Clear;
|
||
frmSelPrintField.IniName:=FTile;
|
||
for i:=0 to FTv.ColumnCount-1 do
|
||
begin
|
||
if FTv.Columns[i].Visible=True then
|
||
begin
|
||
PrnGrid.Columns.Add;
|
||
j:=PrnGrid.Columns.Count-1;
|
||
PrnGrid.Columns[j].Title.Caption:=FTv.Columns[i].Caption;
|
||
PrnGrid.Columns[j].FieldName:=FTv.Columns[i].DataBinding.FieldName;
|
||
PrnGrid.Columns[j].Width:=FTv.Columns[i].Width;
|
||
if FTv.Columns[i].SortOrder=soAscending then
|
||
begin
|
||
FOrder:=' '+FTv.Columns[i].DataBinding.FieldName+' ';
|
||
end else
|
||
if FTv.Columns[i].SortOrder=soDescending then
|
||
begin
|
||
FOrder:=' '+FTv.Columns[i].DataBinding.FieldName+' DESC';
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
end;
|
||
FAdoQry.Open;
|
||
FAdoQry.Sort:=FOrder;
|
||
CreateCDS20(FAdoQry,frmSelPrintField.ClientDataSet1);
|
||
InitCDSData20(FAdoQry,frmSelPrintField.ClientDataSet1);
|
||
if FTv.OptionsView.Footer=True then
|
||
begin
|
||
if FTv.DataController.Summary.FooterSummaryItems.Count>0 then
|
||
begin
|
||
frmSelPrintField.ClientDataSet1.Append;
|
||
frmSelPrintField.ClientDataSet1.FieldByName('index').Value:=frmSelPrintField.ClientDataSet1.RecNo+1;
|
||
frmSelPrintField.ClientDataSet1.Post;
|
||
for i:=0 to FTv.ColumnCount-1 do
|
||
begin
|
||
if FTv.Columns[i].Visible=False then Continue;
|
||
fcolumnName:=FTv.Columns[i].Name;
|
||
if FTv.Columns[i].Summary.FooterKind<>sknone then
|
||
begin
|
||
for k:=0 to FTv.DataController.Summary.FooterSummaryItems.Count-1 do
|
||
begin
|
||
if TcxGridDBTableSummaryItem(FTv.DataController.Summary.FooterSummaryItems.Items[k]).Column.Name=fcolumnName then
|
||
begin
|
||
frmSelPrintField.ClientDataSet1.edit;
|
||
frmSelPrintField.ClientDataSet1.FieldByName(FTv.Columns[i].DataBinding.FieldName).Value:=
|
||
FTv.DataController.Summary.FooterSummaryValues[k];
|
||
//frmSelPrintField.ClientDataSet1.FieldByName('flag').Value:='Y';
|
||
frmSelPrintField.ClientDataSet1.Post;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
frmSelPrintField.RMPrintDBGrid1.PageCaptionMsg.TitleMemo.Add(FTile);
|
||
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
frmSelPrintField.Free;
|
||
except
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure SelExportData(FTv:TcxGridDBTableView;FAdoQry:TADOQuery;FTile:string);
|
||
var
|
||
i,j:Integer;
|
||
fsj:string;
|
||
begin
|
||
if FAdoQry.IsEmpty then Exit;
|
||
try
|
||
frmSelExportField:=TfrmSelExportField.Create(Application);
|
||
with frmSelExportField do
|
||
begin
|
||
with frmSelExportField.ExpGrid do
|
||
begin
|
||
// ExpGrid.Columns.Clear;
|
||
ExpGrid.ClearItems;
|
||
frmSelExportField.IniName:=FTile;
|
||
for i:=0 to FTv.ColumnCount-1 do
|
||
begin
|
||
if FTv.Columns[i].Visible=True then
|
||
begin
|
||
ExpGrid.CreateColumn;
|
||
j:=ExpGrid.ColumnCount-1;
|
||
ExpGrid.Columns[j].Caption:=FTv.Columns[i].Caption;
|
||
ExpGrid.Columns[j].DataBinding.FieldName:=FTv.Columns[i].DataBinding.FieldName;
|
||
ExpGrid.Columns[j].Width:=FTv.Columns[i].Width;
|
||
end;
|
||
end;
|
||
end;
|
||
ExportDataSource.DataSet:=FAdoQry;
|
||
FAdoQry.Open;
|
||
if ShowModal=1 then
|
||
begin
|
||
|
||
end;
|
||
end;
|
||
frmSelExportField.Free;
|
||
except
|
||
|
||
end;
|
||
end;
|
||
end.
|
||
|