Apply new .gitignore
8
.gitignore
vendored
|
|
@ -13,4 +13,10 @@
|
|||
*.~pas
|
||||
*.~dfm
|
||||
*.~ddp
|
||||
*.~dpr
|
||||
*.~dpr
|
||||
*.~dpr
|
||||
*.~bpg
|
||||
*.identcache
|
||||
*.local
|
||||
*.zip
|
||||
*.rar
|
||||
307
Z99Dependency/RTFunAndForm/Form/U_LabelAdd.dfm
Normal file
|
|
@ -0,0 +1,307 @@
|
|||
object frmLabelAdd: TfrmLabelAdd
|
||||
Left = 191
|
||||
Top = 109
|
||||
Width = 997
|
||||
Height = 612
|
||||
BorderIcons = [biMaximize]
|
||||
Caption = #26631#31614#32534#36753
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 28
|
||||
Width = 413
|
||||
Height = 513
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
Left = 40
|
||||
Top = 404
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #23458#25143#21517#31216#65306
|
||||
Enabled = False
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clBlue
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
Visible = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 31
|
||||
Top = 69
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #26631#31614#25991#20214#65306
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clBlue
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
Left = 31
|
||||
Top = 95
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #22791' '#27880#65306
|
||||
end
|
||||
object Label9: TLabel
|
||||
Left = 32
|
||||
Top = 16
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #26631#31614#21517#31216#65306
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clBlue
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object Label10: TLabel
|
||||
Left = 32
|
||||
Top = 44
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #26631#31614#31867#22411#65306
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clBlue
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object customerNo: TBtnEditA
|
||||
Left = 104
|
||||
Top = 400
|
||||
Width = 295
|
||||
Height = 20
|
||||
Enabled = False
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
OnBtnClick = customerNoBtnClick
|
||||
end
|
||||
object LabelFileName: TBtnEditA
|
||||
Left = 92
|
||||
Top = 65
|
||||
Width = 260
|
||||
Height = 20
|
||||
ReadOnly = True
|
||||
TabOrder = 1
|
||||
OnBtnClick = LabelFileNameBtnClick
|
||||
end
|
||||
object beizhu: TMemo
|
||||
Left = 92
|
||||
Top = 92
|
||||
Width = 257
|
||||
Height = 149
|
||||
ScrollBars = ssBoth
|
||||
TabOrder = 2
|
||||
end
|
||||
object BtOpen: TBitBtn
|
||||
Left = 353
|
||||
Top = 64
|
||||
Width = 36
|
||||
Height = 19
|
||||
Caption = #25171#24320
|
||||
TabOrder = 3
|
||||
OnClick = BtOpenClick
|
||||
end
|
||||
object LabelCaption: TEdit
|
||||
Left = 92
|
||||
Top = 12
|
||||
Width = 260
|
||||
Height = 20
|
||||
TabOrder = 4
|
||||
end
|
||||
object LabelType: TFTComboBox
|
||||
Tag = 99
|
||||
Left = 92
|
||||
Top = 37
|
||||
Width = 260
|
||||
Height = 20
|
||||
Style = csDropDownList
|
||||
ItemHeight = 12
|
||||
ItemIndex = 0
|
||||
TabOrder = 5
|
||||
Text = #20013#25991#26631#31614
|
||||
Items.Strings = (
|
||||
#20013#25991#26631#31614
|
||||
#33521#25991#26631#31614
|
||||
#20013#33521#25991#26631#31614)
|
||||
end
|
||||
end
|
||||
object ToolBar1: TToolBar
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 981
|
||||
Height = 20
|
||||
AutoSize = True
|
||||
ButtonHeight = 18
|
||||
ButtonWidth = 60
|
||||
Caption = 'ToolBar2'
|
||||
Color = clBtnFace
|
||||
Flat = True
|
||||
List = True
|
||||
ParentColor = False
|
||||
ShowCaptions = True
|
||||
TabOrder = 1
|
||||
Transparent = False
|
||||
object Tsave: TToolButton
|
||||
Left = 0
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #20445#23384#26631#31614
|
||||
ImageIndex = 5
|
||||
OnClick = TsaveClick
|
||||
end
|
||||
object Tclose: TToolButton
|
||||
Left = 64
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #20851#38381
|
||||
ImageIndex = 10
|
||||
OnClick = TcloseClick
|
||||
end
|
||||
end
|
||||
object RMPreview1: TRMPreview
|
||||
Left = 428
|
||||
Top = 20
|
||||
Width = 553
|
||||
Height = 553
|
||||
Align = alRight
|
||||
BevelOuter = bvLowered
|
||||
Caption = #26631#31614#39044#35272
|
||||
TabOrder = 2
|
||||
OnDblClick = RMPreview1DblClick
|
||||
Options.RulerUnit = rmutScreenPixels
|
||||
Options.RulerVisible = False
|
||||
Options.DrawBorder = False
|
||||
Options.BorderPen.Color = clGray
|
||||
Options.BorderPen.Style = psDash
|
||||
end
|
||||
object ADOQueryCmd: TADOQuery
|
||||
Connection = LabelSet_DataLink.ADOLink
|
||||
CommandTimeout = 300
|
||||
Parameters = <>
|
||||
Left = 512
|
||||
Top = 208
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Filter = 'RMFl(*.rmf)|*.rmf'
|
||||
InitialDir = '.'
|
||||
Left = 200
|
||||
Top = 4
|
||||
end
|
||||
object RMGridReport1: TRMGridReport
|
||||
ThreadPrepareReport = True
|
||||
InitialZoom = pzDefault
|
||||
PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbExport, pbNavigator]
|
||||
DefaultCollate = False
|
||||
ShowPrintDialog = False
|
||||
SaveReportOptions.RegistryPath = 'Software\ReportMachine\ReportSettings\'
|
||||
Preview = RMPreview1
|
||||
PreviewOptions.RulerUnit = rmutScreenPixels
|
||||
PreviewOptions.RulerVisible = False
|
||||
PreviewOptions.DrawBorder = False
|
||||
PreviewOptions.BorderPen.Color = clGray
|
||||
PreviewOptions.BorderPen.Style = psDash
|
||||
CompressLevel = rmzcFastest
|
||||
CompressThread = False
|
||||
LaterBuildEvents = True
|
||||
OnlyOwnerDataSet = False
|
||||
Left = 336
|
||||
Top = 8
|
||||
ReportData = {}
|
||||
end
|
||||
object ADOQueryTmp: TADOQuery
|
||||
Connection = LabelSet_DataLink.ADOLink
|
||||
LockType = ltReadOnly
|
||||
CommandTimeout = 300
|
||||
Parameters = <>
|
||||
Left = 528
|
||||
Top = 184
|
||||
end
|
||||
object RMGridReportDesigner1: TRMGridReportDesigner
|
||||
Left = 376
|
||||
Top = 8
|
||||
end
|
||||
object RMBarCodeObject1: TRMBarCodeObject
|
||||
Left = 280
|
||||
Top = 4
|
||||
end
|
||||
object RMBMPExport1: TRMBMPExport
|
||||
ScaleX = 1.000000000000000000
|
||||
ScaleY = 1.000000000000000000
|
||||
Left = 408
|
||||
Top = 8
|
||||
end
|
||||
object RMXLSExport1: TRMXLSExport
|
||||
ShowAfterExport = True
|
||||
ExportPrecision = 1
|
||||
PagesOfSheet = 10
|
||||
ExportImages = True
|
||||
ExportFrames = True
|
||||
ExportImageFormat = ifBMP
|
||||
JPEGQuality = 0
|
||||
ScaleX = 1.000000000000000000
|
||||
ScaleY = 1.000000000000000000
|
||||
CompressFile = False
|
||||
Left = 440
|
||||
Top = 8
|
||||
end
|
||||
object RMDS_Main: TRMDBDataSet
|
||||
Visible = True
|
||||
AliasName = #26631#31614#25968#25454
|
||||
Left = 498
|
||||
Top = 72
|
||||
end
|
||||
object RMDataDictionary1: TRMDataDictionary
|
||||
FieldFieldNames.TableName = 'TableName'
|
||||
FieldFieldNames.FieldName = 'FieldName'
|
||||
FieldFieldNames.FieldAlias = 'FieldAlias'
|
||||
Left = 562
|
||||
Top = 72
|
||||
end
|
||||
object ADOQuery1: TADOQuery
|
||||
Connection = LabelSet_DataLink.ADOLink
|
||||
Parameters = <>
|
||||
Left = 352
|
||||
Top = 480
|
||||
end
|
||||
object RMGridReport2: TRMGridReport
|
||||
ThreadPrepareReport = True
|
||||
InitialZoom = pzDefault
|
||||
PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbExport, pbNavigator]
|
||||
DefaultCollate = False
|
||||
SaveReportOptions.RegistryPath = 'Software\ReportMachine\ReportSettings\'
|
||||
PreviewOptions.RulerUnit = rmutScreenPixels
|
||||
PreviewOptions.RulerVisible = False
|
||||
PreviewOptions.DrawBorder = False
|
||||
PreviewOptions.BorderPen.Color = clGray
|
||||
PreviewOptions.BorderPen.Style = psDash
|
||||
Dataset = RMDS_Main
|
||||
CompressLevel = rmzcFastest
|
||||
CompressThread = False
|
||||
LaterBuildEvents = True
|
||||
OnlyOwnerDataSet = False
|
||||
Left = 432
|
||||
Top = 368
|
||||
ReportData = {}
|
||||
end
|
||||
end
|
||||
344
Z99Dependency/RTFunAndForm/Form/U_LabelAdd.pas
Normal file
|
|
@ -0,0 +1,344 @@
|
|||
unit U_LabelAdd;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ComCtrls, ToolWin, StdCtrls, BtnEdit, ExtCtrls, DB, ADODB,
|
||||
RM_System, RM_Common, RM_Class, RM_GridReport, Buttons, FTComboBox,
|
||||
RM_Preview, RM_e_Xls, RM_e_Graphic, RM_e_bmp, RM_BarCode,
|
||||
RM_DsgGridReport, RM_Dataset, cxStyles, cxCustomData, cxGraphics,
|
||||
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, cxGridLevel,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||||
cxControls, cxGridCustomView, cxGrid;
|
||||
|
||||
type
|
||||
TfrmLabelAdd = class(TForm)
|
||||
Panel1: TPanel;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
customerNo: TBtnEditA;
|
||||
LabelFileName: TBtnEditA;
|
||||
beizhu: TMemo;
|
||||
ToolBar1: TToolBar;
|
||||
Tsave: TToolButton;
|
||||
Tclose: TToolButton;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
OpenDialog1: TOpenDialog;
|
||||
RMGridReport1: TRMGridReport;
|
||||
BtOpen: TBitBtn;
|
||||
Label9: TLabel;
|
||||
LabelCaption: TEdit;
|
||||
Label10: TLabel;
|
||||
LabelType: TFTComboBox;
|
||||
ADOQueryTmp: TADOQuery;
|
||||
RMPreview1: TRMPreview;
|
||||
RMGridReportDesigner1: TRMGridReportDesigner;
|
||||
RMBarCodeObject1: TRMBarCodeObject;
|
||||
RMBMPExport1: TRMBMPExport;
|
||||
RMXLSExport1: TRMXLSExport;
|
||||
RMDS_Main: TRMDBDataSet;
|
||||
RMDataDictionary1: TRMDataDictionary;
|
||||
ADOQuery1: TADOQuery;
|
||||
RMGridReport2: TRMGridReport;
|
||||
procedure TcloseClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure TsaveClick(Sender: TObject);
|
||||
procedure LabelFileNameBtnClick(Sender: TObject);
|
||||
procedure customerNoBtnClick(Sender: TObject);
|
||||
procedure BtOpenClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure RMPreview1DblClick(Sender: TObject);
|
||||
private
|
||||
fIsChg:Boolean;
|
||||
function SaveData():Boolean;
|
||||
function EditData():Boolean;
|
||||
procedure InitWinData();
|
||||
procedure InitVarDictionary();
|
||||
procedure InitDataSetDictionary();
|
||||
public
|
||||
fcustomNo:string;
|
||||
fKeyNo:string;
|
||||
fWinStatus:integer;
|
||||
end;
|
||||
|
||||
var
|
||||
frmLabelAdd: TfrmLabelAdd;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_RTFun;
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmLabelAdd.TcloseClick(Sender: TObject);
|
||||
begin
|
||||
if fIsChg then
|
||||
begin
|
||||
if application.MessageBox('标签设计过,是否要保存?','提示信息',1)=1 then
|
||||
begin
|
||||
Tsave.Click ;
|
||||
end
|
||||
else
|
||||
close;
|
||||
end
|
||||
else
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelAdd.FormCreate(Sender: TObject);
|
||||
begin
|
||||
panel1.Align :=alClient;
|
||||
fIsChg:=false;
|
||||
// ClearWinData(panel1);
|
||||
// InitVarDictionary();
|
||||
end;
|
||||
|
||||
procedure TfrmLabelAdd.TsaveClick(Sender: TObject);
|
||||
begin
|
||||
if trim(labelCaption.Text)='' then
|
||||
begin
|
||||
application.MessageBox('标签名称不能为空!','提示');
|
||||
labelCaption.SetFocus;
|
||||
exit;
|
||||
end;
|
||||
if trim(LabelFileName.Text)='' then
|
||||
begin
|
||||
application.MessageBox('标签文件不能为空,请选择标签!','提示');
|
||||
LabelFileName.SetFocus;
|
||||
exit;
|
||||
end;
|
||||
if fWinStatus=0 then
|
||||
begin
|
||||
if SaveData() then
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if EditData() then
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//函数功能:保存数据
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
function TfrmLabelAdd.SaveData():Boolean;
|
||||
begin
|
||||
try
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from P_Label');
|
||||
sql.Add('where 1<>1');
|
||||
Open;
|
||||
|
||||
Append;
|
||||
fieldByName('CustomerNO').value:=trim(customerno.txtCode);
|
||||
fieldByName('filler').value:=DName;
|
||||
fieldByName('filltime').value:=DServerDate;
|
||||
fieldByName('beizhu').value:= trim(beizhu.text);
|
||||
|
||||
fieldByName('LabelCaption').value:=trim(LabelCaption.text);
|
||||
fieldByName('LabelType').value:=trim(LabelType.text);
|
||||
fieldByName('LabelFileName').value:= trim(LabelFileName.text);
|
||||
//TBlobField(FieldByName('LabelFile')).LoadFromStream(fStream);
|
||||
RMGridReport1.SaveToBlobField(TBlobField(FieldByName('LabelFile')));
|
||||
Post;
|
||||
end;
|
||||
result:=true;
|
||||
except
|
||||
Result:=false;
|
||||
application.MessageBox('保存标签模板出错!','警告信息',0);
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//函数功能:保存数据
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
function TfrmLabelAdd.EditData():Boolean;
|
||||
begin
|
||||
try
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from P_Label');
|
||||
sql.Add('where labelId='+fkeyNo);
|
||||
Open;
|
||||
Edit;
|
||||
fieldByName('LabelCaption').value:=trim(LabelCaption.text);
|
||||
fieldByName('LabelType').value:=trim(LabelType.text);
|
||||
fieldByName('LabelFileName').value:= trim(LabelFileName.text);
|
||||
RMGridReport1.SaveToBlobField(TBlobField(FieldByName('LabelFile')));
|
||||
fieldByName('Editer').value:=DName;
|
||||
fieldByName('EditTime').value:=DServerDate;
|
||||
fieldByName('beizhu').value:= trim(beizhu.text);
|
||||
Post;
|
||||
end;
|
||||
result:=true;
|
||||
except
|
||||
Result:=false;
|
||||
application.MessageBox('保存标签模板出错!','警告信息',0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelAdd.LabelFileNameBtnClick(Sender: TObject);
|
||||
begin
|
||||
if OpenDialog1.Execute() then
|
||||
begin
|
||||
LabelFileName.Text:=OpenDialog1.FileName;
|
||||
RMGridReport1.LoadFromFile(LabelFileName.Text);
|
||||
RMGridReport1.Preview :=RMPreview1;
|
||||
RMGridReport1.ShowReport ;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelAdd.customerNoBtnClick(Sender: TObject);
|
||||
begin
|
||||
{
|
||||
FormGetCust:=TFormGetCust.Create(self);
|
||||
|
||||
if FormGetCust.ShowModal=mrok then
|
||||
begin
|
||||
customNo.TxtCode:=trim(FormGetCust.ADOQuery1.Fieldbyname('customno').AsString);
|
||||
customNo.Text:=trim(FormGetCust.ADOQuery1.Fieldbyname('shortname').AsString);
|
||||
end;
|
||||
FormGetCust.Free;
|
||||
}
|
||||
{ frmCustHelp:=TfrmCustHelp.create(self);
|
||||
with frmCustHelp do
|
||||
begin
|
||||
if showModal=1 then
|
||||
begin
|
||||
customNo.TxtCode:=trim(ADOQueryHelp.Fieldbyname('customno').AsString);
|
||||
customNo.Text:=trim(ADOQueryHelp.Fieldbyname('shortname').AsString);
|
||||
end;
|
||||
free;
|
||||
end; }
|
||||
end;
|
||||
|
||||
procedure TfrmLabelAdd.BtOpenClick(Sender: TObject);
|
||||
begin
|
||||
with RMGridReport2 do
|
||||
begin
|
||||
if trim(LabelFileName.Text)='' then
|
||||
LoadFromFile(ExtractFilePath(Application.ExeName)+'report/标签模板.rmf');
|
||||
InitDataSetDictionary();
|
||||
RMDS_Main.DataSet :=ADOQuery1;
|
||||
application.ProcessMessages;
|
||||
|
||||
DesignReport() ;
|
||||
fIsChg:=true;
|
||||
RMDS_Main.DataSet :=nil;
|
||||
RMGridReport1.NewReport;
|
||||
RMGridReport1.LoadFromFile(LabelFileName.Text);
|
||||
RMGridReport1.ShowReport ;
|
||||
end;
|
||||
|
||||
end;
|
||||
////////////////////////////////////////////////////////////
|
||||
//初始化窗口数据
|
||||
////////////////////////////////////////////////////////////
|
||||
procedure TfrmLabelAdd.InitWinData();
|
||||
begin
|
||||
try
|
||||
with ADOQueryTmp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('select A.*');
|
||||
// sql.Add('customNoName=isnull((select customName from BC_customer where customNO=A.customNo),A.customNo)');
|
||||
sql.Add('from P_Label A');
|
||||
sql.Add('WHERE LabelId='+fkeyNo);
|
||||
Open;
|
||||
if isEmpty then
|
||||
begin
|
||||
close;
|
||||
exit;
|
||||
end;
|
||||
|
||||
SSetWinData(ADOQueryTmp,panel1);
|
||||
RMGridReport1.LoadFromBlobField(tblobfield(fieldbyname('labelFile')));
|
||||
RMGridReport2.FileName:=trim(fieldByName('labelFileName').AsString);
|
||||
RMGridReport2.LoadFromBlobField(tblobfield(fieldbyname('labelFile')));
|
||||
RMGridReport1.Preview :=RMPreview1;
|
||||
//RMGridReport1.PrepareReport;
|
||||
RMGridReport1.ShowReport ;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelAdd.FormShow(Sender: TObject);
|
||||
begin
|
||||
if fWinStatus>0 then
|
||||
InitWinData();
|
||||
end;
|
||||
|
||||
procedure TfrmLabelAdd.RMPreview1DblClick(Sender: TObject);
|
||||
begin
|
||||
//btOpen.Click ;
|
||||
end;
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
procedure TfrmLabelAdd.InitVarDictionary();
|
||||
var
|
||||
i:integer;
|
||||
begin
|
||||
{ try
|
||||
with RMGridReport2 do
|
||||
begin
|
||||
Dictionary.Variables.Clear ;
|
||||
Dictionary.Variables.AddCategory('客户单位信息');
|
||||
with ADOQueryTmp do
|
||||
begin
|
||||
close;
|
||||
sql.clear;
|
||||
sql.Add('exec P_Label_CustPrintData');
|
||||
sql.Add(quotedStr(fCustomNo));
|
||||
Open;
|
||||
for i:=0 to FieldCount-1 do
|
||||
begin
|
||||
|
||||
Dictionary.Variables.Add(trim(fields[i].FieldName)
|
||||
,'');
|
||||
Dictionary.Variables.AsString[trim(fields[i].FieldName)]:=trim(fields[i].AsString);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
|
||||
end; }
|
||||
end;
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////
|
||||
procedure TfrmLabelAdd.InitDataSetDictionary();
|
||||
begin
|
||||
{ with ADOQuery1 do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('exec P_Label_PrintSet');
|
||||
sql.Add(quotedStr(''));
|
||||
//sql.Add(','+quotedStr(''));
|
||||
//sql.Add(','+quotedStr(''));
|
||||
//sql.Add(','+quotedStr(''));
|
||||
//sql.Add(','+quotedStr(''));
|
||||
OPen;
|
||||
end;
|
||||
with RMGridReport2 do
|
||||
begin
|
||||
Dictionary.FieldAliases.Clear;
|
||||
Dictionary.FieldAliases['RMDS_Main']:= '标签数据';
|
||||
Dictionary.FieldAliases['RMDS_Main."barcode"']:='标签条码';
|
||||
end; }
|
||||
end;
|
||||
|
||||
end.
|
||||
428
Z99Dependency/RTFunAndForm/Form/U_LabelList.dfm
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
object frmLabelList: TfrmLabelList
|
||||
Left = 192
|
||||
Top = 29
|
||||
Width = 1057
|
||||
Height = 705
|
||||
BorderIcons = [biMaximize]
|
||||
Caption = #26631#31614#20449#24687
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poOwnerFormCenter
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Panel1: TPanel
|
||||
Left = 12
|
||||
Top = 80
|
||||
Width = 452
|
||||
Height = 561
|
||||
BevelOuter = bvNone
|
||||
TabOrder = 0
|
||||
object Panel2: TPanel
|
||||
Left = 0
|
||||
Top = 3
|
||||
Width = 452
|
||||
Height = 558
|
||||
Align = alClient
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
TabOrder = 0
|
||||
object cxGrid1: TcxGrid
|
||||
Left = 2
|
||||
Top = 2
|
||||
Width = 448
|
||||
Height = 554
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
object tv1: TcxGridDBTableView
|
||||
OnDblClick = tv1DblClick
|
||||
NavigatorButtons.ConfirmDelete = False
|
||||
OnFocusedRecordChanged = tv1FocusedRecordChanged
|
||||
DataController.DataSource = DS_Label
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsCustomize.ColumnFiltering = False
|
||||
OptionsSelection.CellSelect = False
|
||||
OptionsView.GroupByBox = False
|
||||
object tv1labelId: TcxGridDBColumn
|
||||
Caption = #26631#31614'ID'
|
||||
DataBinding.FieldName = 'labelId'
|
||||
Width = 53
|
||||
end
|
||||
object tv1labeltype: TcxGridDBColumn
|
||||
Caption = #26631#31614#31867#22411
|
||||
DataBinding.FieldName = 'labeltype'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
HeaderAlignmentVert = vaCenter
|
||||
Width = 90
|
||||
end
|
||||
object tv1labelCaption: TcxGridDBColumn
|
||||
Caption = #26631#31614#26631#39064
|
||||
DataBinding.FieldName = 'labelCaption'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
HeaderAlignmentVert = vaCenter
|
||||
Width = 120
|
||||
end
|
||||
object tv1labelFile: TcxGridDBColumn
|
||||
Caption = #25991#20214#21517
|
||||
DataBinding.FieldName = 'labelFile'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
HeaderAlignmentVert = vaCenter
|
||||
Width = 167
|
||||
end
|
||||
end
|
||||
object cxGrid1Level1: TcxGridLevel
|
||||
GridView = tv1
|
||||
end
|
||||
end
|
||||
end
|
||||
object Panel3: TPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 452
|
||||
Height = 3
|
||||
Align = alTop
|
||||
Caption = 'Panel3'
|
||||
TabOrder = 1
|
||||
Visible = False
|
||||
object Label1: TLabel
|
||||
Left = 40
|
||||
Top = 13
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #23458#25143#21517#31216#65306
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clBlue
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 52
|
||||
Top = 35
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #19994#21153#21592#65306
|
||||
Visible = False
|
||||
end
|
||||
object Label4: TLabel
|
||||
Left = 40
|
||||
Top = 61
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #30005#35805#21495#30721#65306
|
||||
end
|
||||
object Label5: TLabel
|
||||
Left = 39
|
||||
Top = 86
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #20844#21496#21517#31216#65306
|
||||
end
|
||||
object Label6: TLabel
|
||||
Left = 14
|
||||
Top = 108
|
||||
Width = 84
|
||||
Height = 12
|
||||
Caption = #20844#21496#33521#25991#21517#31216#65306
|
||||
end
|
||||
object Label7: TLabel
|
||||
Left = 61
|
||||
Top = 133
|
||||
Width = 36
|
||||
Height = 12
|
||||
Caption = #22320#22336#65306
|
||||
end
|
||||
object Label8: TLabel
|
||||
Left = 37
|
||||
Top = 157
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #33521#25991#22320#22336#65306
|
||||
end
|
||||
object Label3: TLabel
|
||||
Left = 61
|
||||
Top = 192
|
||||
Width = 36
|
||||
Height = 12
|
||||
Caption = #22791#27880#65306
|
||||
end
|
||||
object Note: TMemo
|
||||
Left = 120
|
||||
Top = 175
|
||||
Width = 293
|
||||
Height = 63
|
||||
ScrollBars = ssBoth
|
||||
TabOrder = 0
|
||||
end
|
||||
object EngAddress: TEdit
|
||||
Left = 120
|
||||
Top = 151
|
||||
Width = 294
|
||||
Height = 20
|
||||
Enabled = False
|
||||
TabOrder = 1
|
||||
end
|
||||
object ChnAddress: TEdit
|
||||
Left = 120
|
||||
Top = 127
|
||||
Width = 293
|
||||
Height = 20
|
||||
TabOrder = 2
|
||||
end
|
||||
object engFactory: TEdit
|
||||
Left = 119
|
||||
Top = 104
|
||||
Width = 295
|
||||
Height = 20
|
||||
TabOrder = 3
|
||||
end
|
||||
object ChnFactory: TEdit
|
||||
Left = 119
|
||||
Top = 81
|
||||
Width = 294
|
||||
Height = 20
|
||||
TabOrder = 4
|
||||
end
|
||||
object TelePhone: TEdit
|
||||
Left = 119
|
||||
Top = 58
|
||||
Width = 294
|
||||
Height = 20
|
||||
TabOrder = 5
|
||||
end
|
||||
object ywy: TEdit
|
||||
Tag = 99
|
||||
Left = 119
|
||||
Top = 31
|
||||
Width = 295
|
||||
Height = 20
|
||||
ReadOnly = True
|
||||
TabOrder = 6
|
||||
Text = 'ywy'
|
||||
Visible = False
|
||||
end
|
||||
object customNo: TBtnEditA
|
||||
Tag = 1
|
||||
Left = 120
|
||||
Top = 7
|
||||
Width = 295
|
||||
Height = 20
|
||||
Enabled = False
|
||||
ReadOnly = True
|
||||
TabOrder = 7
|
||||
OnBtnClick = customNoBtnClick
|
||||
end
|
||||
end
|
||||
end
|
||||
object RMPreview1: TRMPreview
|
||||
Left = 488
|
||||
Top = 85
|
||||
Width = 553
|
||||
Height = 581
|
||||
Align = alRight
|
||||
BevelOuter = bvLowered
|
||||
Caption = 'Insert After'
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = False
|
||||
TabOrder = 1
|
||||
OnDblClick = RMPreview1DblClick
|
||||
Options.RulerUnit = rmutScreenPixels
|
||||
Options.RulerVisible = False
|
||||
Options.DrawBorder = False
|
||||
Options.BorderPen.Color = clGray
|
||||
Options.BorderPen.Style = psDash
|
||||
end
|
||||
object ToolBar2: TToolBar
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 1041
|
||||
AutoSize = True
|
||||
ButtonHeight = 30
|
||||
ButtonWidth = 83
|
||||
Caption = 'ToolBar2'
|
||||
Color = clBtnFace
|
||||
Flat = True
|
||||
Images = LabelSet_DataLink.ThreeImgList
|
||||
List = True
|
||||
ParentColor = False
|
||||
ShowCaptions = True
|
||||
TabOrder = 2
|
||||
Transparent = False
|
||||
object ToolButton1: TToolButton
|
||||
Left = 0
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #26597#35810
|
||||
ImageIndex = 21
|
||||
OnClick = ToolButton1Click
|
||||
end
|
||||
object TOK: TToolButton
|
||||
Left = 63
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #30830#23450
|
||||
ImageIndex = 41
|
||||
OnClick = TOkClick
|
||||
end
|
||||
object Tadd: TToolButton
|
||||
Left = 126
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #26032#22686#26631#31614
|
||||
ImageIndex = 44
|
||||
OnClick = TaddClick
|
||||
end
|
||||
object Tupd: TToolButton
|
||||
Left = 213
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #20462#25913#26631#31614
|
||||
ImageIndex = 54
|
||||
OnClick = TupdClick
|
||||
end
|
||||
object Tdel: TToolButton
|
||||
Left = 300
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #21024#38500#26631#31614
|
||||
ImageIndex = 48
|
||||
OnClick = TdelClick
|
||||
end
|
||||
object Tclose: TToolButton
|
||||
Left = 387
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #20851#38381
|
||||
ImageIndex = 55
|
||||
OnClick = TcloseClick
|
||||
end
|
||||
end
|
||||
object Panel4: TPanel
|
||||
Left = 0
|
||||
Top = 32
|
||||
Width = 1041
|
||||
Height = 53
|
||||
Align = alTop
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
TabOrder = 3
|
||||
object Label9: TLabel
|
||||
Left = 36
|
||||
Top = 20
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #26631#31614#31867#22411
|
||||
end
|
||||
object Label10: TLabel
|
||||
Left = 280
|
||||
Top = 20
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #26631#31614#26631#39064
|
||||
end
|
||||
object LabelCaption: TEdit
|
||||
Left = 332
|
||||
Top = 16
|
||||
Width = 100
|
||||
Height = 20
|
||||
TabOrder = 0
|
||||
OnChange = LabelTypeChange
|
||||
end
|
||||
object LabelType: TFTComboBox
|
||||
Tag = 99
|
||||
Left = 88
|
||||
Top = 17
|
||||
Width = 100
|
||||
Height = 20
|
||||
Style = csDropDownList
|
||||
ItemHeight = 12
|
||||
ItemIndex = 0
|
||||
TabOrder = 1
|
||||
OnChange = LabelTypeChange
|
||||
Items.Strings = (
|
||||
''
|
||||
#20013#25991#26631#31614
|
||||
#33521#25991#26631#31614
|
||||
#20013#33521#25991#26631#31614)
|
||||
end
|
||||
end
|
||||
object ADOQueryCmd: TADOQuery
|
||||
Connection = LabelSet_DataLink.ADOLink
|
||||
CommandTimeout = 300
|
||||
Parameters = <>
|
||||
Left = 508
|
||||
Top = 208
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Filter = 'RMFl(*.rmf)|*.rmf'
|
||||
InitialDir = '.'
|
||||
Left = 316
|
||||
Top = 148
|
||||
end
|
||||
object RMGridReport1: TRMGridReport
|
||||
ThreadPrepareReport = True
|
||||
InitialZoom = pzDefault
|
||||
PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbExport, pbNavigator]
|
||||
ModalPreview = False
|
||||
DefaultCollate = False
|
||||
ShowPrintDialog = False
|
||||
SaveReportOptions.RegistryPath = 'Software\ReportMachine\ReportSettings\'
|
||||
Preview = RMPreview1
|
||||
PreviewOptions.RulerUnit = rmutScreenPixels
|
||||
PreviewOptions.RulerVisible = False
|
||||
PreviewOptions.DrawBorder = False
|
||||
PreviewOptions.BorderPen.Color = clGray
|
||||
PreviewOptions.BorderPen.Style = psDash
|
||||
CompressLevel = rmzcFastest
|
||||
CompressThread = False
|
||||
LaterBuildEvents = True
|
||||
OnlyOwnerDataSet = False
|
||||
Left = 436
|
||||
Top = 152
|
||||
ReportData = {}
|
||||
end
|
||||
object ADOQueryTmp: TADOQuery
|
||||
Connection = LabelSet_DataLink.ADOLink
|
||||
LockType = ltReadOnly
|
||||
CommandTimeout = 300
|
||||
Parameters = <>
|
||||
Left = 528
|
||||
Top = 184
|
||||
end
|
||||
object ADOQuery1: TADOQuery
|
||||
Connection = LabelSet_DataLink.ADOLink
|
||||
Parameters = <>
|
||||
Left = 392
|
||||
Top = 228
|
||||
end
|
||||
object DS_Label: TDataSource
|
||||
DataSet = ADOQueryLabel
|
||||
Left = 66
|
||||
Top = 456
|
||||
end
|
||||
object ADOQueryLabel: TADOQuery
|
||||
Connection = LabelSet_DataLink.ADOLink
|
||||
LockType = ltReadOnly
|
||||
CommandTimeout = 300
|
||||
Parameters = <>
|
||||
Left = 114
|
||||
Top = 464
|
||||
end
|
||||
end
|
||||
612
Z99Dependency/RTFunAndForm/Form/U_LabelList.pas
Normal file
|
|
@ -0,0 +1,612 @@
|
|||
unit U_LabelList;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, StrUtils,Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ComCtrls, ToolWin, StdCtrls, BtnEdit, ExtCtrls, DB, ADODB,
|
||||
RM_System, RM_Common, RM_Class, RM_GridReport, Buttons, FTComboBox,
|
||||
RM_Preview, RM_e_Xls, RM_e_Graphic, RM_e_bmp, RM_BarCode,
|
||||
RM_DsgGridReport, RM_Dataset, cxStyles, cxCustomData, cxGraphics,
|
||||
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, cxGridLevel,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||||
cxControls, cxGridCustomView, cxGrid;
|
||||
|
||||
type
|
||||
TfrmLabelList = class(TForm)
|
||||
Panel1: TPanel;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
OpenDialog1: TOpenDialog;
|
||||
RMGridReport1: TRMGridReport;
|
||||
ADOQueryTmp: TADOQuery;
|
||||
RMPreview1: TRMPreview;
|
||||
ADOQuery1: TADOQuery;
|
||||
Panel2: TPanel;
|
||||
cxGrid1: TcxGrid;
|
||||
tv1: TcxGridDBTableView;
|
||||
tv1labeltype: TcxGridDBColumn;
|
||||
tv1labelCaption: TcxGridDBColumn;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
tv1labelFile: TcxGridDBColumn;
|
||||
DS_Label: TDataSource;
|
||||
ADOQueryLabel: TADOQuery;
|
||||
Panel3: TPanel;
|
||||
Note: TMemo;
|
||||
EngAddress: TEdit;
|
||||
ChnAddress: TEdit;
|
||||
engFactory: TEdit;
|
||||
ChnFactory: TEdit;
|
||||
TelePhone: TEdit;
|
||||
ywy: TEdit;
|
||||
customNo: TBtnEditA;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label4: TLabel;
|
||||
Label5: TLabel;
|
||||
Label6: TLabel;
|
||||
Label7: TLabel;
|
||||
Label8: TLabel;
|
||||
Label3: TLabel;
|
||||
tv1labelId: TcxGridDBColumn;
|
||||
ToolBar2: TToolBar;
|
||||
Tadd: TToolButton;
|
||||
Tupd: TToolButton;
|
||||
Tdel: TToolButton;
|
||||
TOK: TToolButton;
|
||||
Tclose: TToolButton;
|
||||
Panel4: TPanel;
|
||||
ToolButton1: TToolButton;
|
||||
Label9: TLabel;
|
||||
Label10: TLabel;
|
||||
LabelCaption: TEdit;
|
||||
LabelType: TFTComboBox;
|
||||
procedure TcloseClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure TsaveClick(Sender: TObject);
|
||||
procedure customNoBtnClick(Sender: TObject);
|
||||
procedure BtOpenClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure RMPreview1DblClick(Sender: TObject);
|
||||
procedure TaddClick(Sender: TObject);
|
||||
procedure TupdClick(Sender: TObject);
|
||||
procedure tv1FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
||||
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
||||
ANewItemRecordFocusingChanged: Boolean);
|
||||
procedure TdelClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure TOkClick(Sender: TObject);
|
||||
procedure tv1DblClick(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure LabelTypeChange(Sender: TObject);
|
||||
private
|
||||
isLoad:Boolean;
|
||||
function SaveData():Boolean;
|
||||
function EditData():Boolean;
|
||||
function IsCheckCustOk():Boolean;
|
||||
function DeleteData():Boolean;
|
||||
procedure InitWinData();
|
||||
procedure InitVarDictionary();
|
||||
procedure InitDataSetDictionary();
|
||||
procedure InitGrid();
|
||||
procedure OpenLabel();
|
||||
procedure SetWinStatus();
|
||||
procedure DoFilter();
|
||||
public
|
||||
fSelLabelId:String;
|
||||
fKeyNo:string;
|
||||
fchg:Boolean;
|
||||
fIsShowModal:Boolean;
|
||||
fWinStatus:integer;
|
||||
end;
|
||||
|
||||
var
|
||||
frmLabelList: TfrmLabelList;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink, U_LabelAdd;
|
||||
{$R *.dfm}
|
||||
procedure TfrmLabelList.DoFilter();
|
||||
var
|
||||
filterStr:string;
|
||||
begin
|
||||
filterStr:='';
|
||||
//计划单号
|
||||
if trim(LabelType.Text) <>'' then
|
||||
begin
|
||||
filterStr:=' and LabelType like '+quotedStr('%'+trim(LabelType.Text)+'%');
|
||||
end;
|
||||
//名称
|
||||
if trim(LabelCaption.Text)<>'' then
|
||||
begin
|
||||
filterStr:=filterStr+' and LabelCaption like '+quotedStr('%'+trim(LabelCaption.Text)+'%');
|
||||
end;
|
||||
try
|
||||
ADOQueryLabel.DisableControls ;
|
||||
if trim(filterStr)='' then
|
||||
begin
|
||||
ADOQueryLabel.Filtered:=false;
|
||||
ADOQueryLabel.EnableControls;
|
||||
exit;
|
||||
end;
|
||||
filterStr:=trim(RightBStr(filterStr,length(filterStr)-4));
|
||||
with ADOQueryLabel do
|
||||
begin
|
||||
filtered:=false;
|
||||
filter:=filterStr;
|
||||
filtered:=true;
|
||||
end;
|
||||
finally
|
||||
ADOQueryLabel.EnableControls;
|
||||
end;
|
||||
end;
|
||||
procedure TfrmLabelList.TcloseClick(Sender: TObject);
|
||||
begin
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.FormCreate(Sender: TObject);
|
||||
begin
|
||||
panel1.Align :=alClient;
|
||||
// ClearWinData(panel3);
|
||||
fSelLabelId := '';
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.TsaveClick(Sender: TObject);
|
||||
begin
|
||||
if trim(customNO.Text)='' then
|
||||
begin
|
||||
application.MessageBox('客户名称不能为空,请选择客户!','提示');
|
||||
customNo.SetFocus;
|
||||
exit;
|
||||
end;
|
||||
if application.MessageBox('确定要保存吗?','提示信息',1)=2 then exit;
|
||||
if fWinStatus=0 then
|
||||
begin
|
||||
if not IsCheckCustOk() then exit;
|
||||
if SaveData() then
|
||||
begin
|
||||
fWinStatus:=1;
|
||||
fchg:=true;
|
||||
SetWinStatus();
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if EditData() then
|
||||
begin
|
||||
fchg:=true;
|
||||
application.MessageBox('保存成功!','提示信息',0)
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//函数功能:保存数据
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
function TfrmLabelList.SaveData():Boolean;
|
||||
begin
|
||||
try
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from JD_Label');
|
||||
sql.Add('where 1<>1');
|
||||
Open;
|
||||
|
||||
Append;
|
||||
fieldByName('customno').value:=trim(customno.txtCode);
|
||||
fieldByName('ChnFactory').value:=trim(ChnFactory.text);
|
||||
fieldByName('engFactory').value:=trim(engFactory.text);
|
||||
fieldByName('TelePhone').value:=trim(TelePhone.text);
|
||||
fieldByName('ChnAddress').value:=trim(ChnAddress.text);
|
||||
fieldByName('EngAddress').value:=trim(EngAddress.text);
|
||||
fieldByName('filler').value:=Dname;
|
||||
fieldByName('filltime').value:=DServerDate;
|
||||
fieldByName('note').value:= trim(Note.text);
|
||||
Post;
|
||||
end;
|
||||
result:=true;
|
||||
except
|
||||
Result:=false;
|
||||
application.MessageBox('保存标签模板出错!','警告信息',0);
|
||||
end;
|
||||
end;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//函数功能:保存数据
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
function TfrmLabelList.EditData():Boolean;
|
||||
begin
|
||||
try
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from JD_Label');
|
||||
sql.Add('where customNo='+fKeyNo);
|
||||
Open;
|
||||
|
||||
Edit;
|
||||
fieldByName('customno').value:=trim(customno.txtCode);
|
||||
fieldByName('ChnFactory').value:=trim(ChnFactory.text);
|
||||
fieldByName('engFactory').value:=trim(engFactory.text);
|
||||
fieldByName('TelePhone').value:=trim(TelePhone.text);
|
||||
fieldByName('ChnAddress').value:=trim(ChnAddress.text);
|
||||
fieldByName('EngAddress').value:=trim(EngAddress.text);
|
||||
fieldByName('note').value:= trim(Note.text);
|
||||
Post;
|
||||
end;
|
||||
result:=true;
|
||||
except
|
||||
Result:=false;
|
||||
application.MessageBox('保存标签模板出错!','警告信息',0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.customNoBtnClick(Sender: TObject);
|
||||
begin
|
||||
{ FormGetCust:=TFormGetCust.Create(self);
|
||||
|
||||
if FormGetCust.ShowModal=mrok then
|
||||
begin
|
||||
customNo.TxtCode:=trim(FormGetCust.ADOQuery1.Fieldbyname('customno').AsString);
|
||||
customNo.Text:=trim(FormGetCust.ADOQuery1.Fieldbyname('shortname').AsString);
|
||||
end;
|
||||
FormGetCust.Free; }
|
||||
{ frmCustHelp:=TfrmCustHelp.create(self);
|
||||
with frmCustHelp do
|
||||
begin
|
||||
if showModal=1 then
|
||||
begin
|
||||
customNo.TxtCode:=trim(ADOQueryHelp.Fieldbyname('customno').AsString);
|
||||
customNo.Text:=trim(ADOQueryHelp.Fieldbyname('shortname').AsString);
|
||||
end;
|
||||
free;
|
||||
end;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.BtOpenClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
////////////////////////////////////////////////////////////
|
||||
//初始化窗口数据
|
||||
////////////////////////////////////////////////////////////
|
||||
procedure TfrmLabelList.InitWinData();
|
||||
begin
|
||||
try
|
||||
with ADOQueryTmp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('select A.* ,B.customName as customNoName');
|
||||
sql.Add('from JD_Label A');
|
||||
sql.Add('INNER JOIN BC_customer B ON A.customNO=B.customNo');
|
||||
sql.Add('WHERE B.customNo='''+fkeyNo+'''');
|
||||
Open;
|
||||
if isEmpty then
|
||||
begin
|
||||
close;
|
||||
exit;
|
||||
end;
|
||||
|
||||
// SetWinData(ADOQueryTmp,panel3);
|
||||
{
|
||||
RMGridReport1.LoadFromBlobField(tblobfield(fieldbyname('labelFile')));
|
||||
RMGridReport1.Preview :=RMPreview1;
|
||||
RMGridReport1.PrepareReport;
|
||||
RMGridReport1.ShowReport ;
|
||||
}
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.FormShow(Sender: TObject);
|
||||
begin
|
||||
{ with ADOquerytmp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('select count(A.customNo) as cnt');
|
||||
sql.Add('from jd_label A');
|
||||
sql.Add('where A.customNo='''+fKeyNO+'''');
|
||||
Open;
|
||||
fWinStatus:=fieldByName('cnt').AsInteger ;
|
||||
///
|
||||
if fWinStatus=0 then
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('select customNo,shortName from bc_customer');
|
||||
sql.Add('where customNo='''+fKeyNO+'''');
|
||||
Open;
|
||||
if RecordCount>0 then
|
||||
begin
|
||||
customNo.TxtCode :=trim(fieldByName('customNo').AsString);
|
||||
customNo.Text :=trim(fieldByName('shortName').AsString);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
SetWinStatus();
|
||||
if fWinStatus>0 then
|
||||
InitWinData();
|
||||
}
|
||||
if fWinStatus=1 then tok.Visible:=false;
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.RMPreview1DblClick(Sender: TObject);
|
||||
begin
|
||||
//btOpen.Click ;
|
||||
end;
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////////
|
||||
procedure TfrmLabelList.InitVarDictionary();
|
||||
var
|
||||
TmpList:Tstrings;
|
||||
mm:string;
|
||||
i:integer;
|
||||
begin
|
||||
try
|
||||
TmpList:=TstringList.Create();
|
||||
with ADOQueryTmp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select distinct ItemType from JC_LabelSetItems ');
|
||||
sql.Add('where valid=''Y''');
|
||||
Open;
|
||||
TmpList.Clear ;
|
||||
while not Eof do
|
||||
begin
|
||||
TmpList.Add(trim(fieldByName('ItemType').AsString));
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
TmpList.Free ;
|
||||
end;
|
||||
end;
|
||||
/////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////
|
||||
procedure TfrmLabelList.InitDataSetDictionary();
|
||||
begin
|
||||
{ with ADOQuery1 do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('exec P_Get_LabelPrintData');
|
||||
sql.Add(quotedStr(''));
|
||||
sql.Add(','+quotedStr(''));
|
||||
sql.Add(','+quotedStr(''));
|
||||
OPen;
|
||||
end; }
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.TaddClick(Sender: TObject);
|
||||
begin
|
||||
{ if trim(customNo.text)='' then
|
||||
begin
|
||||
application.MessageBox('请先选择客户?','提示信息',0);
|
||||
exit;
|
||||
end;
|
||||
}
|
||||
frmLabelAdd:=TfrmLabelAdd.create(self);
|
||||
with frmLabelAdd do
|
||||
begin
|
||||
// fCustomNo:=trim(customNo.TxtCode);
|
||||
// customNO.TxtCode:=trim(self.customNo.TxtCode) ;
|
||||
// customNO.text:=trim(self.customNo.text) ;
|
||||
if showModal =1 then
|
||||
begin
|
||||
fchg:=true;
|
||||
InitGrid();
|
||||
end;
|
||||
free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.TupdClick(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryLabel.IsEmpty then exit;
|
||||
frmLabelAdd:=TfrmLabelAdd.create(self);
|
||||
with frmLabelAdd do
|
||||
begin
|
||||
// fCustomNo:=trim(customNo.TxtCode);
|
||||
// customNO.TxtCode:=trim(self.customNo.TxtCode) ;
|
||||
// customNO.text:=trim(self.customNo.text) ;
|
||||
fKeyNo:=ADOQueryLabel.fieldByName('LabelId').AsString ;
|
||||
fWinstatus:=1;
|
||||
if showModal =1 then
|
||||
begin
|
||||
fchg:=true;
|
||||
InitGrid();
|
||||
end;
|
||||
free;
|
||||
end;
|
||||
end;
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
procedure TfrmLabelList.InitGrid();
|
||||
begin
|
||||
try
|
||||
isLoad:=false;
|
||||
ADOQuerylabel.DisableControls ;
|
||||
with ADOQuerylabel do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('select * from P_Label');
|
||||
// sql.Add('where customNO='''+trim(fKeyNo)+'''');
|
||||
sql.Add('where valid=''Y''');
|
||||
Open;
|
||||
|
||||
//if trim(fSelLabelId)<>'' then
|
||||
// locate('labelId',(fSelLabelId),[]) ;
|
||||
end;
|
||||
finally
|
||||
ADOQuerylabel.EnableControls;
|
||||
isLoad:=true;
|
||||
DoFilter();
|
||||
OpenLabel();
|
||||
end;
|
||||
end;
|
||||
////////////////////////////////////////////////////////
|
||||
//函数功能:打开标签文件
|
||||
////////////////////////////////////////////////////////
|
||||
procedure TfrmLabelList.OpenLabel();
|
||||
begin
|
||||
if ADOQueryLabel.IsEmpty then exit;
|
||||
with RMGridReport1 do
|
||||
begin
|
||||
LoadFromBlobField(tblobfield(ADOQueryLabel.fieldbyname('labelFile')));
|
||||
//Preview :=RMPreview1;
|
||||
ShowReport ;
|
||||
end;
|
||||
end;
|
||||
procedure TfrmLabelList.tv1FocusedRecordChanged(
|
||||
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
||||
AFocusedRecord: TcxCustomGridRecord;
|
||||
ANewItemRecordFocusingChanged: Boolean);
|
||||
begin
|
||||
if isLoad then
|
||||
OpenLabel();
|
||||
end;
|
||||
//////////////////////////////////////////////////////////
|
||||
//函数功能:检查该客户的标签是否已存在
|
||||
/////////////////////////////////////////////////////////
|
||||
function TfrmLabelList.IsCheckCustOk():Boolean;
|
||||
begin
|
||||
try
|
||||
with ADOQueryTmp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('select count(customNO)as cnt from P_Label');
|
||||
sql.Add('where customNO='''+trim(customNO.TxtCode)+'''');
|
||||
Open;
|
||||
|
||||
if fieldByName('cnt').AsInteger>0 then
|
||||
begin
|
||||
Result:=false ;
|
||||
application.MessageBox('该客户标签信息已存!','警告信息',0);
|
||||
end
|
||||
else
|
||||
Result:=true;
|
||||
end;
|
||||
except
|
||||
result:=false;
|
||||
application.MessageBox('检查该客户标签信息是否已存在时发生错误!','警告信息',0);
|
||||
end;
|
||||
end;
|
||||
/////////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////////
|
||||
function TfrmLabelList.DeleteData():Boolean;
|
||||
begin
|
||||
try
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.clear;
|
||||
sql.Add('delete P_Label');
|
||||
sql.Add('where labelId='+ADOQueryLabel.fieldByName('LabelID').asString);
|
||||
execSql;
|
||||
end;
|
||||
result:=true;
|
||||
except
|
||||
result:=false;
|
||||
application.MessageBox('删除失败!','警告信息',0);
|
||||
end;
|
||||
end;
|
||||
procedure TfrmLabelList.TdelClick(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryLabel.IsEmpty then exit;
|
||||
if application.MessageBox('确定要删除此标签吗?','警告信息',1)=2 then exit;
|
||||
if DeleteData() then
|
||||
begin
|
||||
fchg:=true;
|
||||
InitGrid();
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////
|
||||
//
|
||||
/////////////////////////////////////////////////////////
|
||||
procedure TfrmLabelList.SetWinStatus();
|
||||
begin
|
||||
case fWinStatus of
|
||||
0:
|
||||
begin
|
||||
// ToolBar2.Visible :=false;
|
||||
// tsave.Visible :=true;
|
||||
customNo.Enabled :=true;
|
||||
panel3.Enabled :=true;
|
||||
end;
|
||||
1:
|
||||
begin
|
||||
// ToolBar2.Visible :=true;
|
||||
// tsave.Visible :=false;
|
||||
customNo.Enabled :=false;
|
||||
panel3.Enabled :=false;
|
||||
TOK.Visible:=false;
|
||||
end;
|
||||
5:
|
||||
begin
|
||||
// ToolBar2.Visible :=false;
|
||||
// tsave.Visible :=false;
|
||||
panel1.Enabled :=false;
|
||||
panel3.Enabled :=false;
|
||||
end;
|
||||
end ;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
if fIsShowModal then
|
||||
Application:=MainApplication ;
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmLabelList:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.TOkClick(Sender: TObject);
|
||||
begin
|
||||
if fWinstatus=1 then exit;
|
||||
if ADOQueryLabel.IsEmpty then exit;
|
||||
fSelLabelId:=trim(ADOQueryLabel.fieldByName('labelId').asString)
|
||||
//+'|'+trim(ADOQueryLabel.fieldByName('labeltype').asString);
|
||||
+'|'+trim(ADOQueryLabel.fieldByName('labelCaption').asString);
|
||||
SetLength( fSelLabelId,32);
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.tv1DblClick(Sender: TObject);
|
||||
begin
|
||||
// TOk.Click ;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmLabelList.LabelTypeChange(Sender: TObject);
|
||||
begin
|
||||
DoFilter();
|
||||
end;
|
||||
|
||||
end.
|
||||
18072
Z99Dependency/RTFunAndForm/Form/U_RTZDYHelp.dfm
Normal file
686
Z99Dependency/RTFunAndForm/Form/U_RTZDYHelp.pas
Normal file
|
|
@ -0,0 +1,686 @@
|
|||
unit U_RTZDYHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
|
||||
cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList,
|
||||
StdCtrls, ExtCtrls, cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu;
|
||||
|
||||
type
|
||||
TfrmRTZDYHelp = class(TForm)
|
||||
TV1: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
V1Code: TcxGridDBColumn;
|
||||
V1Name: TcxGridDBColumn;
|
||||
ToolBar1: TToolBar;
|
||||
ADOQueryMain: TADOQuery;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
TBAdd: TToolButton;
|
||||
TBSave: TToolButton;
|
||||
TBDel: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
ToolButton1: TToolButton;
|
||||
TBEdit: TToolButton;
|
||||
V1Note: TcxGridDBColumn;
|
||||
V1OrderNo: TcxGridDBColumn;
|
||||
ADOConnection1: TADOConnection;
|
||||
Panel1: TPanel;
|
||||
Label1: TLabel;
|
||||
ZDYName: TEdit;
|
||||
Label2: TLabel;
|
||||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||||
V1ZdyFlag: TcxGridDBColumn;
|
||||
V1HelpType: TcxGridDBColumn;
|
||||
ThreeImgList: TImageList;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBAddClick(Sender: TObject);
|
||||
procedure TBSaveClick(Sender: TObject);
|
||||
procedure TBDelClick(Sender: TObject);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure TBEditClick(Sender: TObject);
|
||||
procedure TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
procedure ZDYNameChange(Sender: TObject);
|
||||
procedure V1NamePropertiesEditValueChanged(Sender: TObject);
|
||||
procedure V1OrderNoPropertiesEditValueChanged(Sender: TObject);
|
||||
procedure V1NotePropertiesEditValueChanged(Sender: TObject);
|
||||
procedure V1Column1PropertiesEditValueChanged(Sender: TObject);
|
||||
procedure V1HelpTypePropertiesEditValueChanged(Sender: TObject);
|
||||
private
|
||||
procedure InitGrid();
|
||||
{ Private declarations }
|
||||
public
|
||||
flag,flagname,snote,MainType:string;
|
||||
fnote,forderno,fZdyFlag,ViewFlag:Boolean;
|
||||
PPSTE:integer;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmRTZDYHelp: TfrmRTZDYHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_RTFun;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmRTZDYHelp.FormCreate(Sender: TObject);
|
||||
begin
|
||||
try
|
||||
cxGrid1.Align:=alClient;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='';
|
||||
Connected:=true;
|
||||
end;
|
||||
except
|
||||
{if Application.MessageBox('网络连接失败,是否要再次连接?','提示',32+4)=IDYES then
|
||||
begin
|
||||
try
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='23242';
|
||||
Connected:=true;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end; }
|
||||
|
||||
frmRTZDYHelp.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
ZDYName.SetFocus;
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.InitGrid();
|
||||
begin
|
||||
try
|
||||
ADOQueryMain.DisableControls;
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select A.*,ZJM=dbo.getPinYin(A.ZdyName) from KH_ZDY A where A.Type='''+flag+'''');
|
||||
if Trim(MainType)<>'' then
|
||||
begin
|
||||
sql.Add(' and A.MainType='''+Trim(MainType)+'''');
|
||||
end;
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
end;
|
||||
end;
|
||||
procedure TfrmRTZDYHelp.TBAddClick(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
ZDYName.SetFocus;
|
||||
TV1.OptionsData.Editing:=True;
|
||||
TV1.OptionsSelection.CellSelect:=True;
|
||||
for i:=0 to 5 do
|
||||
begin
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Append;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
procedure TfrmRTZDYHelp.TBSaveClick(Sender: TObject);
|
||||
var
|
||||
maxno:string;
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
ZDYName.SetFocus;
|
||||
|
||||
if ClientDataSet1.Locate('ZDYName',null,[]) then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if ClientDataSet1.Locate('ZDYName','',[]) then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add('select * from KH_ZDY where ZdyNo='''+Trim(flag)+'''');
|
||||
open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into KH_ZDY(ZDYNo,ZDYName,Type,MainType) select :ZDYNo,:ZDYName,:Type,:MainType ');
|
||||
Parameters.ParamByName('ZDYNo').Value:=Trim(flag);
|
||||
Parameters.ParamByName('ZDYName').Value:=Trim(flagname);
|
||||
Parameters.ParamByName('Type').Value:='Main';
|
||||
Parameters.ParamByName('MainType').Value:=Trim(MainType);
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
ClientDataSet1.DisableControls;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
First;
|
||||
while not eof do
|
||||
begin
|
||||
if Trim(ClientDataSet1.FieldByName('ZDYNO').AsString)='' then
|
||||
begin
|
||||
if GetLSNo(ADOQueryTemp,maxno,'SY','KH_ZDY',3,1)=False then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('取最大编号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
maxno:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||||
end;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.add('select * from KH_Zdy where Type='''+Trim(flag)+'''');
|
||||
if Trim(MainType)<>'' then
|
||||
SQL.Add(' and MainType='''+Trim(MainType)+'''');
|
||||
sql.Add(' and ZdyName='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
||||
Open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty=False then
|
||||
begin
|
||||
if ADOQueryTemp.RecordCount>1 then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)='' then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end else
|
||||
begin
|
||||
if Trim(ADOQueryTemp.fieldbyname('ZdyNo').AsString)<>Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString) then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
SQL.Add('delete KH_ZDY where ZDYNO='''+Trim(ClientDataSet1.fieldbyname('ZDYNO').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from KH_ZDY where 1<>1');
|
||||
Open;
|
||||
end;
|
||||
ADOQueryCmd.Append;
|
||||
ADOQueryCmd.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ADOQueryCmd.FieldByName('ZDYName').Value:=ClientDataSet1.fieldbyname('ZDYName').Value;
|
||||
ADOQueryCmd.FieldByName('note').Value:=Trim(snote);
|
||||
//ADOQueryCmd.FieldByName('orderno').Value:=ClientDataSet1.fieldbyname('Name').AsString;
|
||||
ADOQueryCmd.FieldByName('Type').Value:=flag;
|
||||
ADOQueryCmd.FieldByName('valid').Value:='Y';
|
||||
if Trim(MainType)<>'' then
|
||||
ADOQueryCmd.FieldByName('MainType').Value:=Trim(MainType);
|
||||
//ADOQueryCmd.FieldByName('sel').Value:=0;
|
||||
ADOQueryCmd.Post;
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ClientDataSet1.Post;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
ClientDataSet1.EnableControls;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
Application.MessageBox('保存成功!','提示',0);
|
||||
TV1.OptionsData.Editing:=False;
|
||||
TV1.OptionsSelection.CellSelect:=False;
|
||||
except
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.TBDelClick(Sender: TObject);
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
if (Trim(ClientDataSet1.FieldByName('ZDYNo').AsString)<>'') or
|
||||
(Trim(ClientDataSet1.FieldByName('ZDYname').AsString)<>'') then
|
||||
begin
|
||||
if application.MessageBox('确定要删除吗?','提示信息',1)=2 then exit;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('delete KH_ZDY where ZDYNo='''+Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString)+'''');
|
||||
SQL.Add(' and Type='''+Trim(flag)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
ClientDataSet1.Delete;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=2;
|
||||
ZDYName.SetFocus;
|
||||
WriteCxGrid('自定义'+Trim(flag),TV1,'自定义数据');
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.FormShow(Sender: TObject);
|
||||
var
|
||||
fsj,fsj1:string;
|
||||
begin
|
||||
{if PPSTE=1 then
|
||||
begin
|
||||
Application.Terminate;
|
||||
Exit;
|
||||
end; }
|
||||
InitGrid();
|
||||
fsj:=Trim(flag)+'01';
|
||||
fsj1:=Trim(flagname)+'01';
|
||||
{if ClientDataSet1.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into KH_ZDY(ZDYNo,ZDYname,Type,note)');
|
||||
sql.Add('select '''+Trim(fsj)+'''');
|
||||
sql.Add(','''+Trim(fsj1)+'''');
|
||||
SQL.Add(','''+Trim(flag)+'''');
|
||||
sql.Add(','''+Trim(snote)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
InitGrid();
|
||||
end;}
|
||||
//frmZDYHelp.Caption:=Trim(flagname)+'<'+Trim(flag)+'>';
|
||||
//ReadCxGrid('自定义',TV1,'自定义数据');
|
||||
ReadCxGrid('自定义'+Trim(flag),TV1,'自定义数据');
|
||||
frmRTZDYHelp.Caption:=Trim(flagname);
|
||||
V1Note.Visible:=fnote;
|
||||
V1ZdyFlag.Visible:=fZdyFlag;
|
||||
V1OrderNo.Visible:=forderno;
|
||||
if ViewFlag=True then
|
||||
begin
|
||||
TBAdd.Visible:=False;
|
||||
TBSave.Visible:=False;
|
||||
TBDel.Visible:=False;
|
||||
TBEdit.Visible:=False;
|
||||
Label2.Visible:=False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
ZDYName.SetFocus;
|
||||
WriteCxGrid('自定义'+Trim(flag),TV1,'自定义数据');
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.TBEditClick(Sender: TObject);
|
||||
begin
|
||||
TV1.OptionsData.Editing:=True;
|
||||
TV1.OptionsSelection.CellSelect:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
begin
|
||||
if TV1.OptionsData.Editing=False then
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.ZDYNameChange(Sender: TObject);
|
||||
var
|
||||
fsj:String;
|
||||
begin
|
||||
if Trim(ZDYName.Text)<>'' then
|
||||
begin
|
||||
fsj:=' zdyname like '''+'%'+Trim(ZDYName.Text)+'%'+''''
|
||||
+' or Note like '''+'%'+Trim(ZDYName.Text)+'%'+''''
|
||||
+' or ZJM like '''+'%'+Trim(ZDYName.Text)+'%'+'''';
|
||||
end;
|
||||
if ADOQueryMain.Active then
|
||||
begin
|
||||
// SDofilter(ADOQueryMain,fsj);
|
||||
try
|
||||
ADOQueryMain.DisableControls;
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
if Trim(fsj)='' then
|
||||
begin
|
||||
Filtered:=False;
|
||||
end else
|
||||
begin
|
||||
Filtered:=False;
|
||||
Filter:=fsj;
|
||||
Filtered:=True;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.V1NamePropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
maxno,mvalue:string;
|
||||
begin
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
//Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('ZdyName').Value:=Trim(mvalue);
|
||||
//Post;
|
||||
end;
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add('select * from KH_ZDY where ZdyNo='''+Trim(flag)+'''');
|
||||
open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into KH_ZDY(ZDYNo,ZDYName,Type,MainType) select :ZDYNo,:ZDYName,:Type,:MainType ');
|
||||
Parameters.ParamByName('ZDYNo').Value:=Trim(flag);
|
||||
Parameters.ParamByName('ZDYName').Value:=Trim(flagname);
|
||||
Parameters.ParamByName('Type').Value:='Main';
|
||||
Parameters.ParamByName('MainType').Value:=Trim(MainType);
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
//ClientDataSet1.DisableControls;
|
||||
//with ClientDataSet1 do
|
||||
//begin
|
||||
//First;
|
||||
//while not eof do
|
||||
//begin
|
||||
if Trim(ClientDataSet1.FieldByName('ZDYNO').AsString)='' then
|
||||
begin
|
||||
if GetLSNo(ADOQueryTemp,maxno,'SY','KH_ZDY',3,1)=False then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('取最大编号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
maxno:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||||
end;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.add('select * from KH_Zdy where Type='''+Trim(flag)+'''');
|
||||
if Trim(MainType)<>'' then
|
||||
SQL.Add(' and MainType='''+Trim(MainType)+'''');
|
||||
sql.Add(' and ZdyName='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
||||
Open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty=False then
|
||||
begin
|
||||
if ADOQueryTemp.RecordCount>1 then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)='' then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end else
|
||||
begin
|
||||
if Trim(ADOQueryTemp.fieldbyname('ZdyNo').AsString)<>Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString) then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
SQL.Add('delete KH_ZDY where ZDYNO='''+Trim(ClientDataSet1.fieldbyname('ZDYNO').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from KH_ZDY where 1<>1');
|
||||
Open;
|
||||
end;
|
||||
ADOQueryCmd.Append;
|
||||
ADOQueryCmd.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ADOQueryCmd.FieldByName('ZDYName').Value:=ClientDataSet1.fieldbyname('ZDYName').AsString;
|
||||
ADOQueryCmd.FieldByName('note').Value:=Trim(snote);
|
||||
//ADOQueryCmd.FieldByName('orderno').Value:=ClientDataSet1.fieldbyname('Name').AsString;
|
||||
ADOQueryCmd.FieldByName('Type').Value:=flag;
|
||||
ADOQueryCmd.FieldByName('valid').Value:='Y';
|
||||
if Trim(MainType)<>'' then
|
||||
ADOQueryCmd.FieldByName('MainType').Value:=Trim(MainType);
|
||||
//ADOQueryCmd.FieldByName('sel').Value:=0;
|
||||
ADOQueryCmd.Post;
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
//ClientDataSet1.Post;
|
||||
// Next;
|
||||
//end;
|
||||
//end;
|
||||
// ClientDataSet1.EnableControls;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
//Application.MessageBox('保存成功!','提示',0);
|
||||
//TV1.OptionsData.Editing:=False;
|
||||
//TV1.OptionsSelection.CellSelect:=False;
|
||||
except
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.V1OrderNoPropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
mvalue:string;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='0';
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('OrderNo').Value:=mvalue;
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set OrderNo='+mvalue);
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.V1NotePropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
mvalue:string;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='0';
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('Note').Value:=mvalue;
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set Note='''+Trim(mvalue)+'''');
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.V1Column1PropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
mvalue:String;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='0';
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('ZdyFlag').Value:=StrToInt(mvalue);
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set ZdyFlag='+Trim(mvalue));
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmRTZDYHelp.V1HelpTypePropertiesEditValueChanged(
|
||||
Sender: TObject);
|
||||
var
|
||||
mvalue:string;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='0';
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('HelpType').Value:=mvalue;
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set HelpType='''+Trim(mvalue)+'''');
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
18063
Z99Dependency/RTFunAndForm/Form/U_SysLogHelp.dfm
Normal file
180
Z99Dependency/RTFunAndForm/Form/U_SysLogHelp.pas
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
unit U_SysLogHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ComCtrls, ToolWin, cxStyles, cxCustomData, cxGraphics, cxFilter,
|
||||
cxData, cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel,strUtils,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||||
cxControls, cxGridCustomView, cxGrid, ADODB, StdCtrls, ExtCtrls, ImgList;
|
||||
|
||||
type
|
||||
TfrmSysLogHelp = class(TForm)
|
||||
ToolBar1: TToolBar;
|
||||
TQry: TToolButton;
|
||||
Tclose: TToolButton;
|
||||
ADOQueryLog: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ADOConnection1: TADOConnection;
|
||||
cxGrid1: TcxGrid;
|
||||
tv1: TcxGridDBTableView;
|
||||
tv1OperMan: TcxGridDBColumn;
|
||||
tv1jopertime: TcxGridDBColumn;
|
||||
tv1Model: TcxGridDBColumn;
|
||||
tv1acction: TcxGridDBColumn;
|
||||
cxGridLevel1: TcxGridLevel;
|
||||
tv1Opevent: TcxGridDBColumn;
|
||||
tv1Result: TcxGridDBColumn;
|
||||
Panel1: TPanel;
|
||||
Label2: TLabel;
|
||||
Label1: TLabel;
|
||||
begDate: TDateTimePicker;
|
||||
endDate: TDateTimePicker;
|
||||
Label3: TLabel;
|
||||
edt_model: TEdit;
|
||||
CheckBox1: TCheckBox;
|
||||
Label4: TLabel;
|
||||
edt_nr: TEdit;
|
||||
ThreeImgList: TImageList;
|
||||
procedure TcloseClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure TQryClick(Sender: TObject);
|
||||
procedure edt_modelChange(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
private
|
||||
procedure DoQuery();
|
||||
procedure DoFilter();
|
||||
public
|
||||
fModel,facction:string;
|
||||
fOtherWhere:string;
|
||||
end;
|
||||
|
||||
var
|
||||
frmSysLogHelp: TfrmSysLogHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink;
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmSysLogHelp.TcloseClick(Sender: TObject);
|
||||
begin
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfrmSysLogHelp.FormCreate(Sender: TObject);
|
||||
begin
|
||||
cxGrid1.Align :=alClient;
|
||||
begDate.DateTime :=date-31;
|
||||
endDate.DateTime :=date;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
/////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
procedure TfrmSysLogHelp.DoQuery();
|
||||
var
|
||||
mbegdate,menddate:string;
|
||||
|
||||
begin
|
||||
mbegdate:=formatDatetime('yyyy-MM-dd',begDate.Date); //
|
||||
menddate:=formatDatetime('yyyy-MM-dd',endDate.Date+1);
|
||||
try
|
||||
with ADOQueryLog do
|
||||
begin
|
||||
close;
|
||||
sql.clear;
|
||||
filtered:=false;
|
||||
sql.add('select A.* ');
|
||||
sql.add('from SY_sysLog A');
|
||||
if CheckBox1.Checked then
|
||||
begin
|
||||
sql.Add('where OperTime>='+quotedStr(mbegdate));
|
||||
sql.Add('and OperTime<'+quotedStr(menddate));
|
||||
end
|
||||
else
|
||||
begin
|
||||
sql.Add('where 1=1');
|
||||
end;
|
||||
if trim(fModel)<>'' then
|
||||
sql.add('and Model='+quotedStr(fModel));
|
||||
if trim(facction)<>'' then
|
||||
sql.add('and acction='+quotedStr(facction));
|
||||
if trim(fOtherWhere)<>'' then
|
||||
begin
|
||||
sql.add(fOtherWhere);
|
||||
end;
|
||||
sql.Add('order by operOr,Opertime');
|
||||
Open;
|
||||
end;
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////
|
||||
//
|
||||
///////////////////////////////////////////////////////////
|
||||
procedure TfrmSysLogHelp.DoFilter();
|
||||
var
|
||||
filterStr:string;
|
||||
begin
|
||||
filterStr:='';
|
||||
//
|
||||
if trim(edt_model.text)<>'' then
|
||||
begin
|
||||
filterStr:=' and model ='+quotedStr(trim(edt_model.text));
|
||||
end;
|
||||
if trim(edt_nr.text)<>'' then
|
||||
begin
|
||||
filterStr:=' and OpEvent like '+quotedStr('%'+trim(edt_nr.text)+'%');
|
||||
end;
|
||||
|
||||
try
|
||||
ADOQueryLog.DisableControls ;
|
||||
if trim(filterStr)='' then
|
||||
begin
|
||||
ADOQueryLog.Filtered:=false;
|
||||
exit;
|
||||
end;
|
||||
filterStr:=trim(RightBStr(filterStr,length(filterStr)-4));
|
||||
with ADOQueryLog do
|
||||
begin
|
||||
filtered:=false;
|
||||
filter:=filterStr;
|
||||
filtered:=true;
|
||||
end;
|
||||
finally
|
||||
ADOQueryLog.EnableControls;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmSysLogHelp.FormShow(Sender: TObject);
|
||||
begin
|
||||
DoQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmSysLogHelp.TQryClick(Sender: TObject);
|
||||
begin
|
||||
DoQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmSysLogHelp.edt_modelChange(Sender: TObject);
|
||||
begin
|
||||
DoFilter();
|
||||
end;
|
||||
|
||||
procedure TfrmSysLogHelp.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
action:=cafree;
|
||||
end;
|
||||
|
||||
end.
|
||||
214
Z99Dependency/RTFunAndForm/Fun/U_MyClassHelpers.pas
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
unit U_MyClassHelpers;
|
||||
interface
|
||||
Uses
|
||||
SysUtils,Windows,Classes,Graphics, Controls,Forms,Dialogs, Math,typinfo;
|
||||
// uMySysUtils;
|
||||
|
||||
Const //记录设计时的屏幕分辨率
|
||||
OriWidth=1366;
|
||||
OriHeight=768;
|
||||
|
||||
{var
|
||||
OriWidth,OriHeight:Integer; }
|
||||
|
||||
Type
|
||||
TfmForm=Class(TForm) //实现窗体屏幕分辨率的自动调整
|
||||
Private
|
||||
fScrResolutionRateW: Double;
|
||||
fScrResolutionRateH: Double;
|
||||
fIsFitDeviceDone: Boolean;
|
||||
procedure FitDeviceResolution;
|
||||
Protected
|
||||
Property IsFitDeviceDone:Boolean Read fIsFitDeviceDone;
|
||||
Property ScrResolutionRateH:Double Read fScrResolutionRateH;
|
||||
Property ScrResolutionRateW:Double Read fScrResolutionRateW;
|
||||
Public
|
||||
Constructor Create(AOwner: TComponent); Override;
|
||||
End;
|
||||
|
||||
TfdForm=Class(TfmForm) //增加对话框窗体的修改确认
|
||||
Protected
|
||||
fIsDlgChange:Boolean;
|
||||
Public
|
||||
Constructor Create(AOwner: TComponent); Override;
|
||||
Property IsDlgChange:Boolean Read fIsDlgChange default false;
|
||||
End;
|
||||
|
||||
implementation
|
||||
|
||||
//uses UMain;
|
||||
|
||||
constructor TfmForm.Create(AOwner: TComponent);
|
||||
begin
|
||||
Inherited Create(AOwner);
|
||||
fScrResolutionRateH:=1;
|
||||
fScrResolutionRateW:=1;
|
||||
Try
|
||||
if Not fIsFitDeviceDone then
|
||||
Begin
|
||||
FitDeviceResolution;
|
||||
fIsFitDeviceDone:=True;
|
||||
End;
|
||||
Except
|
||||
fIsFitDeviceDone:=False;
|
||||
End;
|
||||
end;
|
||||
|
||||
procedure TfmForm.FitDeviceResolution;
|
||||
Var
|
||||
LocList:TList;
|
||||
LocFontRate:Double;
|
||||
LocFontSize:Integer;
|
||||
LocFont:TFont;
|
||||
locK:Integer;
|
||||
|
||||
//计算尺度调整的基本参数
|
||||
Procedure CalBasicScalePars;
|
||||
Begin
|
||||
try
|
||||
Self.Scaled:=False;
|
||||
fScrResolutionRateH:=screen.height/OriHeight;
|
||||
fScrResolutionRateW:=screen.Width/OriWidth;
|
||||
LocFontRate:=Min(fScrResolutionRateH,fScrResolutionRateW);
|
||||
except
|
||||
Raise;
|
||||
end;
|
||||
End;
|
||||
|
||||
function PropertyExists(const AObject: TObject;const APropName:String):Boolean;
|
||||
//判断一个属性是否存在
|
||||
var
|
||||
PropInfo:PPropInfo;
|
||||
begin
|
||||
PropInfo:=GetPropInfo(AObject.ClassInfo,APropName);
|
||||
Result:=Assigned(PropInfo);
|
||||
end;
|
||||
|
||||
function GetObjectProperty(
|
||||
const AObject : TObject;
|
||||
const APropName : string
|
||||
):TObject;
|
||||
var
|
||||
PropInfo:PPropInfo;
|
||||
begin
|
||||
Result := nil;
|
||||
PropInfo:=GetPropInfo(AObject.ClassInfo,APropName);
|
||||
if Assigned(PropInfo) and
|
||||
(PropInfo^.PropType^.Kind = tkClass) then
|
||||
Result := GetObjectProp(AObject,PropInfo);
|
||||
end;
|
||||
|
||||
//保存原有坐标位置:利用递归法遍历各级容器里的控件,直到最后一级
|
||||
Procedure ControlsPostoList(vCtl:TControl;vList:TList);
|
||||
Var
|
||||
locPRect:^TRect;
|
||||
i:Integer;
|
||||
locCtl:TControl;
|
||||
locFontp:^Integer;
|
||||
Begin
|
||||
try
|
||||
New(locPRect);
|
||||
locPRect^:=vCtl.BoundsRect;
|
||||
vList.Add(locPRect);
|
||||
If PropertyExists(vCtl,'FONT') Then
|
||||
Begin
|
||||
LocFont:=TFont(GetObjectProperty(vCtl,'FONT'));
|
||||
New(locFontp);
|
||||
locFontP^:=LocFont.Size;
|
||||
vList.Add(locFontP);
|
||||
// ShowMessage(vCtl.Name+'Ori:='+InttoStr(LocFont.Size));
|
||||
End;
|
||||
If vCtl Is TWinControl Then
|
||||
For i:=0 to TWinControl(vCtl).ControlCount-1 Do
|
||||
begin
|
||||
locCtl:=TWinControl(vCtl).Controls[i];
|
||||
ControlsPosToList(locCtl,vList);
|
||||
end;
|
||||
except
|
||||
Raise;
|
||||
end;
|
||||
End;
|
||||
|
||||
//计算新的坐标位置:利用递归法遍历各级容器里的控件,直到最后一层。
|
||||
// 计算坐标时先计算顶级容器级的,然后逐级递进
|
||||
Procedure AdjustControlsScale(vCtl:TControl;vList:TList;Var vK:Integer);
|
||||
Var
|
||||
locOriRect,LocNewRect:TRect;
|
||||
i:Integer;
|
||||
locCtl:TControl;
|
||||
Begin
|
||||
try
|
||||
If vCtl.Align<>alClient Then
|
||||
Begin
|
||||
locOriRect:=TRect(vList.Items[vK]^);
|
||||
With locNewRect Do
|
||||
begin
|
||||
Left:=Round(locOriRect.Left*fScrResolutionRateW);
|
||||
Right:=Round(locOriRect.Right*fScrResolutionRateW);
|
||||
Top:=Round(locOriRect.Top*fScrResolutionRateH);
|
||||
Bottom:=Round(locOriRect.Bottom*fScrResolutionRateH);
|
||||
vCtl.SetBounds(Left,Top,Right-Left,Bottom-Top);
|
||||
end;
|
||||
End;
|
||||
If PropertyExists(vCtl,'FONT') Then
|
||||
Begin
|
||||
Inc(vK);
|
||||
LocFont:=TFont(GetObjectProperty(vCtl,'FONT'));
|
||||
locFontSize:=Integer(vList.Items[vK]^);
|
||||
LocFont.Size := Round(LocFontRate*locFontSize);
|
||||
// ShowMessage(vCtl.Name+'New:='+InttoStr(LocFont.Size));
|
||||
End;
|
||||
Inc(vK);
|
||||
If vCtl Is TWinControl Then
|
||||
For i:=0 to TwinControl(vCtl).ControlCount-1 Do
|
||||
begin
|
||||
locCtl:=TWinControl(vCtl).Controls[i];
|
||||
AdjustControlsScale(locCtl,vList,vK);
|
||||
end;
|
||||
except
|
||||
Raise;
|
||||
end;
|
||||
End;
|
||||
|
||||
//释放坐标位置指针和列表对象
|
||||
Procedure FreeListItem(vList:TList);
|
||||
Var
|
||||
i:Integer;
|
||||
Begin
|
||||
For i:=0 to vList.Count-1 Do
|
||||
Dispose(vList.Items[i]);
|
||||
vList.Free;
|
||||
End;
|
||||
|
||||
begin
|
||||
LocList:=TList.Create;
|
||||
Try
|
||||
Try
|
||||
if (Screen.width<>OriWidth)OR(Screen.Height<>OriHeight) then
|
||||
begin
|
||||
CalBasicScalePars;
|
||||
// AdjustComponentFont(Self);
|
||||
ControlsPostoList(Self,locList);
|
||||
locK:=0;
|
||||
AdjustControlsScale(Self,locList,locK);
|
||||
|
||||
End;
|
||||
Except on E:Exception Do
|
||||
Raise Exception.Create('进行屏幕分辨率自适应调整时出现错误'+E.Message);
|
||||
End;
|
||||
Finally
|
||||
FreeListItem(locList);
|
||||
End;
|
||||
end;
|
||||
|
||||
|
||||
{ TfdForm }
|
||||
|
||||
constructor TfdForm.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
fIsDlgChange:=False;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
4718
Z99Dependency/RTFunAndForm/Fun/U_RTFun.pas
Normal file
388
Z99Dependency/ThreeFun/ComFunc/U_ADOFunc.pas
Normal file
|
|
@ -0,0 +1,388 @@
|
|||
unit U_ADOFunc;
|
||||
interface
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ComCtrls, ToolWin, StdCtrls,DBGrids, DB, cxDBData, ADODB,StrUtils,
|
||||
Midas, ExtCtrls, Buttons,DBClient,FTComboBox,BtnEdit;
|
||||
|
||||
|
||||
function ISNotOnly(ADOQry:TADOQuery;fieldname: string;tablename: string; str_vari:string): boolean;
|
||||
function WriteLog(ADOQry:TADOQuery;mModel:string;mAction:string;OpEvent:string):Boolean;
|
||||
procedure GetERPSetQryTimeValue(ADOQry:TADOQuery);
|
||||
function DelData(ADOQueryCmd:TADOQuery;mDelStr:String;mInt:Integer):Boolean;
|
||||
procedure Setsavedata(ADOQueryCmd:TADOQuery;MyTable:string;
|
||||
Myparent:TWinControl;MyTag:integer);
|
||||
function GetFieldValue(sqlStr:String;mcaption:string;ADOQuerytmp:TADOQuery):Boolean;
|
||||
procedure CreateCDSChg(SADOQry:TADOQuery; mClientDataset:TclientDataSet; AColCount: Integer);
|
||||
function ADORowChgToCol(fromADoQry:TADOQuery;toClientSet:TclientDataSet;
|
||||
colCount:integer;GroupFields:string;chnField:string):Boolean;
|
||||
procedure GetYearPeriod(AdoQueryTemp:TADOQuery;FDate:TDateTime);
|
||||
function ADOColToRow(fromADoQry:TADOQuery;toClientSet:TclientDataSet;
|
||||
chgFields:string;chgCaptions:string;
|
||||
TocolCount:integer):boolean;
|
||||
implementation
|
||||
uses
|
||||
U_global,U_formPas,U_commFunc;
|
||||
////判断输入的字符型数据是否已经存在
|
||||
function ISNotOnly(ADOQry:TADOQuery;fieldname: string;tablename: string; str_vari:string): boolean;
|
||||
begin
|
||||
result:=true;
|
||||
try
|
||||
with ADOQry do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select '+fieldname+' from '+tablename);
|
||||
sql.Add('where '+fieldname+'='''+str_vari+'''' );
|
||||
open;
|
||||
if (recordcount>0) and (not fields[0].isnull) then
|
||||
result:=false;
|
||||
close;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////
|
||||
function WriteLog(ADOQry:TADOQuery;mModel:string;mAction:string;OpEvent:string):Boolean;
|
||||
begin
|
||||
///////////////////////////////////
|
||||
//写日志
|
||||
try
|
||||
with ADOQry do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('select * from xs_sysLog');
|
||||
sql.Add('where 1<>1');
|
||||
Open;
|
||||
|
||||
Append;
|
||||
fieldByName('Operor').Value :=gUserName;
|
||||
fieldByName('OperTime').Value :=gserverDate;
|
||||
fieldByName('Model').Value :=mModel;
|
||||
fieldByName('acction').Value :=mAction;
|
||||
fieldByName('result').Value :='成功';
|
||||
fieldByName('OpEvent').Value :=trim(OpEvent);
|
||||
Post;
|
||||
end;
|
||||
result:=true;
|
||||
except
|
||||
result:=false;
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
///////////////////////////////////////////////////////
|
||||
procedure GetERPSetQryTimeValue(ADOQry:TADOQuery);
|
||||
begin
|
||||
try
|
||||
with ADOQry do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('select * from XS_SysParam');
|
||||
Open;
|
||||
if RecordCount>0 then
|
||||
begin
|
||||
gQryBegTime:=fieldByName('QryBegTime').AsString ;
|
||||
gQryEndTime:=fieldByName('QryEndTime').AsString ;
|
||||
end
|
||||
else
|
||||
begin
|
||||
gQryBegTime:='00:00';
|
||||
gQryEndTime:='00:00';
|
||||
end;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////
|
||||
//////函数功能:根据SQL语句删除数据
|
||||
//////////////////////////////////////////////
|
||||
function DelData(ADOQueryCmd:TADOQuery;mDelStr:String;mInt:Integer):Boolean;
|
||||
begin
|
||||
try
|
||||
result:=False;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add(mDelStr);
|
||||
ExecSQL;
|
||||
end;
|
||||
result:=True;
|
||||
except
|
||||
result:=False;
|
||||
Application.MessageBox('数据删除失败!','提示',0);
|
||||
end;
|
||||
end;
|
||||
/////////////////////////////////////////////////////
|
||||
//保存数据时字段赋值
|
||||
/////////////////////////////////////////////////////
|
||||
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
|
||||
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 TComboBox then
|
||||
begin
|
||||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TComboBox(Controls[i]).Text);
|
||||
end else
|
||||
if Controls[i] is TDateTimePicker then
|
||||
begin
|
||||
if TDateTimePicker(Controls[i]).ShowCheckbox then
|
||||
begin
|
||||
if TDateTimePicker(Controls[i]).Checked then
|
||||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
||||
end else
|
||||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=TDateTimePicker(Controls[i]).DateTime;
|
||||
end else
|
||||
if Controls[i] is TBtnEditA then
|
||||
begin
|
||||
ADOQueryCmd.FieldByName(Controls[i].Name).Value:=Trim(TBtnEditA(Controls[i]).TxtCode);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////////////////////
|
||||
function GetFieldValue(sqlStr:String;mcaption:string;ADOQuerytmp:TADOQuery):Boolean;
|
||||
begin
|
||||
result:=false;
|
||||
try
|
||||
with ADOQuerytmp do
|
||||
begin
|
||||
close ;
|
||||
sql.Clear ;
|
||||
sql.Add(sqlStr);
|
||||
Open;
|
||||
end;
|
||||
result:=true;
|
||||
except
|
||||
application.MessageBox(pchar('获取【'+mcaption+'】字段值出错!'),'警告信息',0);
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
procedure GetYearPeriod(AdoQueryTemp:TADOQuery;FDate:TDateTime);
|
||||
var
|
||||
fsj:string;
|
||||
begin
|
||||
fsj:=FormatDateTime('yyyy-MM-dd',FDate);
|
||||
with AdoQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add('select * from gy_kjrlb where Qsrq<='''+fsj+''' ');
|
||||
SQL.Add(' and Zzrq>='''+fsj+'''');
|
||||
Open;
|
||||
end;
|
||||
with AdoQueryTemp do
|
||||
begin
|
||||
if IsEmpty then
|
||||
begin
|
||||
Application.MessageBox('还未设置该日期的会计期间!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
gkjyear:=fieldbyname('kjYear').AsInteger;
|
||||
gperiod:=fieldbyname('period').AsInteger;
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////
|
||||
//mClientDataset:TclientDataSet
|
||||
///////////////////////////////////////////////////////////
|
||||
function ADORowChgToCol(fromADoQry:TADOQuery;toClientSet:TclientDataSet;
|
||||
colCount:integer;GroupFields:string;chnField:string):Boolean;
|
||||
var
|
||||
i:integer;
|
||||
k:integer;
|
||||
idx:integer;
|
||||
begin
|
||||
if colCount<=0 then exit;
|
||||
if GroupFields='' then exit;
|
||||
if chnField='' then exit;
|
||||
|
||||
CreateCDSChg(fromADoQry, toClientSet, colCount);
|
||||
|
||||
with fromADoQry do
|
||||
begin
|
||||
first;
|
||||
while not eof do
|
||||
begin
|
||||
toClientSet.Last;
|
||||
if Trim(toClientSet.FieldByName(GroupFields).AsString) = Trim(fieldByName(GroupFields).AsString) then
|
||||
// if toClientSet.locate(GroupFields,VarArrayOf([trim(fieldByName(GroupFields).AsString)]),[]) then
|
||||
begin
|
||||
idx:=toClientSet.fieldByName('curIndex').asInteger;
|
||||
//是否已满要求列数
|
||||
if (idx >= 1) and (idx < colCount) then
|
||||
begin
|
||||
toClientSet.Edit;
|
||||
toClientSet.fieldByName('chgField'+intTostr(idx + 1)).value:=fieldByName(chnField).asfloat;
|
||||
toClientSet.fieldByName('curIndex').value:=toClientSet.fieldByName('curIndex').AsInteger+1;
|
||||
toClientSet.Post;
|
||||
end
|
||||
//多行换行
|
||||
else
|
||||
begin
|
||||
toClientSet.append;
|
||||
for k:=0 to fields.count-1 do
|
||||
begin
|
||||
toClientSet.fields[k].value:= fields[k].value;
|
||||
end;
|
||||
for i:=1 to colcount do
|
||||
begin
|
||||
toClientSet.FieldByName('chgField'+intToStr(i)).Value := 0;
|
||||
end;
|
||||
toClientSet.fieldByName('chgField1').value:=fieldByName(chnField).asfloat;
|
||||
toClientSet.fieldByName('curIndex').value:= 1;
|
||||
toClientSet.Post;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
toClientSet.append;
|
||||
for k:=0 to fields.count-1 do
|
||||
begin
|
||||
toClientSet.fields[k].value:= fields[k].value;
|
||||
end;
|
||||
for i:=1 to colcount do
|
||||
begin
|
||||
toClientSet.FieldByName('chgField'+intToStr(i)).Value := 0;
|
||||
end;
|
||||
toClientSet.fieldByName('chgField1').value:=fieldByName(chnField).asfloat;
|
||||
toClientSet.fieldByName('curIndex').value:= 1;
|
||||
toClientSet.Post;
|
||||
end;
|
||||
|
||||
next;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CreateCDSChg(SADOQry:TADOQuery; mClientDataset:TclientDataSet; AColCount: Integer);
|
||||
var
|
||||
i: Integer;
|
||||
mFieldName: String;
|
||||
mSize: Integer;
|
||||
begin
|
||||
mFieldName := '';
|
||||
|
||||
mClientDataset.Close;
|
||||
mClientDataset.FieldDefs.Clear;
|
||||
with SADOQry do
|
||||
begin
|
||||
for i := 0 to FieldCount - 1 do //
|
||||
begin
|
||||
if (Fields[i].DataType = ftString) and (Fields[i].Size = 0) then
|
||||
begin
|
||||
mSize := 1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
mSize := Fields[i].Size;
|
||||
end;
|
||||
mFieldName := Trim(Fields[i].FieldName);
|
||||
mClientDataset.FieldDefs.Add(mFieldName, Fields[i].DataType, mSize);
|
||||
end;
|
||||
end;
|
||||
for i := 1 to AColCount do
|
||||
begin
|
||||
mClientDataset.FieldDefs.Add('chgField' + IntToStr(i), ftFloat, 0);
|
||||
end;
|
||||
mClientDataset.FieldDefs.Add('curIndex', ftInteger, 0);
|
||||
|
||||
mClientDataset.CreateDataSet;
|
||||
end;
|
||||
/////////////////////////////////////////////////////
|
||||
//函数功能:将数据集列转为行
|
||||
//新数据集的第一列为行表头
|
||||
/////////////////////////////////////////////////////
|
||||
function ADOColToRow(fromADoQry:TADOQuery;toClientSet:TclientDataSet;
|
||||
chgFields:string;chgCaptions:string;
|
||||
TocolCount:integer):boolean;
|
||||
var
|
||||
mField:string;
|
||||
fieldCount:integer;
|
||||
i,j,k:integer;
|
||||
chgFieldsList:Tstringlist;
|
||||
chgCaptionsList:TstringList;
|
||||
begin
|
||||
fromADoQry.DisableControls;
|
||||
toClientSet.DisableControls;
|
||||
try
|
||||
chgFieldsList:=TStringList.Create;
|
||||
chgCaptionsList:=TStringList.Create;
|
||||
chgFieldsList:=split(chgFields,',');
|
||||
chgCaptionsList:=split(chgCaptions,',');
|
||||
/////////////////////////////////////////
|
||||
toClientSet.Close;
|
||||
toClientSet.FieldDefs.Clear;
|
||||
//创建新的数据集
|
||||
for i:=0 to TocolCount do //
|
||||
begin
|
||||
toClientSet.FieldDefs.Add('def'+intTostr(i),
|
||||
ftString,1000);
|
||||
end;
|
||||
toClientSet.Close;
|
||||
toClientSet.CreateDataSet;
|
||||
////////////////////////////////////////////
|
||||
|
||||
///////////////////////////
|
||||
//将数据转换到新的数据集中
|
||||
for i:=0 to chgCaptionsList.Count-1 do
|
||||
begin
|
||||
with toClientSet do
|
||||
begin
|
||||
Append;
|
||||
//行标头字段内容
|
||||
fieldByName('def0').Value := chgCaptionsList.Strings[i];
|
||||
//列值到行值
|
||||
//获取元数据集中对应的列字段
|
||||
mField:=chgFieldsList.Strings[i];
|
||||
fromADoQry.first;
|
||||
for j:=1 to TocolCount do
|
||||
begin
|
||||
//附行值
|
||||
K:=0;
|
||||
while not fromADoQry.Eof do
|
||||
begin
|
||||
fieldByName('def'+intTostr(k+1)).value:=fromADoQry.fieldByName(mField).Value ;
|
||||
K:=k+1;
|
||||
fromADoQry.next;
|
||||
end;
|
||||
end;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
chgFieldsList.Free;
|
||||
chgCaptionsList.Free ;
|
||||
fromADoQry.EnableControls;
|
||||
toClientSet.EnableControls;
|
||||
result:=true;
|
||||
except
|
||||
fromADoQry.EnableControls;
|
||||
toClientSet.EnableControls;
|
||||
chgFieldsList.Free;
|
||||
chgCaptionsList.Free ;
|
||||
result:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
303
Z99Dependency/ThreeFun/ComFunc/U_CommFunc.pas
Normal file
|
|
@ -0,0 +1,303 @@
|
|||
unit U_CommFunc;
|
||||
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages,dialogs, SysUtils, Variants,Classes,
|
||||
StdCtrls, ExtCtrls;
|
||||
|
||||
function split(STR_Source :string; STR_Split:string):TStringList; //分割字符串
|
||||
function AddNewLineToStr(sourceStr:String;number:integer):String ; //在字符串中加入换行符号
|
||||
function StrToE(source:string;ID:integer;flg:integer):String; //加密函数
|
||||
function splitChnFromStr(sourceStr:String):TStringList; //从字符串中分离出计算变量
|
||||
function strToArray(sourceStr:string;number:integer):TStringList; //将中文字符串按没行指定的个数分割
|
||||
function okNumeric(str:string):boolean; //验证输入的是否是数字
|
||||
function okNan(str:string):boolean;
|
||||
function IsNumber(mStr: string): Boolean; //验证数字
|
||||
function IsInteger(mStr: string): Boolean; //验证整型
|
||||
//把字符串转化为一行一个
|
||||
function StrToOne(sourceStr:string):String;
|
||||
implementation
|
||||
|
||||
//字符串分割函数
|
||||
function split(STR_Source :string; STR_Split:string):TStringList;
|
||||
var
|
||||
temp:String;
|
||||
i:Integer;
|
||||
begin
|
||||
Result:=TStringList.Create;
|
||||
//如果是空自符串则返回空列表
|
||||
if trim(STR_Source) = '' then exit;
|
||||
temp:=STR_Source;
|
||||
i:=pos(STR_Split,STR_Source);
|
||||
while i <> 0 do
|
||||
begin
|
||||
Result.add(copy(temp,0,i-1));
|
||||
Delete(temp,1,i+length(STR_Split)-1); //如果STR_Split长度大于1的话,原来的只删除STR_Split字符的第一个.
|
||||
i:=pos(STR_Split,temp);
|
||||
end;
|
||||
Result.add(temp);
|
||||
end;
|
||||
//**************************************************************
|
||||
//在字符串中加入换行符号 number:一行字符串的个数
|
||||
function AddNewLineToStr(sourceStr:String;number:integer):String ;
|
||||
var
|
||||
i:integer;
|
||||
tmpStr:string;
|
||||
tstr_tmp:TstringList;
|
||||
isNext:boolean;
|
||||
begin
|
||||
isNext:=false;
|
||||
tmpStr:='';
|
||||
tstr_tmp:=Tstringlist.create();
|
||||
for i:=1 to length(sourceStr) do
|
||||
begin
|
||||
if isNext then
|
||||
begin
|
||||
isNext:=false ;
|
||||
continue;
|
||||
end;
|
||||
if (ord(sourceStr[i])>=33)and(ord(sourceStr[i])<=126) then
|
||||
begin
|
||||
tstr_tmp.Append(sourceStr[i]);
|
||||
isNext:=false;
|
||||
end
|
||||
else
|
||||
if (ord(sourceStr[i])>=127) then
|
||||
begin
|
||||
tstr_tmp.Append(copy(sourceStr,i,2));
|
||||
isNext:=true;
|
||||
end;
|
||||
end; //end for
|
||||
|
||||
for i:=1 to tstr_tmp.Count do
|
||||
begin
|
||||
if (i mod number=0) and (i<>tstr_tmp.Count) then
|
||||
tmpStr:=tmpStr+tstr_tmp.Strings[i-1]+chr(13)
|
||||
else
|
||||
tmpStr:=tmpStr+tstr_tmp.Strings[i-1];
|
||||
end;
|
||||
|
||||
result:=tmpStr;
|
||||
end;
|
||||
|
||||
//**************************************************************
|
||||
// 从字符串中分离出计算变量
|
||||
function splitChnFromStr(sourceStr:String):TStringList ;
|
||||
var
|
||||
i:integer;
|
||||
tstr_tmp:TstringList;
|
||||
isNext:boolean;
|
||||
tmp:String;
|
||||
begin
|
||||
isNext:=false;
|
||||
tstr_tmp:=Tstringlist.create();
|
||||
for i:=1 to length(sourceStr) do
|
||||
begin
|
||||
if isNext then
|
||||
begin
|
||||
isNext:=false ;
|
||||
continue;
|
||||
end;
|
||||
if (ord(sourceStr[i])>=33)and(ord(sourceStr[i])<=126) then
|
||||
begin
|
||||
if sourceStr[i] in['/','=','-','+','*','\','(',')'] then
|
||||
begin
|
||||
if Length(tmp)>2 then
|
||||
begin
|
||||
tstr_tmp.Append(tmp);
|
||||
tmp:='';
|
||||
end;
|
||||
isNext:=false;
|
||||
end
|
||||
else
|
||||
begin
|
||||
tmp:=tmp+sourceStr[i];
|
||||
isNext:=false;
|
||||
end;
|
||||
end
|
||||
else
|
||||
if (ord(sourceStr[i])>=127) then
|
||||
begin
|
||||
//tstr_tmp.Append(copy(sourceStr,i,2));
|
||||
tmp:=tmp+copy(sourceStr,i,2);
|
||||
isNext:=true;
|
||||
end;
|
||||
end; //end for
|
||||
if Length(tmp)>2 then tstr_tmp.Append(tmp);
|
||||
result:=tstr_tmp;
|
||||
end;
|
||||
|
||||
//*****************************************************
|
||||
// 加密 1:加 0:减
|
||||
function StrToE(source:string;ID:integer;flg:integer):String;
|
||||
var
|
||||
i:integer;
|
||||
tmp:String;
|
||||
begin
|
||||
setLength(tmp,length(source));
|
||||
if flg=1 then
|
||||
begin
|
||||
for i:=1 to Length(source) do
|
||||
begin
|
||||
tmp[i]:=chr(ord(source[i])+ID);
|
||||
end;
|
||||
end
|
||||
else if flg=0 then
|
||||
begin
|
||||
for i:=1 to Length(source) do
|
||||
begin
|
||||
tmp[i]:=chr(ord(source[i])-ID);
|
||||
end;
|
||||
end;
|
||||
result:=tmp;
|
||||
end;
|
||||
//********************************************************************
|
||||
//将中文字符串按没行指定的个数分割
|
||||
function strToArray(sourceStr:string;number:integer):TStringList;
|
||||
var
|
||||
i,cnt:integer;
|
||||
tmpStr:string;
|
||||
tstr_tmp1,tstr_tmp2:TstringList;
|
||||
isNext:boolean;
|
||||
begin
|
||||
isNext:=false;
|
||||
tmpStr:='';
|
||||
tstr_tmp1:=Tstringlist.create();
|
||||
tstr_tmp2:=Tstringlist.create();
|
||||
for i:=1 to length(sourceStr) do
|
||||
begin
|
||||
if isNext then
|
||||
begin
|
||||
isNext:=false ;
|
||||
continue;
|
||||
end;
|
||||
if (ord(sourceStr[i])>=33)and(ord(sourceStr[i])<=126) then
|
||||
begin
|
||||
tstr_tmp1.Append(sourceStr[i]);
|
||||
isNext:=false;
|
||||
end
|
||||
else
|
||||
if (ord(sourceStr[i])>=127) then
|
||||
begin
|
||||
tstr_tmp1.Append(copy(sourceStr,i,2));
|
||||
isNext:=true;
|
||||
end;
|
||||
end; //end for
|
||||
|
||||
if number=1 then
|
||||
begin
|
||||
result:=tstr_tmp1;
|
||||
exit;
|
||||
end;
|
||||
cnt:=1;
|
||||
tmpStr:='';
|
||||
for i:=0 to tstr_tmp1.Count-1 do
|
||||
begin
|
||||
if cnt<=number then
|
||||
begin
|
||||
tmpStr:=tmpStr+tstr_tmp1.strings[i];
|
||||
inc(cnt);
|
||||
end
|
||||
else
|
||||
begin
|
||||
tstr_tmp2.append(tmpStr);
|
||||
tmpStr:=tstr_tmp1.strings[i];
|
||||
cnt:=2;
|
||||
end;
|
||||
end;
|
||||
if tmpStr<>'' then tstr_tmp2.append(tmpStr);
|
||||
result:=tstr_tmp2;
|
||||
end;
|
||||
|
||||
//*************************************************************
|
||||
//验证输入的是否是数字
|
||||
function okNumeric(str:string):boolean;
|
||||
begin
|
||||
str:=trim(str);
|
||||
try
|
||||
if str='' then
|
||||
begin
|
||||
result:=false;
|
||||
exit;
|
||||
end;
|
||||
strToFloat(str);
|
||||
result:=true;
|
||||
except
|
||||
on EConvertError do
|
||||
result:=false;
|
||||
end;
|
||||
end;
|
||||
//*************************************************************
|
||||
//验证输入的是否是数字
|
||||
function okNan(str:string):boolean;
|
||||
begin
|
||||
result:=true;
|
||||
str:=trim(str);
|
||||
try
|
||||
if str='' then
|
||||
begin
|
||||
result:=false;
|
||||
exit;
|
||||
end;
|
||||
strToInt(str);
|
||||
except
|
||||
on EConvertError do
|
||||
result:=false;
|
||||
end;
|
||||
end;
|
||||
//****************************************************************
|
||||
//把字符串转化为一行一个
|
||||
function StrToOne(sourceStr:string):String;
|
||||
var
|
||||
i:integer;
|
||||
isNext:Boolean;
|
||||
tmp:string;
|
||||
begin
|
||||
isNext:=false;
|
||||
for i:=1 to length(sourceStr) do
|
||||
begin
|
||||
if isNext then
|
||||
begin
|
||||
isNext:=false ;
|
||||
continue;
|
||||
end;
|
||||
if (ord(sourceStr[i])>=33)and(ord(sourceStr[i])<=126) then
|
||||
begin
|
||||
tmp:=tmp+(sourceStr[i]);
|
||||
isNext:=false;
|
||||
end
|
||||
else
|
||||
if (ord(sourceStr[i])>=127) then
|
||||
begin
|
||||
tmp:=tmp+(copy(sourceStr,i,2))+#13;
|
||||
isNext:=true;
|
||||
end;
|
||||
end; //end for
|
||||
result:=tmp;
|
||||
end;
|
||||
//* 返回字符串是否是正确的数字表达 *//
|
||||
function IsNumber(mStr: string): Boolean;
|
||||
var
|
||||
I: Real;
|
||||
E: Integer;
|
||||
begin
|
||||
Val(mStr, I, E);
|
||||
Result := E = 0;
|
||||
E := Trunc(I);
|
||||
end;
|
||||
// * 返回字符串是否是正确的整数表达 *//
|
||||
function IsInteger(mStr: string): Boolean;
|
||||
var
|
||||
I: Integer;
|
||||
E: Integer;
|
||||
begin
|
||||
Val(mStr, I, E);
|
||||
Result := E = 0;
|
||||
E := Trunc(I);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
||||
1
Z99Dependency/ThreeFun/Delphi_二微码/123.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
2342314324
|
||||
35
Z99Dependency/ThreeFun/Delphi_二微码/Project1.cfg
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
-$A8
|
||||
-$B-
|
||||
-$C+
|
||||
-$D+
|
||||
-$E-
|
||||
-$F-
|
||||
-$G+
|
||||
-$H+
|
||||
-$I+
|
||||
-$J-
|
||||
-$K-
|
||||
-$L+
|
||||
-$M-
|
||||
-$N+
|
||||
-$O+
|
||||
-$P+
|
||||
-$Q-
|
||||
-$R-
|
||||
-$S-
|
||||
-$T-
|
||||
-$U-
|
||||
-$V+
|
||||
-$W-
|
||||
-$X+
|
||||
-$YD
|
||||
-$Z1
|
||||
-cg
|
||||
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
-H+
|
||||
-W+
|
||||
-M
|
||||
-$M16384,1048576
|
||||
-K$00400000
|
||||
-LE"d:\program files (x86)\borland\delphi7\Projects\Bpl"
|
||||
-LN"d:\program files (x86)\borland\delphi7\Projects\Bpl"
|
||||
136
Z99Dependency/ThreeFun/Delphi_二微码/Project1.dof
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
[FileVersion]
|
||||
Version=7.0
|
||||
[Compiler]
|
||||
A=8
|
||||
B=0
|
||||
C=1
|
||||
D=1
|
||||
E=0
|
||||
F=0
|
||||
G=1
|
||||
H=1
|
||||
I=1
|
||||
J=0
|
||||
K=0
|
||||
L=1
|
||||
M=0
|
||||
N=1
|
||||
O=1
|
||||
P=1
|
||||
Q=0
|
||||
R=0
|
||||
S=0
|
||||
T=0
|
||||
U=0
|
||||
V=1
|
||||
W=0
|
||||
X=1
|
||||
Y=1
|
||||
Z=1
|
||||
ShowHints=1
|
||||
ShowWarnings=1
|
||||
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
|
||||
NamespacePrefix=
|
||||
SymbolDeprecated=1
|
||||
SymbolLibrary=1
|
||||
SymbolPlatform=1
|
||||
UnitLibrary=1
|
||||
UnitPlatform=1
|
||||
UnitDeprecated=1
|
||||
HResultCompat=1
|
||||
HidingMember=1
|
||||
HiddenVirtual=1
|
||||
Garbage=1
|
||||
BoundsError=1
|
||||
ZeroNilCompat=1
|
||||
StringConstTruncated=1
|
||||
ForLoopVarVarPar=1
|
||||
TypedConstVarPar=1
|
||||
AsgToTypedConst=1
|
||||
CaseLabelRange=1
|
||||
ForVariable=1
|
||||
ConstructingAbstract=1
|
||||
ComparisonFalse=1
|
||||
ComparisonTrue=1
|
||||
ComparingSignedUnsigned=1
|
||||
CombiningSignedUnsigned=1
|
||||
UnsupportedConstruct=1
|
||||
FileOpen=1
|
||||
FileOpenUnitSrc=1
|
||||
BadGlobalSymbol=1
|
||||
DuplicateConstructorDestructor=1
|
||||
InvalidDirective=1
|
||||
PackageNoLink=1
|
||||
PackageThreadVar=1
|
||||
ImplicitImport=1
|
||||
HPPEMITIgnored=1
|
||||
NoRetVal=1
|
||||
UseBeforeDef=1
|
||||
ForLoopVarUndef=1
|
||||
UnitNameMismatch=1
|
||||
NoCFGFileFound=1
|
||||
MessageDirective=1
|
||||
ImplicitVariants=1
|
||||
UnicodeToLocale=1
|
||||
LocaleToUnicode=1
|
||||
ImagebaseMultiple=1
|
||||
SuspiciousTypecast=1
|
||||
PrivatePropAccessor=1
|
||||
UnsafeType=1
|
||||
UnsafeCode=1
|
||||
UnsafeCast=1
|
||||
[Linker]
|
||||
MapFile=0
|
||||
OutputObjs=0
|
||||
ConsoleApp=1
|
||||
DebugInfo=0
|
||||
RemoteSymbols=0
|
||||
MinStackSize=16384
|
||||
MaxStackSize=1048576
|
||||
ImageBase=4194304
|
||||
ExeDescription=
|
||||
[Directories]
|
||||
OutputDir=
|
||||
UnitOutputDir=
|
||||
PackageDLLOutputDir=
|
||||
PackageDCPOutputDir=
|
||||
SearchPath=
|
||||
Packages=
|
||||
Conditionals=
|
||||
DebugSourceDirs=
|
||||
UsePackages=0
|
||||
[Parameters]
|
||||
RunParams=
|
||||
HostApplication=C:\Users\Administrator\Desktop\QR-Windows编码201108正式及发布和演示\2-QR编码演示发布包\QR-DLL演示版说明\DEMO程序源码\Delphi\Project1.exe
|
||||
Launcher=
|
||||
UseLauncher=0
|
||||
DebugCWD=
|
||||
[Language]
|
||||
ActiveLang=
|
||||
ProjectLang=
|
||||
RootDir=
|
||||
[Version Info]
|
||||
IncludeVerInfo=0
|
||||
AutoIncBuild=0
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
Release=0
|
||||
Build=0
|
||||
Debug=0
|
||||
PreRelease=0
|
||||
Special=0
|
||||
Private=0
|
||||
DLL=0
|
||||
Locale=2052
|
||||
CodePage=936
|
||||
[Version Info Keys]
|
||||
CompanyName=
|
||||
FileDescription=
|
||||
FileVersion=1.0.0.0
|
||||
InternalName=
|
||||
LegalCopyright=
|
||||
LegalTrademarks=
|
||||
OriginalFilename=
|
||||
ProductName=
|
||||
ProductVersion=1.0.0.0
|
||||
Comments=
|
||||
13
Z99Dependency/ThreeFun/Delphi_二微码/Project1.dpr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
program Project1;
|
||||
|
||||
uses
|
||||
Forms,
|
||||
Unit1 in 'Unit1.pas' {Form1};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
BIN
Z99Dependency/ThreeFun/Delphi_二微码/Project1.res
Normal file
287
Z99Dependency/ThreeFun/Delphi_二微码/Unit1.dfm
Normal file
|
|
@ -0,0 +1,287 @@
|
|||
object Form1: TForm1
|
||||
Left = 434
|
||||
Top = 164
|
||||
Width = 494
|
||||
Height = 463
|
||||
Caption = #20108#32500#26465#30721#27979#35797
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
OnCreate = FormCreate
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object GroupBox1: TGroupBox
|
||||
Left = 4
|
||||
Top = 12
|
||||
Width = 321
|
||||
Height = 185
|
||||
Caption = #21442#25968#35774#32622
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
Left = 8
|
||||
Top = 24
|
||||
Width = 24
|
||||
Height = 12
|
||||
Caption = #25513#27169
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 98
|
||||
Top = 24
|
||||
Width = 66
|
||||
Height = 12
|
||||
Caption = #26657#39564#31561#32423' '
|
||||
end
|
||||
object Label3: TLabel
|
||||
Left = 208
|
||||
Top = 24
|
||||
Width = 30
|
||||
Height = 12
|
||||
Caption = #32553#25918' '
|
||||
end
|
||||
object Label4: TLabel
|
||||
Left = 8
|
||||
Top = 80
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #26465#30721#20449#24687
|
||||
end
|
||||
object Label11: TLabel
|
||||
Left = 8
|
||||
Top = 56
|
||||
Width = 24
|
||||
Height = 12
|
||||
Caption = #29256#26412
|
||||
end
|
||||
object Edit1: TEdit
|
||||
Left = 40
|
||||
Top = 20
|
||||
Width = 50
|
||||
Height = 20
|
||||
ImeName = #32043#20809#25340#38899#36755#20837#27861
|
||||
TabOrder = 0
|
||||
Text = '3'
|
||||
end
|
||||
object Edit2: TEdit
|
||||
Left = 156
|
||||
Top = 20
|
||||
Width = 50
|
||||
Height = 20
|
||||
ImeName = #32043#20809#25340#38899#36755#20837#27861
|
||||
TabOrder = 1
|
||||
Text = '3'
|
||||
end
|
||||
object Edit3: TEdit
|
||||
Left = 256
|
||||
Top = 20
|
||||
Width = 50
|
||||
Height = 20
|
||||
Enabled = False
|
||||
ImeName = #32043#20809#25340#38899#36755#20837#27861
|
||||
TabOrder = 2
|
||||
Text = '3'
|
||||
end
|
||||
object Memo1: TMemo
|
||||
Left = 8
|
||||
Top = 96
|
||||
Width = 145
|
||||
Height = 81
|
||||
Lines.Strings = (
|
||||
'201405010008'
|
||||
#30591#29305#36719#20214
|
||||
'')
|
||||
ScrollBars = ssVertical
|
||||
TabOrder = 3
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 160
|
||||
Top = 48
|
||||
Width = 151
|
||||
Height = 134
|
||||
BevelOuter = bvLowered
|
||||
TabOrder = 4
|
||||
object Image1: TImage
|
||||
Left = 1
|
||||
Top = 1
|
||||
Width = 149
|
||||
Height = 132
|
||||
Align = alClient
|
||||
Anchors = [akTop, akRight, akBottom]
|
||||
AutoSize = True
|
||||
Center = True
|
||||
end
|
||||
end
|
||||
object Edit10: TEdit
|
||||
Left = 40
|
||||
Top = 52
|
||||
Width = 49
|
||||
Height = 20
|
||||
TabOrder = 5
|
||||
Text = '0'
|
||||
end
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 9
|
||||
Top = 376
|
||||
Width = 90
|
||||
Height = 25
|
||||
Caption = #20174#32534#36753#26639#29983#25104
|
||||
TabOrder = 1
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 124
|
||||
Top = 376
|
||||
Width = 90
|
||||
Height = 25
|
||||
Caption = #20174#25991#20214#29983#25104
|
||||
TabOrder = 2
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object Button3: TButton
|
||||
Left = 240
|
||||
Top = 376
|
||||
Width = 90
|
||||
Height = 25
|
||||
Caption = #20445#23384
|
||||
TabOrder = 3
|
||||
OnClick = Button3Click
|
||||
end
|
||||
object GroupBox2: TGroupBox
|
||||
Left = 8
|
||||
Top = 200
|
||||
Width = 321
|
||||
Height = 177
|
||||
Caption = #25991#23383
|
||||
TabOrder = 4
|
||||
object Label5: TLabel
|
||||
Left = 8
|
||||
Top = 24
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #27599#34892#23383#25968
|
||||
end
|
||||
object Label6: TLabel
|
||||
Left = 8
|
||||
Top = 64
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #25991#23383#20449#24687
|
||||
end
|
||||
object Label7: TLabel
|
||||
Left = 8
|
||||
Top = 104
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #23383#20307#22823#23567
|
||||
end
|
||||
object Label8: TLabel
|
||||
Left = 8
|
||||
Top = 142
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #27700#24179#30041#30333
|
||||
end
|
||||
object Label9: TLabel
|
||||
Left = 160
|
||||
Top = 104
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #23383#20307#39640#24230
|
||||
end
|
||||
object Label10: TLabel
|
||||
Left = 160
|
||||
Top = 142
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #22402#30452#30041#30333
|
||||
end
|
||||
object Edit4: TEdit
|
||||
Left = 72
|
||||
Top = 20
|
||||
Width = 57
|
||||
Height = 20
|
||||
TabOrder = 0
|
||||
Text = '9'
|
||||
end
|
||||
object Edit5: TEdit
|
||||
Left = 73
|
||||
Top = 60
|
||||
Width = 216
|
||||
Height = 20
|
||||
TabOrder = 1
|
||||
Text = '123456789'
|
||||
end
|
||||
object Edit6: TEdit
|
||||
Left = 70
|
||||
Top = 100
|
||||
Width = 67
|
||||
Height = 20
|
||||
TabOrder = 2
|
||||
Text = '0'
|
||||
end
|
||||
object Edit7: TEdit
|
||||
Left = 72
|
||||
Top = 138
|
||||
Width = 65
|
||||
Height = 20
|
||||
TabOrder = 3
|
||||
Text = '10'
|
||||
end
|
||||
object Edit8: TEdit
|
||||
Left = 225
|
||||
Top = 100
|
||||
Width = 56
|
||||
Height = 20
|
||||
TabOrder = 4
|
||||
Text = '10'
|
||||
end
|
||||
object Edit9: TEdit
|
||||
Left = 230
|
||||
Top = 138
|
||||
Width = 59
|
||||
Height = 20
|
||||
TabOrder = 5
|
||||
Text = '10'
|
||||
end
|
||||
end
|
||||
object Button4: TButton
|
||||
Left = 376
|
||||
Top = 376
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #25171#21360#39044#35272
|
||||
TabOrder = 5
|
||||
OnClick = Button4Click
|
||||
end
|
||||
object OpenDialog1: TOpenDialog
|
||||
Left = 232
|
||||
Top = 216
|
||||
end
|
||||
object SaveDialog1: TSaveDialog
|
||||
Left = 288
|
||||
Top = 216
|
||||
end
|
||||
object RM1: TRMGridReport
|
||||
ThreadPrepareReport = True
|
||||
InitialZoom = pzDefault
|
||||
PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbExport, pbNavigator]
|
||||
DefaultCollate = False
|
||||
SaveReportOptions.RegistryPath = 'Software\ReportMachine\ReportSettings\'
|
||||
PreviewOptions.RulerUnit = rmutScreenPixels
|
||||
PreviewOptions.RulerVisible = False
|
||||
PreviewOptions.DrawBorder = False
|
||||
PreviewOptions.BorderPen.Color = clGray
|
||||
PreviewOptions.BorderPen.Style = psDash
|
||||
CompressLevel = rmzcFastest
|
||||
CompressThread = False
|
||||
LaterBuildEvents = True
|
||||
OnlyOwnerDataSet = False
|
||||
Left = 388
|
||||
Top = 300
|
||||
ReportData = {}
|
||||
end
|
||||
end
|
||||
203
Z99Dependency/ThreeFun/Delphi_二微码/Unit1.pas
Normal file
|
|
@ -0,0 +1,203 @@
|
|||
unit Unit1;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, RM_System, RM_Common, RM_Class,
|
||||
RM_GridReport;
|
||||
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
GroupBox1: TGroupBox;
|
||||
Edit1: TEdit;
|
||||
Edit2: TEdit;
|
||||
Edit3: TEdit;
|
||||
Edit10: TEdit;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
Label4: TLabel;
|
||||
Memo1: TMemo;
|
||||
Panel1: TPanel;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Button3: TButton;
|
||||
Image1: TImage;
|
||||
OpenDialog1: TOpenDialog;
|
||||
SaveDialog1: TSaveDialog;
|
||||
GroupBox2: TGroupBox;
|
||||
Edit4: TEdit;
|
||||
Edit5: TEdit;
|
||||
Edit6: TEdit;
|
||||
Edit7: TEdit;
|
||||
Edit8: TEdit;
|
||||
Edit9: TEdit;
|
||||
Label5: TLabel;
|
||||
Label6: TLabel;
|
||||
Label7: TLabel;
|
||||
Label8: TLabel;
|
||||
Label9: TLabel;
|
||||
Label10: TLabel;
|
||||
Label11: TLabel;
|
||||
Button4: TButton;
|
||||
RM1: TRMGridReport;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure Button3Click(Sender: TObject);
|
||||
procedure Button4Click(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
CurrentDir:string;
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
|
||||
TMakebar = procedure(ucData:pchar;nDataLen:integer;nErrLevel:integer;nMask:integer;nBarEdition:integer;szBmpFileName:pchar;nScale:integer);stdcall;
|
||||
TMixtext = procedure( szSrcBmpFileName:PChar;szDstBmpFileName:PChar;sztext:PChar;fontsize,txtheight,hmargin,vmargin,txtcntoneline:integer);stdcall;
|
||||
//TSetColorDepth = procedure( ndepth:integer);stdcall;
|
||||
//TGetColorDepth = procedure();stdcall;
|
||||
//(PCHAR ucData, long nDataLen, char* szBmpFileName,
|
||||
// long nClumn, long , long );
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
var
|
||||
Moudle: THandle;
|
||||
Makebar:TMakebar;
|
||||
Mixtext:TMixtext;
|
||||
//SetColorDepth:TSetColorDepth;
|
||||
//GetColorDepth:TGetColorDepth;
|
||||
strsz,StrPt,FilePt:PChar;
|
||||
|
||||
Txt,Txt1:String;
|
||||
begin
|
||||
Moudle:=LoadLibrary('MakeQRBarcode.dll');
|
||||
@Makebar:=GetProcAddress(Moudle,'Make');
|
||||
@Mixtext:=GetProcAddress(Moudle,'MixText');
|
||||
//@SetColorDepth:=getprocaddress(Moudle, 'SetColorDepth');
|
||||
//@GetColorDepth:=getprocaddress(Moudle, 'GetColorDepth');
|
||||
Txt:=Memo1.Lines.Text;
|
||||
Txt1:=Edit5.Text;
|
||||
StrPt:=PChar(Txt);
|
||||
strsz:=PChar(Txt1);
|
||||
FilePt:=PChar(String('temp.bmp'));
|
||||
//SetColorDepth(StrToInt(Edit10.Text));
|
||||
Makebar(StrPt,Length(Txt),StrToInt(Edit2.Text),StrToInt(Edit1.Text),
|
||||
StrToInt(Edit10.Text),FilePt,StrToInt(Edit3.Text));
|
||||
//GetColorDepth;
|
||||
Mixtext( FilePt,FilePt,strsz,StrToInt(Edit6.Text),StrToInt(Edit8.Text),StrToInt(Edit7.Text),StrToInt(Edit9.Text),StrToInt(Edit4.Text));
|
||||
Image1.Picture.LoadFromFile('temp.bmp');
|
||||
end;
|
||||
|
||||
procedure TForm1.Button2Click(Sender: TObject);
|
||||
var
|
||||
Moudle: THandle;
|
||||
Makebar:TMakebar;
|
||||
Mixtext:TMixtext;
|
||||
// SetColorDepth:TSetColorDepth;
|
||||
// GetColorDepth:TGetColorDepth;
|
||||
strsz,StrPt,FilePt:PChar;
|
||||
Txt,Txt1:string;
|
||||
|
||||
begin
|
||||
//CurrentDir := GetCurrentDir();
|
||||
OpenDialog1.InitialDir := CurrentDir;
|
||||
//CreateDir(CurrentDir+'\\bmp\\');
|
||||
if OpenDialog1.Execute then
|
||||
Memo1.Lines.LoadFromFile(OpenDialog1.FileName)
|
||||
else
|
||||
Memo1.Lines.Clear;
|
||||
Moudle:=LoadLibrary('MakeQRBarcode.dll');
|
||||
@Makebar:=GetProcAddress(Moudle,'Make');
|
||||
@Mixtext:=GetProcAddress(Moudle,'MixText');
|
||||
// @SetColorDepth:=getprocaddress(Moudle, 'SetColorDepth');
|
||||
// @GetColorDepth:=getprocaddress(Moudle, 'GetColorDepth');
|
||||
Txt:=Memo1.Lines.Text;
|
||||
Txt1:=Edit5.Text;
|
||||
StrPt:=PChar(Txt);
|
||||
strsz:=PChar(Txt1);
|
||||
FilePt:=PChar(String('temp.bmp'));
|
||||
// SetColorDepth(StrToInt(Edit10.Text));
|
||||
Makebar(StrPt,Length(Txt),StrToInt(Edit2.Text),StrToInt(Edit1.Text),
|
||||
StrToInt(Edit10.Text),FilePt,StrToInt(Edit3.Text));
|
||||
// GetColorDepth;
|
||||
Mixtext( FilePt,FilePt,strsz,StrToInt(Edit6.Text),StrToInt(Edit8.Text),StrToInt(Edit7.Text),StrToInt(Edit9.Text),StrToInt(Edit4.Text));
|
||||
Image1.Picture.LoadFromFile('temp.bmp');
|
||||
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
CurrentDir := GetCurrentDir();
|
||||
end;
|
||||
|
||||
procedure TForm1.Button3Click(Sender: TObject);
|
||||
var
|
||||
//CurrentDir:string;
|
||||
NewFile: TFileStream;
|
||||
OldFile: TFileStream;
|
||||
PImg:string;
|
||||
|
||||
begin
|
||||
//CurrentDir := GetCurrentDir();
|
||||
CreateDir(CurrentDir+'\\bmp\\');
|
||||
SaveDialog1.InitialDir := CurrentDir + '\\bmp\\';
|
||||
SaveDialog1.FileName := 'barcode.bmp';
|
||||
SaveDialog1.Filter := '位图文件 (*.bmp)|*.bmp|所有文件 (*.*)|*.*||';
|
||||
SaveDialog1.Title := '另存为';
|
||||
if (SaveDialog1.Execute()) then
|
||||
begin
|
||||
OldFile := TFileStream.Create(CurrentDir+'\\temp.bmp', fmOpenRead);
|
||||
try
|
||||
NewFile := TFileStream.Create(SaveDialog1.FileName, fmCreate);
|
||||
try
|
||||
NewFile.CopyFrom(OldFile, OldFile.Size);
|
||||
finally
|
||||
FreeAndNil(NewFile);
|
||||
end;
|
||||
finally
|
||||
FreeAndNil(OldFile);
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TForm1.Button4Click(Sender: TObject);
|
||||
var
|
||||
//CurrentDir:string;
|
||||
NewFile: TFileStream;
|
||||
OldFile: TFileStream;
|
||||
PImg:string;
|
||||
|
||||
begin
|
||||
|
||||
PImg:='D:\RT2012.bmp';
|
||||
OldFile := TFileStream.Create(CurrentDir+'\\temp.bmp', fmOpenRead);
|
||||
try
|
||||
NewFile := TFileStream.Create(PImg, fmCreate);
|
||||
try
|
||||
NewFile.CopyFrom(OldFile, OldFile.Size);
|
||||
DeleteFile(PImg);
|
||||
finally
|
||||
FreeAndNil(NewFile);
|
||||
end;
|
||||
finally
|
||||
FreeAndNil(OldFile);
|
||||
end;
|
||||
RMVariables['PImg'] :=trim(PImg);
|
||||
RM1.LoadFromFile(ExtractFilePath(Application.ExeName) + 'Report\图片显示.rmf');
|
||||
RM1.ShowReport;
|
||||
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
BIN
Z99Dependency/ThreeFun/Delphi_二微码/bmp/1.bmp
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
Z99Dependency/ThreeFun/Delphi_二微码/bmp/2222.bmp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Z99Dependency/ThreeFun/Delphi_二微码/bmp/X1.bmp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Z99Dependency/ThreeFun/Delphi_二微码/bmp/barcode.bmp
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
Z99Dependency/ThreeFun/Delphi_二微码/bmp/qqq.bmp
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
Z99Dependency/ThreeFun/Delphi_二微码/bmp/temp.bmp
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
1
Z99Dependency/ThreeFun/Delphi_二微码/bmp/新建 文本文档.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
safdffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
BIN
Z99Dependency/ThreeFun/Delphi_二微码/temp.bmp
Normal file
|
After Width: | Height: | Size: 12 KiB |
13
Z99Dependency/ThreeFun/Form/GetAddRess.dpr
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
program GetAddRess;
|
||||
|
||||
uses
|
||||
Forms,
|
||||
U_GetAddRess in 'U_GetAddRess.pas' {Form1};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
18215
Z99Dependency/ThreeFun/Form/U_ColumnBandSet.dfm
Normal file
467
Z99Dependency/ThreeFun/Form/U_ColumnBandSet.pas
Normal file
|
|
@ -0,0 +1,467 @@
|
|||
unit U_ColumnBandSet;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, DB, cxDBData, cxCheckBox, ADODB, DBClient,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
|
||||
cxClasses, cxControls, cxGridCustomView, cxGrid, ComCtrls, ToolWin,
|
||||
ImgList;
|
||||
|
||||
type
|
||||
TfrmColumnBandSet = class(TForm)
|
||||
ToolBar1: TToolBar;
|
||||
TBTP: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
Tv1: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
v1Column1: TcxGridDBColumn;
|
||||
v1Column2: TcxGridDBColumn;
|
||||
v1Column3: TcxGridDBColumn;
|
||||
cxGrid2: TcxGrid;
|
||||
Tv2: TcxGridDBTableView;
|
||||
cxGridDBColumn1: TcxGridDBColumn;
|
||||
cxGridLevel1: TcxGridLevel;
|
||||
v2Column1: TcxGridDBColumn;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
ClientDataSet2: TClientDataSet;
|
||||
DataSource1: TDataSource;
|
||||
DataSource2: TDataSource;
|
||||
ADOQuery1: TADOQuery;
|
||||
ADOQuery2: TADOQuery;
|
||||
ADOQuery3: TADOQuery;
|
||||
ADOQuery4: TADOQuery;
|
||||
ADOLink: TADOConnection;
|
||||
ThreeImgList: TImageList;
|
||||
ThreeColorBase: TcxStyleRepository;
|
||||
SHuangSe: TcxStyle;
|
||||
SkyBlue: TcxStyle;
|
||||
Default: TcxStyle;
|
||||
QHuangSe: TcxStyle;
|
||||
Red: TcxStyle;
|
||||
FontBlue: TcxStyle;
|
||||
TextSHuangSe: TcxStyle;
|
||||
FonePurple: TcxStyle;
|
||||
FoneClMaroon: TcxStyle;
|
||||
FoneRed: TcxStyle;
|
||||
RowColor: TcxStyle;
|
||||
handBlack: TcxStyle;
|
||||
cxBlue: TcxStyle;
|
||||
FenHongS: TcxStyle;
|
||||
cxGrid3: TcxGrid;
|
||||
Tv3: TcxGridDBTableView;
|
||||
cxGridDBColumn3: TcxGridDBColumn;
|
||||
cxGridDBColumn4: TcxGridDBColumn;
|
||||
cxGridDBColumn5: TcxGridDBColumn;
|
||||
cxGridLevel2: TcxGridLevel;
|
||||
DSName: TDataSource;
|
||||
CDSName: TClientDataSet;
|
||||
ADOQuery5: TADOQuery;
|
||||
v2Column2: TcxGridDBColumn;
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure TBTPClick(Sender: TObject);
|
||||
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
procedure SCreateCDS200(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
||||
procedure SInitCDSData200(fromADO:TADOQuery;toCDS:TclientDataSet);
|
||||
function GetLSNo200(ADOQueryTmp:TADOQuery;
|
||||
var mMaxNo:string;
|
||||
mFlag:string;
|
||||
mTable:string;
|
||||
mlen:integer;
|
||||
mtype:integer=0):Boolean;
|
||||
public
|
||||
MKName:String;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmColumnBandSet: TfrmColumnBandSet;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink;
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmColumnBandSet.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmColumnBandSet:=nil;
|
||||
end;
|
||||
procedure TfrmColumnBandSet.SCreateCDS200(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
||||
var
|
||||
i:integer;
|
||||
mfieldName:string;
|
||||
mSize:integer;
|
||||
begin
|
||||
mfieldName:='';
|
||||
mClientDataset.FieldDefs.Clear;
|
||||
with SADOQry do
|
||||
begin
|
||||
for i:=0 to fieldCount-1 do //
|
||||
begin
|
||||
if (Fields[i].DataType=ftString) and (Fields[i].Size=0) then
|
||||
begin
|
||||
msize:=1;
|
||||
end
|
||||
else
|
||||
msize:=Fields[i].Size;
|
||||
mfieldName:=trim(fields[i].FieldName);
|
||||
mClientDataset.FieldDefs.Add(mfieldName,
|
||||
Fields[i].DataType,msize);
|
||||
|
||||
end;
|
||||
end;
|
||||
mClientDataset.FieldDefs.Add('Sflag',ftString,1);
|
||||
mClientDataset.FieldDefs.Add('Sindex',ftInteger,0);
|
||||
mClientDataset.FieldDefs.Add('Ssel',ftBoolean,0);
|
||||
mClientDataset.FieldDefs.Add('SDefNote',ftString,10);
|
||||
mClientDataset.Close;
|
||||
mClientDataset.CreateDataSet;
|
||||
end;
|
||||
procedure TfrmColumnBandSet.SInitCDSData200(fromADO:TADOQuery;toCDS:TclientDataSet);
|
||||
var
|
||||
i:integer;
|
||||
k:integer;
|
||||
begin
|
||||
if fromADO.IsEmpty then exit;
|
||||
fromADO.first;
|
||||
K:=1;
|
||||
try
|
||||
toCDS.DisableControls;
|
||||
toCDS.Filtered:=false;
|
||||
|
||||
while not fromADO.Eof do
|
||||
begin
|
||||
with toCDS do
|
||||
begin
|
||||
Append;
|
||||
for i:=0 to fromADO.FieldCount-1 do
|
||||
begin
|
||||
fields[i].value:=fromADO.Fields[i].Value ;
|
||||
end;
|
||||
fieldByName('Sflag').AsString :='1';
|
||||
fieldByName('Sindex').value :=k;
|
||||
fieldByName('Ssel').value :=false;
|
||||
inc(k);
|
||||
Post;
|
||||
end;
|
||||
fromADO.Next;
|
||||
end;
|
||||
if not toCDS.IsEmpty then
|
||||
begin
|
||||
toCDS.First ;
|
||||
end;
|
||||
finally
|
||||
toCDS.EnableControls;
|
||||
end;
|
||||
end;
|
||||
procedure TfrmColumnBandSet.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmColumnBandSet.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmColumnBandSet.FormShow(Sender: TObject);
|
||||
begin
|
||||
try
|
||||
ADOQuery1.DisableControls;
|
||||
with ADOQuery1 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
SQL.Add('select * from SY_User where UserId<>''Admin'' ');
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS200(ADOQuery1,ClientDataSet1);
|
||||
SInitCDSData200(ADOQuery1,ClientDataSet1);
|
||||
finally
|
||||
ADOQuery1.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmColumnBandSet.TBTPClick(Sender: TObject);
|
||||
var
|
||||
MaxNo:String;
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
if ClientDataSet1.Locate('SSel',True,[])=False then Exit;
|
||||
try
|
||||
ADOQuery3.Connection.BeginTrans;
|
||||
if ClientDataSet1.Locate('SSel',True,[])=True then
|
||||
begin
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
First;
|
||||
while not eof do
|
||||
begin
|
||||
if ClientDataSet1.FieldByName('SSel').AsBoolean=True then
|
||||
begin
|
||||
with ADOQuery3 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('Delete Table_Column where ');
|
||||
sql.Add(' Owner='''+Trim(ClientDataSet1.fieldbyname('UserId').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQuery3 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from Table_Column where 1<>1 ');
|
||||
open;
|
||||
end;
|
||||
ClientDataSet2.DisableControls;
|
||||
with ClientDataSet2 do
|
||||
begin
|
||||
first;
|
||||
while not Eof do
|
||||
begin
|
||||
with ADOQuery3 do
|
||||
begin
|
||||
Append;
|
||||
if GetLSNo200(ADOQuery4,MaxNo,'CL','Table_Column',4,1)=False then
|
||||
begin
|
||||
ADOQuery3.Connection.RollbackTrans;
|
||||
Application.MessageBox('取最大号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
FieldByName('TCID').Value:=Trim(MaxNo);
|
||||
FieldByName('Owner').Value:=Trim(ClientDataSet1.fieldbyname('UserId').AsString);
|
||||
//SSetSaveDataCDSNew(ADOQuery3,Tv2,ClientDataSet2,'Table_Column',0);
|
||||
FieldByName('CxTabName').Value:=Trim(ClientDataSet2.fieldbyname('CxTabName').AsString);
|
||||
FieldByName('CxColName').Value:=Trim(ClientDataSet2.fieldbyname('CxColName').AsString);
|
||||
if ClientDataSet2.fieldbyname('TCNotVisble').AsBoolean=True then
|
||||
FieldByName('TCNotVisble').Value:=1
|
||||
else
|
||||
FieldByName('TCNotVisble').Value:=0;
|
||||
FieldByName('ColName').Value:=Trim(ClientDataSet2.fieldbyname('ColName').AsString);
|
||||
FieldByName('OrderNo').Value:=ClientDataSet2.fieldbyname('OrderNo').Value;
|
||||
FieldByName('FillTime').Value:=Now;
|
||||
Post;
|
||||
end;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
ClientDataSet2.EnableControls;
|
||||
end;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
if ClientDataSet1.Locate('SSel',True,[])=True then
|
||||
begin
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
First;
|
||||
while not eof do
|
||||
begin
|
||||
if ClientDataSet1.FieldByName('SSel').AsBoolean=True then
|
||||
begin
|
||||
with ADOQuery3 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add(' Delete Table_Name where');
|
||||
sql.Add(' Owner='''+Trim(ClientDataSet1.fieldbyname('UserId').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQuery3 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from Table_Name where 1<>1 ');
|
||||
open;
|
||||
end;
|
||||
CDSName.DisableControls;
|
||||
with CDSName do
|
||||
begin
|
||||
First;
|
||||
while not eof do
|
||||
begin
|
||||
with ADOQuery3 do
|
||||
begin
|
||||
Append;
|
||||
FieldByName('Owner').Value:=Trim(ClientDataSet1.fieldbyname('UserId').AsString);
|
||||
FieldByName('CxTabName').Value:=Trim(CDSName.fieldbyname('CxTabName').AsString);
|
||||
if CDSName.fieldbyname('TCNotVisble').AsBoolean=True then
|
||||
FieldByName('TCNotVisble').Value:=1
|
||||
else
|
||||
FieldByName('TCNotVisble').Value:=0;
|
||||
if CDSName.fieldbyname('InPut').AsBoolean=True then
|
||||
FieldByName('InPut').Value:=1
|
||||
else
|
||||
FieldByName('InPut').Value:=0;
|
||||
FieldByName('FillTime').Value:=Now;
|
||||
FieldByName('OrderNo').Value:=CDSName.fieldbyname('OrderNo').Value;
|
||||
Post;
|
||||
end;
|
||||
next;
|
||||
end;
|
||||
end;
|
||||
CDSName.EnableControls;
|
||||
end;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
ADOQuery3.Connection.CommitTrans;
|
||||
Application.MessageBox('保存成功!','提示',0);
|
||||
except
|
||||
ADOQuery3.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
end;
|
||||
function TfrmColumnBandSet.GetLSNo200(ADOQueryTmp:TADOQuery;
|
||||
var mMaxNo:string;
|
||||
mFlag:string;
|
||||
mTable:string;
|
||||
mlen:integer;
|
||||
mtype:integer=0):Boolean;
|
||||
begin
|
||||
try
|
||||
with ADOQueryTmp do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear ;
|
||||
sql.Add('exec Get_SY_MaxBH ');
|
||||
sql.Add(' '+quotedStr(mFlag));
|
||||
sql.Add(','+quotedStr(mTable));
|
||||
sql.Add(','+intTostr(mlen));
|
||||
sql.Add(','+intTostr(mtype));
|
||||
//ShowMessage(SQL.Text);
|
||||
Open;
|
||||
|
||||
if RecordCount>0 then
|
||||
begin
|
||||
mMaxNo:=trim(fieldByName('MaxBH').AsString) ;
|
||||
if mMaxNo<>'' then
|
||||
result:=true
|
||||
else
|
||||
Result:=false;
|
||||
end
|
||||
else
|
||||
begin
|
||||
result:=false;
|
||||
end;
|
||||
|
||||
end;
|
||||
if not Result then
|
||||
application.MessageBox(Pchar('无法生成流水号('+mflag+')'),'提示信息',MB_ICONINFORMATION);
|
||||
|
||||
Except
|
||||
result:=false;
|
||||
application.MessageBox(Pchar('无法生成流水号('+mflag+')'),'提示信息',MB_ICONINFORMATION);
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmColumnBandSet.Tv1CellClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
begin
|
||||
ADOQuery2.DisableControls;
|
||||
with ADOQuery2 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from Table_Column where ');
|
||||
sql.Add(' Owner='''+Trim(ClientDataSet1.fieldbyname('UserId').AsString)+'''');
|
||||
Open;
|
||||
end;
|
||||
if ADOQuery2.IsEmpty=False then
|
||||
begin
|
||||
with ADOQuery2 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from Table_Column where ');
|
||||
sql.Add(' Owner='''+Trim(ClientDataSet1.fieldbyname('UserId').AsString)+'''');
|
||||
sql.Add(' order by OrderNo ');
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS200(ADOQuery2,ClientDataSet2);
|
||||
SInitCDSData200(ADOQuery2,ClientDataSet2);
|
||||
end else
|
||||
begin
|
||||
while ClientDataSet2.Locate('TCNotVisble',True,[]) do
|
||||
begin
|
||||
with ClientDataSet2 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('TCNotVisble').Value:=0;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
ADOQuery2.EnableControls;
|
||||
ADOQuery5.DisableControls;
|
||||
with ADOQuery5 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from Table_Name where ');
|
||||
sql.Add(' Owner='''+Trim(ClientDataSet1.fieldbyname('UserId').AsString)+'''');
|
||||
Open;
|
||||
end;
|
||||
if ADOQuery5.IsEmpty=False then
|
||||
begin
|
||||
with ADOQuery5 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from Table_Name where ');
|
||||
sql.Add(' Owner='''+Trim(ClientDataSet1.fieldbyname('UserId').AsString)+'''');
|
||||
sql.Add(' order by OrderNo ');
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS200(ADOQuery5,CDSName);
|
||||
SInitCDSData200(ADOQuery5,CDSName);
|
||||
end else
|
||||
begin
|
||||
while CDSName.Locate('TCNotVisble',True,[]) do
|
||||
begin
|
||||
with CDSName do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('TCNotVisble').Value:=0;
|
||||
FieldByName('InPut').Value:=0;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
ADOQuery5.EnableControls;
|
||||
end;
|
||||
|
||||
procedure TfrmColumnBandSet.FormCreate(Sender: TObject);
|
||||
begin
|
||||
with ADOLink do
|
||||
begin
|
||||
if not Connected then
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//LoginPrompt:=false;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
18157
Z99Dependency/ThreeFun/Form/U_ColumnSet.dfm
Normal file
347
Z99Dependency/ThreeFun/Form/U_ColumnSet.pas
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
unit U_ColumnSet;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, DB, cxDBData, cxCheckBox, ADODB, DBClient,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
|
||||
cxClasses, cxControls, cxGridCustomView, cxGrid, ComCtrls, ToolWin,
|
||||
ImgList;
|
||||
|
||||
type
|
||||
TfrmColumnSet = class(TForm)
|
||||
ToolBar1: TToolBar;
|
||||
TBTP: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
Tv1: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
v1Column1: TcxGridDBColumn;
|
||||
v1Column2: TcxGridDBColumn;
|
||||
v1Column3: TcxGridDBColumn;
|
||||
cxGrid2: TcxGrid;
|
||||
Tv2: TcxGridDBTableView;
|
||||
cxGridDBColumn1: TcxGridDBColumn;
|
||||
cxGridDBColumn2: TcxGridDBColumn;
|
||||
cxGridLevel1: TcxGridLevel;
|
||||
v2Column1: TcxGridDBColumn;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
ClientDataSet2: TClientDataSet;
|
||||
DataSource1: TDataSource;
|
||||
DataSource2: TDataSource;
|
||||
ADOQuery1: TADOQuery;
|
||||
ADOQuery2: TADOQuery;
|
||||
ADOQuery3: TADOQuery;
|
||||
ADOQuery4: TADOQuery;
|
||||
ADOLink: TADOConnection;
|
||||
ThreeImgList: TImageList;
|
||||
ThreeColorBase: TcxStyleRepository;
|
||||
SHuangSe: TcxStyle;
|
||||
SkyBlue: TcxStyle;
|
||||
Default: TcxStyle;
|
||||
QHuangSe: TcxStyle;
|
||||
Red: TcxStyle;
|
||||
FontBlue: TcxStyle;
|
||||
TextSHuangSe: TcxStyle;
|
||||
FonePurple: TcxStyle;
|
||||
FoneClMaroon: TcxStyle;
|
||||
FoneRed: TcxStyle;
|
||||
RowColor: TcxStyle;
|
||||
handBlack: TcxStyle;
|
||||
cxBlue: TcxStyle;
|
||||
FenHongS: TcxStyle;
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure TBTPClick(Sender: TObject);
|
||||
procedure Tv1CellClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
procedure SCreateCDS200(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
||||
procedure SInitCDSData200(fromADO:TADOQuery;toCDS:TclientDataSet);
|
||||
function GetLSNo200(ADOQueryTmp:TADOQuery;
|
||||
var mMaxNo:string;
|
||||
mFlag:string;
|
||||
mTable:string;
|
||||
mlen:integer;
|
||||
mtype:integer=0):Boolean;
|
||||
public
|
||||
MKName:String;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmColumnSet: TfrmColumnSet;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink;
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmColumnSet.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmColumnSet:=nil;
|
||||
end;
|
||||
procedure TfrmColumnSet.SCreateCDS200(SADOQry:TADOQuery; mClientDataset:TclientDataSet );
|
||||
var
|
||||
i:integer;
|
||||
mfieldName:string;
|
||||
mSize:integer;
|
||||
begin
|
||||
mfieldName:='';
|
||||
mClientDataset.FieldDefs.Clear;
|
||||
with SADOQry do
|
||||
begin
|
||||
for i:=0 to fieldCount-1 do //
|
||||
begin
|
||||
if (Fields[i].DataType=ftString) and (Fields[i].Size=0) then
|
||||
begin
|
||||
msize:=1;
|
||||
end
|
||||
else
|
||||
msize:=Fields[i].Size;
|
||||
mfieldName:=trim(fields[i].FieldName);
|
||||
mClientDataset.FieldDefs.Add(mfieldName,
|
||||
Fields[i].DataType,msize);
|
||||
|
||||
end;
|
||||
end;
|
||||
mClientDataset.FieldDefs.Add('Sflag',ftString,1);
|
||||
mClientDataset.FieldDefs.Add('Sindex',ftInteger,0);
|
||||
mClientDataset.FieldDefs.Add('Ssel',ftBoolean,0);
|
||||
mClientDataset.FieldDefs.Add('SDefNote',ftString,10);
|
||||
mClientDataset.Close;
|
||||
mClientDataset.CreateDataSet;
|
||||
end;
|
||||
procedure TfrmColumnSet.SInitCDSData200(fromADO:TADOQuery;toCDS:TclientDataSet);
|
||||
var
|
||||
i:integer;
|
||||
k:integer;
|
||||
begin
|
||||
if fromADO.IsEmpty then exit;
|
||||
fromADO.first;
|
||||
K:=1;
|
||||
try
|
||||
toCDS.DisableControls;
|
||||
toCDS.Filtered:=false;
|
||||
|
||||
while not fromADO.Eof do
|
||||
begin
|
||||
with toCDS do
|
||||
begin
|
||||
Append;
|
||||
for i:=0 to fromADO.FieldCount-1 do
|
||||
begin
|
||||
fields[i].value:=fromADO.Fields[i].Value ;
|
||||
end;
|
||||
fieldByName('Sflag').AsString :='1';
|
||||
fieldByName('Sindex').value :=k;
|
||||
fieldByName('Ssel').value :=false;
|
||||
inc(k);
|
||||
Post;
|
||||
end;
|
||||
fromADO.Next;
|
||||
end;
|
||||
if not toCDS.IsEmpty then
|
||||
begin
|
||||
toCDS.First ;
|
||||
end;
|
||||
finally
|
||||
toCDS.EnableControls;
|
||||
end;
|
||||
end;
|
||||
procedure TfrmColumnSet.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmColumnSet.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmColumnSet.FormShow(Sender: TObject);
|
||||
begin
|
||||
try
|
||||
ADOQuery1.DisableControls;
|
||||
with ADOQuery1 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
SQL.Add('select * from SY_User where UserId<>''Admin'' ');
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS200(ADOQuery1,ClientDataSet1);
|
||||
SInitCDSData200(ADOQuery1,ClientDataSet1);
|
||||
finally
|
||||
ADOQuery1.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmColumnSet.TBTPClick(Sender: TObject);
|
||||
var
|
||||
MaxNo:String;
|
||||
begin
|
||||
if ClientDataSet1.Locate('SSel',True,[])=False then Exit;
|
||||
try
|
||||
ADOQuery3.Connection.BeginTrans;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
First;
|
||||
while not eof do
|
||||
begin
|
||||
if ClientDataSet1.FieldByName('SSel').AsBoolean=True then
|
||||
begin
|
||||
with ADOQuery3 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('Delete Table_Column where CxTabName='''+Trim(ClientDataSet2.fieldbyname('CxTabName').AsString)+'''');
|
||||
sql.Add(' and Owner='''+Trim(ClientDataSet1.fieldbyname('UserId').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQuery3 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from Table_Column where 1<>1 ');
|
||||
open;
|
||||
end;
|
||||
|
||||
with ClientDataSet2 do
|
||||
begin
|
||||
first;
|
||||
while not Eof do
|
||||
begin
|
||||
with ADOQuery3 do
|
||||
begin
|
||||
Append;
|
||||
if GetLSNo200(ADOQuery4,MaxNo,'CL','Table_Column',4,1)=False then
|
||||
begin
|
||||
ADOQuery3.Connection.RollbackTrans;
|
||||
Application.MessageBox('取最大号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
FieldByName('TCID').Value:=Trim(MaxNo);
|
||||
FieldByName('Owner').Value:=Trim(ClientDataSet1.fieldbyname('UserId').AsString);
|
||||
//SSetSaveDataCDSNew(ADOQuery3,Tv2,ClientDataSet2,'Table_Column',0);
|
||||
FieldByName('CxTabName').Value:=Trim(ClientDataSet2.fieldbyname('CxTabName').AsString);
|
||||
FieldByName('CxColName').Value:=Trim(ClientDataSet2.fieldbyname('CxColName').AsString);
|
||||
FieldByName('TCNotVisble').Value:=ClientDataSet2.fieldbyname('TCNotVisble').Value;
|
||||
FieldByName('ColName').Value:=Trim(ClientDataSet2.fieldbyname('ColName').AsString);
|
||||
Post;
|
||||
end;
|
||||
Next;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
ADOQuery3.Connection.CommitTrans;
|
||||
Application.MessageBox('保存成功!','提示',0);
|
||||
except
|
||||
ADOQuery3.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
end;
|
||||
function TfrmColumnSet.GetLSNo200(ADOQueryTmp:TADOQuery;
|
||||
var mMaxNo:string;
|
||||
mFlag:string;
|
||||
mTable:string;
|
||||
mlen:integer;
|
||||
mtype:integer=0):Boolean;
|
||||
begin
|
||||
try
|
||||
with ADOQueryTmp do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear ;
|
||||
sql.Add('exec Get_SY_MaxBH ');
|
||||
sql.Add(' '+quotedStr(mFlag));
|
||||
sql.Add(','+quotedStr(mTable));
|
||||
sql.Add(','+intTostr(mlen));
|
||||
sql.Add(','+intTostr(mtype));
|
||||
//ShowMessage(SQL.Text);
|
||||
Open;
|
||||
|
||||
if RecordCount>0 then
|
||||
begin
|
||||
mMaxNo:=trim(fieldByName('MaxBH').AsString) ;
|
||||
if mMaxNo<>'' then
|
||||
result:=true
|
||||
else
|
||||
Result:=false;
|
||||
end
|
||||
else
|
||||
begin
|
||||
result:=false;
|
||||
end;
|
||||
|
||||
end;
|
||||
if not Result then
|
||||
application.MessageBox(Pchar('无法生成流水号('+mflag+')'),'提示信息',MB_ICONINFORMATION);
|
||||
|
||||
Except
|
||||
result:=false;
|
||||
application.MessageBox(Pchar('无法生成流水号('+mflag+')'),'提示信息',MB_ICONINFORMATION);
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmColumnSet.Tv1CellClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
begin
|
||||
ADOQuery2.DisableControls;
|
||||
with ADOQuery2 do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from Table_Column where CxTabName='''+Trim(ClientDataSet2.fieldbyname('CxTabName').AsString)+'''');
|
||||
sql.Add(' and Owner='''+Trim(ClientDataSet1.fieldbyname('UserId').AsString)+'''');
|
||||
Open;
|
||||
end;
|
||||
if ADOQuery2.IsEmpty=False then
|
||||
begin
|
||||
SCreateCDS200(ADOQuery2,ClientDataSet2);
|
||||
SInitCDSData200(ADOQuery2,ClientDataSet2);
|
||||
end else
|
||||
begin
|
||||
while ClientDataSet2.Locate('TCNotVisble',True,[]) do
|
||||
begin
|
||||
with ClientDataSet2 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('TCNotVisble').Value:=0;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
ADOQuery2.EnableControls;
|
||||
end;
|
||||
|
||||
procedure TfrmColumnSet.FormCreate(Sender: TObject);
|
||||
begin
|
||||
with ADOLink do
|
||||
begin
|
||||
if not Connected then
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//LoginPrompt:=false;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
86
Z99Dependency/ThreeFun/Form/U_FilterHelp.dfm
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
object frmFilterHelp: TfrmFilterHelp
|
||||
Left = 287
|
||||
Top = 145
|
||||
BorderStyle = bsDialog
|
||||
Caption = #39640#32423#36807#28388
|
||||
ClientHeight = 507
|
||||
ClientWidth = 457
|
||||
Color = clBtnFace
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object ScrollBox1: TScrollBox
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 457
|
||||
Height = 465
|
||||
Align = alTop
|
||||
Color = clSkyBlue
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
Left = 184
|
||||
Top = 8
|
||||
Width = 68
|
||||
Height = 16
|
||||
Caption = #36807#28388#26465#20214
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clRed
|
||||
Font.Height = -16
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 384
|
||||
Top = 8
|
||||
Width = 57
|
||||
Height = 17
|
||||
Caption = #31934#30830
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 465
|
||||
Width = 457
|
||||
Height = 43
|
||||
Align = alTop
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
TabOrder = 1
|
||||
object Button1: TButton
|
||||
Left = 112
|
||||
Top = 9
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 264
|
||||
Top = 9
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #20851#38381
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
end
|
||||
object XPManifest1: TXPManifest
|
||||
Left = 280
|
||||
Top = 328
|
||||
end
|
||||
end
|
||||
213
Z99Dependency/ThreeFun/Form/U_FilterHelp.pas
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
unit U_FilterHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls,cxGridLevel,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||||
cxControls, cxGridCustomView, cxGrid, cxStyles, cxCustomData, cxGraphics,
|
||||
cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData,StrUtils,ADODB,
|
||||
XPMan;
|
||||
|
||||
type
|
||||
TfrmFilterHelp = class(TForm)
|
||||
ScrollBox1: TScrollBox;
|
||||
Panel1: TPanel;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Label1: TLabel;
|
||||
CheckBox1: TCheckBox;
|
||||
XPManifest1: TXPManifest;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
procedure CreateFilers(Tv1:TcxGridDBTableView);
|
||||
function GSGetFilters():string;
|
||||
procedure GSQryDofilter(ADOQry:TADOQuery;FilterStr:string);
|
||||
procedure TcxGridToExcel(mfileName:string;gridName:TcxGrid);
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmFilterHelp: TfrmFilterHelp;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmFilterHelp.Button1Click(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=1
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////////
|
||||
//函数功能:利用cxGrid自带的功能导出到excel中
|
||||
//////////////////////////////////////////////////////////////////
|
||||
procedure TfrmFilterHelp.TcxGridToExcel(mfileName:string;gridName:TcxGrid);
|
||||
var
|
||||
saveDialog:TSaveDialog;
|
||||
begin
|
||||
try
|
||||
saveDialog:=TSaveDialog.Create(nil);
|
||||
saveDialog.Filter:='xls(*.xls)|*.xls|全部(*.*)|*.*';
|
||||
saveDialog.Options:=[ofOverwritePrompt];
|
||||
saveDialog.FileName:=mfileName;
|
||||
if saveDialog.Execute then
|
||||
if Assigned(gridName) then
|
||||
begin
|
||||
try
|
||||
|
||||
ExportGrid4ToExcel(saveDialog.FileName,gridName);
|
||||
except
|
||||
application.MessageBox('创建失败,源文件可能处于编辑状态!','提示信息',0);
|
||||
exit;
|
||||
end;
|
||||
application.MessageBox('成功导出!','提示信息',0);
|
||||
end
|
||||
else
|
||||
application.MessageBox('导出失败!','提示信息',0);
|
||||
finally
|
||||
saveDialog.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmFilterHelp.Button2Click(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=-1;
|
||||
end;
|
||||
|
||||
procedure TfrmFilterHelp.CreateFilers(Tv1:TcxGridDBTableView);
|
||||
var
|
||||
i,j,z,m,FTop,FLeft,Fdiv,FMod:Integer;// mod 余数,div商
|
||||
FLableEdit:TLabeledEdit;
|
||||
|
||||
begin
|
||||
j:=0;
|
||||
for i:=0 to Tv1.ColumnCount-1 do
|
||||
begin
|
||||
m:=0;
|
||||
if Tv1.Columns[i].Visible=False then Continue;
|
||||
if not ( (Tv1.DataController.DataSource.DataSet.FieldByName(Tv1.Columns[i].DataBinding.FieldName).DataType=ftBCD) or
|
||||
(Tv1.DataController.DataSource.DataSet.FieldByName(Tv1.Columns[i].DataBinding.FieldName).DataType=ftString) ) then Continue;
|
||||
Fdiv:=(j+1) div 3;
|
||||
FMod:=(j+1) mod 3;
|
||||
FLableEdit:=TLabeledEdit.Create(Self);
|
||||
FLableEdit.EditLabel.Caption:=Trim(Tv1.Columns[i].Caption);
|
||||
FLableEdit.Name:=Trim(Tv1.Columns[i].DataBinding.FieldName);
|
||||
if Tv1.DataController.DataSource.DataSet.FieldByName(Tv1.Columns[i].DataBinding.FieldName).DataType=ftBCD then
|
||||
begin
|
||||
FLableEdit.EditLabel.Caption:=Trim(Tv1.Columns[i].Caption+'始');
|
||||
FLableEdit.Hint:=Trim(Tv1.Columns[i].DataBinding.FieldName);
|
||||
FLableEdit.Tag:=1;
|
||||
end;
|
||||
FLableEdit.Text:='';
|
||||
FLableEdit.TabOrder:=j;
|
||||
FLableEdit.Parent:=ScrollBox1;
|
||||
if FMod>0 then
|
||||
FLableEdit.Top:=50*(Fdiv+1)
|
||||
else
|
||||
FLableEdit.Top:=50*Fdiv;
|
||||
if FMod=1 then
|
||||
FLableEdit.Left:=29
|
||||
else if FMod=2 then
|
||||
FLableEdit.Left:=163
|
||||
else if FMod=0 then
|
||||
FLableEdit.Left:=305;
|
||||
if Tv1.DataController.DataSource.DataSet.FieldByName(Tv1.Columns[i].DataBinding.FieldName).DataType=ftBCD then
|
||||
begin
|
||||
j:=j+1;
|
||||
Fdiv:=(j+1) div 3;
|
||||
FMod:=(j+1) mod 3;
|
||||
FLableEdit:=TLabeledEdit.Create(Self);
|
||||
FLableEdit.EditLabel.Caption:=Trim(Tv1.Columns[i].Caption+'止');
|
||||
FLableEdit.Hint:=Trim(Tv1.Columns[i].DataBinding.FieldName);
|
||||
FLableEdit.Tag:=2;
|
||||
FLableEdit.Text:='';
|
||||
FLableEdit.TabOrder:=j;
|
||||
FLableEdit.Parent:=ScrollBox1;
|
||||
if FMod>0 then
|
||||
FLableEdit.Top:=50*(Fdiv+1)
|
||||
else
|
||||
FLableEdit.Top:=50*Fdiv;
|
||||
if FMod=1 then
|
||||
FLableEdit.Left:=29
|
||||
else if FMod=2 then
|
||||
FLableEdit.Left:=163
|
||||
else if FMod=0 then
|
||||
FLableEdit.Left:=305;
|
||||
end;
|
||||
j:=j+1;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TfrmFilterHelp.GSGetFilters():string;
|
||||
var
|
||||
i:Integer;
|
||||
FValue:Double;
|
||||
begin
|
||||
Result:='';
|
||||
with ScrollBox1 do
|
||||
begin
|
||||
for i:=0 to ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TLabel then Continue;
|
||||
if Controls[i] is TLabeledEdit then
|
||||
begin
|
||||
if Trim(TLabeledEdit(Controls[i]).Text)<>'' then
|
||||
begin
|
||||
if TLabeledEdit(Controls[i]).Tag>0 then
|
||||
begin
|
||||
try
|
||||
FValue:=StrToFloat(TLabeledEdit(Controls[i]).Text);
|
||||
except
|
||||
Application.MessageBox('不能输入非法数字!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
if TLabeledEdit(Controls[i]).Tag=1 then
|
||||
begin
|
||||
Result:=Result+'and '+Controls[i].Hint+'>='+Trim(TLabeledEdit(Controls[i]).Text);
|
||||
end else
|
||||
if TLabeledEdit(Controls[i]).Tag=2 then
|
||||
begin
|
||||
Result:=Result+'and '+Controls[i].Hint+'<='+Trim(TLabeledEdit(Controls[i]).Text);
|
||||
end else
|
||||
begin
|
||||
if CheckBox1.Checked then
|
||||
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TLabeledEdit(Controls[i]).Text))
|
||||
else
|
||||
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TLabeledEdit(Controls[i]).Text)+'%');
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if Trim(Result)<>'' then
|
||||
Result:=Trim(RightBStr(Result,Length(Result)-4));
|
||||
end;
|
||||
|
||||
procedure TfrmFilterHelp.GSQryDofilter(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;
|
||||
|
||||
end.
|
||||
131
Z99Dependency/ThreeFun/Form/U_FjList.dfm
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
object frmFjList: TfrmFjList
|
||||
Left = 237
|
||||
Top = 203
|
||||
Width = 639
|
||||
Height = 394
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption = #38468#20214#20449#24687
|
||||
Color = clBtnFace
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object ListView1: TListView
|
||||
Left = 4
|
||||
Top = 16
|
||||
Width = 429
|
||||
Height = 301
|
||||
Columns = <>
|
||||
TabOrder = 0
|
||||
OnDblClick = ListView1DblClick
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 472
|
||||
Top = 0
|
||||
Width = 151
|
||||
Height = 356
|
||||
Align = alRight
|
||||
TabOrder = 1
|
||||
object FileName: TcxButton
|
||||
Left = 30
|
||||
Top = 60
|
||||
Width = 75
|
||||
Height = 25
|
||||
Hint = 'Filesother'
|
||||
Caption = #28155#21152
|
||||
TabOrder = 0
|
||||
OnClick = FileNameClick
|
||||
LookAndFeel.Kind = lfOffice11
|
||||
end
|
||||
object cxButton1: TcxButton
|
||||
Left = 30
|
||||
Top = 96
|
||||
Width = 75
|
||||
Height = 25
|
||||
Hint = 'Filesother'
|
||||
Caption = #21024#38500
|
||||
TabOrder = 1
|
||||
OnClick = cxButton1Click
|
||||
LookAndFeel.Kind = lfOffice11
|
||||
end
|
||||
object cxButton2: TcxButton
|
||||
Left = 30
|
||||
Top = 132
|
||||
Width = 75
|
||||
Height = 25
|
||||
Hint = 'Filesother'
|
||||
Caption = #20445#23384
|
||||
TabOrder = 2
|
||||
OnClick = cxButton2Click
|
||||
LookAndFeel.Kind = lfOffice11
|
||||
end
|
||||
object cxButton3: TcxButton
|
||||
Left = 30
|
||||
Top = 172
|
||||
Width = 75
|
||||
Height = 25
|
||||
Hint = 'Filesother'
|
||||
Caption = #20851#38381
|
||||
TabOrder = 3
|
||||
Visible = False
|
||||
OnClick = cxButton3Click
|
||||
LookAndFeel.Kind = lfOffice11
|
||||
end
|
||||
end
|
||||
object Panel2: TPanel
|
||||
Left = 176
|
||||
Top = 140
|
||||
Width = 193
|
||||
Height = 41
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
Caption = 'Panel2'
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clBlue
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
Visible = False
|
||||
OnDblClick = Panel2DblClick
|
||||
end
|
||||
object ADOQueryTmp: TADOQuery
|
||||
Connection = ADOConnection1
|
||||
Parameters = <>
|
||||
Left = 520
|
||||
Top = 28
|
||||
end
|
||||
object ADOQueryCmd: TADOQuery
|
||||
Connection = ADOConnection1
|
||||
Parameters = <>
|
||||
Left = 568
|
||||
Top = 32
|
||||
end
|
||||
object ImageList1: TImageList
|
||||
Left = 536
|
||||
Top = 228
|
||||
end
|
||||
object IdFTP1: TIdFTP
|
||||
MaxLineAction = maException
|
||||
ReadTimeout = 0
|
||||
ProxySettings.ProxyType = fpcmNone
|
||||
ProxySettings.Port = 0
|
||||
Left = 500
|
||||
Top = 198
|
||||
end
|
||||
object ADOConnection1: TADOConnection
|
||||
LoginPrompt = False
|
||||
Left = 532
|
||||
Top = 240
|
||||
end
|
||||
end
|
||||
393
Z99Dependency/ThreeFun/Form/U_FjList.pas
Normal file
|
|
@ -0,0 +1,393 @@
|
|||
unit U_FjList;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ExtCtrls, ComCtrls, Menus, cxLookAndFeelPainters, StdCtrls,
|
||||
cxButtons, DB, ADODB, ImgList,shellapi, IdBaseComponent, IdComponent,
|
||||
IdTCPConnection, IdTCPClient, IdFTP,strutils;
|
||||
|
||||
type
|
||||
TfrmFjList = class(TForm)
|
||||
ListView1: TListView;
|
||||
Panel1: TPanel;
|
||||
FileName: TcxButton;
|
||||
cxButton1: TcxButton;
|
||||
cxButton2: TcxButton;
|
||||
cxButton3: TcxButton;
|
||||
ADOQueryTmp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
ImageList1: TImageList;
|
||||
Panel2: TPanel;
|
||||
IdFTP1: TIdFTP;
|
||||
ADOConnection1: TADOConnection;
|
||||
procedure cxButton3Click(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FileNameClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ListView1DblClick(Sender: TObject);
|
||||
procedure cxButton1Click(Sender: TObject);
|
||||
procedure cxButton2Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure Panel2DblClick(Sender: TObject);
|
||||
private
|
||||
procedure InitData();
|
||||
{ Private declarations }
|
||||
public
|
||||
fkeyNO:string;
|
||||
fType:string;
|
||||
fId:integer;
|
||||
|
||||
fstatus:integer;
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmFjList: TfrmFjList;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_Fun10;
|
||||
{$R *.dfm}
|
||||
procedure TfrmFjList.InitData();
|
||||
var
|
||||
ListItem: TListItem;
|
||||
Flag: Cardinal;
|
||||
info: SHFILEINFOA;
|
||||
Icon: TIcon;
|
||||
begin
|
||||
ListView1.Items.Clear;
|
||||
try
|
||||
|
||||
with adoqueryTmp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select fileName from TP_File ');
|
||||
sql.Add('where WBID='+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
open;
|
||||
if not IsEmpty then
|
||||
begin
|
||||
while not eof do
|
||||
begin
|
||||
with ListView1 do
|
||||
begin
|
||||
LargeImages := ImageList1;
|
||||
Icon := TIcon.Create;
|
||||
ListItem := Items.Add;
|
||||
Listitem.Caption := trim(fieldbyname('fileName').AsString);
|
||||
// Listitem.SubItems.Add(OpenDiaLog.FileName);
|
||||
Flag := (SHGFI_SMALLICON or SHGFI_ICON or SHGFI_USEFILEATTRIBUTES);
|
||||
SHGetFileInfo(Pchar(trim(fieldbyname('fileName').AsString)), 0, info, Sizeof(info), Flag);
|
||||
Icon.Handle := info.hIcon;
|
||||
ImageList1.AddIcon(Icon);
|
||||
ListItem.ImageIndex := ImageList1.Count - 1;
|
||||
end;
|
||||
next;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.cxButton3Click(Sender: TObject);
|
||||
begin
|
||||
ADOQueryTmp.Close;
|
||||
ADOQuerycmd.Close;
|
||||
ListView1.Items.Free;
|
||||
ModalResult:=-1;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmFjList:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.FileNameClick(Sender: TObject);
|
||||
var
|
||||
OpenDiaLog: TOpenDialog;
|
||||
fFileName:string;
|
||||
fFilePath:string;
|
||||
maxNo:string;
|
||||
// myStream: TADOBlobStream;
|
||||
// FJStream : TMemoryStream;
|
||||
begin
|
||||
|
||||
try
|
||||
OpenDiaLog := TOpenDialog.Create(Self);
|
||||
if OpenDiaLog.Execute then
|
||||
begin
|
||||
fFilePath:=OpenDiaLog.FileName;
|
||||
fFileName:=ExtractFileName(OpenDiaLog.FileName);
|
||||
|
||||
|
||||
with adoqueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select TFId from TP_File ');
|
||||
sql.Add('where WBID<>'+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
||||
open;
|
||||
IF not adoqueryCmd.IsEmpty then
|
||||
begin
|
||||
application.MessageBox('此附件名称已存在,请修改文件名,继续上传!','提示信息',MB_ICONERROR);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
Panel2.Caption:='正在上传数据,请稍等...';
|
||||
Panel2.Visible:=true;
|
||||
application.ProcessMessages;
|
||||
|
||||
if GetLSNo(ADOQueryCmd,maxNo,'FJ','TP_File',4,1)=False then
|
||||
begin
|
||||
Application.MessageBox('取最大号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
adoqueryCmd.Connection.BeginTrans;
|
||||
|
||||
|
||||
with adoqueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('delete from TP_File ');
|
||||
sql.Add('where WBID='+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
||||
execsql;
|
||||
end;
|
||||
|
||||
try
|
||||
with adoqueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from TP_File ');
|
||||
sql.Add('where WBID='+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
||||
open;
|
||||
append;
|
||||
fieldbyname('TFID').Value:=trim(maxNO);
|
||||
fieldbyname('WBID').Value:=trim(fkeyNO);
|
||||
fieldbyname('TFType').Value:=trim(fType);
|
||||
fieldbyname('FileName').Value:=trim(fFileName);
|
||||
// tblobfield(FieldByName('Filesother')).LoadFromFile(fFilePath);
|
||||
post;
|
||||
end;
|
||||
|
||||
if fFilePath <> '' then
|
||||
begin
|
||||
try
|
||||
IdFTP1.Host := PicSvr;
|
||||
IdFTP1.Username := 'three';
|
||||
IdFTP1.Password := '641010';
|
||||
IdFTP1.Connect();
|
||||
IdFTP1.Put(fFilePath, 'FJ\' + Trim(fFileName));
|
||||
IdFTP1.Quit;
|
||||
except
|
||||
IdFTP1.Quit;
|
||||
Application.MessageBox('上传客户图样文件失败,请检查文件服务器!', '提示', MB_ICONWARNING);
|
||||
end;
|
||||
end;
|
||||
IdFTP1.Quit;
|
||||
|
||||
Panel2.Visible:=false;
|
||||
initdata();
|
||||
finally
|
||||
// FJStream.Free;
|
||||
end;
|
||||
|
||||
end;
|
||||
adoqueryCmd.Connection.CommitTrans;
|
||||
except
|
||||
adoqueryCmd.Connection.RollbackTrans;
|
||||
application.MessageBox('附件保存失败!','提示信息',0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.FormCreate(Sender: TObject);
|
||||
begin
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='';
|
||||
Connected:=true;
|
||||
end;
|
||||
ListView1.Align:=alclient;
|
||||
fstatus:=0;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.FormShow(Sender: TObject);
|
||||
begin
|
||||
IF fstatus=0 then Panel1.Visible:=true
|
||||
else Panel1.Visible:=false;
|
||||
initdata();
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.ListView1DblClick(Sender: TObject);
|
||||
var
|
||||
sFieldName:string;
|
||||
fileName:string;
|
||||
begin
|
||||
if ListView1.Items.Count<1 THEN EXIT;
|
||||
|
||||
if listView1.SelCount<1 then exit;
|
||||
sFieldName:=leftbstr(ExtractFilePath(Application.ExeName),1)+':\图片查看';
|
||||
|
||||
if not DirectoryExists(pchar(sFieldName)) then
|
||||
CreateDirectory(pchar(sFieldName),nil);
|
||||
|
||||
fileName:=ListView1.Selected.Caption;
|
||||
|
||||
sFieldName:=sFieldName+'\'+trim(fileName);
|
||||
|
||||
try
|
||||
IdFTP1.Host := PicSvr;
|
||||
IdFTP1.Username := 'three';
|
||||
IdFTP1.Password := '641010';
|
||||
IdFTP1.Connect();
|
||||
except
|
||||
;
|
||||
end;
|
||||
|
||||
if IdFTP1.Connected then
|
||||
begin
|
||||
|
||||
Panel2.Caption:='正在下载数据,请稍等...';
|
||||
Panel2.Visible:=true;
|
||||
application.ProcessMessages;
|
||||
try
|
||||
IdFTP1.Get('FJ\'+ Trim(fileName), sFieldName,false, true);
|
||||
except
|
||||
Panel2.Visible:=false;
|
||||
Application.MessageBox('客户图样文件不存在', '提示', MB_ICONWARNING);
|
||||
IdFTP1.Quit;
|
||||
Exit;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Panel2.Visible:=false;
|
||||
Application.MessageBox('无法连接文件服务器', '提示', MB_ICONWARNING);
|
||||
IdFTP1.Quit;
|
||||
Exit;
|
||||
end;
|
||||
Panel2.Visible:=false;
|
||||
if IdFTP1.Connected then IdFTP1.Quit;
|
||||
ShellExecute(Handle, 'open',PChar(sFieldName),'', '', SW_SHOWNORMAL);
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.cxButton1Click(Sender: TObject);
|
||||
var
|
||||
fFileName:string;
|
||||
fFilePath:string;
|
||||
begin
|
||||
if listView1.SelCount<1 then exit;
|
||||
|
||||
try
|
||||
fFileName:=ListView1.Selected.Caption;
|
||||
// ADOQueryTmp.Locate('fileName',fFileName,[]);
|
||||
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('delete from TP_File ');
|
||||
sql.Add('where WBID='+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
||||
execsql;
|
||||
end;
|
||||
|
||||
initData();
|
||||
|
||||
except
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.cxButton2Click(Sender: TObject);
|
||||
var
|
||||
SaveDialog: TSaveDialog;
|
||||
fFileName:string;
|
||||
fFilePath:string;
|
||||
begin
|
||||
if listView1.SelCount<1 then exit;
|
||||
|
||||
try
|
||||
|
||||
fFileName:=ListView1.Selected.Caption;
|
||||
|
||||
SaveDialog := TSaveDialog.Create(Self);
|
||||
|
||||
SaveDialog.FileName:=fFileName;
|
||||
if SaveDialog.Execute then
|
||||
begin
|
||||
Panel2.Caption:='正在保存数据,请稍等...';
|
||||
Panel2.Visible:=true;
|
||||
application.ProcessMessages;
|
||||
fFilePath:=SaveDialog.FileName;
|
||||
try
|
||||
IdFTP1.Host := PicSvr;
|
||||
IdFTP1.Username := 'three';
|
||||
IdFTP1.Password := '641010';
|
||||
IdFTP1.Connect();
|
||||
except
|
||||
;
|
||||
end;
|
||||
|
||||
if IdFTP1.Connected then
|
||||
begin
|
||||
|
||||
Panel2.Caption:='正在下载数据,请稍等...';
|
||||
Panel2.Visible:=true;
|
||||
application.ProcessMessages;
|
||||
try
|
||||
IdFTP1.Get('FJ\'+ Trim(fFileName), fFilePath,false, true);
|
||||
except
|
||||
Panel2.Visible:=false;
|
||||
Application.MessageBox('客户图样文件不存在', '提示', MB_ICONWARNING);
|
||||
IdFTP1.Quit;
|
||||
Exit;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Panel2.Visible:=false;
|
||||
Application.MessageBox('无法连接文件服务器', '提示', MB_ICONWARNING);
|
||||
IdFTP1.Quit;
|
||||
Exit;
|
||||
end;
|
||||
Panel2.Visible:=false;
|
||||
if IdFTP1.Connected then IdFTP1.Quit;
|
||||
end;
|
||||
except
|
||||
Panel2.Visible:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
if fId=10 then Action:=cafree
|
||||
else
|
||||
Action:=cahide;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList.Panel2DblClick(Sender: TObject);
|
||||
begin
|
||||
Panel2.Visible:=false;
|
||||
end;
|
||||
|
||||
end.
|
||||
134
Z99Dependency/ThreeFun/Form/U_FjList10.dfm
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
object frmFjList10: TfrmFjList10
|
||||
Left = 237
|
||||
Top = 203
|
||||
Width = 798
|
||||
Height = 502
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
Caption = #38468#20214#20449#24687
|
||||
Color = clBtnFace
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object ListView1: TListView
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 631
|
||||
Height = 464
|
||||
Align = alClient
|
||||
Columns = <
|
||||
item
|
||||
end>
|
||||
TabOrder = 0
|
||||
OnDblClick = ListView1DblClick
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 631
|
||||
Top = 0
|
||||
Width = 151
|
||||
Height = 464
|
||||
Align = alRight
|
||||
TabOrder = 1
|
||||
object FileName: TcxButton
|
||||
Left = 30
|
||||
Top = 60
|
||||
Width = 75
|
||||
Height = 25
|
||||
Hint = 'Filesother'
|
||||
Caption = #28155#21152
|
||||
TabOrder = 0
|
||||
OnClick = FileNameClick
|
||||
LookAndFeel.Kind = lfOffice11
|
||||
end
|
||||
object cxButton1: TcxButton
|
||||
Left = 30
|
||||
Top = 96
|
||||
Width = 75
|
||||
Height = 25
|
||||
Hint = 'Filesother'
|
||||
Caption = #21024#38500
|
||||
TabOrder = 1
|
||||
OnClick = cxButton1Click
|
||||
LookAndFeel.Kind = lfOffice11
|
||||
end
|
||||
object cxButton2: TcxButton
|
||||
Left = 30
|
||||
Top = 132
|
||||
Width = 75
|
||||
Height = 25
|
||||
Hint = 'Filesother'
|
||||
Caption = #21478#23384#20026'...'
|
||||
TabOrder = 2
|
||||
OnClick = cxButton2Click
|
||||
LookAndFeel.Kind = lfOffice11
|
||||
end
|
||||
object cxButton3: TcxButton
|
||||
Left = 30
|
||||
Top = 172
|
||||
Width = 75
|
||||
Height = 25
|
||||
Hint = 'Filesother'
|
||||
Caption = #20851#38381
|
||||
TabOrder = 3
|
||||
Visible = False
|
||||
OnClick = cxButton3Click
|
||||
LookAndFeel.Kind = lfOffice11
|
||||
end
|
||||
end
|
||||
object Panel2: TPanel
|
||||
Left = 176
|
||||
Top = 140
|
||||
Width = 193
|
||||
Height = 41
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
Caption = 'Panel2'
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clBlue
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
Visible = False
|
||||
OnDblClick = Panel2DblClick
|
||||
end
|
||||
object ADOQueryTmp: TADOQuery
|
||||
Connection = ADOConnection1
|
||||
Parameters = <>
|
||||
Left = 520
|
||||
Top = 28
|
||||
end
|
||||
object ADOQueryCmd: TADOQuery
|
||||
Connection = ADOConnection1
|
||||
Parameters = <>
|
||||
Left = 568
|
||||
Top = 32
|
||||
end
|
||||
object ImageList1: TImageList
|
||||
Left = 536
|
||||
Top = 228
|
||||
end
|
||||
object IdFTP1: TIdFTP
|
||||
MaxLineAction = maException
|
||||
ReadTimeout = 0
|
||||
ProxySettings.ProxyType = fpcmNone
|
||||
ProxySettings.Port = 0
|
||||
Left = 500
|
||||
Top = 198
|
||||
end
|
||||
object ADOConnection1: TADOConnection
|
||||
LoginPrompt = False
|
||||
Left = 532
|
||||
Top = 240
|
||||
end
|
||||
end
|
||||
438
Z99Dependency/ThreeFun/Form/U_FjList10.pas
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
unit U_FjList10;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ExtCtrls, ComCtrls, Menus, cxLookAndFeelPainters, StdCtrls,
|
||||
cxButtons, DB, ADODB, ImgList,shellapi, IdBaseComponent, IdComponent,
|
||||
IdTCPConnection, IdTCPClient, IdFTP,strutils;
|
||||
|
||||
type
|
||||
TfrmFjList10 = class(TForm)
|
||||
ListView1: TListView;
|
||||
Panel1: TPanel;
|
||||
FileName: TcxButton;
|
||||
cxButton1: TcxButton;
|
||||
cxButton2: TcxButton;
|
||||
cxButton3: TcxButton;
|
||||
ADOQueryTmp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
ImageList1: TImageList;
|
||||
Panel2: TPanel;
|
||||
IdFTP1: TIdFTP;
|
||||
ADOConnection1: TADOConnection;
|
||||
procedure cxButton3Click(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FileNameClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ListView1DblClick(Sender: TObject);
|
||||
procedure cxButton1Click(Sender: TObject);
|
||||
procedure cxButton2Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure Panel2DblClick(Sender: TObject);
|
||||
private
|
||||
procedure InitData();
|
||||
{ Private declarations }
|
||||
public
|
||||
fkeyNO:string;
|
||||
fType:string;
|
||||
fId:integer;
|
||||
|
||||
fstatus:integer;
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmFjList10: TfrmFjList10;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_Fun10,U_CompressionFun;
|
||||
{$R *.dfm}
|
||||
procedure TfrmFjList10.InitData();
|
||||
var
|
||||
ListItem: TListItem;
|
||||
Flag: Cardinal;
|
||||
info: SHFILEINFOA;
|
||||
Icon: TIcon;
|
||||
begin
|
||||
ListView1.Items.Clear;
|
||||
try
|
||||
|
||||
with adoqueryTmp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from TP_File ');
|
||||
sql.Add('where WBID='+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
open;
|
||||
if not IsEmpty then
|
||||
begin
|
||||
while not eof do
|
||||
begin
|
||||
with ListView1 do
|
||||
begin
|
||||
LargeImages := ImageList1;
|
||||
Icon := TIcon.Create;
|
||||
ListItem := Items.Add;
|
||||
Listitem.Caption := trim(fieldbyname('fileName').AsString);
|
||||
// Listitem.SubItems.Add(OpenDiaLog.FileName);
|
||||
Flag := (SHGFI_SMALLICON or SHGFI_ICON or SHGFI_USEFILEATTRIBUTES);
|
||||
SHGetFileInfo(Pchar(trim(fieldbyname('fileName').AsString)), 0, info, Sizeof(info), Flag);
|
||||
Icon.Handle := info.hIcon;
|
||||
ImageList1.AddIcon(Icon);
|
||||
ListItem.ImageIndex := ImageList1.Count - 1;
|
||||
end;
|
||||
next;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.cxButton3Click(Sender: TObject);
|
||||
begin
|
||||
ADOQueryTmp.Close;
|
||||
ADOQuerycmd.Close;
|
||||
ListView1.Items.Free;
|
||||
ModalResult:=-1;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmFjList10:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.FileNameClick(Sender: TObject);
|
||||
var
|
||||
OpenDiaLog: TOpenDialog;
|
||||
fFileName:string;
|
||||
fFilePath:string;
|
||||
maxNo:string;
|
||||
// myStream: TADOBlobStream;
|
||||
// FJStream : TMemoryStream;
|
||||
FJStream : TMemoryStream;
|
||||
mfileSize:integer;
|
||||
mCreationTime:TdateTime;
|
||||
mWriteTime:TdateTime;
|
||||
begin
|
||||
|
||||
try
|
||||
OpenDiaLog := TOpenDialog.Create(Self);
|
||||
if OpenDiaLog.Execute then
|
||||
begin
|
||||
fFilePath:=OpenDiaLog.FileName;
|
||||
fFileName:=ExtractFileName(OpenDiaLog.FileName);
|
||||
|
||||
|
||||
with adoqueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select TFId from TP_File ');
|
||||
sql.Add('where WBID<>'+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
||||
open;
|
||||
IF not adoqueryCmd.IsEmpty then
|
||||
begin
|
||||
application.MessageBox('此附件名称已存在,请修改文件名,继续上传!','提示信息',MB_ICONERROR);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
Panel2.Caption:='正在上传数据,请稍等...';
|
||||
Panel2.Visible:=true;
|
||||
application.ProcessMessages;
|
||||
|
||||
if GetLSNo(ADOQueryCmd,maxNo,'FJ','TP_File',4,1)=False then
|
||||
begin
|
||||
Application.MessageBox('取最大号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
//获取文件信息
|
||||
GetFileInfo(fFilePath,mfileSize,mCreationTime,mWriteTime);
|
||||
|
||||
adoqueryCmd.Connection.BeginTrans;
|
||||
|
||||
|
||||
with adoqueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('delete from TP_File ');
|
||||
sql.Add('where WBID='+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
||||
execsql;
|
||||
end;
|
||||
|
||||
try
|
||||
FJStream:=TMemoryStream.Create;
|
||||
with adoqueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from TP_File ');
|
||||
sql.Add('where WBID='+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
||||
open;
|
||||
append;
|
||||
fieldbyname('TFID').Value:=trim(maxNO);
|
||||
fieldbyname('WBID').Value:=trim(fkeyNO);
|
||||
fieldbyname('TFType').Value:=trim(fType);
|
||||
fieldbyname('FileName').Value:=trim(fFileName);
|
||||
FJStream.LoadFromFile(fFilePath);
|
||||
CompressionStream(FJStream);
|
||||
tblobfield(FieldByName('Filesother')).LoadFromStream(FJStream);
|
||||
// tblobfield(FieldByName('Filesother')).LoadFromFile(fFilePath);
|
||||
post;
|
||||
end;
|
||||
|
||||
{ if fFilePath <> '' then
|
||||
begin
|
||||
try
|
||||
IdFTP1.Host := PicSvr;
|
||||
IdFTP1.Username := 'three';
|
||||
IdFTP1.Password := '641010';
|
||||
IdFTP1.Connect();
|
||||
IdFTP1.Put(fFilePath, 'FJ\' + Trim(fFileName));
|
||||
IdFTP1.Quit;
|
||||
except
|
||||
IdFTP1.Quit;
|
||||
Application.MessageBox('上传客户图样文件失败,请检查文件服务器!', '提示', MB_ICONWARNING);
|
||||
end;
|
||||
end;
|
||||
IdFTP1.Quit; }
|
||||
|
||||
Panel2.Visible:=false;
|
||||
initdata();
|
||||
finally
|
||||
// FJStream.Free;
|
||||
end;
|
||||
|
||||
end;
|
||||
adoqueryCmd.Connection.CommitTrans;
|
||||
except
|
||||
adoqueryCmd.Connection.RollbackTrans;
|
||||
application.MessageBox('附件保存失败!','提示信息',0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.FormCreate(Sender: TObject);
|
||||
begin
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='';
|
||||
Connected:=true;
|
||||
end;
|
||||
ListView1.Align:=alclient;
|
||||
fstatus:=0;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.FormShow(Sender: TObject);
|
||||
begin
|
||||
IF fstatus=0 then Panel1.Visible:=true
|
||||
else Panel1.Visible:=false;
|
||||
initdata();
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.ListView1DblClick(Sender: TObject);
|
||||
var
|
||||
sFieldName:string;
|
||||
fileName:string;
|
||||
ff: TADOBlobStream;
|
||||
FJStream : TMemoryStream;
|
||||
begin
|
||||
if ListView1.Items.Count<1 THEN EXIT;
|
||||
|
||||
if listView1.SelCount<1 then exit;
|
||||
sFieldName:=leftbstr(ExtractFilePath(Application.ExeName),1)+':\图片查看';
|
||||
|
||||
if not DirectoryExists(pchar(sFieldName)) then
|
||||
CreateDirectory(pchar(sFieldName),nil);
|
||||
|
||||
fileName:=ListView1.Selected.Caption;
|
||||
|
||||
sFieldName:=sFieldName+'\'+trim(fileName);
|
||||
|
||||
{ try
|
||||
IdFTP1.Host := PicSvr;
|
||||
IdFTP1.Username := 'three';
|
||||
IdFTP1.Password := '641010';
|
||||
IdFTP1.Connect();
|
||||
except
|
||||
;
|
||||
end;
|
||||
|
||||
if IdFTP1.Connected then
|
||||
begin
|
||||
|
||||
Panel2.Caption:='正在下载数据,请稍等...';
|
||||
Panel2.Visible:=true;
|
||||
application.ProcessMessages;
|
||||
try
|
||||
IdFTP1.Get('FJ\'+ Trim(fileName), sFieldName,true, false);
|
||||
except
|
||||
Panel2.Visible:=false;
|
||||
Application.MessageBox('客户图样文件不存在', '提示', MB_ICONWARNING);
|
||||
IdFTP1.Quit;
|
||||
Exit;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Panel2.Visible:=false;
|
||||
Application.MessageBox('无法连接文件服务器', '提示', MB_ICONWARNING);
|
||||
IdFTP1.Quit;
|
||||
Exit;
|
||||
end;
|
||||
Panel2.Visible:=false;
|
||||
if IdFTP1.Connected then IdFTP1.Quit;
|
||||
ShellExecute(Handle, 'open',PChar(sFieldName),'', '', SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
try
|
||||
adoqueryTmp.Locate('FileName',fileName,[]);
|
||||
ff := TADOBlobstream.Create(adoqueryTmp.fieldByName('FilesOther') as TblobField, bmRead);
|
||||
|
||||
fjStream:= TMemoryStream.Create ;
|
||||
ff.SaveToStream(fjStream);
|
||||
UnCompressionStream(fjStream);
|
||||
fjStream.SaveToFile(sFieldName);
|
||||
ShellExecute(Handle, 'open',PChar(sFieldName),'', '', SW_SHOWNORMAL);
|
||||
finally
|
||||
fjStream.free;
|
||||
ff.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.cxButton1Click(Sender: TObject);
|
||||
var
|
||||
fFileName:string;
|
||||
fFilePath:string;
|
||||
begin
|
||||
if listView1.SelCount<1 then exit;
|
||||
|
||||
try
|
||||
fFileName:=ListView1.Selected.Caption;
|
||||
// ADOQueryTmp.Locate('fileName',fFileName,[]);
|
||||
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('delete from TP_File ');
|
||||
sql.Add('where WBID='+quotedstr(trim(fkeyNO)));
|
||||
sql.Add('and TFType='+quotedstr(trim(fType)));
|
||||
sql.Add('and FileName='+quotedstr(trim(fFileName)));
|
||||
execsql;
|
||||
end;
|
||||
|
||||
initData();
|
||||
|
||||
except
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.cxButton2Click(Sender: TObject);
|
||||
var
|
||||
SaveDialog: TSaveDialog;
|
||||
fFileName:string;
|
||||
fFilePath:string;
|
||||
ff: TADOBlobStream;
|
||||
FJStream : TMemoryStream;
|
||||
begin
|
||||
if listView1.SelCount<1 then exit;
|
||||
|
||||
try
|
||||
|
||||
fFileName:=ListView1.Selected.Caption;
|
||||
adoqueryTmp.Locate('FileName',fFileName,[]);
|
||||
|
||||
SaveDialog := TSaveDialog.Create(Self);
|
||||
|
||||
SaveDialog.FileName:=fFileName;
|
||||
if SaveDialog.Execute then
|
||||
begin
|
||||
Panel2.Caption:='正在保存数据,请稍等...';
|
||||
Panel2.Visible:=true;
|
||||
application.ProcessMessages;
|
||||
fFilePath:=SaveDialog.FileName;
|
||||
try
|
||||
ff := TADOBlobstream.Create(adoqueryTmp.fieldByName('FilesOther') as TblobField, bmRead);
|
||||
|
||||
fjStream:= TMemoryStream.Create ;
|
||||
ff.SaveToStream(fjStream);
|
||||
UnCompressionStream(fjStream);
|
||||
fjStream.SaveToFile(fFilePath);
|
||||
// ShellExecute(Handle, 'open',PChar(sFieldName),'', '', SW_SHOWNORMAL);
|
||||
finally
|
||||
fjStream.free;
|
||||
ff.Free;
|
||||
Panel2.Visible:=false;
|
||||
end;
|
||||
|
||||
end;
|
||||
{ try
|
||||
IdFTP1.Host := PicSvr;
|
||||
IdFTP1.Username := 'three';
|
||||
IdFTP1.Password := '641010';
|
||||
IdFTP1.Connect();
|
||||
except
|
||||
;
|
||||
end;
|
||||
|
||||
if IdFTP1.Connected then
|
||||
begin
|
||||
|
||||
Panel2.Caption:='正在下载数据,请稍等...';
|
||||
Panel2.Visible:=true;
|
||||
application.ProcessMessages;
|
||||
try
|
||||
IdFTP1.Get('FJ\'+ Trim(fFileName), fFilePath,false, true);
|
||||
except
|
||||
Panel2.Visible:=false;
|
||||
Application.MessageBox('客户图样文件不存在', '提示', MB_ICONWARNING);
|
||||
IdFTP1.Quit;
|
||||
Exit;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Panel2.Visible:=false;
|
||||
Application.MessageBox('无法连接文件服务器', '提示', MB_ICONWARNING);
|
||||
IdFTP1.Quit;
|
||||
Exit;
|
||||
end;
|
||||
Panel2.Visible:=false;
|
||||
if IdFTP1.Connected then IdFTP1.Quit;
|
||||
end; }
|
||||
except
|
||||
Panel2.Visible:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
if fId=10 then Action:=cafree
|
||||
else
|
||||
Action:=cahide;
|
||||
end;
|
||||
|
||||
procedure TfrmFjList10.Panel2DblClick(Sender: TObject);
|
||||
begin
|
||||
Panel2.Visible:=false;
|
||||
end;
|
||||
|
||||
end.
|
||||
47
Z99Dependency/ThreeFun/Form/U_GetAddRess.dfm
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
object Form1: TForm1
|
||||
Left = 200
|
||||
Top = 128
|
||||
Width = 520
|
||||
Height = 376
|
||||
Caption = 'Form1'
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -14
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
PixelsPerInch = 120
|
||||
TextHeight = 16
|
||||
object Label1: TLabel
|
||||
Left = 158
|
||||
Top = 118
|
||||
Width = 41
|
||||
Height = 16
|
||||
Caption = 'Label1'
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 256
|
||||
Top = 128
|
||||
Width = 41
|
||||
Height = 16
|
||||
Caption = 'Label2'
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 138
|
||||
Top = 59
|
||||
Width = 92
|
||||
Height = 31
|
||||
Caption = 'Button1'
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Edit1: TEdit
|
||||
Left = 246
|
||||
Top = 59
|
||||
Width = 149
|
||||
Height = 21
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
43
Z99Dependency/ThreeFun/Form/U_GetAddRess.pas
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
unit U_GetAddRess;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs,StdCtrls,WinSock;
|
||||
Function sendarp(ipaddr:ulong;temp:dword;ulmacaddr:pointer;ulmacaddrleng:pointer) : DWord; StdCall; External 'Iphlpapi.dll' Name 'SendARP';
|
||||
type
|
||||
TForm1 = class(TForm)
|
||||
Button1: TButton;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Edit1: TEdit;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TForm1.Button1Click(Sender: TObject);
|
||||
var
|
||||
myip:ulong;
|
||||
mymac:array[0..5] of byte;
|
||||
mymaclength:ulong;
|
||||
r:integer;
|
||||
begin
|
||||
{myip:=inet_addr(PChar(Trim(Edit1.Text)));
|
||||
mymaclength:=length(mymac);
|
||||
r:=sendarp(myip,0,@mymac,@mymaclength);
|
||||
label1.caption:='errorcode:'+inttostr(r);
|
||||
label2.caption:=format('%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x',[mymac[0],mymac[1],mymac[2],mymac[3],mymac[4],mymac[5]]); }
|
||||
end;
|
||||
|
||||
end.
|
||||
3635
Z99Dependency/ThreeFun/Form/U_ItemManageNew.dfm
Normal file
264
Z99Dependency/ThreeFun/Form/U_ItemManageNew.pas
Normal file
|
|
@ -0,0 +1,264 @@
|
|||
unit U_ItemManageNew;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
|
||||
cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList,
|
||||
StdCtrls, ExtCtrls;
|
||||
|
||||
type
|
||||
TfrmItemManageNew = class(TForm)
|
||||
TV1: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
V1Code: TcxGridDBColumn;
|
||||
V1Name: TcxGridDBColumn;
|
||||
ToolBar1: TToolBar;
|
||||
ADOQueryMain: TADOQuery;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
TBAdd: TToolButton;
|
||||
TBSave: TToolButton;
|
||||
TBDel: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
ToolButton1: TToolButton;
|
||||
TBEdit: TToolButton;
|
||||
V1Note: TcxGridDBColumn;
|
||||
V1OrderNo: TcxGridDBColumn;
|
||||
ADOConnection1: TADOConnection;
|
||||
ImageList24: TImageList;
|
||||
Panel1: TPanel;
|
||||
Label1: TLabel;
|
||||
Edit1: TEdit;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBAddClick(Sender: TObject);
|
||||
procedure TBSaveClick(Sender: TObject);
|
||||
procedure TBDelClick(Sender: TObject);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure TBEditClick(Sender: TObject);
|
||||
procedure TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
private
|
||||
procedure InitGrid();
|
||||
{ Private declarations }
|
||||
public
|
||||
flag,flagname,snote:string;
|
||||
fnote,forderno:Boolean;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmItemManageNew: TfrmItemManageNew;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_Fun;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmItemManageNew.FormCreate(Sender: TObject);
|
||||
begin
|
||||
cxGrid1.Align:=alClient;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.InitGrid();
|
||||
begin
|
||||
try
|
||||
ADOQueryMain.DisableControls;
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from XC_Code where Flag='''+flag+'''');
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.TBAddClick(Sender: TObject);
|
||||
begin
|
||||
TV1.OptionsData.Editing:=True;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Append;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.TBSaveClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('delete XC_Code where Flag='''+Flag+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from XC_Code where 1<>1');
|
||||
Open;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then
|
||||
begin
|
||||
ADOQueryCmd.Close;
|
||||
ADOQueryCmd.sql.Clear;
|
||||
ADOQueryCmd.sql.Add('delete from XC_Code where Code='''+Flag+'''');
|
||||
ADOQueryCmd.ExecSQL;
|
||||
end else
|
||||
begin
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
First;
|
||||
while not eof do
|
||||
begin
|
||||
if Trim(ClientDataSet1.FieldByName('Code').AsString)='' then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('编号不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if Trim(ClientDataSet1.FieldByName('Name').AsString)='' then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from XC_Code where Code='''+Trim(ClientDataSet1.fieldbyname('Code').AsString)+'''');
|
||||
Open;
|
||||
if not IsEmpty then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('编号重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
ADOQueryCmd.Append;
|
||||
ADOQueryCmd.FieldByName('Code').Value:=ClientDataSet1.fieldbyname('Code').AsString;
|
||||
ADOQueryCmd.FieldByName('Name').Value:=ClientDataSet1.fieldbyname('Name').AsString;
|
||||
ADOQueryCmd.FieldByName('note').Value:=Trim(snote);
|
||||
//ADOQueryCmd.FieldByName('orderno').Value:=ClientDataSet1.fieldbyname('Name').AsString;
|
||||
ADOQueryCmd.FieldByName('Flag').Value:=flag;
|
||||
ADOQueryCmd.FieldByName('valid').Value:='Y';
|
||||
ADOQueryCmd.FieldByName('sel').Value:=0;
|
||||
ADOQueryCmd.Post;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
Application.MessageBox('保存成功!','提示',0);
|
||||
except
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
TV1.OptionsData.Editing:=False;
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.TBDelClick(Sender: TObject);
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
if (Trim(ClientDataSet1.FieldByName('Code').AsString)<>'') or
|
||||
(Trim(ClientDataSet1.FieldByName('name').AsString)<>'') then
|
||||
begin
|
||||
if application.MessageBox('确定要删除吗?','提示信息',1)=2 then exit;
|
||||
ClientDataSet1.Delete;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=2;
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.FormShow(Sender: TObject);
|
||||
var
|
||||
fsj,fsj1:string;
|
||||
begin
|
||||
InitGrid();
|
||||
fsj:=Trim(flag)+'01';
|
||||
fsj1:=Trim(flagname)+'01';
|
||||
if ClientDataSet1.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
//sql.Add('insert into XC_Code(code,name,flag,note)');
|
||||
//sql.Add('select '''+Trim(flag)+'''');
|
||||
//sql.Add(','''+Trim(flagname)+'''');
|
||||
//SQL.Add(',''BASECODE'' ');
|
||||
//sql.Add(','''+Trim(snote)+'''');
|
||||
sql.Add('insert into XC_Code(code,name,flag,note)');
|
||||
sql.Add('select '''+Trim(fsj)+'''');
|
||||
sql.Add(','''+Trim(fsj1)+'''');
|
||||
SQL.Add(','''+Trim(flag)+'''');
|
||||
sql.Add(','''+Trim(snote)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
InitGrid();
|
||||
end;
|
||||
frmItemManageNew.Caption:=Trim(flagname)+'<'+Trim(flag)+'>';
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.TBEditClick(Sender: TObject);
|
||||
begin
|
||||
TV1.OptionsData.Editing:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmItemManageNew.TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
begin
|
||||
if TV1.OptionsData.Editing=False then
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
17996
Z99Dependency/ThreeFun/Form/U_KHHelp.dfm
Normal file
167
Z99Dependency/ThreeFun/Form/U_KHHelp.pas
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
unit U_KHHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
|
||||
cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList,
|
||||
StdCtrls, ExtCtrls, cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu;
|
||||
|
||||
type
|
||||
TfrmKHHelp = class(TForm)
|
||||
TV1: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
V1Name: TcxGridDBColumn;
|
||||
ToolBar1: TToolBar;
|
||||
ADOQueryMain: TADOQuery;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
TBClose: TToolButton;
|
||||
ToolButton1: TToolButton;
|
||||
ADOConnection1: TADOConnection;
|
||||
Panel1: TPanel;
|
||||
Label1: TLabel;
|
||||
ZDYName: TEdit;
|
||||
ThreeImgList: TImageList;
|
||||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||||
V1Column1: TcxGridDBColumn;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
procedure ZDYNameChange(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
private
|
||||
procedure InitGrid();
|
||||
{ Private declarations }
|
||||
public
|
||||
flag,flagname,snote,MainType:string;
|
||||
fnote,forderno,fZdyFlag:Boolean;
|
||||
PPSTE:integer;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmKHHelp: TfrmKHHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_Fun;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmKHHelp.FormCreate(Sender: TObject);
|
||||
begin
|
||||
try
|
||||
cxGrid1.Align:=alClient;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='';
|
||||
Connected:=true;
|
||||
end;
|
||||
except
|
||||
frmKHHelp.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmKHHelp.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
ZDYName.SetFocus;
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmKHHelp.InitGrid();
|
||||
var
|
||||
CYType:String;
|
||||
begin
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from SY_User where UserId='''+Trim(DCode)+'''');
|
||||
Open;
|
||||
end;
|
||||
CYType:=Trim(ADOQueryTemp.fieldbyname('DPID').AsString);
|
||||
try
|
||||
ADOQueryMain.DisableControls;
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('exec P_Select_User_KHName :CYType');
|
||||
Parameters.ParamByName('CYType').Value:=Trim(CYType);
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmKHHelp.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=2;
|
||||
ZDYName.SetFocus;
|
||||
WriteCxGrid('客户名称',TV1,'基础数据');
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmKHHelp.FormShow(Sender: TObject);
|
||||
begin
|
||||
InitGrid();
|
||||
ReadCxGrid('客户名称',TV1,'基础数据');
|
||||
end;
|
||||
|
||||
procedure TfrmKHHelp.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
ZDYName.SetFocus;
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmKHHelp.TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
begin
|
||||
if TV1.OptionsData.Editing=False then
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmKHHelp.ZDYNameChange(Sender: TObject);
|
||||
var
|
||||
fsj:String;
|
||||
begin
|
||||
if Trim(ZDYName.Text)<>'' then
|
||||
begin
|
||||
fsj:=' zdyname like '''+'%'+Trim(ZDYName.Text)+'%'+''''
|
||||
+' or ZJM like '''+'%'+Trim(ZDYName.Text)+'%'+'''';
|
||||
end;
|
||||
if ADOQueryMain.Active then
|
||||
begin
|
||||
SDofilter(ADOQueryMain,fsj);
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmKHHelp.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmKHHelp:=nil;
|
||||
end;
|
||||
|
||||
end.
|
||||
104
Z99Dependency/ThreeFun/Form/U_SelExportField.dfm
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
object frmSelExportField: TfrmSelExportField
|
||||
Left = 473
|
||||
Top = 162
|
||||
BorderStyle = bsDialog
|
||||
Caption = #23383#27573#23548#20986#36873#25321
|
||||
ClientHeight = 616
|
||||
ClientWidth = 538
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -15
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 120
|
||||
TextHeight = 15
|
||||
object Button1: TButton
|
||||
Left = 118
|
||||
Top = 570
|
||||
Width = 93
|
||||
Height = 31
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 304
|
||||
Top = 570
|
||||
Width = 94
|
||||
Height = 31
|
||||
Caption = #20851#38381
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object cxGrid1: TcxGrid
|
||||
Left = 531
|
||||
Top = 79
|
||||
Width = 352
|
||||
Height = 141
|
||||
TabOrder = 2
|
||||
Visible = False
|
||||
object ExpGrid: TcxGridDBTableView
|
||||
Navigator.Buttons.CustomButtons = <>
|
||||
DataController.DataSource = ExportDataSource
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsBehavior.AlwaysShowEditor = True
|
||||
OptionsView.GroupByBox = False
|
||||
end
|
||||
object cxGrid1Level1: TcxGridLevel
|
||||
GridView = ExpGrid
|
||||
end
|
||||
end
|
||||
object Panel2: TScrollBox
|
||||
Left = 3
|
||||
Top = 0
|
||||
Width = 528
|
||||
Height = 548
|
||||
HorzScrollBar.Visible = False
|
||||
Color = clSkyBlue
|
||||
ParentColor = False
|
||||
TabOrder = 3
|
||||
object Label4: TLabel
|
||||
Left = 198
|
||||
Top = 11
|
||||
Width = 72
|
||||
Height = 17
|
||||
Caption = #23383#27573#36873#25321
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clRed
|
||||
Font.Height = -17
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 25
|
||||
Top = 561
|
||||
Width = 61
|
||||
Height = 22
|
||||
Caption = #20840#36873
|
||||
TabOrder = 4
|
||||
OnClick = CheckBox1Click
|
||||
end
|
||||
object CheckBox2: TCheckBox
|
||||
Left = 25
|
||||
Top = 581
|
||||
Width = 61
|
||||
Height = 22
|
||||
Caption = #20840#24323
|
||||
TabOrder = 5
|
||||
OnClick = CheckBox2Click
|
||||
end
|
||||
object ExportDataSource: TDataSource
|
||||
Left = 424
|
||||
Top = 233
|
||||
end
|
||||
end
|
||||
310
Z99Dependency/ThreeFun/Form/U_SelExportField.pas
Normal file
|
|
@ -0,0 +1,310 @@
|
|||
unit U_SelExportField;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, RM_FormReport, RM_PDBGrid,
|
||||
DB,IniFiles, RM_Common, RM_Class, RM_e_Xls, cxStyles, cxCustomData,
|
||||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
|
||||
cxGridLevel, cxClasses, cxControls, cxGridCustomView,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid; }
|
||||
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,cxGridExportLink,
|
||||
ExtCtrls, Buttons,DBClient,FTComboBox,cxDropDownEdit,cxGridBandedTableView,
|
||||
cxGridDBBandedTableView,cxRichEdit,cxButtonEdit,IniFiles,WinSock,
|
||||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
|
||||
|
||||
type
|
||||
TfrmSelExportField = class(TForm)
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
ExportDataSource: TDataSource;
|
||||
ExpGrid: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
Panel2: TScrollBox;
|
||||
Label4: TLabel;
|
||||
CheckBox1: TCheckBox;
|
||||
CheckBox2: TCheckBox;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure CheckBox1Click(Sender: TObject);
|
||||
procedure CheckBox2Click(Sender: TObject);
|
||||
private
|
||||
procedure CreateCheckBox();
|
||||
procedure ExportData();
|
||||
procedure ReadINIFile(fieldname:string);
|
||||
procedure WriteINIFile(fieldname:string);
|
||||
Function IsINIFile(fieldname:string):Boolean;
|
||||
procedure GetExportFields();
|
||||
procedure IsCheck();
|
||||
procedure TcxGridToExcel(mfileName:string;gridName:TcxGrid);
|
||||
{ Private declarations }
|
||||
public
|
||||
ExportFields,IniName:string;
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmSelExportField: TfrmSelExportField;
|
||||
|
||||
implementation
|
||||
|
||||
//uses U_SelPrintField,U_FormPas;
|
||||
|
||||
|
||||
{$R *.dfm}
|
||||
procedure TfrmSelExportField.CreateCheckBox();
|
||||
var
|
||||
i,j,FTop,FLeft,Fdiv,FMod:Integer;// mod 余数,div商
|
||||
FCheckBox:TCheckBox;
|
||||
begin
|
||||
for i:=0 to ExpGrid.ColumnCount-1 do
|
||||
begin
|
||||
Fdiv:=(i+1) div 3;
|
||||
FMod:=(i+1) mod 3;
|
||||
FCheckBox:=TCheckBox.Create(Self);
|
||||
FCheckBox.Caption:=Trim(ExpGrid.Columns[i].Caption);
|
||||
FCheckBox.TabOrder:=i;
|
||||
FCheckBox.Parent:=Panel2;
|
||||
FCheckBox.Checked:=True;
|
||||
if FMod>0 then
|
||||
FCheckBox.Top:=36*(Fdiv+1)
|
||||
else
|
||||
FCheckBox.Top:=36*Fdiv;
|
||||
if FMod=1 then
|
||||
FCheckBox.Left:=29
|
||||
else if FMod=2 then
|
||||
FCheckBox.Left:=163
|
||||
else if FMod=0 then
|
||||
FCheckBox.Left:=305;
|
||||
|
||||
end;
|
||||
end;
|
||||
procedure TfrmSelExportField.TcxGridToExcel(mfileName:string;gridName:TcxGrid);
|
||||
var
|
||||
saveDialog:TSaveDialog;
|
||||
begin
|
||||
try
|
||||
saveDialog:=TSaveDialog.Create(nil);
|
||||
saveDialog.Filter:='xls(*.xls)|*.xls|全部(*.*)|*.*';
|
||||
saveDialog.Options:=[ofOverwritePrompt];
|
||||
saveDialog.FileName:=mfileName;
|
||||
if saveDialog.Execute then
|
||||
if Assigned(gridName) then
|
||||
begin
|
||||
try
|
||||
|
||||
ExportGridToExcel(saveDialog.FileName,gridName);
|
||||
except
|
||||
application.MessageBox('创建失败,源文件可能处于编辑状态!','提示信息',0);
|
||||
exit;
|
||||
end;
|
||||
application.MessageBox('成功导出!','提示信息',0);
|
||||
end
|
||||
else
|
||||
application.MessageBox('导出失败!','提示信息',0);
|
||||
finally
|
||||
saveDialog.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.Button1Click(Sender: TObject);
|
||||
begin
|
||||
//ShowMessage('10除以3取余'+inttostr(10 mod 3)+',取整'+inttostr(10 div 3));
|
||||
ExportData();
|
||||
GetExportFields();
|
||||
if IsINIFile(IniName)=True then
|
||||
begin
|
||||
DeleteFile(IniName);
|
||||
end;
|
||||
WriteINIFile(IniName);
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmSelExportField:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.FormShow(Sender: TObject);
|
||||
begin
|
||||
CreateCheckBox();
|
||||
ReadINIFile(IniName);
|
||||
IsCheck();
|
||||
end;
|
||||
procedure TfrmSelExportField.IsCheck();
|
||||
var
|
||||
i:Integer;
|
||||
fsj:string;
|
||||
begin
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
fsj:=Trim(TCheckBox(Controls[i]).Caption);
|
||||
if Pos(fsj,ExportFields)>0 then
|
||||
TCheckBox(Controls[i]).Checked:=True
|
||||
else
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.ExportData();
|
||||
var
|
||||
i,j:Integer;
|
||||
begin
|
||||
j:=0;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked=True then
|
||||
begin
|
||||
j:=1;
|
||||
ExpGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=True
|
||||
end else
|
||||
begin
|
||||
ExpGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
TcxGridToExcel(Trim(IniName),cxGrid1);
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmSelExportField.Button2Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.ReadINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldExportSet\' +trim(fieldname)+'.INI';
|
||||
programIni:=Tinifile.create(FName);
|
||||
ExportFields:=programIni.ReadString('导出设置','导出字段','');
|
||||
programIni.Free;
|
||||
end;
|
||||
procedure TfrmSelExportField.GetExportFields();
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
ExportFields:='Begin';
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked then
|
||||
begin
|
||||
ExportFields:=ExportFields+'/'+TCheckBox(Controls[i]).Caption;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//写设置信息到INI文件
|
||||
//参数
|
||||
//////////////////////////////////////////////////////////////////
|
||||
procedure TfrmSelExportField.WriteINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldExportSet\'+trim(fieldname)+'.INI';
|
||||
if not DirectoryExists(ExtractFileDir(FName)) then
|
||||
CreateDir(ExtractFileDir(FName));
|
||||
programIni:=Tinifile.create(FName);
|
||||
programIni.WriteString('导出设置','导出字段',ExportFields);
|
||||
programIni.Free;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//判断InI文件是否存在
|
||||
//////////////////////////////////////////////////////////////////
|
||||
Function TfrmSelExportField.IsINIFile(fieldname:string):Boolean;
|
||||
var
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldExportSet\'+trim(fieldname)+'.INI';
|
||||
if FileExists(FName) then
|
||||
Result:=True
|
||||
else
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.CheckBox1Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox1.Checked then
|
||||
begin
|
||||
CheckBox2.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.CheckBox2Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox2.Checked then
|
||||
begin
|
||||
CheckBox1.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
149
Z99Dependency/ThreeFun/Form/U_SelPrintField.dfm
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
object frmSelPrintField: TfrmSelPrintField
|
||||
Left = 329
|
||||
Top = 100
|
||||
Width = 427
|
||||
Height = 530
|
||||
Caption = #23383#27573#25171#21360#36873#25321
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Button1: TButton
|
||||
Left = 94
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 243
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #20851#38381
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object PrnGrid: TDBGrid
|
||||
Left = 497
|
||||
Top = 93
|
||||
Width = 200
|
||||
Height = 120
|
||||
DataSource = PrintDataSource
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -13
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
TitleFont.Charset = ANSI_CHARSET
|
||||
TitleFont.Color = clWindowText
|
||||
TitleFont.Height = -16
|
||||
TitleFont.Name = #23435#20307
|
||||
TitleFont.Style = []
|
||||
Visible = False
|
||||
end
|
||||
object ScrollBox1: TScrollBox
|
||||
Left = 2
|
||||
Top = 0
|
||||
Width = 415
|
||||
Height = 438
|
||||
Color = clSkyBlue
|
||||
ParentColor = False
|
||||
TabOrder = 3
|
||||
object Label4: TLabel
|
||||
Left = 158
|
||||
Top = 9
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #23383#27573#36873#25321
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clRed
|
||||
Font.Height = -14
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
object RMPrintDBGrid1: TRMPrintDBGrid
|
||||
ReportOptions = [rmgoStretch, rmgoWordWrap, rmgoGridLines]
|
||||
PageLayout.LeftMargin = 38
|
||||
PageLayout.TopMargin = 38
|
||||
PageLayout.RightMargin = 38
|
||||
PageLayout.BottomMargin = 38
|
||||
PageLayout.Height = 2970
|
||||
PageLayout.Width = 2100
|
||||
PageLayout.PageBin = 0
|
||||
PageLayout.PrinterName = #40664#35748#25171#21360#26426
|
||||
PageLayout.ColorPrint = False
|
||||
PageHeaderMsg.Font.Charset = GB2312_CHARSET
|
||||
PageHeaderMsg.Font.Color = clWindowText
|
||||
PageHeaderMsg.Font.Height = -13
|
||||
PageHeaderMsg.Font.Name = #23435#20307
|
||||
PageHeaderMsg.Font.Style = []
|
||||
PageFooterMsg.Font.Charset = GB2312_CHARSET
|
||||
PageFooterMsg.Font.Color = clWindowText
|
||||
PageFooterMsg.Font.Height = -15
|
||||
PageFooterMsg.Font.Name = #23435#20307
|
||||
PageFooterMsg.Font.Style = []
|
||||
PageCaptionMsg.CaptionMsg.Font.Charset = GB2312_CHARSET
|
||||
PageCaptionMsg.CaptionMsg.Font.Color = clWindowText
|
||||
PageCaptionMsg.CaptionMsg.Font.Height = -13
|
||||
PageCaptionMsg.CaptionMsg.Font.Name = #23435#20307
|
||||
PageCaptionMsg.CaptionMsg.Font.Style = []
|
||||
PageCaptionMsg.TitleFont.Charset = GB2312_CHARSET
|
||||
PageCaptionMsg.TitleFont.Color = clWindowText
|
||||
PageCaptionMsg.TitleFont.Height = -16
|
||||
PageCaptionMsg.TitleFont.Name = #23435#20307
|
||||
PageCaptionMsg.TitleFont.Style = [fsBold]
|
||||
MasterDataBandOptions.ReprintColumnHeaderOnNewColumn = True
|
||||
GridNumOptions.Text = 'No'
|
||||
GridFontOptions.Font.Charset = ANSI_CHARSET
|
||||
GridFontOptions.Font.Color = clWindowText
|
||||
GridFontOptions.Font.Height = -15
|
||||
GridFontOptions.Font.Name = #23435#20307
|
||||
GridFontOptions.Font.Style = []
|
||||
ReportSettings.InitialZoom = pzDefault
|
||||
ReportSettings.PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS]
|
||||
DBGrid = PrnGrid
|
||||
Left = 339
|
||||
Top = 449
|
||||
end
|
||||
object PrintDataSource: TDataSource
|
||||
DataSet = ClientDataSet1
|
||||
Left = 536
|
||||
Top = 246
|
||||
end
|
||||
object RMXLSExport1: TRMXLSExport
|
||||
ShowAfterExport = True
|
||||
ExportPrecision = 1
|
||||
PagesOfSheet = 1
|
||||
ExportImages = True
|
||||
ExportFrames = True
|
||||
ExportImageFormat = ifBMP
|
||||
JPEGQuality = 0
|
||||
ScaleX = 1.000000000000000000
|
||||
ScaleY = 1.000000000000000000
|
||||
CompressFile = False
|
||||
Left = 359
|
||||
Top = 368
|
||||
end
|
||||
object ClientDataSet1: TClientDataSet
|
||||
Aggregates = <>
|
||||
Params = <>
|
||||
Left = 378
|
||||
Top = 340
|
||||
end
|
||||
end
|
||||
241
Z99Dependency/ThreeFun/Form/U_SelPrintField.pas
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
unit U_SelPrintField;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, RM_FormReport, RM_PDBGrid,
|
||||
DB,IniFiles, RM_Common, RM_Class, RM_e_Xls, DBClient;
|
||||
|
||||
type
|
||||
TfrmSelPrintField = class(TForm)
|
||||
RMPrintDBGrid1: TRMPrintDBGrid;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
PrintDataSource: TDataSource;
|
||||
PrnGrid: TDBGrid;
|
||||
RMXLSExport1: TRMXLSExport;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
ScrollBox1: TScrollBox;
|
||||
Label4: TLabel;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
private
|
||||
procedure CreateCheckBox();
|
||||
procedure PrintData();
|
||||
procedure ReadINIFile(fieldname:string);
|
||||
procedure WriteINIFile(fieldname:string);
|
||||
Function IsINIFile(fieldname:string):Boolean;
|
||||
procedure GetPrintFields();
|
||||
procedure IsCheck();
|
||||
{ Private declarations }
|
||||
public
|
||||
PrintFields,IniName:string;
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmSelPrintField: TfrmSelPrintField;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
procedure TfrmSelPrintField.CreateCheckBox();
|
||||
var
|
||||
i,j,FTop,FLeft,Fdiv,FMod:Integer;// mod 余数,div商
|
||||
FCheckBox:TCheckBox;
|
||||
begin
|
||||
for i:=0 to PrnGrid.Columns.Count-1 do
|
||||
begin
|
||||
Fdiv:=(i+1) div 3;
|
||||
FMod:=(i+1) mod 3;
|
||||
FCheckBox:=TCheckBox.Create(Self);
|
||||
FCheckBox.Caption:=Trim(PrnGrid.Columns[i].Title.Caption);
|
||||
FCheckBox.TabOrder:=i;
|
||||
FCheckBox.Parent:=ScrollBox1;
|
||||
FCheckBox.Checked:=True;
|
||||
if FMod>0 then
|
||||
FCheckBox.Top:=36*(Fdiv+1)
|
||||
else
|
||||
FCheckBox.Top:=36*Fdiv;
|
||||
if FMod=1 then
|
||||
FCheckBox.Left:=29
|
||||
else if FMod=2 then
|
||||
FCheckBox.Left:=163
|
||||
else if FMod=0 then
|
||||
FCheckBox.Left:=305;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.Button1Click(Sender: TObject);
|
||||
begin
|
||||
//ShowMessage('10除以3取余'+inttostr(10 mod 3)+',取整'+inttostr(10 div 3));
|
||||
PrintData();
|
||||
GetPrintFields();
|
||||
if IsINIFile(IniName)=True then
|
||||
begin
|
||||
DeleteFile(IniName);
|
||||
end;
|
||||
WriteINIFile(IniName);
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmSelPrintField:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.FormShow(Sender: TObject);
|
||||
begin
|
||||
CreateCheckBox();
|
||||
ReadINIFile(IniName);
|
||||
IsCheck();
|
||||
end;
|
||||
procedure TfrmSelPrintField.IsCheck();
|
||||
var
|
||||
i:Integer;
|
||||
fsj:string;
|
||||
begin
|
||||
with ScrollBox1 do
|
||||
begin
|
||||
for i:=0 to ScrollBox1.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
fsj:=Trim(TCheckBox(Controls[i]).Caption);
|
||||
if Pos(fsj,PrintFields)>0 then
|
||||
TCheckBox(Controls[i]).Checked:=True
|
||||
else
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.PrintData();
|
||||
var
|
||||
i,j,k:Integer;
|
||||
FFieldName:string;
|
||||
begin
|
||||
j:=0;
|
||||
k:=0;
|
||||
with ScrollBox1 do
|
||||
begin
|
||||
for i:=0 to ScrollBox1.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked=True then
|
||||
begin
|
||||
j:=1;
|
||||
PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=True;
|
||||
k:=k+1;
|
||||
if k=1 then
|
||||
begin
|
||||
FFieldName:=PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].FieldName;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{ClientDataSet1.Last;
|
||||
if Trim(ClientDataSet1.FieldByName('flag').AsString)='Y' then
|
||||
begin
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName(FFieldName).Value:='合计';
|
||||
ClientDataSet1.Post;
|
||||
end;}
|
||||
|
||||
if j=1 then
|
||||
begin
|
||||
RMPrintDBGrid1.ShowReport ;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Application.MessageBox('没有可打印的信息!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
//Panel2.Visible:=False;
|
||||
//RMPrintDBGrid1.ShowReport;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.Button2Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.ReadINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\' +trim(fieldname)+'.INI';
|
||||
programIni:=Tinifile.create(FName);
|
||||
PrintFields:=programIni.ReadString('打印设置','打印字段','');
|
||||
programIni.Free;
|
||||
end;
|
||||
procedure TfrmSelPrintField.GetPrintFields();
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
PrintFields:='Begin';
|
||||
with ScrollBox1 do
|
||||
begin
|
||||
for i:=0 to ScrollBox1.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked then
|
||||
begin
|
||||
PrintFields:=PrintFields+'/'+TCheckBox(Controls[i]).Caption;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//写设置信息到INI文件
|
||||
//参数
|
||||
//////////////////////////////////////////////////////////////////
|
||||
procedure TfrmSelPrintField.WriteINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\'+trim(fieldname)+'.INI';
|
||||
if not DirectoryExists(ExtractFileDir(FName)) then
|
||||
CreateDir(ExtractFileDir(FName));
|
||||
programIni:=Tinifile.create(FName);
|
||||
programIni.WriteString('打印设置','打印字段',PrintFields);
|
||||
programIni.Free;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//判断InI文件是否存在
|
||||
//////////////////////////////////////////////////////////////////
|
||||
Function TfrmSelPrintField.IsINIFile(fieldname:string):Boolean;
|
||||
var
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\'+trim(fieldname)+'.INI';
|
||||
if FileExists(FName) then
|
||||
Result:=True
|
||||
else
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
end.
|
||||
163
Z99Dependency/ThreeFun/Form/U_SelPrintFieldNew.dfm
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
object frmSelPrintFieldNew: TfrmSelPrintFieldNew
|
||||
Left = 272
|
||||
Top = 178
|
||||
BorderStyle = bsDialog
|
||||
Caption = #23383#27573#25171#21360#36873#25321
|
||||
ClientHeight = 493
|
||||
ClientWidth = 430
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Button1: TButton
|
||||
Left = 94
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 243
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #20851#38381
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object PrnGrid: TDBGrid
|
||||
Left = 17
|
||||
Top = 165
|
||||
Width = 320
|
||||
Height = 120
|
||||
DataSource = PrintDataSource
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
TitleFont.Charset = GB2312_CHARSET
|
||||
TitleFont.Color = clWindowText
|
||||
TitleFont.Height = -12
|
||||
TitleFont.Name = #23435#20307
|
||||
TitleFont.Style = []
|
||||
Visible = False
|
||||
end
|
||||
object Panel2: TScrollBox
|
||||
Left = 2
|
||||
Top = 0
|
||||
Width = 423
|
||||
Height = 438
|
||||
HorzScrollBar.Visible = False
|
||||
BevelInner = bvSpace
|
||||
BevelKind = bkTile
|
||||
BorderStyle = bsNone
|
||||
Color = clSkyBlue
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 3
|
||||
object Label4: TLabel
|
||||
Left = 166
|
||||
Top = 9
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #23383#27573#36873#25321
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clRed
|
||||
Font.Height = -14
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 21
|
||||
Top = 450
|
||||
Width = 49
|
||||
Height = 17
|
||||
Caption = #20840#36873
|
||||
TabOrder = 4
|
||||
OnClick = CheckBox1Click
|
||||
end
|
||||
object CheckBox2: TCheckBox
|
||||
Left = 21
|
||||
Top = 466
|
||||
Width = 49
|
||||
Height = 17
|
||||
Caption = #20840#24323
|
||||
TabOrder = 5
|
||||
OnClick = CheckBox2Click
|
||||
end
|
||||
object PrintDataSource: TDataSource
|
||||
DataSet = ClientDataSet1
|
||||
Left = 536
|
||||
Top = 246
|
||||
end
|
||||
object ClientDataSet1: TClientDataSet
|
||||
Aggregates = <>
|
||||
Params = <>
|
||||
Left = 378
|
||||
Top = 340
|
||||
end
|
||||
object RMPrintDBGrid1: TRMPrintDBGrid
|
||||
ReportOptions = [rmgoStretch, rmgoWordWrap, rmgoGridLines]
|
||||
PageLayout.LeftMargin = 38
|
||||
PageLayout.TopMargin = 38
|
||||
PageLayout.RightMargin = 38
|
||||
PageLayout.BottomMargin = 38
|
||||
PageLayout.Height = 2970
|
||||
PageLayout.Width = 2100
|
||||
PageLayout.PageBin = 0
|
||||
PageLayout.PrinterName = #40664#35748#25171#21360#26426
|
||||
PageLayout.ColorPrint = False
|
||||
PageHeaderMsg.Font.Charset = GB2312_CHARSET
|
||||
PageHeaderMsg.Font.Color = clWindowText
|
||||
PageHeaderMsg.Font.Height = -13
|
||||
PageHeaderMsg.Font.Name = #23435#20307
|
||||
PageHeaderMsg.Font.Style = []
|
||||
PageFooterMsg.Font.Charset = GB2312_CHARSET
|
||||
PageFooterMsg.Font.Color = clWindowText
|
||||
PageFooterMsg.Font.Height = -13
|
||||
PageFooterMsg.Font.Name = #23435#20307
|
||||
PageFooterMsg.Font.Style = []
|
||||
PageCaptionMsg.CaptionMsg.Font.Charset = GB2312_CHARSET
|
||||
PageCaptionMsg.CaptionMsg.Font.Color = clWindowText
|
||||
PageCaptionMsg.CaptionMsg.Font.Height = -13
|
||||
PageCaptionMsg.CaptionMsg.Font.Name = #23435#20307
|
||||
PageCaptionMsg.CaptionMsg.Font.Style = []
|
||||
PageCaptionMsg.TitleFont.Charset = GB2312_CHARSET
|
||||
PageCaptionMsg.TitleFont.Color = clWindowText
|
||||
PageCaptionMsg.TitleFont.Height = -13
|
||||
PageCaptionMsg.TitleFont.Name = #23435#20307
|
||||
PageCaptionMsg.TitleFont.Style = []
|
||||
GridNumOptions.Text = 'No'
|
||||
GridFontOptions.Font.Charset = DEFAULT_CHARSET
|
||||
GridFontOptions.Font.Color = clWindowText
|
||||
GridFontOptions.Font.Height = -11
|
||||
GridFontOptions.Font.Name = 'MS Sans Serif'
|
||||
GridFontOptions.Font.Style = []
|
||||
ReportSettings.InitialZoom = pzDefault
|
||||
ReportSettings.PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit]
|
||||
DBGrid = PrnGrid
|
||||
Left = 328
|
||||
Top = 424
|
||||
end
|
||||
end
|
||||
291
Z99Dependency/ThreeFun/Form/U_SelPrintFieldNew.pas
Normal file
|
|
@ -0,0 +1,291 @@
|
|||
unit U_SelPrintFieldNew;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, RM_FormReport, RM_PDBGrid,
|
||||
DB,IniFiles, RM_Common, RM_Class, RM_e_Xls, DBClient;
|
||||
|
||||
type
|
||||
TfrmSelPrintFieldNew = class(TForm)
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
PrintDataSource: TDataSource;
|
||||
PrnGrid: TDBGrid;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
Panel2: TScrollBox;
|
||||
Label4: TLabel;
|
||||
CheckBox1: TCheckBox;
|
||||
CheckBox2: TCheckBox;
|
||||
RMPrintDBGrid1: TRMPrintDBGrid;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure CheckBox1Click(Sender: TObject);
|
||||
procedure CheckBox2Click(Sender: TObject);
|
||||
private
|
||||
procedure CreateCheckBox();
|
||||
procedure PrintData();
|
||||
procedure ReadINIFile(fieldname:string);
|
||||
procedure WriteINIFile(fieldname:string);
|
||||
Function IsINIFile(fieldname:string):Boolean;
|
||||
procedure GetPrintFields();
|
||||
procedure IsCheck();
|
||||
{ Private declarations }
|
||||
public
|
||||
PrintFields,IniName:string;
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
var
|
||||
frmSelPrintFieldNew: TfrmSelPrintFieldNew;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
procedure TfrmSelPrintFieldNew.CreateCheckBox();
|
||||
var
|
||||
i,j,FTop,FLeft,Fdiv,FMod:Integer;// mod 余数,div商
|
||||
FCheckBox:TCheckBox;
|
||||
begin
|
||||
for i:=0 to PrnGrid.Columns.Count-1 do
|
||||
begin
|
||||
Fdiv:=(i+1) div 3;
|
||||
FMod:=(i+1) mod 3;
|
||||
FCheckBox:=TCheckBox.Create(Self);
|
||||
FCheckBox.Caption:=Trim(PrnGrid.Columns[i].Title.Caption);
|
||||
FCheckBox.TabOrder:=i;
|
||||
FCheckBox.Parent:=Panel2;
|
||||
FCheckBox.Checked:=True;
|
||||
if FMod>0 then
|
||||
FCheckBox.Top:=36*(Fdiv+1)
|
||||
else
|
||||
FCheckBox.Top:=36*Fdiv;
|
||||
if FMod=1 then
|
||||
FCheckBox.Left:=29
|
||||
else if FMod=2 then
|
||||
FCheckBox.Left:=163
|
||||
else if FMod=0 then
|
||||
FCheckBox.Left:=305;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.Button1Click(Sender: TObject);
|
||||
begin
|
||||
//ShowMessage('10除以3取余'+inttostr(10 mod 3)+',取整'+inttostr(10 div 3));
|
||||
PrintData();
|
||||
GetPrintFields();
|
||||
if IsINIFile(IniName)=True then
|
||||
begin
|
||||
DeleteFile(IniName);
|
||||
end;
|
||||
WriteINIFile(IniName);
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmSelPrintFieldNew:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.FormShow(Sender: TObject);
|
||||
begin
|
||||
CreateCheckBox();
|
||||
ReadINIFile(IniName);
|
||||
IsCheck();
|
||||
end;
|
||||
procedure TfrmSelPrintFieldNew.IsCheck();
|
||||
var
|
||||
i:Integer;
|
||||
fsj:string;
|
||||
begin
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
fsj:=Trim(TCheckBox(Controls[i]).Caption);
|
||||
if Pos(fsj,PrintFields)>0 then
|
||||
TCheckBox(Controls[i]).Checked:=True
|
||||
else
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.PrintData();
|
||||
var
|
||||
i,j,k:Integer;
|
||||
FFieldName:string;
|
||||
begin
|
||||
j:=0;
|
||||
k:=0;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked=True then
|
||||
begin
|
||||
j:=1;
|
||||
PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=True;
|
||||
k:=k+1;
|
||||
if k=1 then
|
||||
begin
|
||||
FFieldName:=PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].FieldName;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{ ClientDataSet1.Last;
|
||||
if Trim(ClientDataSet1.FieldByName('flag').AsString)='Y' then
|
||||
begin
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName(FFieldName).Value:='合计';
|
||||
ClientDataSet1.Post;
|
||||
end;}
|
||||
|
||||
if j=1 then
|
||||
begin
|
||||
RMPrintDBGrid1.ShowReport ;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Application.MessageBox('没有可打印的信息!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
//Panel2.Visible:=False;
|
||||
//RMPrintDBGrid1.ShowReport;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.Button2Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.ReadINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\' +trim(fieldname)+'.INI';
|
||||
programIni:=Tinifile.create(FName);
|
||||
PrintFields:=programIni.ReadString('打印设置','打印字段','');
|
||||
programIni.Free;
|
||||
end;
|
||||
procedure TfrmSelPrintFieldNew.GetPrintFields();
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
PrintFields:='Begin';
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked then
|
||||
begin
|
||||
PrintFields:=PrintFields+'/'+TCheckBox(Controls[i]).Caption;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//写设置信息到INI文件
|
||||
//参数
|
||||
//////////////////////////////////////////////////////////////////
|
||||
procedure TfrmSelPrintFieldNew.WriteINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\'+trim(fieldname)+'.INI';
|
||||
if not DirectoryExists(ExtractFileDir(FName)) then
|
||||
CreateDir(ExtractFileDir(FName));
|
||||
programIni:=Tinifile.create(FName);
|
||||
programIni.WriteString('打印设置','打印字段',PrintFields);
|
||||
programIni.Free;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//判断InI文件是否存在
|
||||
//////////////////////////////////////////////////////////////////
|
||||
Function TfrmSelPrintFieldNew.IsINIFile(fieldname:string):Boolean;
|
||||
var
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\'+trim(fieldname)+'.INI';
|
||||
if FileExists(FName) then
|
||||
Result:=True
|
||||
else
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.CheckBox1Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox1.Checked then
|
||||
begin
|
||||
CheckBox2.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.CheckBox2Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox2.Checked then
|
||||
begin
|
||||
CheckBox1.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
18063
Z99Dependency/ThreeFun/Form/U_SysLogHelp.dfm
Normal file
180
Z99Dependency/ThreeFun/Form/U_SysLogHelp.pas
Normal file
|
|
@ -0,0 +1,180 @@
|
|||
unit U_SysLogHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ComCtrls, ToolWin, cxStyles, cxCustomData, cxGraphics, cxFilter,
|
||||
cxData, cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel,strUtils,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||||
cxControls, cxGridCustomView, cxGrid, ADODB, StdCtrls, ExtCtrls, ImgList;
|
||||
|
||||
type
|
||||
TfrmSysLogHelp = class(TForm)
|
||||
ToolBar1: TToolBar;
|
||||
TQry: TToolButton;
|
||||
Tclose: TToolButton;
|
||||
ADOQueryLog: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ADOConnection1: TADOConnection;
|
||||
cxGrid1: TcxGrid;
|
||||
tv1: TcxGridDBTableView;
|
||||
tv1OperMan: TcxGridDBColumn;
|
||||
tv1jopertime: TcxGridDBColumn;
|
||||
tv1Model: TcxGridDBColumn;
|
||||
tv1acction: TcxGridDBColumn;
|
||||
cxGridLevel1: TcxGridLevel;
|
||||
tv1Opevent: TcxGridDBColumn;
|
||||
tv1Result: TcxGridDBColumn;
|
||||
Panel1: TPanel;
|
||||
Label2: TLabel;
|
||||
Label1: TLabel;
|
||||
begDate: TDateTimePicker;
|
||||
endDate: TDateTimePicker;
|
||||
Label3: TLabel;
|
||||
edt_model: TEdit;
|
||||
CheckBox1: TCheckBox;
|
||||
Label4: TLabel;
|
||||
edt_nr: TEdit;
|
||||
ThreeImgList: TImageList;
|
||||
procedure TcloseClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure TQryClick(Sender: TObject);
|
||||
procedure edt_modelChange(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
private
|
||||
procedure DoQuery();
|
||||
procedure DoFilter();
|
||||
public
|
||||
fModel,facction:string;
|
||||
fOtherWhere:string;
|
||||
end;
|
||||
|
||||
var
|
||||
frmSysLogHelp: TfrmSysLogHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink;
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmSysLogHelp.TcloseClick(Sender: TObject);
|
||||
begin
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfrmSysLogHelp.FormCreate(Sender: TObject);
|
||||
begin
|
||||
cxGrid1.Align :=alClient;
|
||||
begDate.DateTime :=date-31;
|
||||
endDate.DateTime :=date;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
/////////////////////////////////////////////////////////
|
||||
//
|
||||
////////////////////////////////////////////////////////
|
||||
procedure TfrmSysLogHelp.DoQuery();
|
||||
var
|
||||
mbegdate,menddate:string;
|
||||
|
||||
begin
|
||||
mbegdate:=formatDatetime('yyyy-MM-dd',begDate.Date); //
|
||||
menddate:=formatDatetime('yyyy-MM-dd',endDate.Date+1);
|
||||
try
|
||||
with ADOQueryLog do
|
||||
begin
|
||||
close;
|
||||
sql.clear;
|
||||
filtered:=false;
|
||||
sql.add('select A.* ');
|
||||
sql.add('from SY_sysLog A');
|
||||
if CheckBox1.Checked then
|
||||
begin
|
||||
sql.Add('where OperTime>='+quotedStr(mbegdate));
|
||||
sql.Add('and OperTime<'+quotedStr(menddate));
|
||||
end
|
||||
else
|
||||
begin
|
||||
sql.Add('where 1=1');
|
||||
end;
|
||||
if trim(fModel)<>'' then
|
||||
sql.add('and Model='+quotedStr(fModel));
|
||||
if trim(facction)<>'' then
|
||||
sql.add('and acction='+quotedStr(facction));
|
||||
if trim(fOtherWhere)<>'' then
|
||||
begin
|
||||
sql.add(fOtherWhere);
|
||||
end;
|
||||
sql.Add('order by operOr,Opertime');
|
||||
Open;
|
||||
end;
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////
|
||||
//
|
||||
///////////////////////////////////////////////////////////
|
||||
procedure TfrmSysLogHelp.DoFilter();
|
||||
var
|
||||
filterStr:string;
|
||||
begin
|
||||
filterStr:='';
|
||||
//
|
||||
if trim(edt_model.text)<>'' then
|
||||
begin
|
||||
filterStr:=' and model ='+quotedStr(trim(edt_model.text));
|
||||
end;
|
||||
if trim(edt_nr.text)<>'' then
|
||||
begin
|
||||
filterStr:=' and OpEvent like '+quotedStr('%'+trim(edt_nr.text)+'%');
|
||||
end;
|
||||
|
||||
try
|
||||
ADOQueryLog.DisableControls ;
|
||||
if trim(filterStr)='' then
|
||||
begin
|
||||
ADOQueryLog.Filtered:=false;
|
||||
exit;
|
||||
end;
|
||||
filterStr:=trim(RightBStr(filterStr,length(filterStr)-4));
|
||||
with ADOQueryLog do
|
||||
begin
|
||||
filtered:=false;
|
||||
filter:=filterStr;
|
||||
filtered:=true;
|
||||
end;
|
||||
finally
|
||||
ADOQueryLog.EnableControls;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmSysLogHelp.FormShow(Sender: TObject);
|
||||
begin
|
||||
DoQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmSysLogHelp.TQryClick(Sender: TObject);
|
||||
begin
|
||||
DoQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmSysLogHelp.edt_modelChange(Sender: TObject);
|
||||
begin
|
||||
DoFilter();
|
||||
end;
|
||||
|
||||
procedure TfrmSysLogHelp.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
action:=cafree;
|
||||
end;
|
||||
|
||||
end.
|
||||
23808
Z99Dependency/ThreeFun/Form/U_UserHelp.dfm
Normal file
214
Z99Dependency/ThreeFun/Form/U_UserHelp.pas
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
unit U_UserHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, cxFilter,
|
||||
cxData, cxDataStorage, cxEdit, DB, cxDBData, StdCtrls, cxGridLevel,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||||
cxControls, cxGridCustomView, cxGrid, cxInplaceContainer, cxDBTL,
|
||||
cxTLData, ComCtrls, ToolWin, ADODB, ImgList,StrUtils, ExtCtrls;
|
||||
|
||||
type
|
||||
TfrmUserHelp = class(TForm)
|
||||
ToolBar2: TToolBar;
|
||||
TOk: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
cxDBTreeList1: TcxDBTreeList;
|
||||
cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
|
||||
cxGrid1: TcxGrid;
|
||||
tv1: TcxGridDBTableView;
|
||||
tv1Code: TcxGridDBColumn;
|
||||
tv1Name: TcxGridDBColumn;
|
||||
DBGrid1Level1: TcxGridLevel;
|
||||
GroupBox1: TGroupBox;
|
||||
ADOQueryDept: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ADOConnection1: TADOConnection;
|
||||
tv1Column1: TcxGridDBColumn;
|
||||
cxStyleRepository1: TcxStyleRepository;
|
||||
cxStyle1: TcxStyle;
|
||||
cxStyle2: TcxStyle;
|
||||
cxStyle_gridRow: TcxStyle;
|
||||
cxStyle_gridFoot: TcxStyle;
|
||||
cxStyle_gridHead: TcxStyle;
|
||||
cxStyle_gridGroupBox: TcxStyle;
|
||||
cxStyle_yellow: TcxStyle;
|
||||
cxStyle_Red: TcxStyle;
|
||||
ADOQueryHelp: TADOQuery;
|
||||
DataSource2: TDataSource;
|
||||
Label1: TLabel;
|
||||
Edt_name: TEdit;
|
||||
ImageList1: TImageList;
|
||||
cxStyleTree: TcxStyle;
|
||||
Label2: TLabel;
|
||||
Edt_Code: TEdit;
|
||||
Splitter1: TSplitter;
|
||||
ThreeImgList: TImageList;
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure TOkClick(Sender: TObject);
|
||||
procedure tv1DblClick(Sender: TObject);
|
||||
procedure Edt_nameChange(Sender: TObject);
|
||||
procedure cxDBTreeList1Click(Sender: TObject);
|
||||
private
|
||||
procedure InitTree();
|
||||
procedure DoQuery();
|
||||
procedure FilterData(strdepotno,strcode,strname:string);
|
||||
public
|
||||
fFrameNo:string;
|
||||
fFrameName:string;
|
||||
fIsYwy:boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
frmUserHelp: TfrmUserHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink;
|
||||
{$R *.dfm}
|
||||
///////////////////////////////////////////////////////////
|
||||
//////功能:过滤数据
|
||||
///////////////////////////////////////////////////////////
|
||||
procedure TfrmUserHelp.FilterData(strdepotno,strcode,strname:string);
|
||||
var
|
||||
filterStr:string;
|
||||
begin
|
||||
filterStr:='';
|
||||
if trim(strdepotno)<>'' then
|
||||
filterStr:=filterStr+' and dept like '+quotedstr('%'+trim(strdepotno)+'%');
|
||||
if trim(strcode)<>'' then
|
||||
filterStr:=filterStr+' and userID like '+quotedstr('%'+trim(strcode)+'%');
|
||||
if trim(strname)<>'' then
|
||||
filterStr:=filterStr+' and userName like '+quotedstr('%'+trim(strname)+'%');
|
||||
|
||||
try
|
||||
ADOQueryHelp.DisableControls ;
|
||||
if trim(filterStr)='' then
|
||||
begin
|
||||
ADOQueryHelp.Filtered:=false;
|
||||
ADOQueryHelp.EnableControls;
|
||||
exit;
|
||||
end;
|
||||
filterStr:=trim(RightBStr(filterStr,length(filterStr)-5));
|
||||
// showmessage(filterStr);
|
||||
with ADOQueryHelp do
|
||||
begin
|
||||
filtered:=false;
|
||||
filter:=filterStr;
|
||||
filtered:=true;
|
||||
end;
|
||||
finally
|
||||
ADOQueryHelp.EnableControls;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////
|
||||
procedure TfrmUserHelp.InitTree();
|
||||
var
|
||||
strsql,strwhere:string;
|
||||
begin
|
||||
strsql:=' SELECT distinct UDept=''ALL'',UDeptTop='''',UDeptName=''所有部门'',Framelevel=0 '+
|
||||
' union '+
|
||||
' SELECT distinct UDept,UDeptTop=''ALL'',UDept,Framelevel=1 '+
|
||||
' FROM BD_staff A '+
|
||||
' WHERE USERID<>''ADMIN'' and ISNULL(UDept,'''')<>'''' ';
|
||||
|
||||
strwhere:=' where A.Valid=''Y'' ';
|
||||
{ if fIsYwy then
|
||||
strwhere:=strwhere+' and A.YWYFlag=''Y'' ';
|
||||
if trim(fFrameNo)<>'' then
|
||||
strwhere:=strwhere+' and A.dept='+quotedstr(trim(fFrameNo));
|
||||
if trim(fFrameName)<>'' then
|
||||
strwhere:=strwhere+' and B.frameName like '+quotedstr('%'+trim(fFrameName)+'%');
|
||||
strsql:=strsql+ strwhere; }
|
||||
|
||||
with ADOQueryDept do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add( strsql);
|
||||
Open;
|
||||
end;
|
||||
cxDBTreeList1.FullExpand;
|
||||
|
||||
DoQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp.FormShow(Sender: TObject);
|
||||
begin
|
||||
InitTree();
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp.FormCreate(Sender: TObject);
|
||||
begin
|
||||
cxGrid1.Align :=alclient;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
procedure TfrmUserHelp.DoQuery();
|
||||
var
|
||||
strsql,strwhere:string;
|
||||
begin
|
||||
strsql:=' select * '+
|
||||
' from BD_staff A '+
|
||||
' where isnull(UserID,'''')<>''ADMIN'' ';
|
||||
strwhere:=' and A.Valid=''Y'' ';
|
||||
if fIsYwy then
|
||||
strwhere:=strwhere+' and A.Isywy=1 ';
|
||||
|
||||
strsql:=strsql+ strwhere +' order by A.userID ';
|
||||
|
||||
with ADOQueryHelp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add( strsql);
|
||||
Open;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp.TOkClick(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryHelp.IsEmpty then
|
||||
begin
|
||||
ModalResult:=-1
|
||||
end
|
||||
else
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp.tv1DblClick(Sender: TObject);
|
||||
begin
|
||||
Tok.Click ;
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp.Edt_nameChange(Sender: TObject);
|
||||
begin
|
||||
FilterData('',edt_code.Text,Edt_name.Text);
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp.cxDBTreeList1Click(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryDept.IsEmpty then exit;
|
||||
if trim(ADOQueryDept.FieldByName('Framelevel').AsString)='0' then
|
||||
FilterData('','','')
|
||||
else
|
||||
FilterData(ADOQueryDept.FieldByName('UDept').AsString,'','');
|
||||
end;
|
||||
|
||||
end.
|
||||
23877
Z99Dependency/ThreeFun/Form/U_UserHelp_Dx.dfm
Normal file
245
Z99Dependency/ThreeFun/Form/U_UserHelp_Dx.pas
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
unit U_UserHelp_Dx;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, cxFilter,
|
||||
cxData, cxDataStorage, cxEdit, DB, cxDBData, StdCtrls, cxGridLevel,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||||
cxControls, cxGridCustomView, cxGrid, cxInplaceContainer, cxDBTL,
|
||||
cxTLData, ComCtrls, ToolWin, ADODB, ImgList,StrUtils, ExtCtrls, DBClient;
|
||||
|
||||
type
|
||||
TfrmUserHelp_Dx = class(TForm)
|
||||
ToolBar2: TToolBar;
|
||||
TOk: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
cxGrid1: TcxGrid;
|
||||
tv1: TcxGridDBTableView;
|
||||
tv1Code: TcxGridDBColumn;
|
||||
tv1Name: TcxGridDBColumn;
|
||||
DBGrid1Level1: TcxGridLevel;
|
||||
GroupBox1: TGroupBox;
|
||||
ADOQueryDept: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ADOConnection1: TADOConnection;
|
||||
tv1Column1: TcxGridDBColumn;
|
||||
cxStyleRepository1: TcxStyleRepository;
|
||||
cxStyle1: TcxStyle;
|
||||
cxStyle2: TcxStyle;
|
||||
cxStyle_gridRow: TcxStyle;
|
||||
cxStyle_gridFoot: TcxStyle;
|
||||
cxStyle_gridHead: TcxStyle;
|
||||
cxStyle_gridGroupBox: TcxStyle;
|
||||
cxStyle_yellow: TcxStyle;
|
||||
cxStyle_Red: TcxStyle;
|
||||
ADOQueryHelp: TADOQuery;
|
||||
DataSource2: TDataSource;
|
||||
Label1: TLabel;
|
||||
Edt_name: TEdit;
|
||||
ImageList1: TImageList;
|
||||
cxStyleTree: TcxStyle;
|
||||
Label2: TLabel;
|
||||
Edt_Code: TEdit;
|
||||
ThreeImgList: TImageList;
|
||||
cxGrid2: TcxGrid;
|
||||
Tv2: TcxGridDBTableView;
|
||||
cxGridDBColumn1: TcxGridDBColumn;
|
||||
cxGridDBColumn2: TcxGridDBColumn;
|
||||
cxGridDBColumn3: TcxGridDBColumn;
|
||||
cxGridLevel1: TcxGridLevel;
|
||||
GroupBox2: TGroupBox;
|
||||
CDS_sel: TClientDataSet;
|
||||
DataSourceSel: TDataSource;
|
||||
cxDBTreeList1: TcxDBTreeList;
|
||||
cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
|
||||
Splitter1: TSplitter;
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure TOkClick(Sender: TObject);
|
||||
procedure tv1DblClick(Sender: TObject);
|
||||
procedure Edt_nameChange(Sender: TObject);
|
||||
procedure cxDBTreeList1Click(Sender: TObject);
|
||||
procedure Tv2DblClick(Sender: TObject);
|
||||
private
|
||||
procedure InitTree();
|
||||
procedure DoQuery();
|
||||
procedure FilterData(strdepotno,strcode,strname:string);
|
||||
public
|
||||
fFrameNo:string;
|
||||
fFrameName:string;
|
||||
fIsYwy:boolean;
|
||||
end;
|
||||
|
||||
var
|
||||
frmUserHelp_Dx: TfrmUserHelp_Dx;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_Fun10;
|
||||
{$R *.dfm}
|
||||
///////////////////////////////////////////////////////////
|
||||
//////功能:过滤数据
|
||||
///////////////////////////////////////////////////////////
|
||||
procedure TfrmUserHelp_Dx.FilterData(strdepotno,strcode,strname:string);
|
||||
var
|
||||
filterStr:string;
|
||||
begin
|
||||
filterStr:='';
|
||||
if trim(strdepotno)<>'' then
|
||||
filterStr:=filterStr+' and dept like '+quotedstr('%'+trim(strdepotno)+'%');
|
||||
if trim(strcode)<>'' then
|
||||
filterStr:=filterStr+' and userID like '+quotedstr('%'+trim(strcode)+'%');
|
||||
if trim(strname)<>'' then
|
||||
filterStr:=filterStr+' and userName like '+quotedstr('%'+trim(strname)+'%');
|
||||
|
||||
try
|
||||
ADOQueryHelp.DisableControls ;
|
||||
if trim(filterStr)='' then
|
||||
begin
|
||||
ADOQueryHelp.Filtered:=false;
|
||||
ADOQueryHelp.EnableControls;
|
||||
exit;
|
||||
end;
|
||||
filterStr:=trim(RightBStr(filterStr,length(filterStr)-5));
|
||||
// showmessage(filterStr);
|
||||
with ADOQueryHelp do
|
||||
begin
|
||||
filtered:=false;
|
||||
filter:=filterStr;
|
||||
filtered:=true;
|
||||
end;
|
||||
finally
|
||||
ADOQueryHelp.EnableControls;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////
|
||||
procedure TfrmUserHelp_Dx.InitTree();
|
||||
var
|
||||
strsql,strwhere:string;
|
||||
begin
|
||||
strsql:=' SELECT distinct UDept=''ALL'',UDeptTop='''',UDeptName=''所有部门'',Framelevel=0 '+
|
||||
' union '+
|
||||
' SELECT distinct UDept,UDeptTop=''ALL'',UDept,Framelevel=1 '+
|
||||
' FROM BD_staff A '+
|
||||
' WHERE USERID<>''ADMIN'' and ISNULL(UDept,'''')<>'''' ';
|
||||
|
||||
strwhere:=' where A.Valid=''Y'' ';
|
||||
{ if fIsYwy then
|
||||
strwhere:=strwhere+' and A.YWYFlag=''Y'' ';
|
||||
if trim(fFrameNo)<>'' then
|
||||
strwhere:=strwhere+' and A.dept='+quotedstr(trim(fFrameNo));
|
||||
if trim(fFrameName)<>'' then
|
||||
strwhere:=strwhere+' and B.frameName like '+quotedstr('%'+trim(fFrameName)+'%');
|
||||
strsql:=strsql+ strwhere; }
|
||||
|
||||
with ADOQueryDept do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add( strsql);
|
||||
Open;
|
||||
end;
|
||||
cxDBTreeList1.FullExpand;
|
||||
|
||||
DoQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp_Dx.FormShow(Sender: TObject);
|
||||
begin
|
||||
InitTree();
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp_Dx.FormCreate(Sender: TObject);
|
||||
begin
|
||||
GroupBox2.Align :=alclient;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////////////
|
||||
procedure TfrmUserHelp_Dx.DoQuery();
|
||||
var
|
||||
strsql,strwhere:string;
|
||||
begin
|
||||
strsql:=' select * '+
|
||||
' from BD_staff A '+
|
||||
' where isnull(UserID,'''')<>''ADMIN'' ';
|
||||
strwhere:=' and A.Valid=''Y'' ';
|
||||
if fIsYwy then
|
||||
strwhere:=strwhere+' and A.Isywy=1 ';
|
||||
|
||||
strsql:=strsql+ strwhere +' order by A.userID ';
|
||||
|
||||
with ADOQueryHelp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add( strsql);
|
||||
Open;
|
||||
end;
|
||||
|
||||
sCreateCDS20(ADOQueryHelp,cds_sel);
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp_Dx.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp_Dx.TOkClick(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryHelp.IsEmpty then
|
||||
begin
|
||||
ModalResult:=-1
|
||||
end
|
||||
else
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp_Dx.tv1DblClick(Sender: TObject);
|
||||
var
|
||||
i:integer;
|
||||
begin
|
||||
if ADOQueryHelp.IsEmpty then exit;
|
||||
|
||||
if CDS_Sel.Locate('userID',trim(adoqueryHelp.fieldbyname('userID').AsString),[]) then exit;
|
||||
with CDS_Sel do
|
||||
begin
|
||||
CDS_Sel.append;
|
||||
for i:=0 to ADOQueryHelp.FieldCount-1 do
|
||||
begin
|
||||
fields[i].Value:=ADOQueryHelp.Fields[i].Value;
|
||||
end;
|
||||
CDS_Sel.Post;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp_Dx.Edt_nameChange(Sender: TObject);
|
||||
begin
|
||||
FilterData('',edt_code.Text,Edt_name.Text);
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp_Dx.cxDBTreeList1Click(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryDept.IsEmpty then exit;
|
||||
if trim(ADOQueryDept.FieldByName('Framelevel').AsString)='0' then
|
||||
FilterData('','','')
|
||||
else
|
||||
FilterData(ADOQueryDept.FieldByName('UDept').AsString,'','');
|
||||
end;
|
||||
|
||||
procedure TfrmUserHelp_Dx.Tv2DblClick(Sender: TObject);
|
||||
begin
|
||||
IF cds_sel.IsEmpty then exit;
|
||||
cds_sel.Delete;
|
||||
end;
|
||||
|
||||
end.
|
||||
18110
Z99Dependency/ThreeFun/Form/U_ZDYHelp.dfm
Normal file
748
Z99Dependency/ThreeFun/Form/U_ZDYHelp.pas
Normal file
|
|
@ -0,0 +1,748 @@
|
|||
unit U_ZDYHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
|
||||
cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList,
|
||||
StdCtrls, ExtCtrls, cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu,
|
||||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator;
|
||||
|
||||
type
|
||||
TfrmZDYHelp = class(TForm)
|
||||
TV1: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
V1Code: TcxGridDBColumn;
|
||||
V1Name: TcxGridDBColumn;
|
||||
ToolBar1: TToolBar;
|
||||
ADOQueryMain: TADOQuery;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
TBAdd: TToolButton;
|
||||
TBSave: TToolButton;
|
||||
TBDel: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
ToolButton1: TToolButton;
|
||||
TBEdit: TToolButton;
|
||||
V1Note: TcxGridDBColumn;
|
||||
V1OrderNo: TcxGridDBColumn;
|
||||
ADOConnection1: TADOConnection;
|
||||
Panel1: TPanel;
|
||||
Label1: TLabel;
|
||||
ZDYName: TEdit;
|
||||
ThreeImgList: TImageList;
|
||||
Label2: TLabel;
|
||||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||||
V1ZdyFlag: TcxGridDBColumn;
|
||||
V1HelpType: TcxGridDBColumn;
|
||||
V1Note1: TcxGridDBColumn;
|
||||
ToolButton2: TToolButton;
|
||||
V1ZdyStr1: TcxGridDBColumn;
|
||||
V1ZdyStr2: TcxGridDBColumn;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBAddClick(Sender: TObject);
|
||||
procedure TBSaveClick(Sender: TObject);
|
||||
procedure TBDelClick(Sender: TObject);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure TBEditClick(Sender: TObject);
|
||||
procedure TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
procedure ZDYNameChange(Sender: TObject);
|
||||
procedure V1NamePropertiesEditValueChanged(Sender: TObject);
|
||||
procedure V1OrderNoPropertiesEditValueChanged(Sender: TObject);
|
||||
procedure V1NotePropertiesEditValueChanged(Sender: TObject);
|
||||
procedure V1Column1PropertiesEditValueChanged(Sender: TObject);
|
||||
procedure V1HelpTypePropertiesEditValueChanged(Sender: TObject);
|
||||
procedure V1Note1PropertiesEditValueChanged(Sender: TObject);
|
||||
procedure ToolButton2Click(Sender: TObject);
|
||||
procedure V1ZdyStr1PropertiesEditValueChanged(Sender: TObject);
|
||||
private
|
||||
procedure InitGrid();
|
||||
{ Private declarations }
|
||||
public
|
||||
flag,flagname,snote,MainType:string;
|
||||
fnote,forderno,fZdyFlag,ViewFlag,fnote1:Boolean;
|
||||
PPSTE:integer;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmZDYHelp: TfrmZDYHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_RTFun;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmZDYHelp.FormCreate(Sender: TObject);
|
||||
begin
|
||||
try
|
||||
cxGrid1.Align:=alClient;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='';
|
||||
Connected:=true;
|
||||
end;
|
||||
except
|
||||
{if Application.MessageBox('网络连接失败,是否要再次连接?','提示',32+4)=IDYES then
|
||||
begin
|
||||
try
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='23242';
|
||||
Connected:=true;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end; }
|
||||
|
||||
frmZDYHelp.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
WriteCxGrid('自定义'+Trim(flag),TV1,'自定义数据');
|
||||
ZDYName.SetFocus;
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.InitGrid();
|
||||
begin
|
||||
try
|
||||
ADOQueryMain.DisableControls;
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select A.*,ZJM=dbo.getPinYin(A.ZdyName) from KH_ZDY A where A.Type='''+flag+'''');
|
||||
if Trim(MainType)<>'' then
|
||||
begin
|
||||
sql.Add(' and A.MainType='''+Trim(MainType)+'''');
|
||||
end;
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.TBAddClick(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
ZDYName.SetFocus;
|
||||
TV1.OptionsData.Editing:=True;
|
||||
TV1.OptionsSelection.CellSelect:=True;
|
||||
for i:=0 to 5 do
|
||||
begin
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Append;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.TBSaveClick(Sender: TObject);
|
||||
var
|
||||
maxno:string;
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
ZDYName.SetFocus;
|
||||
|
||||
if ClientDataSet1.Locate('ZDYName',null,[]) then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if ClientDataSet1.Locate('ZDYName','',[]) then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add('select * from KH_ZDY where ZdyNo='''+Trim(flag)+'''');
|
||||
open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into KH_ZDY(ZDYNo,ZDYName,Type,MainType) select :ZDYNo,:ZDYName,:Type,:MainType ');
|
||||
Parameters.ParamByName('ZDYNo').Value:=Trim(flag);
|
||||
Parameters.ParamByName('ZDYName').Value:=Trim(flagname);
|
||||
Parameters.ParamByName('Type').Value:='Main';
|
||||
Parameters.ParamByName('MainType').Value:=Trim(MainType);
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
ClientDataSet1.DisableControls;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
First;
|
||||
while not eof do
|
||||
begin
|
||||
if Trim(ClientDataSet1.FieldByName('ZDYNO').AsString)='' then
|
||||
begin
|
||||
if GetLSNo(ADOQueryTemp,maxno,'SY','KH_ZDY',3,1)=False then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('取最大编号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
maxno:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||||
end;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.add('select * from KH_Zdy where Type='''+Trim(flag)+'''');
|
||||
if Trim(MainType)<>'' then
|
||||
SQL.Add(' and MainType='''+Trim(MainType)+'''');
|
||||
sql.Add(' and ZdyName='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
||||
Open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty=False then
|
||||
begin
|
||||
if ADOQueryTemp.RecordCount>1 then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)='' then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end else
|
||||
begin
|
||||
if Trim(ADOQueryTemp.fieldbyname('ZdyNo').AsString)<>Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString) then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
SQL.Add('delete KH_ZDY where ZDYNO='''+Trim(ClientDataSet1.fieldbyname('ZDYNO').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from KH_ZDY where 1<>1');
|
||||
Open;
|
||||
end;
|
||||
ADOQueryCmd.Append;
|
||||
ADOQueryCmd.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ADOQueryCmd.FieldByName('ZDYName').Value:=ClientDataSet1.fieldbyname('ZDYName').Value;
|
||||
ADOQueryCmd.FieldByName('note').Value:=Trim(snote);
|
||||
//ADOQueryCmd.FieldByName('orderno').Value:=ClientDataSet1.fieldbyname('Name').AsString;
|
||||
ADOQueryCmd.FieldByName('Type').Value:=flag;
|
||||
ADOQueryCmd.FieldByName('valid').Value:='Y';
|
||||
if Trim(MainType)<>'' then
|
||||
ADOQueryCmd.FieldByName('MainType').Value:=Trim(MainType);
|
||||
//ADOQueryCmd.FieldByName('sel').Value:=0;
|
||||
ADOQueryCmd.Post;
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ClientDataSet1.Post;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
ClientDataSet1.EnableControls;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
Application.MessageBox('保存成功!','提示',0);
|
||||
TV1.OptionsData.Editing:=False;
|
||||
TV1.OptionsSelection.CellSelect:=False;
|
||||
except
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.TBDelClick(Sender: TObject);
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
if (Trim(ClientDataSet1.FieldByName('ZDYNo').AsString)<>'') or
|
||||
(Trim(ClientDataSet1.FieldByName('ZDYname').AsString)<>'') then
|
||||
begin
|
||||
if application.MessageBox('确定要删除吗?','提示信息',1)=2 then exit;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('delete KH_ZDY where ZDYNo='''+Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString)+'''');
|
||||
SQL.Add(' and Type='''+Trim(flag)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
ClientDataSet1.Delete;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=2;
|
||||
ZDYName.SetFocus;
|
||||
WriteCxGrid('自定义'+Trim(flag),TV1,'自定义数据');
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.FormShow(Sender: TObject);
|
||||
var
|
||||
fsj,fsj1:string;
|
||||
begin
|
||||
{if PPSTE=1 then
|
||||
begin
|
||||
Application.Terminate;
|
||||
Exit;
|
||||
end; }
|
||||
InitGrid();
|
||||
fsj:=Trim(flag)+'01';
|
||||
fsj1:=Trim(flagname)+'01';
|
||||
{if ClientDataSet1.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into KH_ZDY(ZDYNo,ZDYname,Type,note)');
|
||||
sql.Add('select '''+Trim(fsj)+'''');
|
||||
sql.Add(','''+Trim(fsj1)+'''');
|
||||
SQL.Add(','''+Trim(flag)+'''');
|
||||
sql.Add(','''+Trim(snote)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
InitGrid();
|
||||
end;}
|
||||
//frmZDYHelp.Caption:=Trim(flagname)+'<'+Trim(flag)+'>';
|
||||
//ReadCxGrid('自定义',TV1,'自定义数据');
|
||||
ReadCxGrid('自定义'+Trim(flag),TV1,'自定义数据');
|
||||
frmZDYHelp.Caption:=Trim(flagname);
|
||||
V1Note.Visible:=fnote;
|
||||
V1Note1.Visible:=fnote1;
|
||||
V1ZdyFlag.Visible:=fZdyFlag;
|
||||
V1OrderNo.Visible:=forderno;
|
||||
if ViewFlag=True then
|
||||
begin
|
||||
TBAdd.Visible:=False;
|
||||
TBSave.Visible:=False;
|
||||
TBDel.Visible:=False;
|
||||
TBEdit.Visible:=False;
|
||||
Label2.Visible:=False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
ZDYName.SetFocus;
|
||||
WriteCxGrid('自定义'+Trim(flag),TV1,'自定义数据');
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.TBEditClick(Sender: TObject);
|
||||
begin
|
||||
TV1.OptionsData.Editing:=True;
|
||||
TV1.OptionsSelection.CellSelect:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
begin
|
||||
if TV1.OptionsData.Editing=False then
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.ZDYNameChange(Sender: TObject);
|
||||
var
|
||||
fsj:String;
|
||||
begin
|
||||
if Trim(ZDYName.Text)<>'' then
|
||||
begin
|
||||
fsj:=' zdyname like '''+'%'+Trim(ZDYName.Text)+'%'+''''
|
||||
+' or Note like '''+'%'+Trim(ZDYName.Text)+'%'+''''
|
||||
+' or ZJM like '''+'%'+Trim(ZDYName.Text)+'%'+'''';
|
||||
end;
|
||||
if ADOQueryMain.Active then
|
||||
begin
|
||||
SDofilter(ADOQueryMain,fsj);
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.V1NamePropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
maxno,mvalue:string;
|
||||
begin
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
//Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('ZdyName').Value:=Trim(mvalue);
|
||||
//Post;
|
||||
end;
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add('select * from KH_ZDY where ZdyNo='''+Trim(flag)+'''');
|
||||
open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into KH_ZDY(ZDYNo,ZDYName,Type,MainType) select :ZDYNo,:ZDYName,:Type,:MainType ');
|
||||
Parameters.ParamByName('ZDYNo').Value:=Trim(flag);
|
||||
Parameters.ParamByName('ZDYName').Value:=Trim(flagname);
|
||||
Parameters.ParamByName('Type').Value:='Main';
|
||||
Parameters.ParamByName('MainType').Value:=Trim(MainType);
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
//ClientDataSet1.DisableControls;
|
||||
//with ClientDataSet1 do
|
||||
//begin
|
||||
//First;
|
||||
//while not eof do
|
||||
//begin
|
||||
if Trim(ClientDataSet1.FieldByName('ZDYNO').AsString)='' then
|
||||
begin
|
||||
if GetLSNo(ADOQueryTemp,maxno,'SY','KH_ZDY',3,1)=False then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('取最大编号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
maxno:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||||
end;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.add('select * from KH_Zdy where Type='''+Trim(flag)+'''');
|
||||
if Trim(MainType)<>'' then
|
||||
SQL.Add(' and MainType='''+Trim(MainType)+'''');
|
||||
sql.Add(' and ZdyName='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
||||
Open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty=False then
|
||||
begin
|
||||
if ADOQueryTemp.RecordCount>1 then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)='' then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end else
|
||||
begin
|
||||
if Trim(ADOQueryTemp.fieldbyname('ZdyNo').AsString)<>Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString) then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
SQL.Add('delete KH_ZDY where ZDYNO='''+Trim(ClientDataSet1.fieldbyname('ZDYNO').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from KH_ZDY where 1<>1');
|
||||
Open;
|
||||
end;
|
||||
ADOQueryCmd.Append;
|
||||
ADOQueryCmd.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ADOQueryCmd.FieldByName('ZDYName').Value:=ClientDataSet1.fieldbyname('ZDYName').AsString;
|
||||
ADOQueryCmd.FieldByName('note').Value:=Trim(snote);
|
||||
//ADOQueryCmd.FieldByName('orderno').Value:=ClientDataSet1.fieldbyname('Name').AsString;
|
||||
ADOQueryCmd.FieldByName('Type').Value:=flag;
|
||||
ADOQueryCmd.FieldByName('valid').Value:='Y';
|
||||
if Trim(MainType)<>'' then
|
||||
ADOQueryCmd.FieldByName('MainType').Value:=Trim(MainType);
|
||||
//ADOQueryCmd.FieldByName('sel').Value:=0;
|
||||
ADOQueryCmd.Post;
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
//ClientDataSet1.Post;
|
||||
// Next;
|
||||
//end;
|
||||
//end;
|
||||
// ClientDataSet1.EnableControls;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
//Application.MessageBox('保存成功!','提示',0);
|
||||
//TV1.OptionsData.Editing:=False;
|
||||
//TV1.OptionsSelection.CellSelect:=False;
|
||||
except
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.V1OrderNoPropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
mvalue:string;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='0';
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('OrderNo').Value:=mvalue;
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set OrderNo='+mvalue);
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.V1NotePropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
mvalue:string;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='';
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('Note').Value:=mvalue;
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set Note='''+Trim(mvalue)+'''');
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.V1Column1PropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
mvalue:String;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='0';
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('ZdyFlag').Value:=StrToInt(mvalue);
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set ZdyFlag='+Trim(mvalue));
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.V1HelpTypePropertiesEditValueChanged(
|
||||
Sender: TObject);
|
||||
var
|
||||
mvalue:string;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='0';
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('HelpType').Value:=mvalue;
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set HelpType='''+Trim(mvalue)+'''');
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.V1Note1PropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
mvalue:string;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='';
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('Note1').Value:=mvalue;
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set Note1='''+Trim(mvalue)+'''');
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.ToolButton2Click(Sender: TObject);
|
||||
begin
|
||||
TcxGridToExcel(Trim(flagname)+'列表',cxGrid1);
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelp.V1ZdyStr1PropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
mvalue,FName:string;
|
||||
begin
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
mvalue:='';
|
||||
end;
|
||||
FName:=TV1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName(FName).Value:=mvalue;
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('Update KH_Zdy Set '+FName+'=');
|
||||
sql.Add(''''+Trim(mvalue)+'''');
|
||||
sql.Add(' where ZdyNo='''+Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
18083
Z99Dependency/ThreeFun/Form/U_ZDYHelpDL.dfm
Normal file
294
Z99Dependency/ThreeFun/Form/U_ZDYHelpDL.pas
Normal file
|
|
@ -0,0 +1,294 @@
|
|||
unit U_ZDYHelpDL;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
|
||||
cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList,
|
||||
StdCtrls, ExtCtrls, cxTL, cxMaskEdit, cxInplaceContainer, cxDBTL,
|
||||
cxTLData, cxDropDownEdit;
|
||||
|
||||
type
|
||||
TfrmZDYDLHelp = class(TForm)
|
||||
TV1: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
V1Code: TcxGridDBColumn;
|
||||
V1Name: TcxGridDBColumn;
|
||||
ToolBar1: TToolBar;
|
||||
ADOQueryMain: TADOQuery;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
TBAdd: TToolButton;
|
||||
TBSave: TToolButton;
|
||||
TBDel: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
ToolButton1: TToolButton;
|
||||
TBEdit: TToolButton;
|
||||
V1Note: TcxGridDBColumn;
|
||||
V1OrderNo: TcxGridDBColumn;
|
||||
ADOConnection1: TADOConnection;
|
||||
Panel1: TPanel;
|
||||
Label1: TLabel;
|
||||
ZDYName: TEdit;
|
||||
ThreeImgList: TImageList;
|
||||
ADOQueryChild: TADOQuery;
|
||||
DataSource2: TDataSource;
|
||||
cxDBTreeList1: TcxDBTreeList;
|
||||
cxColumn2: TcxDBTreeListColumn;
|
||||
V1Column1: TcxGridDBColumn;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBAddClick(Sender: TObject);
|
||||
procedure TBSaveClick(Sender: TObject);
|
||||
procedure TBDelClick(Sender: TObject);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure TBEditClick(Sender: TObject);
|
||||
procedure TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
procedure ZDYNameChange(Sender: TObject);
|
||||
procedure cxDBTreeList1Click(Sender: TObject);
|
||||
private
|
||||
procedure InitGrid();
|
||||
{ Private declarations }
|
||||
public
|
||||
MainType,MainTypeName,flag,flagname,snote:string;
|
||||
fnote,forderno:Boolean;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmZDYDLHelp: TfrmZDYDLHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_Fun;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmZDYDLHelp.FormCreate(Sender: TObject);
|
||||
begin
|
||||
cxGrid1.Align:=alClient;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.InitGrid();
|
||||
begin
|
||||
try
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select A.*,TypeName=(select ZdyName from KH_Zdy B where B.ZdyNO=A.Type) from KH_Zdy A');
|
||||
if Trim(ADOQueryChild.fieldbyname('frameNo').AsString)<>'QB' then
|
||||
sql.Add('where Type='''+Trim(ADOQueryChild.fieldbyname('frameNo').AsString)+'''')
|
||||
else
|
||||
sql.Add('where MainType='''+Trim(MainType)+''' and Type<>''Main'' ');
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.TBAddClick(Sender: TObject);
|
||||
begin
|
||||
TV1.OptionsData.Editing:=True;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Append;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.TBSaveClick(Sender: TObject);
|
||||
var
|
||||
maxno,fsj:string;
|
||||
i:Integer;
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if Trim(ClientDataSet1.fieldbyname('TypeName').AsString)='' then
|
||||
begin
|
||||
Application.MessageBox('类别不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
First;
|
||||
while not eof do
|
||||
begin
|
||||
if Trim(ClientDataSet1.FieldByName('ZDYNO').AsString)='' then
|
||||
begin
|
||||
if GetLSNo(ADOQueryTemp,maxno,'SY','KH_ZDY',3,1)=False then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('取最大编号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
maxno:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
SQL.Add('delete KH_ZDY where ZDYNO='''+Trim(ClientDataSet1.fieldbyname('ZDYNO').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from KH_ZDY where 1<>1');
|
||||
Open;
|
||||
end;
|
||||
if Trim(ClientDataSet1.FieldByName('ZDYName').AsString)='' then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
ADOQueryCmd.Append;
|
||||
ADOQueryCmd.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ADOQueryCmd.FieldByName('ZDYName').Value:=ClientDataSet1.fieldbyname('ZDYName').AsString;
|
||||
ADOQueryCmd.FieldByName('note').Value:=Trim(snote);
|
||||
//ADOQueryCmd.FieldByName('orderno').Value:=ClientDataSet1.fieldbyname('Name').AsString;
|
||||
// ADOQueryCmd.FieldByName('Type').Value:=TcxComboBox(V1Column1).Properties.Items.Strings[1];
|
||||
i:=(V1Column1.Properties as TcxComboBoxProperties).Items.IndexOf(ClientDataSet1.fieldbyname('TypeName').AsString);
|
||||
fsj:=TA((V1Column1.Properties as TcxComboBoxProperties).Items.Objects[i]).S;
|
||||
ADOQueryCmd.FieldByName('Type').Value:=Trim(fsj);
|
||||
ADOQueryCmd.FieldByName('valid').Value:='Y';
|
||||
ADOQueryCmd.FieldByName('Maintype').Value:=Trim(MainType);
|
||||
//ADOQueryCmd.FieldByName('sel').Value:=0;
|
||||
ADOQueryCmd.Post;
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ClientDataSet1.Post;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
Application.MessageBox('保存成功!','提示',0);
|
||||
except
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
TV1.OptionsData.Editing:=False;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.TBDelClick(Sender: TObject);
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
if (Trim(ClientDataSet1.FieldByName('ZDYNo').AsString)<>'') or
|
||||
(Trim(ClientDataSet1.FieldByName('ZDYname').AsString)<>'') then
|
||||
begin
|
||||
if application.MessageBox('确定要删除吗?','提示信息',1)=2 then exit;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('delete KH_ZDY where ZDYNo='''+Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString)+'''');
|
||||
SQL.Add(' and Type='''+Trim(ADOQueryChild.fieldbyname('frameNO').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
ClientDataSet1.Delete;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=2;
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.FormShow(Sender: TObject);
|
||||
var
|
||||
fsj,fsj1:string;
|
||||
begin
|
||||
fsj:='select ZdyNo code,ZdyName name from KH_Zdy where MainType='''+MainType+''' and Type=''Main''';
|
||||
SInitCxGridComboBoxBySql(ADOQueryTemp,V1Column1,fsj,1,True,'');
|
||||
fsj:= ' select frameNo=''QB'',frameName=''全部'',TopFrameNo='''+Trim(MainType)+''''+
|
||||
' union all select frameNo=ZdyNo,frameName=ZdyName,TopFrameNo=MainType '+
|
||||
' from KH_Zdy A '+
|
||||
' where A.MainType='''+MainType+''' and Type=''Main''';
|
||||
with ADOQueryChild do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add(fsj);
|
||||
Open;
|
||||
end;
|
||||
cxDBTreeList1.FullExpand;
|
||||
InitGrid();
|
||||
|
||||
frmZDYDLHelp.Caption:=Trim(MainTypename)+'<'+Trim(MainType)+'>';
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.TBEditClick(Sender: TObject);
|
||||
begin
|
||||
TV1.OptionsData.Editing:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
begin
|
||||
if TV1.OptionsData.Editing=False then
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.ZDYNameChange(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryMain.Active then
|
||||
begin
|
||||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYDLHelp.cxDBTreeList1Click(Sender: TObject);
|
||||
begin
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
end.
|
||||
18056
Z99Dependency/ThreeFun/Form/U_ZDYHelpSel.dfm
Normal file
494
Z99Dependency/ThreeFun/Form/U_ZDYHelpSel.pas
Normal file
|
|
@ -0,0 +1,494 @@
|
|||
unit U_ZDYHelpSel;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, DB, cxDBData, ToolWin, ComCtrls,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGridLevel,
|
||||
cxClasses, cxControls, cxGridCustomView, cxGrid, DBClient, ADODB, ImgList,
|
||||
StdCtrls, ExtCtrls, cxCheckBox, cxTextEdit;
|
||||
|
||||
type
|
||||
TfrmZDYHelpSel = class(TForm)
|
||||
TV1: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
V1Code: TcxGridDBColumn;
|
||||
V1Name: TcxGridDBColumn;
|
||||
ToolBar1: TToolBar;
|
||||
ADOQueryMain: TADOQuery;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
TBAdd: TToolButton;
|
||||
TBSave: TToolButton;
|
||||
TBDel: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
ToolButton1: TToolButton;
|
||||
TBEdit: TToolButton;
|
||||
V1Note: TcxGridDBColumn;
|
||||
V1OrderNo: TcxGridDBColumn;
|
||||
ADOConnection1: TADOConnection;
|
||||
Panel1: TPanel;
|
||||
Label1: TLabel;
|
||||
ZDYName: TEdit;
|
||||
ThreeImgList: TImageList;
|
||||
V1Column1: TcxGridDBColumn;
|
||||
Label2: TLabel;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBAddClick(Sender: TObject);
|
||||
procedure TBSaveClick(Sender: TObject);
|
||||
procedure TBDelClick(Sender: TObject);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure TBEditClick(Sender: TObject);
|
||||
procedure TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
procedure ZDYNameChange(Sender: TObject);
|
||||
procedure V1NamePropertiesEditValueChanged(Sender: TObject);
|
||||
private
|
||||
procedure InitGrid();
|
||||
{ Private declarations }
|
||||
public
|
||||
flag,flagname,snote,MainType,ReturnStr,FGStr:string;
|
||||
fnote,forderno:Boolean;
|
||||
PPSTE,JiangeStr:integer;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmZDYHelpSel: TfrmZDYHelpSel;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_Fun;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmZDYHelpSel.FormCreate(Sender: TObject);
|
||||
begin
|
||||
try
|
||||
cxGrid1.Align:=alClient;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='';
|
||||
Connected:=true;
|
||||
end;
|
||||
except
|
||||
{if Application.MessageBox('网络连接失败,是否要再次连接?','提示',32+4)=IDYES then
|
||||
begin
|
||||
try
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='23242';
|
||||
Connected:=true;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end; }
|
||||
|
||||
frmZDYHelpSel.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
ZDYName.SetFocus;
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.InitGrid();
|
||||
begin
|
||||
try
|
||||
ADOQueryMain.DisableControls;
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from KH_ZDY where Type='''+flag+'''');
|
||||
if Trim(MainType)<>'' then
|
||||
begin
|
||||
sql.Add(' and MainType='''+Trim(MainType)+'''');
|
||||
end;
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.TBAddClick(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
ZDYName.SetFocus;
|
||||
TV1.OptionsData.Editing:=True;
|
||||
TV1.OptionsSelection.CellSelect:=True;
|
||||
for i:=0 to 5 do
|
||||
begin
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Append;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.TBSaveClick(Sender: TObject);
|
||||
var
|
||||
maxno:string;
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add('select * from KH_ZDY where ZdyNo='''+Trim(flag)+'''');
|
||||
open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into KH_ZDY(ZDYNo,ZDYName,Type,MainType) select :ZDYNo,:ZDYName,:Type,:MainType ');
|
||||
Parameters.ParamByName('ZDYNo').Value:=Trim(flag);
|
||||
Parameters.ParamByName('ZDYName').Value:=Trim(flagname);
|
||||
Parameters.ParamByName('Type').Value:='Main';
|
||||
Parameters.ParamByName('MainType').Value:=Trim(MainType);
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
First;
|
||||
while not eof do
|
||||
begin
|
||||
if Trim(ClientDataSet1.FieldByName('ZDYNO').AsString)='' then
|
||||
begin
|
||||
if GetLSNo(ADOQueryTemp,maxno,'SY','KH_ZDY',3,1)=False then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('取最大编号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
maxno:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
SQL.Add('delete KH_ZDY where ZDYNO='''+Trim(ClientDataSet1.fieldbyname('ZDYNO').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from KH_ZDY where 1<>1');
|
||||
Open;
|
||||
end;
|
||||
if Trim(ClientDataSet1.FieldByName('ZDYName').AsString)='' then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
ADOQueryCmd.Append;
|
||||
ADOQueryCmd.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ADOQueryCmd.FieldByName('ZDYName').Value:=ClientDataSet1.fieldbyname('ZDYName').AsString;
|
||||
ADOQueryCmd.FieldByName('note').Value:=Trim(snote);
|
||||
//ADOQueryCmd.FieldByName('orderno').Value:=ClientDataSet1.fieldbyname('Name').AsString;
|
||||
ADOQueryCmd.FieldByName('Type').Value:=flag;
|
||||
ADOQueryCmd.FieldByName('valid').Value:='Y';
|
||||
if Trim(MainType)<>'' then
|
||||
ADOQueryCmd.FieldByName('MainType').Value:=Trim(MainType);
|
||||
//ADOQueryCmd.FieldByName('sel').Value:=0;
|
||||
ADOQueryCmd.Post;
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ClientDataSet1.Post;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
Application.MessageBox('保存成功!','提示',0);
|
||||
except
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
// TV1.OptionsData.Editing:=False;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.TBDelClick(Sender: TObject);
|
||||
begin
|
||||
if ClientDataSet1.IsEmpty then Exit;
|
||||
if (Trim(ClientDataSet1.FieldByName('ZDYNo').AsString)<>'') or
|
||||
(Trim(ClientDataSet1.FieldByName('ZDYname').AsString)<>'') then
|
||||
begin
|
||||
if application.MessageBox('确定要删除吗?','提示信息',1)=2 then exit;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('delete KH_ZDY where ZDYNo='''+Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString)+'''');
|
||||
SQL.Add(' and Type='''+Trim(flag)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
ClientDataSet1.Delete;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=2;
|
||||
ZDYName.SetFocus;
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.FormShow(Sender: TObject);
|
||||
var
|
||||
fsj,fsj1:string;
|
||||
begin
|
||||
{if PPSTE=1 then
|
||||
begin
|
||||
Application.Terminate;
|
||||
Exit;
|
||||
end; }
|
||||
InitGrid();
|
||||
fsj:=Trim(flag)+'01';
|
||||
fsj1:=Trim(flagname)+'01';
|
||||
{if ClientDataSet1.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into KH_ZDY(ZDYNo,ZDYname,Type,note)');
|
||||
sql.Add('select '''+Trim(fsj)+'''');
|
||||
sql.Add(','''+Trim(fsj1)+'''');
|
||||
SQL.Add(','''+Trim(flag)+'''');
|
||||
sql.Add(','''+Trim(snote)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
InitGrid();
|
||||
end;}
|
||||
//frmZDYHelp.Caption:=Trim(flagname)+'<'+Trim(flag)+'>';
|
||||
frmZDYHelpSel.Caption:=Trim(flagname);
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
ReturnStr:='';
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
First;
|
||||
while not Eof do
|
||||
begin
|
||||
if FieldByName('SSel').AsBoolean=True then
|
||||
begin
|
||||
if JiangeStr<>99 then
|
||||
begin
|
||||
if FGStr<>'' then
|
||||
ReturnStr:=ReturnStr+Trim(fieldbyname('ZDYName').AsString)+FGStr
|
||||
else
|
||||
ReturnStr:=ReturnStr+Trim(fieldbyname('ZDYName').AsString)+';'
|
||||
end
|
||||
else
|
||||
ReturnStr:=ReturnStr+Trim(fieldbyname('ZDYName').AsString);
|
||||
end;
|
||||
Next;
|
||||
end;
|
||||
end;
|
||||
if JiangeStr<>99 then
|
||||
ReturnStr:=Copy(ReturnStr,1,Length(ReturnStr)-1);
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.TBEditClick(Sender: TObject);
|
||||
begin
|
||||
TV1.OptionsData.Editing:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.TV1CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
begin
|
||||
if TV1.OptionsData.Editing=False then
|
||||
begin
|
||||
ModalResult:=1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.ZDYNameChange(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryMain.Active then
|
||||
begin
|
||||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||||
SCreateCDS20(ADOQueryMain,ClientDataSet1);
|
||||
SInitCDSData20(ADOQueryMain,ClientDataSet1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZDYHelpSel.V1NamePropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
maxno,mvalue:string;
|
||||
begin
|
||||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||||
if Trim(mvalue)='' then
|
||||
begin
|
||||
//Application.MessageBox('名称不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
with ClientDataSet1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('ZdyName').Value:=Trim(mvalue);
|
||||
//Post;
|
||||
end;
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add('select * from KH_ZDY where ZdyNo='''+Trim(flag)+'''');
|
||||
open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into KH_ZDY(ZDYNo,ZDYName,Type,MainType) select :ZDYNo,:ZDYName,:Type,:MainType ');
|
||||
Parameters.ParamByName('ZDYNo').Value:=Trim(flag);
|
||||
Parameters.ParamByName('ZDYName').Value:=Trim(flagname);
|
||||
Parameters.ParamByName('Type').Value:='Main';
|
||||
Parameters.ParamByName('MainType').Value:=Trim(MainType);
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
//ClientDataSet1.DisableControls;
|
||||
//with ClientDataSet1 do
|
||||
//begin
|
||||
//First;
|
||||
//while not eof do
|
||||
//begin
|
||||
if Trim(ClientDataSet1.FieldByName('ZDYNO').AsString)='' then
|
||||
begin
|
||||
if GetLSNo(ADOQueryTemp,maxno,'SY','KH_ZDY',3,1)=False then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('取最大编号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
maxno:=Trim(ClientDataSet1.fieldbyname('ZDYNo').AsString);
|
||||
end;
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.add('select * from KH_Zdy where Type='''+Trim(flag)+'''');
|
||||
if Trim(MainType)<>'' then
|
||||
SQL.Add(' and MainType='''+Trim(MainType)+'''');
|
||||
sql.Add(' and ZdyName='''+Trim(ClientDataSet1.fieldbyname('ZdyName').AsString)+'''');
|
||||
Open;
|
||||
end;
|
||||
if ADOQueryTemp.IsEmpty=False then
|
||||
begin
|
||||
if ADOQueryTemp.RecordCount>1 then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString)='' then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end else
|
||||
begin
|
||||
if Trim(ADOQueryTemp.fieldbyname('ZdyNo').AsString)<>Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString) then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
//ClientDataSet1.EnableControls;
|
||||
Application.MessageBox('名称重复!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
SQL.Add('delete KH_ZDY where ZDYNO='''+Trim(ClientDataSet1.fieldbyname('ZDYNO').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('select * from KH_ZDY where 1<>1');
|
||||
Open;
|
||||
end;
|
||||
ADOQueryCmd.Append;
|
||||
ADOQueryCmd.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
ADOQueryCmd.FieldByName('ZDYName').Value:=ClientDataSet1.fieldbyname('ZDYName').AsString;
|
||||
ADOQueryCmd.FieldByName('note').Value:=Trim(snote);
|
||||
//ADOQueryCmd.FieldByName('orderno').Value:=ClientDataSet1.fieldbyname('Name').AsString;
|
||||
ADOQueryCmd.FieldByName('Type').Value:=flag;
|
||||
ADOQueryCmd.FieldByName('valid').Value:='Y';
|
||||
if Trim(MainType)<>'' then
|
||||
ADOQueryCmd.FieldByName('MainType').Value:=Trim(MainType);
|
||||
//ADOQueryCmd.FieldByName('sel').Value:=0;
|
||||
ADOQueryCmd.Post;
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName('ZDYNo').Value:=Trim(maxno);
|
||||
//ClientDataSet1.Post;
|
||||
// Next;
|
||||
//end;
|
||||
//end;
|
||||
// ClientDataSet1.EnableControls;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
//Application.MessageBox('保存成功!','提示',0);
|
||||
//TV1.OptionsData.Editing:=False;
|
||||
//TV1.OptionsSelection.CellSelect:=False;
|
||||
except
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!','提示',0);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
332
Z99Dependency/ThreeFun/Form/U_ZdyAttachGYSHelp.dfm
Normal file
|
|
@ -0,0 +1,332 @@
|
|||
object frmZdyAttachGYSHelp: TfrmZdyAttachGYSHelp
|
||||
Left = 328
|
||||
Top = 120
|
||||
Width = 1038
|
||||
Height = 618
|
||||
Align = alClient
|
||||
Caption = #20379#24212#21830#36164#26009#31649#29702
|
||||
Color = clBtnFace
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object ToolBar1: TToolBar
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 1022
|
||||
Height = 31
|
||||
ButtonHeight = 30
|
||||
ButtonWidth = 59
|
||||
Caption = 'ToolBar1'
|
||||
Color = clSkyBlue
|
||||
DisabledImages = DataLink_BaseInfo.ThreeImgList
|
||||
Flat = True
|
||||
Images = DataLink_BaseInfo.ThreeImgList
|
||||
List = True
|
||||
ParentColor = False
|
||||
ShowCaptions = True
|
||||
TabOrder = 0
|
||||
object TBRafresh: TToolButton
|
||||
Left = 0
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #21047#26032
|
||||
ImageIndex = 9
|
||||
OnClick = TBRafreshClick
|
||||
end
|
||||
object ToolButton2: TToolButton
|
||||
Left = 63
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #36807#28388
|
||||
ImageIndex = 59
|
||||
OnClick = ToolButton2Click
|
||||
end
|
||||
object ToolButton3: TToolButton
|
||||
Left = 126
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #26032#22686
|
||||
ImageIndex = 3
|
||||
Visible = False
|
||||
OnClick = ToolButton3Click
|
||||
end
|
||||
object ToolButton4: TToolButton
|
||||
Left = 189
|
||||
Top = 0
|
||||
Caption = #20462#25913
|
||||
ImageIndex = 54
|
||||
Visible = False
|
||||
OnClick = ToolButton4Click
|
||||
end
|
||||
object TBDel: TToolButton
|
||||
Left = 248
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #21024#38500
|
||||
ImageIndex = 17
|
||||
Visible = False
|
||||
OnClick = TBDelClick
|
||||
end
|
||||
object ToolButton1: TToolButton
|
||||
Left = 311
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #23548#20986
|
||||
ImageIndex = 53
|
||||
OnClick = ToolButton1Click
|
||||
end
|
||||
object TBClose: TToolButton
|
||||
Left = 374
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #20851#38381
|
||||
ImageIndex = 55
|
||||
OnClick = TBCloseClick
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 31
|
||||
Width = 1022
|
||||
Height = 39
|
||||
Align = alTop
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
Color = clSkyBlue
|
||||
TabOrder = 1
|
||||
object Label3: TLabel
|
||||
Left = 203
|
||||
Top = 13
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #20379#24212#21830#21517#31216
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 22
|
||||
Top = 13
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #20379#24212#21830#32534#21495
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 395
|
||||
Top = 13
|
||||
Width = 24
|
||||
Height = 12
|
||||
Caption = #31867#22411
|
||||
end
|
||||
object ZdyName: TEdit
|
||||
Tag = 2
|
||||
Left = 267
|
||||
Top = 9
|
||||
Width = 89
|
||||
Height = 20
|
||||
TabOrder = 0
|
||||
OnChange = ZdyNameChange
|
||||
end
|
||||
object ZdyCode: TEdit
|
||||
Tag = 2
|
||||
Left = 83
|
||||
Top = 9
|
||||
Width = 89
|
||||
Height = 20
|
||||
TabOrder = 1
|
||||
OnChange = ZdyNameChange
|
||||
end
|
||||
object DEFstr5: TComboBox
|
||||
Tag = 1
|
||||
Left = 424
|
||||
Top = 8
|
||||
Width = 81
|
||||
Height = 20
|
||||
Style = csDropDownList
|
||||
ItemHeight = 12
|
||||
TabOrder = 2
|
||||
OnChange = ZdyNameChange
|
||||
Items.Strings = (
|
||||
#22383#24067
|
||||
#21152#24037#21378)
|
||||
end
|
||||
end
|
||||
object cxGrid2: TcxGrid
|
||||
Left = 0
|
||||
Top = 70
|
||||
Width = 1022
|
||||
Height = 509
|
||||
Align = alClient
|
||||
TabOrder = 2
|
||||
object Tv2: TcxGridDBTableView
|
||||
OnDblClick = Tv2DblClick
|
||||
NavigatorButtons.ConfirmDelete = False
|
||||
NavigatorButtons.Delete.Enabled = False
|
||||
NavigatorButtons.Delete.Visible = False
|
||||
DataController.DataSource = DS_HZ
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <
|
||||
item
|
||||
Kind = skSum
|
||||
end
|
||||
item
|
||||
Kind = skSum
|
||||
end
|
||||
item
|
||||
Kind = skSum
|
||||
end>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsBehavior.GoToNextCellOnEnter = True
|
||||
OptionsCustomize.ColumnFiltering = False
|
||||
OptionsData.Deleting = False
|
||||
OptionsData.DeletingConfirmation = False
|
||||
OptionsSelection.CellSelect = False
|
||||
OptionsView.Footer = True
|
||||
OptionsView.GroupByBox = False
|
||||
Styles.Inactive = DataLink_BaseInfo.SHuangSe
|
||||
Styles.IncSearch = DataLink_BaseInfo.SHuangSe
|
||||
Styles.Selection = DataLink_BaseInfo.SHuangSe
|
||||
Styles.Header = DataLink_BaseInfo.handBlack
|
||||
object v2Column6: TcxGridDBColumn
|
||||
Caption = #20379#24212#21830#21517#31216
|
||||
DataBinding.FieldName = 'ZdyName'
|
||||
PropertiesClassName = 'TcxButtonEditProperties'
|
||||
Properties.Buttons = <
|
||||
item
|
||||
Default = True
|
||||
Kind = bkEllipsis
|
||||
end>
|
||||
Properties.ReadOnly = True
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Options.Focusing = False
|
||||
Width = 124
|
||||
end
|
||||
object v2Column2: TcxGridDBColumn
|
||||
Caption = #20379#24212#21830#32534#21495
|
||||
DataBinding.FieldName = 'ZdyCode'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 80
|
||||
end
|
||||
object v2Column8: TcxGridDBColumn
|
||||
Caption = #31867#22411
|
||||
DataBinding.FieldName = 'DEFstr5'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 77
|
||||
end
|
||||
object v2Column3: TcxGridDBColumn
|
||||
Caption = #30005#35805
|
||||
DataBinding.FieldName = 'DEFstr1'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 72
|
||||
end
|
||||
object v2Column4: TcxGridDBColumn
|
||||
Caption = #25163#26426
|
||||
DataBinding.FieldName = 'DEFstr2'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 74
|
||||
end
|
||||
object v2Column5: TcxGridDBColumn
|
||||
Caption = #20256#30495
|
||||
DataBinding.FieldName = 'DEFstr3'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 68
|
||||
end
|
||||
object v2Column7: TcxGridDBColumn
|
||||
Caption = #20844#21496#22320#22336
|
||||
DataBinding.FieldName = 'DEFNote1'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 69
|
||||
end
|
||||
object v2Column9: TcxGridDBColumn
|
||||
Caption = #32852#31995#20154
|
||||
DataBinding.FieldName = 'DEFstr4'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 73
|
||||
end
|
||||
object v2Column1: TcxGridDBColumn
|
||||
Caption = #22791#27880
|
||||
DataBinding.FieldName = 'Note'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 114
|
||||
end
|
||||
end
|
||||
object cxGridLevel1: TcxGridLevel
|
||||
GridView = Tv2
|
||||
end
|
||||
end
|
||||
object ADOQueryTemp: TADOQuery
|
||||
Connection = DataLink_BaseInfo.ADOLink
|
||||
LockType = ltReadOnly
|
||||
Parameters = <>
|
||||
Left = 789
|
||||
Top = 9
|
||||
end
|
||||
object ADOQueryCmd: TADOQuery
|
||||
Connection = DataLink_BaseInfo.ADOLink
|
||||
Parameters = <>
|
||||
Left = 829
|
||||
Top = 1
|
||||
end
|
||||
object ADOQueryMain: TADOQuery
|
||||
Connection = DataLink_BaseInfo.ADOLink
|
||||
LockType = ltReadOnly
|
||||
Parameters = <>
|
||||
Left = 949
|
||||
Top = 225
|
||||
end
|
||||
object RM1: TRMGridReport
|
||||
ThreadPrepareReport = True
|
||||
InitialZoom = pzDefault
|
||||
PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbExport, pbNavigator]
|
||||
DefaultCollate = False
|
||||
SaveReportOptions.RegistryPath = 'Software\ReportMachine\ReportSettings\'
|
||||
PreviewOptions.RulerUnit = rmutScreenPixels
|
||||
PreviewOptions.RulerVisible = False
|
||||
PreviewOptions.DrawBorder = False
|
||||
PreviewOptions.BorderPen.Color = clGray
|
||||
PreviewOptions.BorderPen.Style = psDash
|
||||
Dataset = RMDB_Main
|
||||
CompressLevel = rmzcFastest
|
||||
CompressThread = False
|
||||
LaterBuildEvents = True
|
||||
OnlyOwnerDataSet = False
|
||||
Left = 864
|
||||
Top = 224
|
||||
ReportData = {}
|
||||
end
|
||||
object RMDB_Main: TRMDBDataSet
|
||||
Visible = True
|
||||
Left = 928
|
||||
Top = 216
|
||||
end
|
||||
object cxGridPopupMenu2: TcxGridPopupMenu
|
||||
Grid = cxGrid2
|
||||
PopupMenus = <>
|
||||
Left = 888
|
||||
Top = 224
|
||||
end
|
||||
object DS_HZ: TDataSource
|
||||
DataSet = CDS_HZ
|
||||
Left = 899
|
||||
Top = 235
|
||||
end
|
||||
object CDS_HZ: TClientDataSet
|
||||
Aggregates = <>
|
||||
Params = <>
|
||||
Left = 872
|
||||
Top = 224
|
||||
end
|
||||
end
|
||||
213
Z99Dependency/ThreeFun/Form/U_ZdyAttachGYSHelp.pas
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
unit U_ZdyAttachGYSHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
|
||||
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||||
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
|
||||
cxButtonEdit, cxTextEdit;
|
||||
|
||||
type
|
||||
TfrmZdyAttachGYSHelp = class(TForm)
|
||||
ToolBar1: TToolBar;
|
||||
TBRafresh: TToolButton;
|
||||
TBDel: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
Panel1: TPanel;
|
||||
ToolButton2: TToolButton;
|
||||
ADOQueryMain: TADOQuery;
|
||||
ToolButton1: TToolButton;
|
||||
RM1: TRMGridReport;
|
||||
RMDB_Main: TRMDBDataSet;
|
||||
Label3: TLabel;
|
||||
ZdyName: TEdit;
|
||||
cxGrid2: TcxGrid;
|
||||
Tv2: TcxGridDBTableView;
|
||||
cxGridLevel1: TcxGridLevel;
|
||||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||||
DS_HZ: TDataSource;
|
||||
CDS_HZ: TClientDataSet;
|
||||
ToolButton3: TToolButton;
|
||||
v2Column6: TcxGridDBColumn;
|
||||
v2Column1: TcxGridDBColumn;
|
||||
v2Column2: TcxGridDBColumn;
|
||||
v2Column3: TcxGridDBColumn;
|
||||
v2Column4: TcxGridDBColumn;
|
||||
v2Column5: TcxGridDBColumn;
|
||||
v2Column7: TcxGridDBColumn;
|
||||
v2Column9: TcxGridDBColumn;
|
||||
Label1: TLabel;
|
||||
ZdyCode: TEdit;
|
||||
ToolButton4: TToolButton;
|
||||
v2Column8: TcxGridDBColumn;
|
||||
Label2: TLabel;
|
||||
DEFstr5: TComboBox;
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure TBDelClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure TBRafreshClick(Sender: TObject);
|
||||
procedure ToolButton2Click(Sender: TObject);
|
||||
procedure ZdyNameChange(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure ToolButton4Click(Sender: TObject);
|
||||
procedure ToolButton3Click(Sender: TObject);
|
||||
procedure Tv2DblClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
procedure InitGrid();
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
frmZdyAttachGYSHelp: TfrmZdyAttachGYSHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_Fun,U_ZDYHelp;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.InitGrid();
|
||||
begin
|
||||
try
|
||||
ADOQueryMain.DisableControls;
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
Filtered:=False;
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add(' select * from KH_Zdy_Attachment where Type=''GYS'' ');
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmZdyAttachGYSHelp:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
WriteCxGrid('供应商资料',Tv2);
|
||||
Close;
|
||||
end;
|
||||
procedure TfrmZdyAttachGYSHelp.TBDelClick(Sender: TObject);
|
||||
begin
|
||||
{ if CDS_HZ.IsEmpty then Exit;
|
||||
if Application.MessageBox('确定要删除数据吗?','提示',32+4)<>IDYES then Exit;
|
||||
if Trim(CDS_HZ.fieldbyname('ATID').AsString)<>'' then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('delete KH_Zdy_Attachment where ATID='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
|
||||
sql.Add('delete KH_Zdy where ZdyNo='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
CDS_HZ.Delete;}
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.FormShow(Sender: TObject);
|
||||
begin
|
||||
ReadCxGrid('供应商资料',Tv2);
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.TBRafreshClick(Sender: TObject);
|
||||
begin
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.ToolButton2Click(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryMain.Active then
|
||||
begin
|
||||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.ZdyNameChange(Sender: TObject);
|
||||
begin
|
||||
ToolButton2.Click;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryMain.IsEmpty then Exit;
|
||||
SelExportData(Tv2,ADOQueryMain,'客户资料列表');
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.ToolButton4Click(Sender: TObject);
|
||||
begin
|
||||
{ try
|
||||
frmZdyAttInputGYS:=TfrmZdyAttInputGYS.Create(Application);
|
||||
with frmZdyAttInputGYS do
|
||||
begin
|
||||
FCYID:=Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
|
||||
if ShowModal=1 then
|
||||
begin
|
||||
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
frmZdyAttInputGYS.Free;
|
||||
end; }
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.ToolButton3Click(Sender: TObject);
|
||||
begin
|
||||
{ try
|
||||
frmZdyAttInputGYS:=TfrmZdyAttInputGYS.Create(Application);
|
||||
with frmZdyAttInputGYS do
|
||||
begin
|
||||
FCYID:='';
|
||||
if ShowModal=1 then
|
||||
begin
|
||||
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
frmZdyAttInputGYS.Free;
|
||||
end; }
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachGYSHelp.Tv2DblClick(Sender: TObject);
|
||||
begin
|
||||
if CDS_HZ.IsEmpty then exit;
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
||||
332
Z99Dependency/ThreeFun/Form/U_ZdyAttachmentHelp.dfm
Normal file
|
|
@ -0,0 +1,332 @@
|
|||
object frmZdyAttachmentHelp: TfrmZdyAttachmentHelp
|
||||
Left = 157
|
||||
Top = 76
|
||||
Width = 1064
|
||||
Height = 652
|
||||
Caption = #23458#25143#36164#26009#31649#29702
|
||||
Color = clBtnFace
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
OnClose = FormClose
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object ToolBar1: TToolBar
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 1048
|
||||
Height = 31
|
||||
ButtonHeight = 30
|
||||
ButtonWidth = 59
|
||||
Caption = 'ToolBar1'
|
||||
Color = clSkyBlue
|
||||
DisabledImages = DataLink_TradeManage.ThreeImgList
|
||||
Flat = True
|
||||
Images = DataLink_TradeManage.ThreeImgList
|
||||
List = True
|
||||
ParentColor = False
|
||||
ShowCaptions = True
|
||||
TabOrder = 0
|
||||
object TBRafresh: TToolButton
|
||||
Left = 0
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #21047#26032
|
||||
ImageIndex = 9
|
||||
OnClick = TBRafreshClick
|
||||
end
|
||||
object ToolButton2: TToolButton
|
||||
Left = 63
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #36807#28388
|
||||
ImageIndex = 59
|
||||
OnClick = ToolButton2Click
|
||||
end
|
||||
object ToolButton3: TToolButton
|
||||
Left = 126
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #26032#22686
|
||||
ImageIndex = 3
|
||||
Visible = False
|
||||
end
|
||||
object ToolButton4: TToolButton
|
||||
Left = 189
|
||||
Top = 0
|
||||
Caption = #20462#25913
|
||||
ImageIndex = 54
|
||||
Visible = False
|
||||
OnClick = ToolButton4Click
|
||||
end
|
||||
object TBDel: TToolButton
|
||||
Left = 248
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #21024#38500
|
||||
ImageIndex = 17
|
||||
Visible = False
|
||||
OnClick = TBDelClick
|
||||
end
|
||||
object ToolButton1: TToolButton
|
||||
Left = 311
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #23548#20986
|
||||
ImageIndex = 53
|
||||
Visible = False
|
||||
OnClick = ToolButton1Click
|
||||
end
|
||||
object TBClose: TToolButton
|
||||
Left = 374
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #20851#38381
|
||||
ImageIndex = 55
|
||||
OnClick = TBCloseClick
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 31
|
||||
Width = 1048
|
||||
Height = 39
|
||||
Align = alTop
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
Color = clSkyBlue
|
||||
TabOrder = 1
|
||||
object Label3: TLabel
|
||||
Left = 190
|
||||
Top = 13
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #23458#25143#21517#31216
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 22
|
||||
Top = 13
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #23458#25143#32534#21495
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 350
|
||||
Top = 13
|
||||
Width = 36
|
||||
Height = 12
|
||||
Caption = #19994#21153#21592
|
||||
end
|
||||
object ZdyName: TEdit
|
||||
Tag = 2
|
||||
Left = 238
|
||||
Top = 9
|
||||
Width = 89
|
||||
Height = 20
|
||||
TabOrder = 0
|
||||
OnChange = ZdyNameChange
|
||||
end
|
||||
object ZdyCode: TEdit
|
||||
Tag = 2
|
||||
Left = 70
|
||||
Top = 9
|
||||
Width = 89
|
||||
Height = 20
|
||||
TabOrder = 1
|
||||
OnChange = ZdyNameChange
|
||||
end
|
||||
object DEFstr5: TEdit
|
||||
Tag = 2
|
||||
Left = 388
|
||||
Top = 9
|
||||
Width = 89
|
||||
Height = 20
|
||||
TabOrder = 2
|
||||
OnChange = ZdyNameChange
|
||||
end
|
||||
end
|
||||
object cxGrid2: TcxGrid
|
||||
Left = 0
|
||||
Top = 70
|
||||
Width = 1048
|
||||
Height = 544
|
||||
Align = alClient
|
||||
TabOrder = 2
|
||||
object Tv2: TcxGridDBTableView
|
||||
NavigatorButtons.ConfirmDelete = False
|
||||
NavigatorButtons.Delete.Enabled = False
|
||||
NavigatorButtons.Delete.Visible = False
|
||||
OnCellDblClick = Tv2CellDblClick
|
||||
DataController.DataSource = DS_HZ
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <
|
||||
item
|
||||
Kind = skSum
|
||||
end
|
||||
item
|
||||
Kind = skSum
|
||||
end
|
||||
item
|
||||
Kind = skSum
|
||||
end>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsBehavior.GoToNextCellOnEnter = True
|
||||
OptionsCustomize.ColumnFiltering = False
|
||||
OptionsData.Deleting = False
|
||||
OptionsData.DeletingConfirmation = False
|
||||
OptionsSelection.CellSelect = False
|
||||
OptionsView.Footer = True
|
||||
OptionsView.GroupByBox = False
|
||||
Styles.Inactive = DataLink_TradeManage.SHuangSe
|
||||
Styles.IncSearch = DataLink_TradeManage.SHuangSe
|
||||
Styles.Selection = DataLink_TradeManage.SHuangSe
|
||||
Styles.Header = DataLink_TradeManage.handBlack
|
||||
object v2Column2: TcxGridDBColumn
|
||||
Caption = #23458#25143#32534#21495
|
||||
DataBinding.FieldName = 'ZdyCode'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 86
|
||||
end
|
||||
object v2Column6: TcxGridDBColumn
|
||||
Caption = #23458#25143#21517#31216
|
||||
DataBinding.FieldName = 'ZdyName'
|
||||
PropertiesClassName = 'TcxButtonEditProperties'
|
||||
Properties.Buttons = <
|
||||
item
|
||||
Default = True
|
||||
Kind = bkEllipsis
|
||||
end>
|
||||
Properties.ReadOnly = True
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Options.Focusing = False
|
||||
Width = 127
|
||||
end
|
||||
object v2Column10: TcxGridDBColumn
|
||||
Caption = #19994#21153#21592
|
||||
DataBinding.FieldName = 'DEFstr5'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 56
|
||||
end
|
||||
object v2Column3: TcxGridDBColumn
|
||||
Caption = #30005#35805
|
||||
DataBinding.FieldName = 'DEFstr1'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 71
|
||||
end
|
||||
object v2Column4: TcxGridDBColumn
|
||||
Caption = #25163#26426
|
||||
DataBinding.FieldName = 'DEFstr2'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 74
|
||||
end
|
||||
object v2Column5: TcxGridDBColumn
|
||||
Caption = #20256#30495
|
||||
DataBinding.FieldName = 'DEFstr3'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 68
|
||||
end
|
||||
object v2Column7: TcxGridDBColumn
|
||||
Caption = #20844#21496#22320#22336
|
||||
DataBinding.FieldName = 'DEFNote1'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 67
|
||||
end
|
||||
object v2Column8: TcxGridDBColumn
|
||||
Caption = #21457#36135#22320#22336
|
||||
DataBinding.FieldName = 'DEFNote2'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 72
|
||||
end
|
||||
object v2Column9: TcxGridDBColumn
|
||||
Caption = #32852#31995#20154
|
||||
DataBinding.FieldName = 'DEFstr4'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 73
|
||||
end
|
||||
object v2Column1: TcxGridDBColumn
|
||||
Caption = #22791#27880
|
||||
DataBinding.FieldName = 'Note'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 165
|
||||
end
|
||||
end
|
||||
object cxGridLevel1: TcxGridLevel
|
||||
GridView = Tv2
|
||||
end
|
||||
end
|
||||
object ADOQueryTemp: TADOQuery
|
||||
Connection = DataLink_TradeManage.ADOLink
|
||||
LockType = ltReadOnly
|
||||
Parameters = <>
|
||||
Left = 789
|
||||
Top = 9
|
||||
end
|
||||
object ADOQueryCmd: TADOQuery
|
||||
Connection = DataLink_TradeManage.ADOLink
|
||||
Parameters = <>
|
||||
Left = 829
|
||||
Top = 1
|
||||
end
|
||||
object ADOQueryMain: TADOQuery
|
||||
Connection = DataLink_TradeManage.ADOLink
|
||||
LockType = ltReadOnly
|
||||
Parameters = <>
|
||||
Left = 949
|
||||
Top = 225
|
||||
end
|
||||
object RM1: TRMGridReport
|
||||
ThreadPrepareReport = True
|
||||
InitialZoom = pzDefault
|
||||
PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbExport, pbNavigator]
|
||||
DefaultCollate = False
|
||||
SaveReportOptions.RegistryPath = 'Software\ReportMachine\ReportSettings\'
|
||||
PreviewOptions.RulerUnit = rmutScreenPixels
|
||||
PreviewOptions.RulerVisible = False
|
||||
PreviewOptions.DrawBorder = False
|
||||
PreviewOptions.BorderPen.Color = clGray
|
||||
PreviewOptions.BorderPen.Style = psDash
|
||||
Dataset = RMDB_Main
|
||||
CompressLevel = rmzcFastest
|
||||
CompressThread = False
|
||||
LaterBuildEvents = True
|
||||
OnlyOwnerDataSet = False
|
||||
Left = 864
|
||||
Top = 224
|
||||
ReportData = {}
|
||||
end
|
||||
object RMDB_Main: TRMDBDataSet
|
||||
Visible = True
|
||||
Left = 928
|
||||
Top = 216
|
||||
end
|
||||
object cxGridPopupMenu2: TcxGridPopupMenu
|
||||
Grid = cxGrid2
|
||||
PopupMenus = <>
|
||||
Left = 888
|
||||
Top = 224
|
||||
end
|
||||
object DS_HZ: TDataSource
|
||||
DataSet = CDS_HZ
|
||||
Left = 899
|
||||
Top = 235
|
||||
end
|
||||
object CDS_HZ: TClientDataSet
|
||||
Aggregates = <>
|
||||
Params = <>
|
||||
Left = 872
|
||||
Top = 224
|
||||
end
|
||||
end
|
||||
201
Z99Dependency/ThreeFun/Form/U_ZdyAttachmentHelp.pas
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
unit U_ZdyAttachmentHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
|
||||
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||||
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
|
||||
cxButtonEdit, cxTextEdit;
|
||||
|
||||
type
|
||||
TfrmZdyAttachmentHelp = class(TForm)
|
||||
ToolBar1: TToolBar;
|
||||
TBRafresh: TToolButton;
|
||||
TBDel: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
Panel1: TPanel;
|
||||
ToolButton2: TToolButton;
|
||||
ADOQueryMain: TADOQuery;
|
||||
ToolButton1: TToolButton;
|
||||
RM1: TRMGridReport;
|
||||
RMDB_Main: TRMDBDataSet;
|
||||
Label3: TLabel;
|
||||
ZdyName: TEdit;
|
||||
cxGrid2: TcxGrid;
|
||||
Tv2: TcxGridDBTableView;
|
||||
cxGridLevel1: TcxGridLevel;
|
||||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||||
DS_HZ: TDataSource;
|
||||
CDS_HZ: TClientDataSet;
|
||||
ToolButton3: TToolButton;
|
||||
v2Column6: TcxGridDBColumn;
|
||||
v2Column1: TcxGridDBColumn;
|
||||
v2Column2: TcxGridDBColumn;
|
||||
v2Column3: TcxGridDBColumn;
|
||||
v2Column4: TcxGridDBColumn;
|
||||
v2Column5: TcxGridDBColumn;
|
||||
v2Column7: TcxGridDBColumn;
|
||||
v2Column8: TcxGridDBColumn;
|
||||
v2Column9: TcxGridDBColumn;
|
||||
Label1: TLabel;
|
||||
ZdyCode: TEdit;
|
||||
v2Column10: TcxGridDBColumn;
|
||||
ToolButton4: TToolButton;
|
||||
Label2: TLabel;
|
||||
DEFstr5: TEdit;
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure TBDelClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure TBRafreshClick(Sender: TObject);
|
||||
procedure ToolButton2Click(Sender: TObject);
|
||||
procedure ZdyNameChange(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure ToolButton4Click(Sender: TObject);
|
||||
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
private
|
||||
{ Private declarations }
|
||||
procedure InitGrid();
|
||||
|
||||
public
|
||||
fkhType:string;
|
||||
end;
|
||||
|
||||
var
|
||||
frmZdyAttachmentHelp: TfrmZdyAttachmentHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_DataLink,U_Fun,U_ZDYHelp;
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.InitGrid();
|
||||
begin
|
||||
try
|
||||
ADOQueryMain.DisableControls;
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
Filtered:=False;
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add(' select * from KH_Zdy_Attachment where Type=''KHName'' ');
|
||||
sql.Add(' and isnull(khType,'''')='+quotedstr(trim(fkhType)));
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmZdyAttachmentHelp:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
WriteCxGrid('客户资料',Tv2,'客户自定义');
|
||||
Close;
|
||||
end;
|
||||
procedure TfrmZdyAttachmentHelp.TBDelClick(Sender: TObject);
|
||||
begin
|
||||
{ if CDS_HZ.IsEmpty then Exit;
|
||||
if Application.MessageBox('确定要删除数据吗?','提示',32+4)<>IDYES then Exit;
|
||||
if Trim(CDS_HZ.fieldbyname('ATID').AsString)<>'' then
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add('delete KH_Zdy_Attachment where ATID='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
|
||||
sql.Add('delete KH_Zdy where ZdyNo='''+Trim(CDS_HZ.fieldbyname('ATID').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
CDS_HZ.Delete; }
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.FormShow(Sender: TObject);
|
||||
begin
|
||||
ReadCxGrid('客户资料',Tv2,'客户自定义');
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.TBRafreshClick(Sender: TObject);
|
||||
begin
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.ToolButton2Click(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryMain.Active then
|
||||
begin
|
||||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.ZdyNameChange(Sender: TObject);
|
||||
begin
|
||||
ToolButton2.Click;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryMain.IsEmpty then Exit;
|
||||
SelExportData(Tv2,ADOQueryMain,'客户资料列表');
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.ToolButton4Click(Sender: TObject);
|
||||
begin
|
||||
{ try
|
||||
frmZdyAttInput:=TfrmZdyAttInput.Create(Application);
|
||||
with frmZdyAttInput do
|
||||
begin
|
||||
FCYID:=Trim(Self.CDS_HZ.fieldbyname('ATID').AsString);
|
||||
if ShowModal=1 then
|
||||
begin
|
||||
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
frmZdyAttInput.Free;
|
||||
end; }
|
||||
end;
|
||||
|
||||
procedure TfrmZdyAttachmentHelp.Tv2CellDblClick(Sender: TcxCustomGridTableView;
|
||||
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
||||
AShift: TShiftState; var AHandled: Boolean);
|
||||
begin
|
||||
if CDS_HZ.IsEmpty then exit;
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
||||
1944
Z99Dependency/ThreeFun/Fun/SPCOMM.PAS
Normal file
108
Z99Dependency/ThreeFun/Fun/U_CompressionFun.pas
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
unit U_CompressionFun;
|
||||
|
||||
interface
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ComCtrls, ToolWin, ShlObj, cxShellCommon, cxControls,
|
||||
cxContainer, cxShellTreeView, cxShellListView, StdCtrls, BtnEdit,
|
||||
OleCtnrs, DB, ADODB,ZLib;
|
||||
|
||||
|
||||
procedure CompressionStream(var ASrcStream:TMemoryStream;ACompressionLevel:Integer = 2);
|
||||
procedure UnCompressionStream(var ASrcStream:TMemoryStream);
|
||||
procedure GetFileInfo(mFile:string;var mfileSize:integer;var CreationTime:tdatetime;var WriteTime:tdatetime);
|
||||
function CovFileDate(Fd:_FileTime):TDateTime;
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
|
||||
procedure GetFileInfo(mFile:string;var mfileSize:integer;var CreationTime:tdatetime;var WriteTime:tdatetime);
|
||||
var
|
||||
vSearchRec: TSearchRec;
|
||||
begin
|
||||
FindFirst(mFile,faAnyFile,vSearchRec);
|
||||
mfileSize:=vSearchRec.Size;
|
||||
CreationTime:=CovFileDate(vSearchRec.FindData.ftCreationTime);//创建时间
|
||||
//vSearchRec.FindData.ftLastAccessTime//访问时间
|
||||
WriteTime:=CovFileDate(vSearchRec.FindData.ftLastWriteTime);//修改时间
|
||||
FindClose(vSearchRec);
|
||||
end;
|
||||
function CovFileDate(Fd:_FileTime):TDateTime;
|
||||
var
|
||||
Tct:_SystemTime;
|
||||
Temp:_FileTime;
|
||||
begin
|
||||
FileTimeToLocalFileTime(Fd,Temp);
|
||||
FileTimeToSystemTime(Temp,Tct);
|
||||
CovFileDate:=SystemTimeToDateTime(Tct);
|
||||
end;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
///////压缩流
|
||||
////////////////////////////////////////////////////
|
||||
procedure CompressionStream(var ASrcStream:TMemoryStream;ACompressionLevel:Integer = 2);
|
||||
var
|
||||
nDestStream:TMemoryStream;
|
||||
nTmpStream:TCompressionStream;
|
||||
nCompressionLevel:TCompressionLevel;
|
||||
begin
|
||||
ASrcStream.Position := 0;
|
||||
nDestStream := TMemoryStream.Create;
|
||||
try
|
||||
//级别
|
||||
case ACompressionLevel of
|
||||
0:nCompressionLevel := clNone;
|
||||
1:nCompressionLevel := clFastest;
|
||||
2:nCompressionLevel := clDefault;
|
||||
3:nCompressionLevel := clMax;
|
||||
else
|
||||
nCompressionLevel := clMax;
|
||||
end;
|
||||
//开始压缩
|
||||
nTmpStream := TCompressionStream.Create(nCompressionLevel,nDestStream);
|
||||
try
|
||||
ASrcStream.SaveToStream(nTmpStream);
|
||||
finally
|
||||
nTmpStream.Free;//释放后nDestStream才会有数据
|
||||
end;
|
||||
ASrcStream.Clear;
|
||||
ASrcStream.LoadFromStream(nDestStream);
|
||||
ASrcStream.Position := 0;
|
||||
finally
|
||||
nDestStream.Clear;
|
||||
nDestStream.Free;
|
||||
end;
|
||||
end;
|
||||
////////////////////////////////////////////////////
|
||||
///////解压缩流
|
||||
////////////////////////////////////////////////////
|
||||
procedure UnCompressionStream(var ASrcStream:TMemoryStream);
|
||||
var
|
||||
nTmpStream:TDecompressionStream;
|
||||
nDestStream:TMemoryStream;
|
||||
nBuf: array[1..512] of Byte;
|
||||
nSrcCount: integer;
|
||||
begin
|
||||
ASrcStream.Position := 0;
|
||||
nDestStream := TMemoryStream.Create;
|
||||
nTmpStream := TDecompressionStream.Create(ASrcStream);
|
||||
try
|
||||
repeat
|
||||
//读入实际大小
|
||||
nSrcCount := nTmpStream.Read(nBuf, SizeOf(nBuf));
|
||||
if nSrcCount > 0 then
|
||||
nDestStream.Write(nBuf, nSrcCount);
|
||||
until (nSrcCount = 0);
|
||||
ASrcStream.Clear;
|
||||
ASrcStream.LoadFromStream(nDestStream);
|
||||
ASrcStream.Position := 0;
|
||||
finally
|
||||
nDestStream.Clear;
|
||||
nDestStream.Free;
|
||||
nTmpStream.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
4292
Z99Dependency/ThreeFun/Fun/U_Fun.pas
Normal file
3600
Z99Dependency/ThreeFun/Fun/U_Fun10.pas
Normal file
3840
Z99Dependency/ThreeFun/Fun/U_RTFun.pas
Normal file
104
Z99Dependency/ThreeFun/Fun/U_SelExportField.dfm
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
object frmSelExportField: TfrmSelExportField
|
||||
Left = 458
|
||||
Top = 108
|
||||
BorderStyle = bsDialog
|
||||
Caption = #23383#27573#23548#20986#36873#25321
|
||||
ClientHeight = 507
|
||||
ClientWidth = 427
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Button1: TButton
|
||||
Left = 94
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 243
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #20851#38381
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object cxGrid1: TcxGrid
|
||||
Left = 329
|
||||
Top = 151
|
||||
Width = 200
|
||||
Height = 162
|
||||
TabOrder = 2
|
||||
Visible = False
|
||||
object ExpGrid: TcxGridDBTableView
|
||||
NavigatorButtons.ConfirmDelete = False
|
||||
DataController.DataSource = ExportDataSource
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsBehavior.AlwaysShowEditor = True
|
||||
OptionsView.GroupByBox = False
|
||||
end
|
||||
object cxGrid1Level1: TcxGridLevel
|
||||
GridView = ExpGrid
|
||||
end
|
||||
end
|
||||
object Panel2: TScrollBox
|
||||
Left = 2
|
||||
Top = 0
|
||||
Width = 423
|
||||
Height = 438
|
||||
HorzScrollBar.Visible = False
|
||||
Color = clSkyBlue
|
||||
ParentColor = False
|
||||
TabOrder = 3
|
||||
object Label4: TLabel
|
||||
Left = 158
|
||||
Top = 9
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #23383#27573#36873#25321
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clRed
|
||||
Font.Height = -14
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 20
|
||||
Top = 449
|
||||
Width = 49
|
||||
Height = 17
|
||||
Caption = #20840#36873
|
||||
TabOrder = 4
|
||||
OnClick = CheckBox1Click
|
||||
end
|
||||
object CheckBox2: TCheckBox
|
||||
Left = 20
|
||||
Top = 465
|
||||
Width = 49
|
||||
Height = 17
|
||||
Caption = #20840#24323
|
||||
TabOrder = 5
|
||||
OnClick = CheckBox2Click
|
||||
end
|
||||
object ExportDataSource: TDataSource
|
||||
Left = 424
|
||||
Top = 233
|
||||
end
|
||||
end
|
||||
277
Z99Dependency/ThreeFun/Fun/U_SelExportField.pas
Normal file
|
|
@ -0,0 +1,277 @@
|
|||
unit U_SelExportField;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, RM_FormReport, RM_PDBGrid,
|
||||
DB,IniFiles, RM_Common, RM_Class, RM_e_Xls, cxStyles, cxCustomData,
|
||||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
|
||||
cxGridLevel, cxClasses, cxControls, cxGridCustomView,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid;
|
||||
|
||||
type
|
||||
TfrmSelExportField = class(TForm)
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
ExportDataSource: TDataSource;
|
||||
ExpGrid: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
Panel2: TScrollBox;
|
||||
Label4: TLabel;
|
||||
CheckBox1: TCheckBox;
|
||||
CheckBox2: TCheckBox;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure CheckBox1Click(Sender: TObject);
|
||||
procedure CheckBox2Click(Sender: TObject);
|
||||
private
|
||||
procedure CreateCheckBox();
|
||||
procedure ExportData();
|
||||
procedure ReadINIFile(fieldname:string);
|
||||
procedure WriteINIFile(fieldname:string);
|
||||
Function IsINIFile(fieldname:string):Boolean;
|
||||
procedure GetExportFields();
|
||||
procedure IsCheck();
|
||||
{ Private declarations }
|
||||
public
|
||||
ExportFields,IniName:string;
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmSelExportField: TfrmSelExportField;
|
||||
|
||||
implementation
|
||||
|
||||
uses U_Fun;
|
||||
|
||||
{$R *.dfm}
|
||||
procedure TfrmSelExportField.CreateCheckBox();
|
||||
var
|
||||
i,j,FTop,FLeft,Fdiv,FMod,z:Integer;// mod 余数,div商
|
||||
FCheckBox:TCheckBox;
|
||||
begin
|
||||
z:=0;
|
||||
for i:=0 to ExpGrid.ColumnCount-1 do
|
||||
begin
|
||||
if ExpGrid.Columns[i].Visible=True then
|
||||
begin
|
||||
Fdiv:=(z+1) div 3;
|
||||
FMod:=(z+1) mod 3;
|
||||
FCheckBox:=TCheckBox.Create(Self);
|
||||
FCheckBox.Caption:=Trim(ExpGrid.Columns[i].Caption);
|
||||
FCheckBox.Tag:=i;
|
||||
FCheckBox.Parent:=Panel2;
|
||||
FCheckBox.Checked:=True;
|
||||
if FMod>0 then
|
||||
FCheckBox.Top:=36*(Fdiv+1)
|
||||
else
|
||||
FCheckBox.Top:=36*Fdiv;
|
||||
if FMod=1 then
|
||||
FCheckBox.Left:=29
|
||||
else if FMod=2 then
|
||||
FCheckBox.Left:=163
|
||||
else if FMod=0 then
|
||||
FCheckBox.Left:=305;
|
||||
z:=z+1;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.Button1Click(Sender: TObject);
|
||||
begin
|
||||
//ShowMessage('10除以3取余'+inttostr(10 mod 3)+',取整'+inttostr(10 div 3));
|
||||
ExportData();
|
||||
GetExportFields();
|
||||
if IsINIFile(IniName)=True then
|
||||
begin
|
||||
DeleteFile(IniName);
|
||||
end;
|
||||
WriteINIFile(IniName);
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmSelExportField:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.FormShow(Sender: TObject);
|
||||
begin
|
||||
CreateCheckBox();
|
||||
ReadINIFile(IniName);
|
||||
IsCheck();
|
||||
end;
|
||||
procedure TfrmSelExportField.IsCheck();
|
||||
var
|
||||
i:Integer;
|
||||
fsj:string;
|
||||
begin
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
fsj:=Trim(TCheckBox(Controls[i]).Caption);
|
||||
if Pos(fsj,ExportFields)>0 then
|
||||
TCheckBox(Controls[i]).Checked:=True
|
||||
else
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.ExportData();
|
||||
var
|
||||
i,j:Integer;
|
||||
begin
|
||||
j:=0;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked=True then
|
||||
begin
|
||||
j:=1;
|
||||
ExpGrid.Columns[TCheckBox(Controls[i]).Tag].Visible:=True
|
||||
end else
|
||||
begin
|
||||
ExpGrid.Columns[TCheckBox(Controls[i]).Tag].Visible:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
TcxGridToExcel(Trim(IniName),cxGrid1);
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmSelExportField.Button2Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
WriteINIFile(IniName);
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.ReadINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldExportSet\' +trim(fieldname)+'.INI';
|
||||
programIni:=Tinifile.create(FName);
|
||||
ExportFields:=programIni.ReadString('导出设置','导出字段','');
|
||||
programIni.Free;
|
||||
end;
|
||||
procedure TfrmSelExportField.GetExportFields();
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
ExportFields:='Begin';
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked then
|
||||
begin
|
||||
ExportFields:=ExportFields+'/'+TCheckBox(Controls[i]).Caption;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//写设置信息到INI文件
|
||||
//参数
|
||||
//////////////////////////////////////////////////////////////////
|
||||
procedure TfrmSelExportField.WriteINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldExportSet\'+trim(fieldname)+'.INI';
|
||||
if not DirectoryExists(ExtractFileDir(FName)) then
|
||||
CreateDir(ExtractFileDir(FName));
|
||||
programIni:=Tinifile.create(FName);
|
||||
programIni.WriteString('导出设置','导出字段',ExportFields);
|
||||
programIni.Free;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//判断InI文件是否存在
|
||||
//////////////////////////////////////////////////////////////////
|
||||
Function TfrmSelExportField.IsINIFile(fieldname:string):Boolean;
|
||||
var
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldExportSet\'+trim(fieldname)+'.INI';
|
||||
if FileExists(FName) then
|
||||
Result:=True
|
||||
else
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.CheckBox1Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox1.Checked then
|
||||
begin
|
||||
CheckBox2.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.CheckBox2Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox2.Checked then
|
||||
begin
|
||||
CheckBox1.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
30
Z99Dependency/ThreeFun/Fun/U_getDogServer.pas
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
unit U_getDogServer;
|
||||
|
||||
interface
|
||||
uses
|
||||
SysUtils,Windows,IniFiles,StrUtils;
|
||||
|
||||
|
||||
function GetLink(H: THandle;var ADOConnString:PAnsiChar):Integer;stdcall; external 'PUBLICDLL.DLL';
|
||||
|
||||
function GetLinkDog(H: THandle;var ADOConnString:string):Integer;
|
||||
implementation
|
||||
|
||||
|
||||
function GetLinkDog(H: THandle;var ADOConnString:string):Integer;
|
||||
var
|
||||
str1:string;
|
||||
Pstr1: PChar;
|
||||
begin
|
||||
try
|
||||
SetLength(str1,255);
|
||||
pstr1:=pchar(str1);
|
||||
result:= GetLink(H,pstr1);
|
||||
ADOConnString:=trim(pstr1);
|
||||
finally
|
||||
SetLength(str1,0);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
1176
Z99Dependency/ThreeFun/RSCommon/U_RSFormPas.pas
Normal file
86
Z99Dependency/ThreeFun/SelfForm/U_FilterHelp.dfm
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
object frmFilterHelp: TfrmFilterHelp
|
||||
Left = 287
|
||||
Top = 145
|
||||
BorderStyle = bsDialog
|
||||
Caption = #39640#32423#36807#28388
|
||||
ClientHeight = 507
|
||||
ClientWidth = 457
|
||||
Color = clBtnFace
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object ScrollBox1: TScrollBox
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 457
|
||||
Height = 465
|
||||
Align = alTop
|
||||
Color = clSkyBlue
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
Left = 184
|
||||
Top = 8
|
||||
Width = 68
|
||||
Height = 16
|
||||
Caption = #36807#28388#26465#20214
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clRed
|
||||
Font.Height = -16
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 384
|
||||
Top = 8
|
||||
Width = 57
|
||||
Height = 17
|
||||
Caption = #31934#30830
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 465
|
||||
Width = 457
|
||||
Height = 43
|
||||
Align = alTop
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
TabOrder = 1
|
||||
object Button1: TButton
|
||||
Left = 112
|
||||
Top = 9
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 264
|
||||
Top = 9
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #20851#38381
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
end
|
||||
object XPManifest1: TXPManifest
|
||||
Left = 280
|
||||
Top = 328
|
||||
end
|
||||
end
|
||||
182
Z99Dependency/ThreeFun/SelfForm/U_FilterHelp.pas
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
unit U_FilterHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls,cxGridLevel,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||||
cxControls, cxGridCustomView, cxGrid, cxStyles, cxCustomData, cxGraphics,
|
||||
cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData,StrUtils,ADODB,
|
||||
XPMan;
|
||||
|
||||
type
|
||||
TfrmFilterHelp = class(TForm)
|
||||
ScrollBox1: TScrollBox;
|
||||
Panel1: TPanel;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
Label1: TLabel;
|
||||
CheckBox1: TCheckBox;
|
||||
XPManifest1: TXPManifest;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
public
|
||||
procedure CreateFilers(Tv1:TcxGridDBTableView);
|
||||
function GSGetFilters():string;
|
||||
procedure GSQryDofilter(ADOQry:TADOQuery;FilterStr:string);
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmFilterHelp: TfrmFilterHelp;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmFilterHelp.Button1Click(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=1
|
||||
end;
|
||||
|
||||
procedure TfrmFilterHelp.Button2Click(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=-1;
|
||||
end;
|
||||
|
||||
procedure TfrmFilterHelp.CreateFilers(Tv1:TcxGridDBTableView);
|
||||
var
|
||||
i,j,z,m,FTop,FLeft,Fdiv,FMod:Integer;// mod 余数,div商
|
||||
FLableEdit:TLabeledEdit;
|
||||
|
||||
begin
|
||||
j:=0;
|
||||
for i:=0 to Tv1.ColumnCount-1 do
|
||||
begin
|
||||
m:=0;
|
||||
if Tv1.Columns[i].Visible=False then Continue;
|
||||
if not ( (Tv1.DataController.DataSource.DataSet.FieldByName(Tv1.Columns[i].DataBinding.FieldName).DataType=ftBCD) or
|
||||
(Tv1.DataController.DataSource.DataSet.FieldByName(Tv1.Columns[i].DataBinding.FieldName).DataType=ftString) ) then Continue;
|
||||
Fdiv:=(j+1) div 3;
|
||||
FMod:=(j+1) mod 3;
|
||||
FLableEdit:=TLabeledEdit.Create(Self);
|
||||
FLableEdit.EditLabel.Caption:=Trim(Tv1.Columns[i].Caption);
|
||||
FLableEdit.Name:=Trim(Tv1.Columns[i].DataBinding.FieldName);
|
||||
if Tv1.DataController.DataSource.DataSet.FieldByName(Tv1.Columns[i].DataBinding.FieldName).DataType=ftBCD then
|
||||
begin
|
||||
FLableEdit.EditLabel.Caption:=Trim(Tv1.Columns[i].Caption+'始');
|
||||
FLableEdit.Hint:=Trim(Tv1.Columns[i].DataBinding.FieldName);
|
||||
FLableEdit.Tag:=1;
|
||||
end;
|
||||
FLableEdit.Text:='';
|
||||
FLableEdit.TabOrder:=j;
|
||||
FLableEdit.Parent:=ScrollBox1;
|
||||
if FMod>0 then
|
||||
FLableEdit.Top:=50*(Fdiv+1)
|
||||
else
|
||||
FLableEdit.Top:=50*Fdiv;
|
||||
if FMod=1 then
|
||||
FLableEdit.Left:=29
|
||||
else if FMod=2 then
|
||||
FLableEdit.Left:=163
|
||||
else if FMod=0 then
|
||||
FLableEdit.Left:=305;
|
||||
if Tv1.DataController.DataSource.DataSet.FieldByName(Tv1.Columns[i].DataBinding.FieldName).DataType=ftBCD then
|
||||
begin
|
||||
j:=j+1;
|
||||
Fdiv:=(j+1) div 3;
|
||||
FMod:=(j+1) mod 3;
|
||||
FLableEdit:=TLabeledEdit.Create(Self);
|
||||
FLableEdit.EditLabel.Caption:=Trim(Tv1.Columns[i].Caption+'止');
|
||||
FLableEdit.Hint:=Trim(Tv1.Columns[i].DataBinding.FieldName);
|
||||
FLableEdit.Tag:=2;
|
||||
FLableEdit.Text:='';
|
||||
FLableEdit.TabOrder:=j;
|
||||
FLableEdit.Parent:=ScrollBox1;
|
||||
if FMod>0 then
|
||||
FLableEdit.Top:=50*(Fdiv+1)
|
||||
else
|
||||
FLableEdit.Top:=50*Fdiv;
|
||||
if FMod=1 then
|
||||
FLableEdit.Left:=29
|
||||
else if FMod=2 then
|
||||
FLableEdit.Left:=163
|
||||
else if FMod=0 then
|
||||
FLableEdit.Left:=305;
|
||||
end;
|
||||
j:=j+1;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TfrmFilterHelp.GSGetFilters():string;
|
||||
var
|
||||
i:Integer;
|
||||
FValue:Double;
|
||||
begin
|
||||
Result:='';
|
||||
with ScrollBox1 do
|
||||
begin
|
||||
for i:=0 to ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TLabel then Continue;
|
||||
if Controls[i] is TLabeledEdit then
|
||||
begin
|
||||
if Trim(TLabeledEdit(Controls[i]).Text)<>'' then
|
||||
begin
|
||||
if TLabeledEdit(Controls[i]).Tag>0 then
|
||||
begin
|
||||
try
|
||||
FValue:=StrToFloat(TLabeledEdit(Controls[i]).Text);
|
||||
except
|
||||
Application.MessageBox('不能输入非法数字!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
if TLabeledEdit(Controls[i]).Tag=1 then
|
||||
begin
|
||||
Result:=Result+'and '+Controls[i].Hint+'>='+Trim(TLabeledEdit(Controls[i]).Text);
|
||||
end else
|
||||
if TLabeledEdit(Controls[i]).Tag=2 then
|
||||
begin
|
||||
Result:=Result+'and '+Controls[i].Hint+'<='+Trim(TLabeledEdit(Controls[i]).Text);
|
||||
end else
|
||||
begin
|
||||
if CheckBox1.Checked then
|
||||
Result:=Result+'and '+Controls[i].Name+'='+QuotedStr(Trim(TLabeledEdit(Controls[i]).Text))
|
||||
else
|
||||
Result:=Result+'and '+Controls[i].Name+' like '+QuotedStr('%'+Trim(TLabeledEdit(Controls[i]).Text)+'%');
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if Trim(Result)<>'' then
|
||||
Result:=Trim(RightBStr(Result,Length(Result)-4));
|
||||
end;
|
||||
|
||||
procedure TfrmFilterHelp.GSQryDofilter(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;
|
||||
|
||||
end.
|
||||
3782
Z99Dependency/ThreeFun/SelfForm/U_PbMfProductHelp.dfm
Normal file
208
Z99Dependency/ThreeFun/SelfForm/U_PbMfProductHelp.pas
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
unit U_PbMfProductHelp;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, DB, ADODB, Grids, DBGrids, ExtCtrls, ComCtrls, ImgList, ToolWin,
|
||||
StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, cxDBData, cxTextEdit, cxGridCustomTableView,
|
||||
cxGridTableView, cxGridDBTableView, cxControls, cxGridCustomView,
|
||||
cxClasses, cxGridLevel, cxGrid,StrUtils, DBClient, cxCheckBox;
|
||||
|
||||
type
|
||||
TfrmPbMfProductHelp = class(TForm)
|
||||
Panel1: TPanel;
|
||||
Label1: TLabel;
|
||||
Edt_name: TEdit;
|
||||
ImageList24: TImageList;
|
||||
DataSource1: TDataSource;
|
||||
ADOQueryHelp: TADOQuery;
|
||||
ToolBar2: TToolBar;
|
||||
TOk: TToolButton;
|
||||
Tclose: TToolButton;
|
||||
cxGrid1: TcxGrid;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
tv1: TcxGridDBTableView;
|
||||
tv1P_code1: TcxGridDBColumn;
|
||||
tv1P_chnName1: TcxGridDBColumn;
|
||||
tv1P_engName1: TcxGridDBColumn;
|
||||
tv1P_Gram1: TcxGridDBColumn;
|
||||
tv1P_breadthp: TcxGridDBColumn;
|
||||
tv1MachZsName: TcxGridDBColumn;
|
||||
tv1factoryName: TcxGridDBColumn;
|
||||
Label2: TLabel;
|
||||
Edt_spec: TEdit;
|
||||
ADOConnection1: TADOConnection;
|
||||
tv1P_spec: TcxGridDBColumn;
|
||||
cxStyleRepository1: TcxStyleRepository;
|
||||
cxStyle1: TcxStyle;
|
||||
cxStyle_Active: TcxStyle;
|
||||
cxStyle_gridRow: TcxStyle;
|
||||
cxStyle_gridFoot: TcxStyle;
|
||||
cxStyle_gridHead: TcxStyle;
|
||||
cxStyle_gridGroupBox: TcxStyle;
|
||||
cxStyle_yellow: TcxStyle;
|
||||
cxStyle_Red: TcxStyle;
|
||||
cxStyle_group: TcxStyle;
|
||||
cxStyle_fontBlue: TcxStyle;
|
||||
cxStyle_fontOlive: TcxStyle;
|
||||
cxStyle_fontbalck: TcxStyle;
|
||||
CDS_Sel: TClientDataSet;
|
||||
tv1Sel: TcxGridDBColumn;
|
||||
procedure BtnOkClick(Sender: TObject);
|
||||
procedure BtnCancelClick(Sender: TObject);
|
||||
procedure DBGrid1DblClick(Sender: TObject);
|
||||
procedure Edt_nameKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure RadioGroup1Click(Sender: TObject);
|
||||
procedure Edt_nameChange(Sender: TObject);
|
||||
procedure tv1MouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
private
|
||||
procedure IntiQuery();
|
||||
procedure DoFilter();
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmPbMfProductHelp: TfrmPbMfProductHelp;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_adodbmd,U_global,U_FormPas;
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmPbMfProductHelp.BtnOkClick(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryHelp.IsEmpty then exit;
|
||||
ModalResult:= 1;
|
||||
end;
|
||||
|
||||
procedure TfrmPbMfProductHelp.BtnCancelClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:= -1;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmPbMfProductHelp.IntiQuery();
|
||||
begin
|
||||
with ADOQueryHelp Do
|
||||
Begin
|
||||
DisableControls;
|
||||
Close;
|
||||
filtered:=false;
|
||||
SQL.Clear;
|
||||
SQL.Add('exec P_Get_MCMf_CatLog');
|
||||
sql.Add('P');
|
||||
Open;
|
||||
|
||||
CreateCDS20(ADOQueryHelp,CDS_Sel);
|
||||
InitCDSData20(ADOQueryHelp,CDS_Sel);
|
||||
EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmPbMfProductHelp.DBGrid1DblClick(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryHelp.IsEmpty then exit;
|
||||
ModalResult := 1;
|
||||
end;
|
||||
|
||||
procedure TfrmPbMfProductHelp.Edt_nameKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
Var
|
||||
TmpSql :string;
|
||||
begin
|
||||
if Key = VK_RETURN then
|
||||
begin
|
||||
IntiQuery();
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmPbMfProductHelp.FormCreate(Sender: TObject);
|
||||
begin
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=gConString;
|
||||
Connected:=true;
|
||||
end;
|
||||
cxgrid1.Align:=alClient;
|
||||
IntiQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmPbMfProductHelp.FormShow(Sender: TObject);
|
||||
begin
|
||||
Edt_Name.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TfrmPbMfProductHelp.RadioGroup1Click(Sender: TObject);
|
||||
begin
|
||||
IntiQuery();
|
||||
end;
|
||||
////////////////////////////////////////////////////
|
||||
//函数:过滤数据
|
||||
////////////////////////////////////////////////////
|
||||
procedure TfrmPbMfProductHelp.DoFilter();
|
||||
var
|
||||
filterStr:string;
|
||||
begin
|
||||
filterStr:='';
|
||||
//名称
|
||||
if trim(edt_Name.Text)<>'' then
|
||||
begin
|
||||
filterStr:=filterStr+' and (P_chnName like '+quotedStr('%'+trim(edt_Name.Text)+'%')+
|
||||
' or P_code like '+quotedStr('%'+trim(edt_Name.Text)+'%')+')';
|
||||
end;
|
||||
//规格
|
||||
if trim(edt_spec.Text)<>'' then
|
||||
filterStr:=filterStr+' and P_spec like '+quotedStr('%'+trim(edt_spec.Text)+'%');
|
||||
|
||||
try
|
||||
|
||||
ADOQueryHelp.DisableControls ;
|
||||
if trim(filterStr)='' then
|
||||
begin
|
||||
ADOQueryHelp.Filtered:=false;
|
||||
ADOQueryHelp.EnableControls;
|
||||
exit;
|
||||
end;
|
||||
filterStr:=trim(RightBStr(filterStr,length(filterStr)-4));
|
||||
with ADOQueryHelp do
|
||||
begin
|
||||
filtered:=false;
|
||||
filter:=filterStr;
|
||||
filtered:=true;
|
||||
end;
|
||||
CreateCDS20(ADOQueryHelp,CDS_Sel);
|
||||
InitCDSData20(ADOQueryHelp,CDS_Sel);
|
||||
finally
|
||||
ADOQueryHelp.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmPbMfProductHelp.Edt_nameChange(Sender: TObject);
|
||||
begin
|
||||
DoFilter();
|
||||
end;
|
||||
|
||||
procedure TfrmPbMfProductHelp.tv1MouseDown(Sender: TObject;
|
||||
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
begin
|
||||
if tv1.Controller.FocusedColumn.Name='tv1Sel' then
|
||||
begin
|
||||
CDS_Sel.Edit;
|
||||
if CDS_Sel.FieldByName('sel').AsBoolean=False then
|
||||
CDS_Sel.FieldByName('sel').Value:=True
|
||||
else
|
||||
CDS_Sel.FieldByName('sel').Value:=False;
|
||||
CDS_Sel.Post;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
4381
Z99Dependency/ThreeFun/SelfForm/U_PlanOrderPL.dfm
Normal file
778
Z99Dependency/ThreeFun/SelfForm/U_PlanOrderPL.pas
Normal file
|
|
@ -0,0 +1,778 @@
|
|||
unit U_PlanOrderPL;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ImgList, ComCtrls, ToolWin, ExtCtrls, BtnEdit, Grids,
|
||||
DBGrids, DB, ADODB, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||||
cxDataStorage, cxEdit, cxDBData, cxGridLevel, cxClasses, cxControls,
|
||||
cxGridCustomView, cxGridCustomTableView, cxGridTableView,
|
||||
cxGridDBTableView, cxGrid, cxPC, cxGridCustomPopupMenu, cxGridPopupMenu,
|
||||
cxTextEdit, cxCalendar, cxMemo, Buttons, DBClient, cxButtonEdit,
|
||||
cxSplitter;
|
||||
|
||||
type
|
||||
TfrmPlanOrderPL = class(TForm)
|
||||
ToolBar3: TToolBar;
|
||||
Tclose: TToolButton;
|
||||
ImageList24: TImageList;
|
||||
GroupBox1: TGroupBox;
|
||||
ComboBox1: TComboBox;
|
||||
begDate: TDateTimePicker;
|
||||
endDate: TDateTimePicker;
|
||||
Label2: TLabel;
|
||||
edtPlan: TEdit;
|
||||
Label3: TLabel;
|
||||
ADOQueryPlan: TADOQuery;
|
||||
DataSourcePlan: TDataSource;
|
||||
Tfind: TToolButton;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
Label4: TLabel;
|
||||
P_chnName: TEdit;
|
||||
Panel1: TPanel;
|
||||
Tv1: TcxGridDBTableView;
|
||||
dbGrid2Level1: TcxGridLevel;
|
||||
dbGrid2: TcxGrid;
|
||||
Tv1PlanNo: TcxGridDBColumn;
|
||||
Tv1Deliver: TcxGridDBColumn;
|
||||
Tv1exigence: TcxGridDBColumn;
|
||||
Tv1p_num: TcxGridDBColumn;
|
||||
Tv1p_chnname: TcxGridDBColumn;
|
||||
Tv1customName: TcxGridDBColumn;
|
||||
Tv1BusineesName: TcxGridDBColumn;
|
||||
Tv1Busntime: TcxGridDBColumn;
|
||||
Tv1statusName: TcxGridDBColumn;
|
||||
Tv1P_unitName: TcxGridDBColumn;
|
||||
v1P_Other: TcxGridDBColumn;
|
||||
Edt_cust: TEdit;
|
||||
v1P_tnum: TcxGridDBColumn;
|
||||
cxTabControl1: TcxTabControl;
|
||||
v1P_FQNo: TcxGridDBColumn;
|
||||
v1P_YhNo: TcxGridDBColumn;
|
||||
v1P_BaseChnName: TcxGridDBColumn;
|
||||
v1Column1: TcxGridDBColumn;
|
||||
v1P_Color: TcxGridDBColumn;
|
||||
v1sbtr2: TcxGridDBColumn;
|
||||
v1LbStr6: TcxGridDBColumn;
|
||||
v1P_Csid: TcxGridDBColumn;
|
||||
v1sid: TcxGridDBColumn;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||||
v1P_FactoryName: TcxGridDBColumn;
|
||||
v1DhChk: TcxGridDBColumn;
|
||||
v1PCSeqNo: TcxGridDBColumn;
|
||||
TBPrint: TToolButton;
|
||||
v1Vuserdef1: TcxGridDBColumn;
|
||||
v1Crafts: TcxGridDBColumn;
|
||||
TBExport: TToolButton;
|
||||
v1CheckName: TcxGridDBColumn;
|
||||
v1PCDate: TcxGridDBColumn;
|
||||
v1BChkTime: TcxGridDBColumn;
|
||||
TBView: TToolButton;
|
||||
Label5: TLabel;
|
||||
p_num1: TEdit;
|
||||
Label6: TLabel;
|
||||
p_num2: TEdit;
|
||||
Label1: TLabel;
|
||||
P_FQNo: TEdit;
|
||||
Label7: TLabel;
|
||||
P_YhNo: TEdit;
|
||||
Label8: TLabel;
|
||||
P_Color: TEdit;
|
||||
Label9: TLabel;
|
||||
P_BaseChnName: TEdit;
|
||||
Label10: TLabel;
|
||||
LbStr6: TEdit;
|
||||
Label12: TLabel;
|
||||
P_Csid: TEdit;
|
||||
cxSplitter1: TcxSplitter;
|
||||
ToolButton5: TToolButton;
|
||||
v1PLTime: TcxGridDBColumn;
|
||||
v1PLPerson: TcxGridDBColumn;
|
||||
v1PCPerson: TcxGridDBColumn;
|
||||
Panel2: TPanel;
|
||||
ToolBar1: TToolBar;
|
||||
btnAddDye: TToolButton;
|
||||
btnDelDye: TToolButton;
|
||||
btnSaveDye: TToolButton;
|
||||
grdDye: TcxGrid;
|
||||
grdDyeTV1: TcxGridDBTableView;
|
||||
grdDyeTV1OrderId: TcxGridDBColumn;
|
||||
grdDyeTV1chnName: TcxGridDBColumn;
|
||||
grdDyeTV1DyeStyle: TcxGridDBColumn;
|
||||
grdDyeTV1DyeUnitName: TcxGridDBColumn;
|
||||
grdDyeTV1UnitdyeNum: TcxGridDBColumn;
|
||||
grdDyeTV1stepId: TcxGridDBColumn;
|
||||
grdDyeTV1beizhu: TcxGridDBColumn;
|
||||
grdDyeL1: TcxGridLevel;
|
||||
CDS_Sub: TClientDataSet;
|
||||
AdoQuerySub: TADOQuery;
|
||||
ds1: TDataSource;
|
||||
grdDyeTV1Crafts: TcxGridDBColumn;
|
||||
ToolButton1: TToolButton;
|
||||
ToolButton2: TToolButton;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure TcloseClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure TfindClick(Sender: TObject);
|
||||
procedure rgSystypeClick(Sender: TObject);
|
||||
procedure cxTabControl1Change(Sender: TObject);
|
||||
procedure v1P_FQNoCustomDrawCell(Sender: TcxCustomGridTableView;
|
||||
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
||||
var ADone: Boolean);
|
||||
procedure TBPrintClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure TBExportClick(Sender: TObject);
|
||||
procedure TBViewClick(Sender: TObject);
|
||||
procedure p_num1KeyPress(Sender: TObject; var Key: Char);
|
||||
procedure edtPlanChange(Sender: TObject);
|
||||
procedure ToolButton5Click(Sender: TObject);
|
||||
procedure btnAddDyeClick(Sender: TObject);
|
||||
procedure btnDelDyeClick(Sender: TObject);
|
||||
procedure grdDyeTV1chnNamePropertiesButtonClick(Sender: TObject;
|
||||
AButtonIndex: Integer);
|
||||
procedure grdDyeTV1CraftsPropertiesButtonClick(Sender: TObject;
|
||||
AButtonIndex: Integer);
|
||||
procedure btnSaveDyeClick(Sender: TObject);
|
||||
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView;
|
||||
APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord;
|
||||
ANewItemRecordFocusingChanged: Boolean);
|
||||
procedure grdDyeTV1UnitdyeNumPropertiesChange(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure ToolButton2Click(Sender: TObject);
|
||||
procedure grdDyeTV1beizhuPropertiesEditValueChanged(Sender: TObject);
|
||||
private
|
||||
procedure DoQuery();
|
||||
procedure InitSubGrid();
|
||||
function saveDye(): Boolean;
|
||||
public
|
||||
FPlanNo:string;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmPlanOrderPL: TfrmPlanOrderPL;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_adodbmd,U_global, U_status,U_SelfForm,U_CxGridSet,
|
||||
U_FormPas,U_plan,U_frameHelp10,U_XcCodeHelp,U_ItemManageNew,U_RhlHelp,
|
||||
U_RhlHelpOne,U_GetXYHelp,U_GetPlanXYHelp;
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmPlanOrderPL.FormCreate(Sender: TObject);
|
||||
begin
|
||||
ReadCxGrid('计划单配料信息',Tv1,'计划单');
|
||||
dbgrid2.Align :=alClient;
|
||||
begDate.DateTime :=SGetServerDate(ADOQueryTemp);
|
||||
endDate.DateTime :=SGetServerDate(ADOQueryTemp);
|
||||
DoQuery();
|
||||
InitSubGrid();
|
||||
end;
|
||||
//////////////////////////////////////////////////
|
||||
//函数:提交数据
|
||||
//////////////////////////////////////////////////
|
||||
procedure TfrmPlanOrderPL.DoQuery();
|
||||
var
|
||||
mwhere:string;
|
||||
begin
|
||||
if comboBox1.ItemIndex=0 then
|
||||
begin
|
||||
mwhere:=' and BusnTime>='''+dateTostr(begdate.Date)+''' and BusnTime<'''+dateTostr(endDate.Date+1)+'''';
|
||||
end
|
||||
else if comboBox1.ItemIndex=1 then
|
||||
begin
|
||||
mwhere:=' and deliver>='''+dateTostr(begdate.Date)+''' and deliver<'''+dateTostr(endDate.Date+1)+'''';
|
||||
end
|
||||
else if comboBox1.ItemIndex=2 then
|
||||
begin
|
||||
mwhere:=' and PCSCDate>='''+dateTostr(begdate.Date)+''' and PCSCDate<'''+dateTostr(endDate.Date+1)+'''';
|
||||
end;
|
||||
|
||||
//计划单
|
||||
if trim(edtPlan.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and A.planNo like ''%'+trim(edtPlan.Text)+'%''';
|
||||
end;
|
||||
|
||||
//客户
|
||||
if trim(Edt_cust.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and CustomNo like ''%'+trim(Edt_cust.Text)+'%''';
|
||||
end;
|
||||
//品种
|
||||
if trim(P_chnName.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and P_chnName like ''%'+trim(P_chnName.Text)+'%''';
|
||||
end;
|
||||
//产品编号
|
||||
if trim(P_FQNo.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and P_FQNo like ''%'+trim(P_FQNo.Text)+'%''';
|
||||
end;
|
||||
//纹路
|
||||
if trim(P_YhNo.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and P_YhNo like ''%'+trim(P_YhNo.Text)+'%''';
|
||||
end;
|
||||
//色号
|
||||
if trim(P_Color.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and P_Color like ''%'+trim(P_Color.Text)+'%''';
|
||||
end;
|
||||
//底布
|
||||
if trim(P_BaseChnName.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and P_BaseChnName like ''%'+trim(P_BaseChnName.Text)+'%''';
|
||||
end;
|
||||
//贝斯
|
||||
if trim(LbStr6.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and LbStr6 like ''%'+trim(LbStr6.Text)+'%''';
|
||||
end;
|
||||
//下达部门
|
||||
if trim(gDef1)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and M.Dept ='''+trim(gDef1)+'''';
|
||||
end;
|
||||
//业务员
|
||||
{if trim(BusineesName.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and BusineesName like ''%'+trim(BusineesName.Text)+'%''';
|
||||
end;}
|
||||
//打样号
|
||||
if trim(P_Csid.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and P_Csid like ''%'+trim(P_Csid.Text)+'%''';
|
||||
end;
|
||||
if Trim(p_num1.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and P_num >='+trim(p_num1.Text);
|
||||
end;
|
||||
if Trim(p_num2.Text)<>'' then
|
||||
begin
|
||||
mwhere:=mwhere+' and P_num <='+trim(p_num2.Text);
|
||||
end;
|
||||
|
||||
try
|
||||
panel1.Visible:=true;
|
||||
panel1.Refresh;
|
||||
ADOQueryPlan.DisableControls;
|
||||
with ADOQueryPlan do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('EXEC P_Get_PlanListPL ');
|
||||
sql.Add(' '+intTostr(cxTabControl1.TabIndex));
|
||||
sql.Add(','+QuotedStr(formatDatetime('yyyy-MM-dd',begdate.Date)));
|
||||
sql.Add(','+QuotedStr(formatDatetime('yyyy-MM-dd',(enddate.Date+1))));
|
||||
sql.Add(','+quotedStr(mwhere));
|
||||
Open;
|
||||
end;
|
||||
finally
|
||||
panel1.Visible :=false;
|
||||
ADOQueryPlan.EnableControls;
|
||||
end;
|
||||
end;
|
||||
procedure TfrmPlanOrderPL.InitSubGrid();
|
||||
begin
|
||||
try
|
||||
AdoQuerySub.DisableControls;
|
||||
with AdoQuerySub do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
SQL.Add('select A.*,B.MName ChnName from MD_ProductPL A ');
|
||||
SQL.Add(' JOIN Gy_Material B ON B.MNumber = A.Dyecode ');
|
||||
SQL.Add('where PlanNo='''+Trim(ADOQueryPlan.fieldbyname('PlanNo').AsString)+'''');
|
||||
sql.Add(' and P_SeqNo='''+Trim(ADOQueryPlan.fieldbyname('P_SeqNo').AsString)+'''');
|
||||
sql.Add(' and Dept='''+Trim(ADOQueryPlan.fieldbyname('Dept').AsString)+'''');
|
||||
Open;
|
||||
CreateCDS20(AdoQuerySub,CDS_Sub);
|
||||
InitCDSData20(AdoQuerySub,CDS_Sub);
|
||||
end;
|
||||
finally
|
||||
AdoQuerySub.EnableControls;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.TcloseClick(Sender: TObject);
|
||||
begin
|
||||
close;
|
||||
WriteCxGrid('计划单配料信息',Tv1,'计划单');
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmPlanOrderPL:=NIL;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.TfindClick(Sender: TObject);
|
||||
begin
|
||||
DoQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.rgSystypeClick(Sender: TObject);
|
||||
begin
|
||||
DoQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.cxTabControl1Change(Sender: TObject);
|
||||
begin
|
||||
{ if cxTabControl1.TabIndex=0 then
|
||||
v1PCSeqNo.Visible:=False
|
||||
else
|
||||
v1PCSeqNo.Visible:=True;
|
||||
if (cxTabControl1.TabIndex=1) or (cxTabControl1.TabIndex=2) then
|
||||
begin
|
||||
v1PCSeqNo.Options.Focusing:=True ;
|
||||
Tv1exigence.Options.Focusing:=True;
|
||||
end
|
||||
else
|
||||
begin
|
||||
v1PCSeqNo.Options.Focusing:=False;
|
||||
Tv1exigence.Options.Focusing:=False;
|
||||
end; }
|
||||
Tfind.Click ;
|
||||
//ADOQueryPlan.Locate('PlanNo',FPlanNo,[]);
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.v1P_FQNoCustomDrawCell(
|
||||
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
||||
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
||||
var
|
||||
id:Integer;
|
||||
begin
|
||||
begin
|
||||
Id:=TV1.GetColumnByFieldName('SBtr3').Index;//;-TV1.GroupedItemCount;
|
||||
if Id<0 then Exit;
|
||||
if AViewInfo.GridRecord.Values[Id]='Red' then
|
||||
begin
|
||||
ACanvas.Brush.Color:=clRed;
|
||||
end else
|
||||
if AViewInfo.GridRecord.Values[Id]='Purple' then
|
||||
begin
|
||||
ACanvas.Brush.Color:=clPurple;
|
||||
end else
|
||||
if AViewInfo.GridRecord.Values[Id]='Olive' then
|
||||
begin
|
||||
ACanvas.Brush.Color:=clOlive;
|
||||
end else
|
||||
if AViewInfo.GridRecord.Values[Id]='Teal' then
|
||||
begin
|
||||
ACanvas.Brush.Color:=clTeal;
|
||||
end else
|
||||
if AViewInfo.GridRecord.Values[Id]='Background' then
|
||||
begin
|
||||
ACanvas.Brush.Color:=clBackground;
|
||||
end;
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.TBPrintClick(Sender: TObject);
|
||||
begin
|
||||
SelPrintDataNew(Tv1,ADOQueryPlan,'生 产 顺 序 表','日期:'+(FormatDateTime('yyyy-MM-dd',SGetServerDate(ADOQueryTemp))),'');
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.FormShow(Sender: TObject);
|
||||
begin
|
||||
ReadCxGrid('计划单排产信息',Tv1,'计划单');
|
||||
v1PCSeqNo.Visible:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.TBExportClick(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryPlan.IsEmpty then Exit;
|
||||
TcxGridToExcel('生产顺序表',dbGrid2);
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.TBViewClick(Sender: TObject);
|
||||
begin
|
||||
try
|
||||
frmPlan:=TfrmPlan.Create(Application);
|
||||
with frmPlan do
|
||||
begin
|
||||
fWinStatus:=5;
|
||||
FplanNo:=Trim(Self.ADOQueryPlan.fieldbyname('PlanNo').AsString);
|
||||
if ShowModal=1 then
|
||||
begin
|
||||
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
frmPlan.Free;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.p_num1KeyPress(Sender: TObject; var Key: Char);
|
||||
begin
|
||||
if not(Key in['0'..'9',#8,#27]) then
|
||||
begin
|
||||
key:=#0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.edtPlanChange(Sender: TObject);
|
||||
begin
|
||||
DoQuery();
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.ToolButton5Click(Sender: TObject);
|
||||
var
|
||||
splanNo:string;
|
||||
begin
|
||||
frmPlan:=TfrmPlan.create(self);
|
||||
with frmPlan do
|
||||
begin
|
||||
fWinStatus:=1;
|
||||
FplanNo:=trim(ADOQueryPlan.fieldByName('PlanNo').asString);
|
||||
planNo.Enabled:=False;
|
||||
showModal;
|
||||
free;
|
||||
end;
|
||||
splanno:=trim(ADOQueryPlan.fieldByName('PlanNo').asString);
|
||||
DoQuery();
|
||||
ADOQueryPlan.Locate('planno',splanno,[]);
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.btnAddDyeClick(Sender: TObject);
|
||||
var
|
||||
mStepId: Integer;
|
||||
begin
|
||||
if ADOQueryPlan.IsEmpty then Exit;
|
||||
if CDS_Sub.IsEmpty then
|
||||
begin
|
||||
mStepId := 1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
CDS_Sub.Last ;
|
||||
mStepId := CDS_Sub.FieldByName('stepId').AsInteger;
|
||||
end;
|
||||
|
||||
frmRhlHelp := TfrmRhlHelp.Create(Application);
|
||||
with frmRhlHelp do
|
||||
begin
|
||||
if ShowModal = 1 then
|
||||
begin
|
||||
with CDS_sel do
|
||||
begin
|
||||
try
|
||||
DisableControls;
|
||||
First ;
|
||||
while not Eof do
|
||||
begin
|
||||
CDS_Sub.Append;
|
||||
CDS_Sub.FieldByName('stepId').Value:=mStepId;
|
||||
CDS_Sub.FieldByName('OrderId').Value:= CDS_Sub.RecordCount+1;
|
||||
CDS_Sub.FieldByName('DyeCode').Value :=trim(FieldByName('DyeCode').AsString);
|
||||
CDS_Sub.FieldByName('chnName').Value :=trim(FieldByName('chnName').AsString);
|
||||
CDS_Sub.FieldByName('DyeStyle').Value :=FieldByName('DyepropertyName').AsString;
|
||||
CDS_Sub.FieldByName('Unit').Value :=FieldByName('DyeUnitName').AsString;
|
||||
CDS_Sub.Post;
|
||||
Next;
|
||||
end;
|
||||
finally
|
||||
EnableControls;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Release;
|
||||
end;
|
||||
btnSaveDye.Enabled:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.btnDelDyeClick(Sender: TObject);
|
||||
begin
|
||||
if CDS_Sub.IsEmpty then Exit;
|
||||
if Trim(CDS_Sub.fieldbyname('PLID').AsString)<>'' then
|
||||
begin
|
||||
if Application.MessageBox('确定要删除数据吗?','提示',32+4)<>IDYES then Exit;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('delete MD_ProductPL where PLID='''+Trim(CDS_Sub.fieldbyname('PLID').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
end;
|
||||
CDS_Sub.Delete;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.grdDyeTV1chnNamePropertiesButtonClick(
|
||||
Sender: TObject; AButtonIndex: Integer);
|
||||
begin
|
||||
if ADOQueryPlan.IsEmpty then Exit;
|
||||
frmRhlHelpOne := TfrmRhlHelpOne.Create(Application);
|
||||
with frmRhlHelpOne do
|
||||
begin
|
||||
if ShowModal = 1 then
|
||||
begin
|
||||
CDS_Sub.Edit;
|
||||
CDS_Sub.FieldByName('DyeCode').Value :=trim(ADOQueryFrom.FieldByName('MNumber').AsString);
|
||||
CDS_Sub.FieldByName('chnName').Value :=trim(ADOQueryFrom.FieldByName('MName').AsString);
|
||||
CDS_Sub.FieldByName('DyeStyle').Value :=ADOQueryFrom.FieldByName('kfsortname').AsString;
|
||||
CDS_Sub.FieldByName('Unit').Value :=ADOQueryFrom.FieldByName('PrimaryUnitName').AsString;
|
||||
end;
|
||||
Release;
|
||||
end;
|
||||
btnSaveDye.Enabled:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.grdDyeTV1CraftsPropertiesButtonClick(
|
||||
Sender: TObject; AButtonIndex: Integer);
|
||||
begin
|
||||
try
|
||||
frmItemManageNew:=TfrmItemManageNew.Create(Application);
|
||||
with frmItemManageNew do
|
||||
begin
|
||||
flag:='JGXMTYPE';
|
||||
flagname:='工序';
|
||||
if ShowModal=1 then
|
||||
begin
|
||||
CDS_Sub.Edit;
|
||||
CDS_Sub.FieldByName('Crafts').Value:=Trim(ClientDataSet1.fieldbyname('name').AsString);
|
||||
//CDSDye.Post;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
frmItemManageNew.Free;
|
||||
end;
|
||||
btnSaveDye.Enabled:=True;
|
||||
end;
|
||||
function TfrmPlanOrderPL.saveDye(): Boolean;
|
||||
var
|
||||
k:integer;
|
||||
MaxNo:String;
|
||||
begin
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
CDS_Sub.First;
|
||||
k := 1;
|
||||
while not CDS_Sub.Eof do
|
||||
begin
|
||||
if Trim(CDS_Sub.fieldbyname('PLId').AsString)<>'' then
|
||||
begin
|
||||
MaxNo:=Trim(CDS_Sub.fieldbyname('PLId').AsString);
|
||||
end else
|
||||
begin
|
||||
if GetMaxNo20(ADOQueryTemp,MaxNo,'MD_ProductPL','PL',1,3)=False then
|
||||
begin
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('取最大号失败!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add('SELECT * FROM MD_ProductPL');
|
||||
SQL.Add('WHERE PlID='''+Trim(CDS_Sub.fieldbyname('PlID').AsString)+'''');
|
||||
Open;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
if Trim(CDS_Sub.FieldByName('PlID').AsString)='' then
|
||||
Append
|
||||
else
|
||||
Edit;
|
||||
FieldByName('PLID').Value := Trim(MaxNo);
|
||||
FieldByName('PlanNo').Value := Trim(ADOQueryPlan.FieldByName('PlanNo').AsString);
|
||||
FieldByName('P_SeqNo').Value :=Trim(ADOQueryPlan.FieldByName('P_SeqNo').AsString);
|
||||
FieldByName('Dept').Value :=Trim(ADOQueryPlan.FieldByName('Dept').AsString);
|
||||
FieldByName('dyeCode').Value :=CDS_Sub.FieldByName('DyeCode').AsString;
|
||||
FieldByName('DyeStyle').Value :=CDS_Sub.FieldByName('DyeStyle').AsString;
|
||||
FieldByName('stepId').Value :=CDS_Sub.FieldByName('stepId').AsInteger;
|
||||
FieldByName('OrderID').Value :=k;
|
||||
FieldByName('Unit').Value :=CDS_Sub.FieldByName('Unit').AsString ;
|
||||
FieldByName('UnitDyeNum').Value :=CDS_Sub.FieldByName('UnitDyeNum').AsFloat ;
|
||||
FieldByName('Crafts').Value :=trim(CDS_Sub.FieldByName('Crafts').asString);
|
||||
FieldByName('beizhu').Value :=trim(CDS_Sub.FieldByName('BeiZhu').asString);
|
||||
if Trim(CDS_Sub.FieldByName('PlanNo').AsString)='' then
|
||||
begin
|
||||
FieldByName('Filler').Value:=Trim(gUserName);
|
||||
end else
|
||||
begin
|
||||
FieldByName('Editer').Value:=Trim(gUserName);
|
||||
FieldByName('EditTime').Value:=GetServerTime10(ADOQueryTemp);
|
||||
end;
|
||||
Post;
|
||||
end;
|
||||
Inc(k);
|
||||
CDS_Sub.Next;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('Update MD_ProductPC Set PLFlag=1,PLPerson='''+Trim(gUserName)+'''');
|
||||
sql.Add(' ,PLTime=getdate() ');
|
||||
sql.Add(' where PCID='''+Trim(ADOQueryPlan.fieldbyname('PCID').AsString)+'''');
|
||||
ExecSQL;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
Result := True;
|
||||
except
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!', '提示', MB_ICONSTOP);
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.btnSaveDyeClick(Sender: TObject);
|
||||
begin
|
||||
if CDS_Sub.Locate('chnName',null,[]) then
|
||||
begin
|
||||
Application.MessageBox('所选材料不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if CDS_Sub.Locate('UnitdyeNum',null,[]) then
|
||||
begin
|
||||
Application.MessageBox('配方数不能为空!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
if saveDye() then
|
||||
begin
|
||||
Application.MessageBox('数据保存成功!','提示',0);
|
||||
btnSaveDye.Enabled:=false;
|
||||
Tfind.Click;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.Tv1FocusedRecordChanged(
|
||||
Sender: TcxCustomGridTableView; APrevFocusedRecord,
|
||||
AFocusedRecord: TcxCustomGridRecord;
|
||||
ANewItemRecordFocusingChanged: Boolean);
|
||||
begin
|
||||
InitSubGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.grdDyeTV1UnitdyeNumPropertiesChange(
|
||||
Sender: TObject);
|
||||
begin
|
||||
btnSaveDye.Enabled:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.ToolButton1Click(Sender: TObject);
|
||||
var
|
||||
mStepId: Integer;
|
||||
begin
|
||||
if ADOQueryPlan.IsEmpty then Exit;
|
||||
if CDS_Sub.IsEmpty then
|
||||
begin
|
||||
mStepId := 1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
CDS_Sub.Last ;
|
||||
mStepId := CDS_Sub.FieldByName('stepId').AsInteger;
|
||||
end;
|
||||
try
|
||||
frmGetXYHelp:=TfrmGetXYHelp.Create(Application);
|
||||
with frmGetXYHelp do
|
||||
begin
|
||||
DYCode.Text:=Trim(ADOQueryPlan.fieldbyname('P_Csid').AsString);
|
||||
if ShowModal=1 then
|
||||
begin
|
||||
with ADOQueryDY do
|
||||
begin
|
||||
try
|
||||
DisableControls;
|
||||
First ;
|
||||
while not Eof do
|
||||
begin
|
||||
CDS_Sub.Append;
|
||||
CDS_Sub.FieldByName('stepId').Value:=mStepId;
|
||||
CDS_Sub.FieldByName('OrderId').Value:= CDS_Sub.RecordCount+1;
|
||||
CDS_Sub.FieldByName('DyeCode').Value :=trim(FieldByName('DyeCode').AsString);
|
||||
CDS_Sub.FieldByName('chnName').Value :=trim(FieldByName('chnName').AsString);
|
||||
CDS_Sub.FieldByName('DyeStyle').Value :=FieldByName('DyeStyle').AsString;
|
||||
CDS_Sub.FieldByName('Unit').Value :=FieldByName('DyeUnit').AsString;
|
||||
CDS_Sub.FieldByName('Crafts').Value:=FieldByName('GXMC').AsString;
|
||||
CDS_Sub.FieldByName('Beizhu').Value:=FieldByName('Beizhu').AsString;
|
||||
CDS_Sub.FieldByName('UnitdyeNum').Value:=FieldByName('UnitdyeNum').AsString;
|
||||
CDS_Sub.Post;
|
||||
Next;
|
||||
end;
|
||||
finally
|
||||
EnableControls;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
frmGetXYHelp.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.ToolButton2Click(Sender: TObject);
|
||||
var
|
||||
mStepId: Integer;
|
||||
begin
|
||||
if ADOQueryPlan.IsEmpty then Exit;
|
||||
if CDS_Sub.IsEmpty then
|
||||
begin
|
||||
mStepId := 1;
|
||||
end
|
||||
else
|
||||
begin
|
||||
CDS_Sub.Last ;
|
||||
mStepId := CDS_Sub.FieldByName('stepId').AsInteger;
|
||||
end;
|
||||
try
|
||||
frmGetPlanXYHelp:=TfrmGetPlanXYHelp.Create(Application);
|
||||
with frmGetPlanXYHelp do
|
||||
begin
|
||||
PlanNO.Text:=Trim(Self.ADOQueryPlan.fieldbyname('sid').AsString);
|
||||
P_Color.Text:=Trim(Self.ADOQueryPlan.fieldbyname('P_Color').AsString);
|
||||
if ShowModal=1 then
|
||||
begin
|
||||
with ADOQueryDY do
|
||||
begin
|
||||
try
|
||||
DisableControls;
|
||||
First ;
|
||||
while not Eof do
|
||||
begin
|
||||
CDS_Sub.Append;
|
||||
CDS_Sub.FieldByName('stepId').Value:=mStepId;
|
||||
CDS_Sub.FieldByName('OrderId').Value:= CDS_Sub.RecordCount+1;
|
||||
CDS_Sub.FieldByName('DyeCode').Value :=trim(FieldByName('DyeCode').AsString);
|
||||
CDS_Sub.FieldByName('chnName').Value :=trim(FieldByName('chnName').AsString);
|
||||
CDS_Sub.FieldByName('DyeStyle').Value :=FieldByName('DyeStyle').AsString;
|
||||
CDS_Sub.FieldByName('Unit').Value :=FieldByName('Unit').AsString;
|
||||
CDS_Sub.FieldByName('Crafts').Value:=FieldByName('Crafts').AsString;
|
||||
CDS_Sub.FieldByName('Beizhu').Value:=FieldByName('Beizhu').AsString;
|
||||
CDS_Sub.FieldByName('UnitdyeNum').Value:=FieldByName('UnitdyeNum').AsString;
|
||||
CDS_Sub.Post;
|
||||
Next;
|
||||
end;
|
||||
finally
|
||||
EnableControls;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
frmGetPlanXYHelp.Free;
|
||||
end;
|
||||
btnSaveDye.Enabled:=True;
|
||||
end;
|
||||
|
||||
procedure TfrmPlanOrderPL.grdDyeTV1beizhuPropertiesEditValueChanged(
|
||||
Sender: TObject);
|
||||
begin
|
||||
btnSaveDye.Enabled:=True;
|
||||
end;
|
||||
|
||||
end.
|
||||
726
Z99Dependency/ThreeFun/SelfForm/U_RSFormPas.pas
Normal file
|
|
@ -0,0 +1,726 @@
|
|||
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;
|
||||
///////////////////////////////////////////////////////
|
||||
///// 函数功能:初始化一级树
|
||||
//////////////////////////////////////////////////////
|
||||
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:='所有'+Trim(ADOQueryTemp.FieldByName('name').AsString)+'员工';
|
||||
aNode:=TreeView1.Items.AddChild(nil,kind) ;
|
||||
ADOQueryTemp.Next;
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////
|
||||
///函数功能:初始化子树
|
||||
//////////////////////////////////////////////
|
||||
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;
|
||||
////////////////////////////////
|
||||
//// 函数功能:获得根节点
|
||||
///////////////////////////////
|
||||
function GetRoot(node:TTreeNode):TTreeNode;
|
||||
begin
|
||||
Result:=node;
|
||||
while((Result <> nil) and (Result.Parent <> nil)) do
|
||||
Result:= Result.Parent;
|
||||
end;
|
||||
//////////////////////////////////////
|
||||
/// 函数功能:汇总过滤条件进行过滤
|
||||
/////////////////////////////////////
|
||||
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;
|
||||
/////////////////////////////
|
||||
//函数功能:获得根节点
|
||||
///////////////////////////
|
||||
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;
|
||||
////////////////////////////
|
||||
/// 函数功能:过滤
|
||||
///////////////////////////
|
||||
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;
|
||||
/////////////////////////////////////////////
|
||||
///函数功能:初始化combobox 【XC_CustCode】
|
||||
////////////////////////////////////////////
|
||||
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('定义XC_CustCode Flag='+FFlag),'提示',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;
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////函数功能:根据SQL语句删除数据
|
||||
//////////////////////////////////////////////
|
||||
function DelData(ADOQueryMain,ADOQueryCmd:TADOQuery;FStr:String):Boolean;
|
||||
begin
|
||||
try
|
||||
result:=False;
|
||||
if ADOQueryMain.IsEmpty then Exit;
|
||||
if Application.MessageBox('确定要删除数据吗?','提示',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('数据删除失败!','提示',0);
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////
|
||||
///函数功能:初始化数据
|
||||
//////////////////////////////////
|
||||
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;
|
||||
////////////////////////////////////
|
||||
///函数功能:按回车跳到下一个控件
|
||||
///////////////////////////////////
|
||||
{procedure KeyPress(Sender: TObject;Key: Char);
|
||||
begin
|
||||
if Key=#13 then
|
||||
begin
|
||||
FindNextControl(TWinControl(sender),True,True,False).SetFocus;
|
||||
end;
|
||||
end;}
|
||||
/////////////////////////////////////
|
||||
/// 函数功能:初始化控件状态
|
||||
////////////////////////////////////
|
||||
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;
|
||||
///////////////////////////////////
|
||||
/////设置保存数据时字段赋值代码
|
||||
//////////////////////////////////
|
||||
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;
|
||||
////////////////////////
|
||||
//增加进度条
|
||||
///////////////////////
|
||||
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('没有定义打印格式文件!不能完成打印' + #13+ fPrintFile),'提示',0);
|
||||
Exit ;
|
||||
end ;
|
||||
end;
|
||||
end;
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//函数:初试化combox中的数据
|
||||
//从XC_CustCode表中取定义数据
|
||||
//Boxtype:0; 带编号:1;
|
||||
//emptyFlag:是否默认为空
|
||||
//isClearOld:清除原有的项目
|
||||
//////////////////////////////////////////////
|
||||
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('基础设置中未找到:'+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;
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//函数:初试化combox中的数据
|
||||
//从XC_CustCode表中取定义数据
|
||||
//Boxtype:0; 带编号: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('未找到:'+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.
|
||||
|
||||
104
Z99Dependency/ThreeFun/SelfForm/U_SelExportField.dfm
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
object frmSelExportField: TfrmSelExportField
|
||||
Left = 473
|
||||
Top = 162
|
||||
BorderStyle = bsDialog
|
||||
Caption = #23383#27573#23548#20986#36873#25321
|
||||
ClientHeight = 493
|
||||
ClientWidth = 430
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Button1: TButton
|
||||
Left = 94
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 243
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #20851#38381
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object cxGrid1: TcxGrid
|
||||
Left = 425
|
||||
Top = 63
|
||||
Width = 281
|
||||
Height = 113
|
||||
TabOrder = 2
|
||||
Visible = False
|
||||
object ExpGrid: TcxGridDBTableView
|
||||
NavigatorButtons.ConfirmDelete = False
|
||||
DataController.DataSource = ExportDataSource
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsBehavior.AlwaysShowEditor = True
|
||||
OptionsView.GroupByBox = False
|
||||
end
|
||||
object cxGrid1Level1: TcxGridLevel
|
||||
GridView = ExpGrid
|
||||
end
|
||||
end
|
||||
object Panel2: TScrollBox
|
||||
Left = 2
|
||||
Top = 0
|
||||
Width = 423
|
||||
Height = 438
|
||||
HorzScrollBar.Visible = False
|
||||
Color = clSkyBlue
|
||||
ParentColor = False
|
||||
TabOrder = 3
|
||||
object Label4: TLabel
|
||||
Left = 158
|
||||
Top = 9
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #23383#27573#36873#25321
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clRed
|
||||
Font.Height = -14
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 20
|
||||
Top = 449
|
||||
Width = 49
|
||||
Height = 17
|
||||
Caption = #20840#36873
|
||||
TabOrder = 4
|
||||
OnClick = CheckBox1Click
|
||||
end
|
||||
object CheckBox2: TCheckBox
|
||||
Left = 20
|
||||
Top = 465
|
||||
Width = 49
|
||||
Height = 17
|
||||
Caption = #20840#24323
|
||||
TabOrder = 5
|
||||
OnClick = CheckBox2Click
|
||||
end
|
||||
object ExportDataSource: TDataSource
|
||||
Left = 424
|
||||
Top = 233
|
||||
end
|
||||
end
|
||||
272
Z99Dependency/ThreeFun/SelfForm/U_SelExportField.pas
Normal file
|
|
@ -0,0 +1,272 @@
|
|||
unit U_SelExportField;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, RM_FormReport, RM_PDBGrid,
|
||||
DB,IniFiles, RM_Common, RM_Class, RM_e_Xls, cxStyles, cxCustomData,
|
||||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
|
||||
cxGridLevel, cxClasses, cxControls, cxGridCustomView,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid;
|
||||
|
||||
type
|
||||
TfrmSelExportField = class(TForm)
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
ExportDataSource: TDataSource;
|
||||
ExpGrid: TcxGridDBTableView;
|
||||
cxGrid1Level1: TcxGridLevel;
|
||||
cxGrid1: TcxGrid;
|
||||
Panel2: TScrollBox;
|
||||
Label4: TLabel;
|
||||
CheckBox1: TCheckBox;
|
||||
CheckBox2: TCheckBox;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure CheckBox1Click(Sender: TObject);
|
||||
procedure CheckBox2Click(Sender: TObject);
|
||||
private
|
||||
procedure CreateCheckBox();
|
||||
procedure ExportData();
|
||||
procedure ReadINIFile(fieldname:string);
|
||||
procedure WriteINIFile(fieldname:string);
|
||||
Function IsINIFile(fieldname:string):Boolean;
|
||||
procedure GetExportFields();
|
||||
procedure IsCheck();
|
||||
{ Private declarations }
|
||||
public
|
||||
ExportFields,IniName:string;
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmSelExportField: TfrmSelExportField;
|
||||
|
||||
implementation
|
||||
|
||||
uses U_SelPrintField,U_FormPas;
|
||||
|
||||
{$R *.dfm}
|
||||
procedure TfrmSelExportField.CreateCheckBox();
|
||||
var
|
||||
i,j,FTop,FLeft,Fdiv,FMod:Integer;// mod 余数,div商
|
||||
FCheckBox:TCheckBox;
|
||||
begin
|
||||
for i:=0 to ExpGrid.ColumnCount-1 do
|
||||
begin
|
||||
Fdiv:=(i+1) div 3;
|
||||
FMod:=(i+1) mod 3;
|
||||
FCheckBox:=TCheckBox.Create(Self);
|
||||
FCheckBox.Caption:=Trim(ExpGrid.Columns[i].Caption);
|
||||
FCheckBox.TabOrder:=i;
|
||||
FCheckBox.Parent:=Panel2;
|
||||
FCheckBox.Checked:=True;
|
||||
if FMod>0 then
|
||||
FCheckBox.Top:=36*(Fdiv+1)
|
||||
else
|
||||
FCheckBox.Top:=36*Fdiv;
|
||||
if FMod=1 then
|
||||
FCheckBox.Left:=29
|
||||
else if FMod=2 then
|
||||
FCheckBox.Left:=163
|
||||
else if FMod=0 then
|
||||
FCheckBox.Left:=305;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.Button1Click(Sender: TObject);
|
||||
begin
|
||||
//ShowMessage('10除以3取余'+inttostr(10 mod 3)+',取整'+inttostr(10 div 3));
|
||||
ExportData();
|
||||
GetExportFields();
|
||||
if IsINIFile(IniName)=True then
|
||||
begin
|
||||
DeleteFile(IniName);
|
||||
end;
|
||||
WriteINIFile(IniName);
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmSelExportField:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.FormShow(Sender: TObject);
|
||||
begin
|
||||
CreateCheckBox();
|
||||
ReadINIFile(IniName);
|
||||
IsCheck();
|
||||
end;
|
||||
procedure TfrmSelExportField.IsCheck();
|
||||
var
|
||||
i:Integer;
|
||||
fsj:string;
|
||||
begin
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
fsj:=Trim(TCheckBox(Controls[i]).Caption);
|
||||
if Pos(fsj,ExportFields)>0 then
|
||||
TCheckBox(Controls[i]).Checked:=True
|
||||
else
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.ExportData();
|
||||
var
|
||||
i,j:Integer;
|
||||
begin
|
||||
j:=0;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked=True then
|
||||
begin
|
||||
j:=1;
|
||||
ExpGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=True
|
||||
end else
|
||||
begin
|
||||
ExpGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
TcxGridToExcel(Trim(IniName),cxGrid1);
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmSelExportField.Button2Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.ReadINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldExportSet\' +trim(fieldname)+'.INI';
|
||||
programIni:=Tinifile.create(FName);
|
||||
ExportFields:=programIni.ReadString('导出设置','导出字段','');
|
||||
programIni.Free;
|
||||
end;
|
||||
procedure TfrmSelExportField.GetExportFields();
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
ExportFields:='Begin';
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked then
|
||||
begin
|
||||
ExportFields:=ExportFields+'/'+TCheckBox(Controls[i]).Caption;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//写设置信息到INI文件
|
||||
//参数
|
||||
//////////////////////////////////////////////////////////////////
|
||||
procedure TfrmSelExportField.WriteINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldExportSet\'+trim(fieldname)+'.INI';
|
||||
if not DirectoryExists(ExtractFileDir(FName)) then
|
||||
CreateDir(ExtractFileDir(FName));
|
||||
programIni:=Tinifile.create(FName);
|
||||
programIni.WriteString('导出设置','导出字段',ExportFields);
|
||||
programIni.Free;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//判断InI文件是否存在
|
||||
//////////////////////////////////////////////////////////////////
|
||||
Function TfrmSelExportField.IsINIFile(fieldname:string):Boolean;
|
||||
var
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldExportSet\'+trim(fieldname)+'.INI';
|
||||
if FileExists(FName) then
|
||||
Result:=True
|
||||
else
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.CheckBox1Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox1.Checked then
|
||||
begin
|
||||
CheckBox2.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmSelExportField.CheckBox2Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox2.Checked then
|
||||
begin
|
||||
CheckBox1.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
149
Z99Dependency/ThreeFun/SelfForm/U_SelPrintField.dfm
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
object frmSelPrintField: TfrmSelPrintField
|
||||
Left = 329
|
||||
Top = 100
|
||||
Width = 427
|
||||
Height = 530
|
||||
Caption = #23383#27573#25171#21360#36873#25321
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Button1: TButton
|
||||
Left = 94
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 243
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #20851#38381
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object PrnGrid: TDBGrid
|
||||
Left = 497
|
||||
Top = 93
|
||||
Width = 200
|
||||
Height = 120
|
||||
DataSource = PrintDataSource
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -13
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
TitleFont.Charset = ANSI_CHARSET
|
||||
TitleFont.Color = clWindowText
|
||||
TitleFont.Height = -16
|
||||
TitleFont.Name = #23435#20307
|
||||
TitleFont.Style = []
|
||||
Visible = False
|
||||
end
|
||||
object ScrollBox1: TScrollBox
|
||||
Left = 2
|
||||
Top = 0
|
||||
Width = 415
|
||||
Height = 438
|
||||
Color = clSkyBlue
|
||||
ParentColor = False
|
||||
TabOrder = 3
|
||||
object Label4: TLabel
|
||||
Left = 158
|
||||
Top = 9
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #23383#27573#36873#25321
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clRed
|
||||
Font.Height = -14
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
object RMPrintDBGrid1: TRMPrintDBGrid
|
||||
ReportOptions = [rmgoStretch, rmgoWordWrap, rmgoGridLines]
|
||||
PageLayout.LeftMargin = 38
|
||||
PageLayout.TopMargin = 38
|
||||
PageLayout.RightMargin = 38
|
||||
PageLayout.BottomMargin = 38
|
||||
PageLayout.Height = 2970
|
||||
PageLayout.Width = 2100
|
||||
PageLayout.PageBin = 0
|
||||
PageLayout.PrinterName = #40664#35748#25171#21360#26426
|
||||
PageLayout.ColorPrint = False
|
||||
PageHeaderMsg.Font.Charset = GB2312_CHARSET
|
||||
PageHeaderMsg.Font.Color = clWindowText
|
||||
PageHeaderMsg.Font.Height = -13
|
||||
PageHeaderMsg.Font.Name = #23435#20307
|
||||
PageHeaderMsg.Font.Style = []
|
||||
PageFooterMsg.Font.Charset = GB2312_CHARSET
|
||||
PageFooterMsg.Font.Color = clWindowText
|
||||
PageFooterMsg.Font.Height = -15
|
||||
PageFooterMsg.Font.Name = #23435#20307
|
||||
PageFooterMsg.Font.Style = []
|
||||
PageCaptionMsg.CaptionMsg.Font.Charset = GB2312_CHARSET
|
||||
PageCaptionMsg.CaptionMsg.Font.Color = clWindowText
|
||||
PageCaptionMsg.CaptionMsg.Font.Height = -13
|
||||
PageCaptionMsg.CaptionMsg.Font.Name = #23435#20307
|
||||
PageCaptionMsg.CaptionMsg.Font.Style = []
|
||||
PageCaptionMsg.TitleFont.Charset = GB2312_CHARSET
|
||||
PageCaptionMsg.TitleFont.Color = clWindowText
|
||||
PageCaptionMsg.TitleFont.Height = -16
|
||||
PageCaptionMsg.TitleFont.Name = #23435#20307
|
||||
PageCaptionMsg.TitleFont.Style = [fsBold]
|
||||
MasterDataBandOptions.ReprintColumnHeaderOnNewColumn = True
|
||||
GridNumOptions.Text = 'No'
|
||||
GridFontOptions.Font.Charset = ANSI_CHARSET
|
||||
GridFontOptions.Font.Color = clWindowText
|
||||
GridFontOptions.Font.Height = -15
|
||||
GridFontOptions.Font.Name = #23435#20307
|
||||
GridFontOptions.Font.Style = []
|
||||
ReportSettings.InitialZoom = pzDefault
|
||||
ReportSettings.PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS]
|
||||
DBGrid = PrnGrid
|
||||
Left = 339
|
||||
Top = 449
|
||||
end
|
||||
object PrintDataSource: TDataSource
|
||||
DataSet = ClientDataSet1
|
||||
Left = 536
|
||||
Top = 246
|
||||
end
|
||||
object RMXLSExport1: TRMXLSExport
|
||||
ShowAfterExport = True
|
||||
ExportPrecision = 1
|
||||
PagesOfSheet = 1
|
||||
ExportImages = True
|
||||
ExportFrames = True
|
||||
ExportImageFormat = ifBMP
|
||||
JPEGQuality = 0
|
||||
ScaleX = 1.000000000000000000
|
||||
ScaleY = 1.000000000000000000
|
||||
CompressFile = False
|
||||
Left = 359
|
||||
Top = 368
|
||||
end
|
||||
object ClientDataSet1: TClientDataSet
|
||||
Aggregates = <>
|
||||
Params = <>
|
||||
Left = 378
|
||||
Top = 340
|
||||
end
|
||||
end
|
||||
241
Z99Dependency/ThreeFun/SelfForm/U_SelPrintField.pas
Normal file
|
|
@ -0,0 +1,241 @@
|
|||
unit U_SelPrintField;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, RM_FormReport, RM_PDBGrid,
|
||||
DB,IniFiles, RM_Common, RM_Class, RM_e_Xls, DBClient;
|
||||
|
||||
type
|
||||
TfrmSelPrintField = class(TForm)
|
||||
RMPrintDBGrid1: TRMPrintDBGrid;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
PrintDataSource: TDataSource;
|
||||
PrnGrid: TDBGrid;
|
||||
RMXLSExport1: TRMXLSExport;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
ScrollBox1: TScrollBox;
|
||||
Label4: TLabel;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
private
|
||||
procedure CreateCheckBox();
|
||||
procedure PrintData();
|
||||
procedure ReadINIFile(fieldname:string);
|
||||
procedure WriteINIFile(fieldname:string);
|
||||
Function IsINIFile(fieldname:string):Boolean;
|
||||
procedure GetPrintFields();
|
||||
procedure IsCheck();
|
||||
{ Private declarations }
|
||||
public
|
||||
PrintFields,IniName:string;
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmSelPrintField: TfrmSelPrintField;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
procedure TfrmSelPrintField.CreateCheckBox();
|
||||
var
|
||||
i,j,FTop,FLeft,Fdiv,FMod:Integer;// mod 余数,div商
|
||||
FCheckBox:TCheckBox;
|
||||
begin
|
||||
for i:=0 to PrnGrid.Columns.Count-1 do
|
||||
begin
|
||||
Fdiv:=(i+1) div 3;
|
||||
FMod:=(i+1) mod 3;
|
||||
FCheckBox:=TCheckBox.Create(Self);
|
||||
FCheckBox.Caption:=Trim(PrnGrid.Columns[i].Title.Caption);
|
||||
FCheckBox.TabOrder:=i;
|
||||
FCheckBox.Parent:=ScrollBox1;
|
||||
FCheckBox.Checked:=True;
|
||||
if FMod>0 then
|
||||
FCheckBox.Top:=36*(Fdiv+1)
|
||||
else
|
||||
FCheckBox.Top:=36*Fdiv;
|
||||
if FMod=1 then
|
||||
FCheckBox.Left:=29
|
||||
else if FMod=2 then
|
||||
FCheckBox.Left:=163
|
||||
else if FMod=0 then
|
||||
FCheckBox.Left:=305;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.Button1Click(Sender: TObject);
|
||||
begin
|
||||
//ShowMessage('10除以3取余'+inttostr(10 mod 3)+',取整'+inttostr(10 div 3));
|
||||
PrintData();
|
||||
GetPrintFields();
|
||||
if IsINIFile(IniName)=True then
|
||||
begin
|
||||
DeleteFile(IniName);
|
||||
end;
|
||||
WriteINIFile(IniName);
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmSelPrintField:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.FormShow(Sender: TObject);
|
||||
begin
|
||||
CreateCheckBox();
|
||||
ReadINIFile(IniName);
|
||||
IsCheck();
|
||||
end;
|
||||
procedure TfrmSelPrintField.IsCheck();
|
||||
var
|
||||
i:Integer;
|
||||
fsj:string;
|
||||
begin
|
||||
with ScrollBox1 do
|
||||
begin
|
||||
for i:=0 to ScrollBox1.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
fsj:=Trim(TCheckBox(Controls[i]).Caption);
|
||||
if Pos(fsj,PrintFields)>0 then
|
||||
TCheckBox(Controls[i]).Checked:=True
|
||||
else
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.PrintData();
|
||||
var
|
||||
i,j,k:Integer;
|
||||
FFieldName:string;
|
||||
begin
|
||||
j:=0;
|
||||
k:=0;
|
||||
with ScrollBox1 do
|
||||
begin
|
||||
for i:=0 to ScrollBox1.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked=True then
|
||||
begin
|
||||
j:=1;
|
||||
PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=True;
|
||||
k:=k+1;
|
||||
if k=1 then
|
||||
begin
|
||||
FFieldName:=PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].FieldName;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{ClientDataSet1.Last;
|
||||
if Trim(ClientDataSet1.FieldByName('flag').AsString)='Y' then
|
||||
begin
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName(FFieldName).Value:='合计';
|
||||
ClientDataSet1.Post;
|
||||
end;}
|
||||
|
||||
if j=1 then
|
||||
begin
|
||||
RMPrintDBGrid1.ShowReport ;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Application.MessageBox('没有可打印的信息!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
//Panel2.Visible:=False;
|
||||
//RMPrintDBGrid1.ShowReport;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.Button2Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintField.ReadINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\' +trim(fieldname)+'.INI';
|
||||
programIni:=Tinifile.create(FName);
|
||||
PrintFields:=programIni.ReadString('打印设置','打印字段','');
|
||||
programIni.Free;
|
||||
end;
|
||||
procedure TfrmSelPrintField.GetPrintFields();
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
PrintFields:='Begin';
|
||||
with ScrollBox1 do
|
||||
begin
|
||||
for i:=0 to ScrollBox1.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked then
|
||||
begin
|
||||
PrintFields:=PrintFields+'/'+TCheckBox(Controls[i]).Caption;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//写设置信息到INI文件
|
||||
//参数
|
||||
//////////////////////////////////////////////////////////////////
|
||||
procedure TfrmSelPrintField.WriteINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\'+trim(fieldname)+'.INI';
|
||||
if not DirectoryExists(ExtractFileDir(FName)) then
|
||||
CreateDir(ExtractFileDir(FName));
|
||||
programIni:=Tinifile.create(FName);
|
||||
programIni.WriteString('打印设置','打印字段',PrintFields);
|
||||
programIni.Free;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//判断InI文件是否存在
|
||||
//////////////////////////////////////////////////////////////////
|
||||
Function TfrmSelPrintField.IsINIFile(fieldname:string):Boolean;
|
||||
var
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\'+trim(fieldname)+'.INI';
|
||||
if FileExists(FName) then
|
||||
Result:=True
|
||||
else
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
end.
|
||||
178
Z99Dependency/ThreeFun/SelfForm/U_SelPrintFieldNew.dfm
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
object frmSelPrintFieldNew: TfrmSelPrintFieldNew
|
||||
Left = 269
|
||||
Top = 139
|
||||
BorderStyle = bsDialog
|
||||
Caption = #23383#27573#25171#21360#36873#25321
|
||||
ClientHeight = 493
|
||||
ClientWidth = 428
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Button1: TButton
|
||||
Left = 94
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = Button1Click
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 243
|
||||
Top = 456
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = #20851#38381
|
||||
TabOrder = 1
|
||||
OnClick = Button2Click
|
||||
end
|
||||
object PrnGrid: TDBGrid
|
||||
Left = 17
|
||||
Top = 165
|
||||
Width = 320
|
||||
Height = 120
|
||||
DataSource = PrintDataSource
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
TitleFont.Charset = GB2312_CHARSET
|
||||
TitleFont.Color = clWindowText
|
||||
TitleFont.Height = -12
|
||||
TitleFont.Name = #23435#20307
|
||||
TitleFont.Style = []
|
||||
Visible = False
|
||||
end
|
||||
object Panel2: TScrollBox
|
||||
Left = 2
|
||||
Top = 0
|
||||
Width = 423
|
||||
Height = 438
|
||||
HorzScrollBar.Visible = False
|
||||
BevelInner = bvSpace
|
||||
BevelKind = bkTile
|
||||
BorderStyle = bsNone
|
||||
Color = clSkyBlue
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 3
|
||||
object Label4: TLabel
|
||||
Left = 166
|
||||
Top = 9
|
||||
Width = 60
|
||||
Height = 14
|
||||
Caption = #23383#27573#36873#25321
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clRed
|
||||
Font.Height = -14
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
object CheckBox1: TCheckBox
|
||||
Left = 21
|
||||
Top = 450
|
||||
Width = 49
|
||||
Height = 17
|
||||
Caption = #20840#36873
|
||||
TabOrder = 4
|
||||
OnClick = CheckBox1Click
|
||||
end
|
||||
object CheckBox2: TCheckBox
|
||||
Left = 21
|
||||
Top = 466
|
||||
Width = 49
|
||||
Height = 17
|
||||
Caption = #20840#24323
|
||||
TabOrder = 5
|
||||
OnClick = CheckBox2Click
|
||||
end
|
||||
object RMPrintDBGrid1: TRMPrintDBGrid
|
||||
ReportOptions = [rmgoStretch, rmgoWordWrap, rmgoGridLines]
|
||||
PageLayout.LeftMargin = 38
|
||||
PageLayout.TopMargin = 38
|
||||
PageLayout.RightMargin = 38
|
||||
PageLayout.BottomMargin = 38
|
||||
PageLayout.Height = 2970
|
||||
PageLayout.Width = 2100
|
||||
PageLayout.PageBin = 0
|
||||
PageLayout.PrinterName = #40664#35748#25171#21360#26426
|
||||
PageLayout.ColorPrint = False
|
||||
PageHeaderMsg.Font.Charset = GB2312_CHARSET
|
||||
PageHeaderMsg.Font.Color = clWindowText
|
||||
PageHeaderMsg.Font.Height = -13
|
||||
PageHeaderMsg.Font.Name = #23435#20307
|
||||
PageHeaderMsg.Font.Style = []
|
||||
PageFooterMsg.Font.Charset = GB2312_CHARSET
|
||||
PageFooterMsg.Font.Color = clWindowText
|
||||
PageFooterMsg.Font.Height = -15
|
||||
PageFooterMsg.Font.Name = #23435#20307
|
||||
PageFooterMsg.Font.Style = []
|
||||
PageCaptionMsg.CaptionMsg.Font.Charset = GB2312_CHARSET
|
||||
PageCaptionMsg.CaptionMsg.Font.Color = clWindowText
|
||||
PageCaptionMsg.CaptionMsg.Font.Height = -13
|
||||
PageCaptionMsg.CaptionMsg.Font.Name = #23435#20307
|
||||
PageCaptionMsg.CaptionMsg.Font.Style = []
|
||||
PageCaptionMsg.TitleFont.Charset = GB2312_CHARSET
|
||||
PageCaptionMsg.TitleFont.Color = clWindowText
|
||||
PageCaptionMsg.TitleFont.Height = -16
|
||||
PageCaptionMsg.TitleFont.Name = #23435#20307
|
||||
PageCaptionMsg.TitleFont.Style = [fsBold]
|
||||
MasterDataBandOptions.ReprintColumnHeaderOnNewColumn = True
|
||||
GridNumOptions.Text = 'No'
|
||||
GridFontOptions.Font.Charset = ANSI_CHARSET
|
||||
GridFontOptions.Font.Color = clWindowText
|
||||
GridFontOptions.Font.Height = -15
|
||||
GridFontOptions.Font.Name = #23435#20307
|
||||
GridFontOptions.Font.Style = []
|
||||
ReportSettings.InitialZoom = pzDefault
|
||||
ReportSettings.PreviewButtons = [pbZoom, pbLoad, pbSave, pbPrint, pbFind, pbPageSetup, pbExit, pbSaveToXLS]
|
||||
DBGrid = PrnGrid
|
||||
Left = 339
|
||||
Top = 449
|
||||
end
|
||||
object PrintDataSource: TDataSource
|
||||
DataSet = ClientDataSet1
|
||||
Left = 536
|
||||
Top = 246
|
||||
end
|
||||
object RMXLSExport1: TRMXLSExport
|
||||
ShowAfterExport = True
|
||||
ExportPrecision = 1
|
||||
PagesOfSheet = 1
|
||||
ExportImages = True
|
||||
ExportFrames = True
|
||||
ExportImageFormat = ifBMP
|
||||
JPEGQuality = 0
|
||||
ScaleX = 1.000000000000000000
|
||||
ScaleY = 1.000000000000000000
|
||||
CompressFile = False
|
||||
Left = 359
|
||||
Top = 368
|
||||
end
|
||||
object ClientDataSet1: TClientDataSet
|
||||
Aggregates = <>
|
||||
Params = <>
|
||||
Left = 378
|
||||
Top = 340
|
||||
end
|
||||
end
|
||||
293
Z99Dependency/ThreeFun/SelfForm/U_SelPrintFieldNew.pas
Normal file
|
|
@ -0,0 +1,293 @@
|
|||
unit U_SelPrintFieldNew;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, RM_FormReport, RM_PDBGrid,
|
||||
DB,IniFiles, RM_Common, RM_Class, RM_e_Xls, DBClient;
|
||||
|
||||
type
|
||||
TfrmSelPrintFieldNew = class(TForm)
|
||||
RMPrintDBGrid1: TRMPrintDBGrid;
|
||||
Button1: TButton;
|
||||
Button2: TButton;
|
||||
PrintDataSource: TDataSource;
|
||||
PrnGrid: TDBGrid;
|
||||
RMXLSExport1: TRMXLSExport;
|
||||
ClientDataSet1: TClientDataSet;
|
||||
Panel2: TScrollBox;
|
||||
Label4: TLabel;
|
||||
CheckBox1: TCheckBox;
|
||||
CheckBox2: TCheckBox;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button2Click(Sender: TObject);
|
||||
procedure CheckBox1Click(Sender: TObject);
|
||||
procedure CheckBox2Click(Sender: TObject);
|
||||
private
|
||||
procedure CreateCheckBox();
|
||||
procedure PrintData();
|
||||
procedure ReadINIFile(fieldname:string);
|
||||
procedure WriteINIFile(fieldname:string);
|
||||
Function IsINIFile(fieldname:string):Boolean;
|
||||
procedure GetPrintFields();
|
||||
procedure IsCheck();
|
||||
{ Private declarations }
|
||||
public
|
||||
PrintFields,IniName:string;
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmSelPrintFieldNew: TfrmSelPrintFieldNew;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
procedure TfrmSelPrintFieldNew.CreateCheckBox();
|
||||
var
|
||||
i,j,FTop,FLeft,Fdiv,FMod:Integer;// mod 余数,div商
|
||||
FCheckBox:TCheckBox;
|
||||
begin
|
||||
for i:=0 to PrnGrid.Columns.Count-1 do
|
||||
begin
|
||||
Fdiv:=(i+1) div 3;
|
||||
FMod:=(i+1) mod 3;
|
||||
FCheckBox:=TCheckBox.Create(Self);
|
||||
FCheckBox.Caption:=Trim(PrnGrid.Columns[i].Title.Caption);
|
||||
FCheckBox.TabOrder:=i;
|
||||
FCheckBox.Parent:=Panel2;
|
||||
FCheckBox.Checked:=True;
|
||||
if FMod>0 then
|
||||
FCheckBox.Top:=36*(Fdiv+1)
|
||||
else
|
||||
FCheckBox.Top:=36*Fdiv;
|
||||
if FMod=1 then
|
||||
FCheckBox.Left:=29
|
||||
else if FMod=2 then
|
||||
FCheckBox.Left:=163
|
||||
else if FMod=0 then
|
||||
FCheckBox.Left:=305;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.Button1Click(Sender: TObject);
|
||||
begin
|
||||
//ShowMessage('10除以3取余'+inttostr(10 mod 3)+',取整'+inttostr(10 div 3));
|
||||
PrintData();
|
||||
GetPrintFields();
|
||||
if IsINIFile(IniName)=True then
|
||||
begin
|
||||
DeleteFile(IniName);
|
||||
end;
|
||||
WriteINIFile(IniName);
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmSelPrintFieldNew:=nil;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.FormShow(Sender: TObject);
|
||||
begin
|
||||
CreateCheckBox();
|
||||
ReadINIFile(IniName);
|
||||
IsCheck();
|
||||
end;
|
||||
procedure TfrmSelPrintFieldNew.IsCheck();
|
||||
var
|
||||
i:Integer;
|
||||
fsj:string;
|
||||
begin
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
fsj:=Trim(TCheckBox(Controls[i]).Caption);
|
||||
if Pos(fsj,PrintFields)>0 then
|
||||
TCheckBox(Controls[i]).Checked:=True
|
||||
else
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.PrintData();
|
||||
var
|
||||
i,j,k:Integer;
|
||||
FFieldName:string;
|
||||
begin
|
||||
j:=0;
|
||||
k:=0;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked=True then
|
||||
begin
|
||||
j:=1;
|
||||
PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=True;
|
||||
k:=k+1;
|
||||
if k=1 then
|
||||
begin
|
||||
FFieldName:=PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].FieldName;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
PrnGrid.Columns[TCheckBox(Controls[i]).TabOrder].Visible:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{ClientDataSet1.Last;
|
||||
if Trim(ClientDataSet1.FieldByName('flag').AsString)='Y' then
|
||||
begin
|
||||
ClientDataSet1.Edit;
|
||||
ClientDataSet1.FieldByName(FFieldName).Value:='合计';
|
||||
ClientDataSet1.Post;
|
||||
end;}
|
||||
|
||||
if j=1 then
|
||||
begin
|
||||
RMPrintDBGrid1.ShowReport ;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Application.MessageBox('没有可打印的信息!','提示',0);
|
||||
Exit;
|
||||
end;
|
||||
//Panel2.Visible:=False;
|
||||
//RMPrintDBGrid1.ShowReport;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.Button2Click(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.ReadINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\' +trim(fieldname)+'.INI';
|
||||
programIni:=Tinifile.create(FName);
|
||||
PrintFields:=programIni.ReadString('打印设置','打印字段','');
|
||||
programIni.Free;
|
||||
end;
|
||||
procedure TfrmSelPrintFieldNew.GetPrintFields();
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
PrintFields:='Begin';
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if TCheckBox(Controls[i]).Checked then
|
||||
begin
|
||||
PrintFields:=PrintFields+'/'+TCheckBox(Controls[i]).Caption;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//写设置信息到INI文件
|
||||
//参数
|
||||
//////////////////////////////////////////////////////////////////
|
||||
procedure TfrmSelPrintFieldNew.WriteINIFile(fieldname:string);
|
||||
var
|
||||
programIni:Tinifile; //配置文件名
|
||||
FName:string;
|
||||
begin
|
||||
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\'+trim(fieldname)+'.INI';
|
||||
if not DirectoryExists(ExtractFileDir(FName)) then
|
||||
CreateDir(ExtractFileDir(FName));
|
||||
programIni:=Tinifile.create(FName);
|
||||
programIni.WriteString('打印设置','打印字段',PrintFields);
|
||||
programIni.Free;
|
||||
end;
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//判断InI文件是否存在
|
||||
//////////////////////////////////////////////////////////////////
|
||||
Function TfrmSelPrintFieldNew.IsINIFile(fieldname:string):Boolean;
|
||||
var
|
||||
FName:string;
|
||||
begin
|
||||
FName:=ExtractFilePath(Application.ExeName)+'FieldPrintSet\'+trim(fieldname)+'.INI';
|
||||
if FileExists(FName) then
|
||||
Result:=True
|
||||
else
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.CheckBox1Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox1.Checked then
|
||||
begin
|
||||
CheckBox2.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmSelPrintFieldNew.CheckBox2Click(Sender: TObject);
|
||||
var
|
||||
i:Integer;
|
||||
begin
|
||||
if CheckBox2.Checked then
|
||||
begin
|
||||
CheckBox1.Checked:=False;
|
||||
with Panel2 do
|
||||
begin
|
||||
for i:=0 to Panel2.ControlCount-1 do
|
||||
begin
|
||||
if Controls[i] is TCheckBox then
|
||||
begin
|
||||
if (TCheckBox(Controls[i]).Name<>'CheckBox1') and (TCheckBox(Controls[i]).Name<>'CheckBox2') then
|
||||
begin
|
||||
TCheckBox(Controls[i]).Checked:=False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
2107
Z99Dependency/ThreeFun/SelfForm/U_SelfForm.pas
Normal file
119
Z99Dependency/ThreeFun/SelfForm/U_XcCustCodeHelp_dx.dfm
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
object frmXcCustCodeHelp_dx: TfrmXcCustCodeHelp_dx
|
||||
Left = 373
|
||||
Top = 226
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsSingle
|
||||
Caption = #36755#20837#24110#21161
|
||||
ClientHeight = 415
|
||||
ClientWidth = 410
|
||||
Color = clBtnFace
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object Label1: TLabel
|
||||
Left = 330
|
||||
Top = 31
|
||||
Width = 60
|
||||
Height = 12
|
||||
Caption = #21517#31216#25110#32534#21495
|
||||
end
|
||||
object btOk: TBitBtn
|
||||
Left = 328
|
||||
Top = 112
|
||||
Width = 57
|
||||
Height = 27
|
||||
Caption = #30830#23450
|
||||
TabOrder = 0
|
||||
OnClick = btOkClick
|
||||
end
|
||||
object btNo: TBitBtn
|
||||
Left = 328
|
||||
Top = 200
|
||||
Width = 57
|
||||
Height = 27
|
||||
Caption = #21462#28040
|
||||
TabOrder = 1
|
||||
OnClick = btNoClick
|
||||
end
|
||||
object dbGrid1: TcxGrid
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 315
|
||||
Height = 415
|
||||
Align = alLeft
|
||||
TabOrder = 2
|
||||
object Tv1: TcxGridDBTableView
|
||||
OnDblClick = Tv1DblClick
|
||||
NavigatorButtons.ConfirmDelete = False
|
||||
DataController.DataSource = DataSource1
|
||||
DataController.Options = [dcoAssignGroupingValues, dcoAssignMasterDetailKeys, dcoSaveExpanding, dcoGroupsAlwaysExpanded]
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <
|
||||
item
|
||||
Kind = skCount
|
||||
end>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsBehavior.GoToNextCellOnEnter = True
|
||||
OptionsBehavior.FocusCellOnCycle = True
|
||||
OptionsCustomize.ColumnFiltering = False
|
||||
OptionsData.Deleting = False
|
||||
OptionsData.DeletingConfirmation = False
|
||||
OptionsData.Inserting = False
|
||||
OptionsSelection.CellSelect = False
|
||||
OptionsView.GroupByBox = False
|
||||
object Tv1code: TcxGridDBColumn
|
||||
Caption = #32534#21495
|
||||
DataBinding.FieldName = 'code'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
HeaderGlyphAlignmentHorz = taCenter
|
||||
Width = 100
|
||||
end
|
||||
object Tv1Name: TcxGridDBColumn
|
||||
Caption = #21517#31216
|
||||
DataBinding.FieldName = 'Name'
|
||||
PropertiesClassName = 'TcxComboBoxProperties'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
HeaderGlyphAlignmentHorz = taCenter
|
||||
Options.Editing = False
|
||||
Options.Focusing = False
|
||||
Width = 189
|
||||
end
|
||||
end
|
||||
object dbGrid1Level1: TcxGridLevel
|
||||
GridView = Tv1
|
||||
end
|
||||
end
|
||||
object NameOrCode: TEdit
|
||||
Left = 320
|
||||
Top = 46
|
||||
Width = 85
|
||||
Height = 20
|
||||
TabOrder = 3
|
||||
OnChange = NameOrCodeChange
|
||||
end
|
||||
object ADOQueryHelp: TADOQuery
|
||||
Connection = ADOConnection1
|
||||
LockType = ltReadOnly
|
||||
Parameters = <>
|
||||
Left = 272
|
||||
Top = 24
|
||||
end
|
||||
object DataSource1: TDataSource
|
||||
DataSet = ADOQueryHelp
|
||||
Left = 216
|
||||
Top = 40
|
||||
end
|
||||
object ADOConnection1: TADOConnection
|
||||
LoginPrompt = False
|
||||
Left = 192
|
||||
Top = 96
|
||||
end
|
||||
end
|
||||
124
Z99Dependency/ThreeFun/SelfForm/U_XcCustCodeHelp_dx.pas
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
unit U_XcCustCodeHelp_dx;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, CheckLst, Buttons, DB, ADODB, cxStyles, cxCustomData,
|
||||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
|
||||
cxDropDownEdit, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
||||
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid;
|
||||
|
||||
type
|
||||
TfrmXcCustCodeHelp_dx = class(TForm)
|
||||
ADOQueryHelp: TADOQuery;
|
||||
btOk: TBitBtn;
|
||||
btNo: TBitBtn;
|
||||
dbGrid1: TcxGrid;
|
||||
Tv1: TcxGridDBTableView;
|
||||
Tv1code: TcxGridDBColumn;
|
||||
Tv1Name: TcxGridDBColumn;
|
||||
dbGrid1Level1: TcxGridLevel;
|
||||
DataSource1: TDataSource;
|
||||
ADOConnection1: TADOConnection;
|
||||
NameOrCode: TEdit;
|
||||
Label1: TLabel;
|
||||
procedure btNoClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure btOkClick(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure Tv1DblClick(Sender: TObject);
|
||||
procedure NameOrCodeChange(Sender: TObject);
|
||||
private
|
||||
procedure InitData();
|
||||
public
|
||||
Fflag:string; //类型标志
|
||||
fDivChar:string;
|
||||
pColumns:integer;
|
||||
fSelResult:string;
|
||||
end;
|
||||
|
||||
var
|
||||
frmXcCustCodeHelp_dx: TfrmXcCustCodeHelp_dx;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_global;
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmXcCustCodeHelp_dx.btNoClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult:=-1;
|
||||
end;
|
||||
|
||||
procedure TfrmXcCustCodeHelp_dx.FormCreate(Sender: TObject);
|
||||
begin
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=gConString;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
////////////////////////////////////////////////
|
||||
//函数:
|
||||
////////////////////////////////////////////////
|
||||
procedure TfrmXcCustCodeHelp_dx.InitData();
|
||||
begin
|
||||
with ADOQueryHelp do
|
||||
begin
|
||||
close;
|
||||
sql.clear;
|
||||
sql.Add('select * from XC_Custcode');
|
||||
sql.Add('where flag='''+Fflag+'''');
|
||||
sql.Add('and Valid=''Y''');
|
||||
sql.Add('order by orderno');
|
||||
Open;
|
||||
end;
|
||||
|
||||
end;
|
||||
procedure TfrmXcCustCodeHelp_dx.FormShow(Sender: TObject);
|
||||
begin
|
||||
self.Caption :='输入帮助(类别:'+FFlag+')';
|
||||
InitData();
|
||||
end;
|
||||
|
||||
procedure TfrmXcCustCodeHelp_dx.btOkClick(Sender: TObject);
|
||||
var
|
||||
fsj:string;
|
||||
begin
|
||||
if ADOQueryHelp.IsEmpty then exit;
|
||||
fSelResult:=trim(ADOQueryHelp.fieldByName('Name').AsString);
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmXcCustCodeHelp_dx.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
Action:=caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmXcCustCodeHelp_dx.Tv1DblClick(Sender: TObject);
|
||||
begin
|
||||
btOk.Click ;
|
||||
end;
|
||||
|
||||
procedure TfrmXcCustCodeHelp_dx.NameOrCodeChange(Sender: TObject);
|
||||
var
|
||||
fsj:string;
|
||||
begin
|
||||
if Trim(NameOrCode.Text)<>'' then
|
||||
begin
|
||||
fsj:=' name like '+QuotedStr('%'+Trim(NameOrCode.Text)+'%');
|
||||
fsj:=fsj+' or code like '+QuotedStr('%'+Trim(NameOrCode.Text)+'%');
|
||||
end;
|
||||
with ADOQueryHelp do
|
||||
begin
|
||||
Filtered:=False;
|
||||
Filter:=fsj;
|
||||
Filtered:=True;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
3628
Z99Dependency/ThreeFun/SelfForm/U_frameHelp10.dfm
Normal file
125
Z99Dependency/ThreeFun/SelfForm/U_frameHelp10.pas
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
unit U_frameHelp10;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ComCtrls, ToolWin, cxGraphics, cxCustomData, cxStyles, cxTL, DB,
|
||||
ADODB, cxControls, cxInplaceContainer, cxTLData, cxDBTL, cxMaskEdit,
|
||||
ImgList;
|
||||
|
||||
type
|
||||
TfrmFrameHelp10 = class(TForm)
|
||||
ToolBar2: TToolBar;
|
||||
TOk: TToolButton;
|
||||
ToolButton7: TToolButton;
|
||||
cxDBTreeList1: TcxDBTreeList;
|
||||
ADOQueryHelp: TADOQuery;
|
||||
DataSource1: TDataSource;
|
||||
ADOConnection1: TADOConnection;
|
||||
cxDBTreeList1cxDBTreeListColumn2: TcxDBTreeListColumn;
|
||||
ImageList24: TImageList;
|
||||
cxStyleRepository1: TcxStyleRepository;
|
||||
cxStyle1: TcxStyle;
|
||||
cxStyle2: TcxStyle;
|
||||
cxStyle_gridRow: TcxStyle;
|
||||
cxStyle_gridFoot: TcxStyle;
|
||||
cxStyle_gridHead: TcxStyle;
|
||||
cxStyle_gridGroupBox: TcxStyle;
|
||||
cxStyle_yellow: TcxStyle;
|
||||
cxStyle_Red: TcxStyle;
|
||||
cxStyleTree: TcxStyle;
|
||||
cxStyle3: TcxStyle;
|
||||
procedure ToolButton7Click(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure TOkClick(Sender: TObject);
|
||||
procedure cxDBTreeList1DblClick(Sender: TObject);
|
||||
private
|
||||
procedure DoQuery();
|
||||
public
|
||||
fFrameNo:string;
|
||||
fFrameName:string;
|
||||
fAddress:String;
|
||||
frametop:string;
|
||||
fWhSql:String;
|
||||
end;
|
||||
|
||||
var
|
||||
frmFrameHelp10: TfrmFrameHelp10;
|
||||
|
||||
implementation
|
||||
uses
|
||||
U_global;
|
||||
{$R *.dfm}
|
||||
|
||||
procedure TfrmFrameHelp10.ToolButton7Click(Sender: TObject);
|
||||
begin
|
||||
close;
|
||||
end;
|
||||
|
||||
procedure TfrmFrameHelp10.FormCreate(Sender: TObject);
|
||||
begin
|
||||
cxDBTreeList1.Align :=alClient;
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=gConString;
|
||||
Connected:=true;
|
||||
end;
|
||||
end;
|
||||
///////////////////////////////////////////////////////////
|
||||
//
|
||||
///////////////////////////////////////////////////////////
|
||||
procedure TfrmFrameHelp10.DoQuery();
|
||||
begin
|
||||
with ADOQueryHelp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear ;
|
||||
sql.Add('select * from YC_frame');
|
||||
sql.Add('where valid=''Y''');
|
||||
sql.Add('and frameLevel>=0');
|
||||
if trim(fFrameNo)<>'' then
|
||||
begin
|
||||
sql.Add('and frameNo like '+quotedStr('%'+fFrameNo+'%'));
|
||||
end;
|
||||
if trim(fFrameName)<>'' then
|
||||
begin
|
||||
sql.Add('and frameName like '+quotedStr('%'+fFrameName+'%'));
|
||||
end;
|
||||
if trim(fAddress)<>'' then
|
||||
begin
|
||||
sql.Add('and Address like '+quotedStr('%'+fAddress+'%'));
|
||||
end;
|
||||
if trim(frametop)<>'' then
|
||||
begin
|
||||
sql.Add('and frametop='+quotedStr(frametop));
|
||||
end;
|
||||
if Trim(fWhSql)<>'' then
|
||||
SQL.Add(fWhSql);
|
||||
sql.Add('order by frameLevel');
|
||||
Open;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmFrameHelp10.FormShow(Sender: TObject);
|
||||
begin
|
||||
DoQuery();
|
||||
cxDBTreeList1.Nodes[0].Expand(False);
|
||||
end;
|
||||
|
||||
procedure TfrmFrameHelp10.TOkClick(Sender: TObject);
|
||||
begin
|
||||
if ADOQueryHelp.IsEmpty then
|
||||
ModalResult:=-1
|
||||
else
|
||||
ModalResult:=1;
|
||||
end;
|
||||
|
||||
procedure TfrmFrameHelp10.cxDBTreeList1DblClick(Sender: TObject);
|
||||
begin
|
||||
tok.Click ;
|
||||
end;
|
||||
|
||||
end.
|
||||
148
Z99Dependency/ThreeFun/cxgridPas/U_CxGridSet.pas
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
unit U_CxGridSet;
|
||||
interface
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs,cxGridCustomView, cxGridCustomTableView, cxGridTableView,cxCustomData,
|
||||
cxGridDBTableView, cxGrid, BtnEdit, StdCtrls, ExtCtrls, ComCtrls, ToolWin,
|
||||
cxGridBandedTableView, cxGridDBBandedTableView;
|
||||
|
||||
procedure ReadCxGrid(fileName:string;cxgrid:TcxGridDBTableView;filePack:string='公用');
|
||||
procedure ReadCxBandedGrid(fileName:string;cxgrid:TcxGridDBBandedTableView;filePack:string='公用');
|
||||
procedure WriteCxGrid(fileName:string;cxgrid:TcxGridDBTableView;filePack:string='公用');
|
||||
procedure WriteCxBandedGrid(fileName:string;cxgrid:TcxGridDBBandedTableView;filePack:string='公用');
|
||||
procedure CreateGroupSummarry(tv1:TcxGridDBTableView);
|
||||
implementation
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
//函数功能:从文件中读取cxGridCol设置
|
||||
//fileName 推荐为窗口的caption名字caption名字
|
||||
///////////////////////////////////////////////////////////////
|
||||
procedure ReadCxGrid(fileName:string;cxgrid:TcxGridDBTableView;filePack:string='公用');
|
||||
var
|
||||
mFileName:string;
|
||||
begin
|
||||
mFileName := ExtractFilePath(Application.ExeName)+'Layout\' +filePack+'\'+trim(fileName)+ '.dbg';
|
||||
//从布局文件中恢复
|
||||
if FileExists(mFileName) then
|
||||
cxgrid.RestoreFromIniFile(mFileName);
|
||||
CreateGroupSummarry(cxgrid);
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////
|
||||
//函数功能:从文件中读取cxGridCol设置
|
||||
//fileName 推荐为窗口的caption名字caption名字
|
||||
///////////////////////////////////////////////////////////////
|
||||
procedure ReadCxBandedGrid(fileName:string;cxgrid:TcxGridDBBandedTableView;filePack:string='公用');
|
||||
var
|
||||
mFileName:string;
|
||||
begin
|
||||
mFileName := ExtractFilePath(Application.ExeName)+'Layout\' +filePack+'\'+trim(fileName)+ '.dbg';
|
||||
//从布局文件中恢复
|
||||
if FileExists(mFileName) then
|
||||
cxgrid.RestoreFromIniFile(mFileName);
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////
|
||||
//函数功能:写cxGridCol设置到.dbg文件中
|
||||
//默认推荐为窗口的caption名字
|
||||
///////////////////////////////////////////////////////////////
|
||||
procedure WriteCxGrid(fileName:string;cxgrid:TcxGridDBTableView;filePack:string='公用');
|
||||
var
|
||||
mFileName:string;
|
||||
begin
|
||||
mFileName := ExtractFilePath(Application.ExeName)+'Layout\' +filePack+'\'+trim(fileName)+ '.dbg';
|
||||
if not DirectoryExists(ExtractFileDir(mFileName)) then
|
||||
CreateDir(ExtractFileDir(mFileName));
|
||||
//保存为布局文件
|
||||
cxgrid.StoreToIniFile(mFileName);
|
||||
|
||||
end;
|
||||
///////////////////////////////////////////////////////////////
|
||||
//函数功能:写cxGridCol设置到.dbg文件中
|
||||
//默认推荐为窗口的caption名字
|
||||
///////////////////////////////////////////////////////////////
|
||||
procedure WriteCxBandedGrid(fileName:string;cxgrid:TcxGridDBBandedTableView;filePack:string='公用');
|
||||
var
|
||||
mFileName:string;
|
||||
begin
|
||||
mFileName := ExtractFilePath(Application.ExeName)+'Layout\' +filePack+'\'+trim(fileName)+ '.dbg';
|
||||
if not DirectoryExists(ExtractFileDir(mFileName)) then
|
||||
CreateDir(ExtractFileDir(mFileName));
|
||||
//保存为布局文件
|
||||
cxgrid.StoreToIniFile(mFileName);
|
||||
end;
|
||||
/////////////////////////////////////////////////////
|
||||
//函数:创建汇总列
|
||||
/////////////////////////////////////////////////////
|
||||
procedure CreateGroupSummarry(tv1:TcxGridDBTableView);
|
||||
var
|
||||
csg : TcxDataSummaryGroup;
|
||||
csglink : TcxDataSummaryGroupItemLink;
|
||||
csgItem : TcxDataSummaryItem;
|
||||
i:integer;
|
||||
mFieldName:string;
|
||||
begin
|
||||
///创建汇总列
|
||||
with tv1.DataController.Summary do
|
||||
begin
|
||||
try
|
||||
csg := DataController.Summary.SummaryGroups.Add; //创建汇总项
|
||||
|
||||
csg.Links.Clear;
|
||||
for i:= 0 to tv1.ColumnCount -1 do
|
||||
begin
|
||||
if not tv1.Columns[i].Visible then continue;
|
||||
mFieldName:=tv1.Columns[i].DataBinding.FieldName;
|
||||
|
||||
if tv1.Columns[i].Summary.FooterKind=skSum then
|
||||
begin
|
||||
// (tv1.DataController.DataSet.Fields[i] as TNumericField).DisplayFormat := '#,0.00;-#,0.00;#';
|
||||
//tv1.Columns[i].Summary.FooterFormat:='0.0';
|
||||
//tv1.Columns[i].Summary.FooterKind := skSum;
|
||||
|
||||
//这个与Group Row上的汇总同时使用时好象只能有一个有效
|
||||
//创建行分组行上的汇总项
|
||||
|
||||
csgitem := csg.SummaryItems.Add;
|
||||
csgitem.ItemLink := tv1.Columns[i]; //汇总字段1
|
||||
csgitem.Position :=spGroup;
|
||||
csgitem.Kind := skSum;
|
||||
csgItem.Format := trim(tv1.Columns[i].Caption) +'小计=#,0.0';
|
||||
|
||||
tv1.Columns[i].Summary.GroupFooterKind := skSum;
|
||||
tv1.Columns[i].Summary.GroupFooterFormat := '#,0.00';
|
||||
|
||||
end
|
||||
else if tv1.Columns[i].Summary.FooterKind=skCount then
|
||||
begin
|
||||
// (tv1.DataController.DataSet.Fields[i] as TNumericField).DisplayFormat := '#,0.00;-#,0.00;#';
|
||||
//tv1.Columns[i].Summary.FooterFormat:='0.0';
|
||||
tv1.Columns[i].Summary.FooterKind := skCount;
|
||||
|
||||
tv1.Columns[i].Summary.GroupFooterKind := skCount;
|
||||
|
||||
//tv1.Columns[i].Summary.GroupFooterFormat := '#,0.00';
|
||||
//这个与Group Row上的汇总同时使用时好象只能有一个有效
|
||||
//创建行分组行上的汇总项
|
||||
csgitem := csg.SummaryItems.Add;
|
||||
csgitem.ItemLink := tv1.Columns[i]; //汇总字段1
|
||||
csgitem.Kind := skCount;
|
||||
//csgItem.Format := '小计=#,0.0';
|
||||
|
||||
end
|
||||
else
|
||||
begin
|
||||
csglink := csg.Links.Add;
|
||||
csglink.ItemLink := tv1.Columns[i]; //分类字段
|
||||
//所有不参与汇总的列都有可能用来分组,必须将这些列加入到
|
||||
//SummaryGroupItemLink中,没有加入该连接的列用来分组时
|
||||
//汇总值不会显示
|
||||
end;
|
||||
|
||||
end;
|
||||
finally
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
345
Z99Dependency/ThreeFun/dllPas/U_WorkShopMain.dfm
Normal file
|
|
@ -0,0 +1,345 @@
|
|||
object frmWorkShopMain: TfrmWorkShopMain
|
||||
Left = 47
|
||||
Top = 135
|
||||
Width = 926
|
||||
Height = 602
|
||||
Caption = #26426#21488#20135#37327#30331#35760
|
||||
Color = clBtnFace
|
||||
Font.Charset = ANSI_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
OnClose = FormClose
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 12
|
||||
object ToolBar3: TToolBar
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 918
|
||||
Height = 22
|
||||
AutoSize = True
|
||||
ButtonWidth = 75
|
||||
Caption = 'ToolBar1'
|
||||
EdgeBorders = []
|
||||
Flat = True
|
||||
Images = ADODBMD_work100.ImageList24
|
||||
List = True
|
||||
ShowCaptions = True
|
||||
TabOrder = 0
|
||||
object Trefresh: TToolButton
|
||||
Left = 0
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #21047#26032
|
||||
ImageIndex = 30
|
||||
OnClick = TrefreshClick
|
||||
end
|
||||
object Tfind: TToolButton
|
||||
Left = 55
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #36807#28388
|
||||
ImageIndex = 2
|
||||
OnClick = TfindClick
|
||||
end
|
||||
object Toutput: TToolButton
|
||||
Left = 110
|
||||
Top = 0
|
||||
Caption = #30331#35760#20135#37327
|
||||
ImageIndex = 50
|
||||
OnClick = ToutputClick
|
||||
end
|
||||
object TMx: TToolButton
|
||||
Left = 185
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #26126#32454
|
||||
ImageIndex = 19
|
||||
end
|
||||
object ToolButton1: TToolButton
|
||||
Left = 240
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #23457#26680
|
||||
ImageIndex = 23
|
||||
Visible = False
|
||||
end
|
||||
object Tclose: TToolButton
|
||||
Left = 295
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #20851' '#38381
|
||||
ImageIndex = 10
|
||||
OnClick = TcloseClick
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 22
|
||||
Width = 918
|
||||
Height = 38
|
||||
Align = alTop
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
TabOrder = 1
|
||||
object Label1: TLabel
|
||||
Left = 449
|
||||
Top = 13
|
||||
Width = 24
|
||||
Height = 12
|
||||
Caption = #26426#21488
|
||||
end
|
||||
object Label8: TLabel
|
||||
Left = 5
|
||||
Top = 12
|
||||
Width = 72
|
||||
Height = 12
|
||||
Caption = #20135#37327#36215#22987#26085#26399
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -12
|
||||
Font.Name = #23435#20307
|
||||
Font.Style = []
|
||||
ParentFont = False
|
||||
end
|
||||
object Label5: TLabel
|
||||
Left = 170
|
||||
Top = 13
|
||||
Width = 12
|
||||
Height = 12
|
||||
Caption = #65293
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 612
|
||||
Top = 12
|
||||
Width = 24
|
||||
Height = 12
|
||||
Caption = #29677#32452
|
||||
end
|
||||
object Label3: TLabel
|
||||
Left = 759
|
||||
Top = 11
|
||||
Width = 24
|
||||
Height = 12
|
||||
Caption = #24037#24207
|
||||
end
|
||||
object Label4: TLabel
|
||||
Left = 286
|
||||
Top = 12
|
||||
Width = 48
|
||||
Height = 12
|
||||
Caption = #26426#21488#37096#38376
|
||||
end
|
||||
object dtBeg: TDateTimePicker
|
||||
Left = 83
|
||||
Top = 9
|
||||
Width = 85
|
||||
Height = 20
|
||||
Date = 39444.322589513890000000
|
||||
Format = 'yyyy-MM-dd'
|
||||
Time = 39444.322589513890000000
|
||||
TabOrder = 0
|
||||
end
|
||||
object dtEnd: TDateTimePicker
|
||||
Left = 181
|
||||
Top = 9
|
||||
Width = 87
|
||||
Height = 20
|
||||
Date = 39444.322589513890000000
|
||||
Format = 'yyyy-MM-dd'
|
||||
Time = 39444.322589513890000000
|
||||
TabOrder = 1
|
||||
end
|
||||
object edtGroup: TBtnEditC
|
||||
Left = 644
|
||||
Top = 8
|
||||
Width = 98
|
||||
Height = 20
|
||||
TabOrder = 2
|
||||
OnBtnUpClick = edtGroupBtnUpClick
|
||||
OnBtnDnClick = edtGroupBtnDnClick
|
||||
end
|
||||
object EditMach: TBtnEditC
|
||||
Left = 479
|
||||
Top = 8
|
||||
Width = 105
|
||||
Height = 20
|
||||
TabOrder = 3
|
||||
end
|
||||
object edtGlide: TBtnEditC
|
||||
Left = 790
|
||||
Top = 7
|
||||
Width = 98
|
||||
Height = 20
|
||||
TabOrder = 4
|
||||
OnBtnUpClick = edtGlideBtnUpClick
|
||||
OnBtnDnClick = edtGlideBtnDnClick
|
||||
end
|
||||
object BtnEditC1: TBtnEditC
|
||||
Left = 338
|
||||
Top = 8
|
||||
Width = 89
|
||||
Height = 20
|
||||
TabOrder = 5
|
||||
end
|
||||
end
|
||||
object cxTabControl1: TcxTabControl
|
||||
Left = 0
|
||||
Top = 60
|
||||
Width = 918
|
||||
Height = 21
|
||||
Align = alTop
|
||||
Style = 10
|
||||
TabIndex = 0
|
||||
TabOrder = 2
|
||||
Tabs.Strings = (
|
||||
#24050#30331#35760
|
||||
#23457#26680#30830#35748
|
||||
#20840#37096)
|
||||
OnChange = cxTabControl1Change
|
||||
ClientRectBottom = 21
|
||||
ClientRectRight = 918
|
||||
ClientRectTop = 18
|
||||
end
|
||||
object cxGrid1: TcxGrid
|
||||
Left = 8
|
||||
Top = 136
|
||||
Width = 881
|
||||
Height = 321
|
||||
TabOrder = 3
|
||||
object tv1: TcxGridDBTableView
|
||||
NavigatorButtons.ConfirmDelete = False
|
||||
DataController.DataSource = DataSource1
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <
|
||||
item
|
||||
Kind = skSum
|
||||
Column = tv1Quantity
|
||||
end
|
||||
item
|
||||
Kind = skSum
|
||||
Column = tv1rollNum
|
||||
end
|
||||
item
|
||||
Kind = skSum
|
||||
Column = tv1crockNum
|
||||
end>
|
||||
DataController.Summary.SummaryGroups = <>
|
||||
OptionsBehavior.FocusCellOnTab = True
|
||||
OptionsCustomize.ColumnFiltering = False
|
||||
OptionsData.Deleting = False
|
||||
OptionsData.Editing = False
|
||||
OptionsSelection.CellSelect = False
|
||||
OptionsView.Footer = True
|
||||
OptionsView.GroupByBox = False
|
||||
Styles.Footer = ADODBMD_work100.cxStyle_gridFoot
|
||||
Styles.Header = ADODBMD_work100.cxStyle_gridHead
|
||||
object tv1ClDate: TcxGridDBColumn
|
||||
Caption = #20135#37327#26085#26399
|
||||
DataBinding.FieldName = 'ClDate'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 89
|
||||
end
|
||||
object tv1DeviceName: TcxGridDBColumn
|
||||
Caption = #20135#37327#26426#21488
|
||||
DataBinding.FieldName = 'DeviceName'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
Properties.Alignment.Horz = taLeftJustify
|
||||
Properties.ReadOnly = True
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 107
|
||||
end
|
||||
object tv1GlideName: TcxGridDBColumn
|
||||
Caption = #29983#20135#24037#24207
|
||||
DataBinding.FieldName = 'GlideName'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
Properties.Alignment.Horz = taLeftJustify
|
||||
Properties.ReadOnly = True
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 76
|
||||
end
|
||||
object tv1groupName: TcxGridDBColumn
|
||||
Caption = #29677#32452#21517#31216
|
||||
DataBinding.FieldName = 'groupName'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 111
|
||||
end
|
||||
object tv1Quantity: TcxGridDBColumn
|
||||
Caption = #20135#37327#25968#37327
|
||||
DataBinding.FieldName = 'Quantity'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
Properties.Alignment.Horz = taLeftJustify
|
||||
Properties.ReadOnly = True
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 96
|
||||
end
|
||||
object tv1rollNum: TcxGridDBColumn
|
||||
Caption = #20135#37327#21305#25968
|
||||
DataBinding.FieldName = 'rollNum'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
Properties.Alignment.Horz = taLeftJustify
|
||||
Properties.ReadOnly = True
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 84
|
||||
end
|
||||
object tv1crockNum: TcxGridDBColumn
|
||||
Caption = #32568#25968
|
||||
DataBinding.FieldName = 'crockNum'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 67
|
||||
end
|
||||
object tv1filler: TcxGridDBColumn
|
||||
Caption = #30331#35760#20154
|
||||
DataBinding.FieldName = 'filler'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
Properties.Alignment.Horz = taLeftJustify
|
||||
Properties.ReadOnly = True
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 81
|
||||
end
|
||||
object tv1filltime: TcxGridDBColumn
|
||||
Caption = #30331#35760#26102#38388
|
||||
DataBinding.FieldName = 'filltime'
|
||||
PropertiesClassName = 'TcxTextEditProperties'
|
||||
Properties.Alignment.Horz = taLeftJustify
|
||||
Properties.ReadOnly = True
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 103
|
||||
end
|
||||
object tv1checker: TcxGridDBColumn
|
||||
Caption = #23457#26680#20154
|
||||
DataBinding.FieldName = 'checker'
|
||||
Visible = False
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 59
|
||||
end
|
||||
object tv1chkTime: TcxGridDBColumn
|
||||
Caption = #23457#26680#26102#38388
|
||||
DataBinding.FieldName = 'chkTime'
|
||||
Visible = False
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 98
|
||||
end
|
||||
end
|
||||
object cxGrid1Level1: TcxGridLevel
|
||||
GridView = tv1
|
||||
end
|
||||
end
|
||||
object ADOQueryMain: TADOQuery
|
||||
Connection = ADODBMD_work100.ADOCon
|
||||
LockType = ltReadOnly
|
||||
CommandTimeout = 300
|
||||
Parameters = <>
|
||||
Left = 360
|
||||
Top = 200
|
||||
end
|
||||
object DataSource1: TDataSource
|
||||
DataSet = ADOQueryMain
|
||||
Left = 320
|
||||
Top = 200
|
||||
end
|
||||
end
|
||||
145
Z99Dependency/ThreeFun/dllPas/dsr.pas
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
unit dsr;
|
||||
|
||||
interface
|
||||
uses
|
||||
SysUtils, StrUtils;
|
||||
|
||||
function FTConSvr(hWnd: THandle;
|
||||
hostAddress: PChar;
|
||||
Server, User, Pswd, DTBase: PChar): Integer; stdcall; external 'FTClient.dll';
|
||||
{
|
||||
FTConSvr 参数说明:hWnd-调用程序主窗口句柄(输入);
|
||||
hostAddress-通讯服务器IP地址(输入);
|
||||
Server-数据库服务器(输出);
|
||||
User-数据库登录名(输出);
|
||||
Pswd-数据库登录密码(输出);
|
||||
DTBase-数据库名(输出)。
|
||||
调用前请先为每个输出参数分配至少16字节的存储空间。
|
||||
返回值:-1表示连接服务器失败(调用程序无需显示原因),调用程序关闭;
|
||||
0表示本次连接成功,1表示已有连接,调用程序请继续运行。
|
||||
}
|
||||
|
||||
//function PBDecode(Strin, StrOut: PAnsiChar; nInLen, nOutLen: Integer): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
|
||||
function ft001():Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数Ini:
|
||||
//目的:初步检查是否存在用户锁,如果有存在,提示用户插入用户锁。在程序初始化时,一定要使用这段代码
|
||||
|
||||
|
||||
function ft002():Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数CheckKey
|
||||
//目的:用狗中特定的算法验证当前的加密狗是否为授权的正确狗
|
||||
//返回结果:要进行设置的值
|
||||
|
||||
|
||||
function ft003(a :longint):longint; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数SetValue
|
||||
//目的:用来对变量进行值的设置
|
||||
//参数a:要进行设置的值
|
||||
//返回结果:要进行设置的值
|
||||
//例:对于原来如 x1 = x2; 的赋值方式,可改用 x1 = ft003(x2)的方式
|
||||
|
||||
|
||||
function ft004(s1,s2 :PAnsiChar; len :Integer) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数CompareString
|
||||
//目的:用来对两个字符串进行比较
|
||||
//参数s1:要比较的两个字符串之一
|
||||
//参数s2:要比较的两个字符串之一
|
||||
//参数len:要比较的长度
|
||||
//返回结果:如果为0,两个字符串相等,如果为正数,s1>s2,如果为负数,s1<s2
|
||||
|
||||
|
||||
function ft005(s1,s2 :PAnsiChar; len :Integer) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数CompareStringNoCase
|
||||
//目的:用来对两个字符串进行比较(忽略大小写)
|
||||
//参数s1:要比较的两个字符串之一
|
||||
//参数s2:要比较的两个字符串之一
|
||||
//参数len:要比较的长度
|
||||
//返回结果:如果为0,两个字符串相等,如果为正数,s1>s2,如果为负数,s1<s2
|
||||
|
||||
|
||||
function ft006(s1,s2 :PAnsiChar) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数Strcat
|
||||
//目的:用来对两个字符串进行连接
|
||||
//参数s1:要连接的两个字符串之一
|
||||
//参数s2:要连接的两个字符串之一
|
||||
//返回结果:返回目的字符串的长度, s1 为连接后的字符串
|
||||
//相当于 s1 = s1 + s2, s2加在s1的后面, 返回。
|
||||
|
||||
function ft007(sd,s :PAnsiChar) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数Strcpy
|
||||
//目的:对字符串进行复制
|
||||
//参数sd:目的字符串
|
||||
//参数s:源字符串
|
||||
//返回结果:返回目的字符串的长度
|
||||
//相当于 sd = s
|
||||
|
||||
function ft008(p1,p2 :LongInt; exp :PAnsiChar) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数:Compare
|
||||
//目的:用来比较两个数的大小,相当于?a>b,a<b,a=b
|
||||
//参数p1:要比较的第一个数
|
||||
//参数p2:要比较的第二个数
|
||||
//参数c:是大于,小于或等于,即">","<","="
|
||||
//返回结果:
|
||||
//如果返回0,表示表达式为假,返回1表示表达式为真
|
||||
|
||||
|
||||
|
||||
//获取设置加密狗中的参数
|
||||
//对加密狗的存储区进行操作时,耗时时间较长,应注意!!!!
|
||||
//加密狗中存储位置说明
|
||||
//允许使用的总空间160字节,其中:64字节存放数据库连接信息,分别是:
|
||||
//标识 对应参数 允许存放的最大字符串长度
|
||||
// 5 IP地址 15
|
||||
// 6 用户名 15
|
||||
// 7 用户口令 15
|
||||
// 8 DataBase 15
|
||||
// 9 标识 可用来进行特别标识,如本加密狗的信息,本机硬件信息等
|
||||
// 0-4 自定义 共80字节空间,每个数字表示1节(16字节),递增
|
||||
// 注意空间不能溢出,否则引起未知错误;
|
||||
// 0-4标识使用的是连续空间,当0位置的长度超过15时,
|
||||
// 将覆盖1号位置的存储区域。
|
||||
// 使用 0, 可用空间 80 - 1;
|
||||
// 1, 64 - 1;
|
||||
// 2, 48 - 1;
|
||||
//........
|
||||
//[out, retval] BSTR * Value
|
||||
function ft011(outstr :PAnsiChar; Ord :Integer) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数GetParm
|
||||
//目的:获取加密狗指定位置的字符串
|
||||
//参数outstr:目的字符串
|
||||
//参数Ord:标识加密狗特定地点的标志值(0-9)
|
||||
//返回结果:返回目的字符串的长度
|
||||
|
||||
function ft012(var instr :PAnsiChar; Ord :Integer) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数SetParm
|
||||
//目的:在加密狗的指定位置存放字符串
|
||||
//参数instr:需存放的字符串
|
||||
//参数Ord:标识加密狗特定地点的标志值(0-9)
|
||||
//返回结果:返回写入字符串的长度
|
||||
|
||||
|
||||
|
||||
//加解密函数
|
||||
function ft021(var instr :PAnsiChar; outstr :PAnsiChar) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//说明:本函数单向加密字符串instr,不能逆向解密!
|
||||
//目的:获取输入字符串instr的单向加密字符串outstr
|
||||
//参数instr:需加密的字符串
|
||||
//参数outStr:单向加密后的密文
|
||||
//返回结果:返回密文的长度
|
||||
|
||||
function ft022(source,dest,key :PAnsiChar; flg :Integer) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
function ft023(source,dest,key :PAnsiChar; flg :Integer) :Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//说明:均为字符串加解密函数,可加解密
|
||||
//目的:用指定的Key,对输入字符串source进行置换,dest为置换后的字符串
|
||||
//参数source:需置换的字符串源文
|
||||
//参数dest:置换后后的字符串密文
|
||||
//参数key:置换采用的key,字符串
|
||||
//参数flg: 为1时,进行加密,为0时进行解密
|
||||
//返回结果:返回置换后字符串的长度
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
||||
|
||||
174
Z99Dependency/ThreeFun/dllPas/dsrnew.pas
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
unit dsrnew;
|
||||
|
||||
interface
|
||||
|
||||
function ft001(): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数Ini:
|
||||
//目的:初步检查是否存在用户锁,如果有存在,提示用户插入用户锁。在程序初始化时,一定要使用这段代码
|
||||
|
||||
|
||||
function ft002(): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数CheckKey
|
||||
//目的:用狗中特定的算法验证当前的加密狗是否为授权的正确狗
|
||||
//返回结果:要进行设置的值
|
||||
|
||||
|
||||
function ft003(a: Integer): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数SetValue
|
||||
//目的:用来对变量进行值的设置
|
||||
//参数a:要进行设置的值
|
||||
//返回结果:要进行设置的值
|
||||
//例:对于原来如 x1 = x2; 的赋值方式,可改用 x1 = ft003(x2)的方式
|
||||
|
||||
|
||||
function ft004(var s1, s2: PAnsiChar; len: Integer): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数CompareString
|
||||
//目的:用来对两个字符串进行比较
|
||||
//参数s1:要比较的两个字符串之一
|
||||
//参数s2:要比较的两个字符串之一
|
||||
//参数len:要比较的长度
|
||||
//返回结果:如果为0,两个字符串相等,如果为正数,s1>s2,如果为负数,s1<s2
|
||||
|
||||
|
||||
function ft005(var s1, s2: PAnsiChar; len: Integer): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数CompareStringNoCase
|
||||
//目的:用来对两个字符串进行比较(忽略大小写)
|
||||
//参数s1:要比较的两个字符串之一
|
||||
//参数s2:要比较的两个字符串之一
|
||||
//参数len:要比较的长度
|
||||
//返回结果:如果为0,两个字符串相等,如果为正数,s1>s2,如果为负数,s1<s2
|
||||
|
||||
|
||||
function ft006(var s1, s2: PAnsiChar): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数Strcat
|
||||
//目的:用来对两个字符串进行连接
|
||||
//参数s1:要连接的两个字符串之一
|
||||
//参数s2:要连接的两个字符串之一
|
||||
//返回结果:返回目的字符串的长度, s1 为连接后的字符串
|
||||
//相当于 s1 = s1 + s2, s2加在s1的后面, 返回。
|
||||
|
||||
|
||||
function ft007(sd, s: PAnsiChar): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数Strcpy
|
||||
//目的:对字符串进行复制
|
||||
//参数sd:目的字符串
|
||||
//参数s:源字符串
|
||||
//返回结果:返回目的字符串的长度
|
||||
//相当于 sd = s
|
||||
|
||||
|
||||
function ft008(p1, p2: Integer; exp: Char): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数:Compare
|
||||
//目的:用来比较两个数的大小,相当于?a>b,a<b,a=b
|
||||
//参数p1:要比较的第一个数
|
||||
//参数p2:要比较的第二个数
|
||||
//参数c:是大于,小于或等于,即">","<","="
|
||||
//返回结果:
|
||||
//如果返回0,表示表达式为假,返回1表示表达式为真
|
||||
|
||||
|
||||
|
||||
//获取设置加密狗中的参数
|
||||
//对加密狗的存储区进行操作时,耗时时间较长,应注意!!!!
|
||||
//加密狗中存储位置说明
|
||||
//允许使用的总空间160字节,其中:64字节存放数据库连接信息,分别是:
|
||||
//标识 对应参数 允许存放的最大字符串长度
|
||||
// 5 IP地址 15
|
||||
// 6 用户名 15
|
||||
// 7 用户口令 15
|
||||
// 8 DataBase 15
|
||||
// 9 标识 可用来进行特别标识,如本加密狗的信息,本机硬件信息等
|
||||
// 0-4 自定义 共80字节空间,每个数字表示1节(16字节),递增
|
||||
// 注意空间不能溢出,否则引起未知错误;
|
||||
// 0-4标识使用的是连续空间,当0位置的长度超过15时,
|
||||
// 将覆盖1号位置的存储区域。
|
||||
// 使用 0, 可用空间 80 - 1;
|
||||
// 1, 64 - 1;
|
||||
// 2, 48 - 1;
|
||||
//........
|
||||
|
||||
|
||||
function ft011(outstr: PAnsiChar; Ord: Integer): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数GetParm
|
||||
//目的:获取加密狗指定位置的字符串
|
||||
//参数outstr:目的字符串
|
||||
//参数Ord:标识加密狗特定地点的标志值(0-9)
|
||||
//返回结果:返回目的字符串的长度
|
||||
|
||||
|
||||
function ft012(instr: PAnsiChar; Ord: Integer): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//输出函数SetParm
|
||||
//目的:在加密狗的指定位置存放字符串
|
||||
//参数instr:需存放的字符串
|
||||
//参数Ord:标识加密狗特定地点的标志值(0-9)
|
||||
//返回结果:返回写入字符串的长度
|
||||
|
||||
|
||||
|
||||
//加解密函数
|
||||
|
||||
function ft021(inStr, outStr: PAnsiChar): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//说明:本函数单向加密字符串instr,不能逆向解密!
|
||||
//目的:获取输入字符串instr的单向加密字符串outstr
|
||||
//参数instr:需加密的字符串
|
||||
//参数outStr:单向加密后的密文
|
||||
//返回结果:返回密文的长度
|
||||
|
||||
|
||||
function ft022(source, dest, key: PAnsiChar; flg: Integer): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
function ft023(source, dest, key: PAnsiChar; flg: Integer): Integer; stdcall; external 'FUTONGDLL.DLL';
|
||||
//说明:均为字符串加解密函数,可加解密
|
||||
//目的:用指定的Key,对输入字符串source进行置换,dest为置换后的字符串
|
||||
//参数source:需置换的字符串源文
|
||||
//参数dest:置换后后的字符串密文
|
||||
//参数key:置换采用的key,字符串
|
||||
//参数flg: 为1时,进行加密,为0时进行解密
|
||||
//返回结果:返回置换后字符串的长度
|
||||
|
||||
function PBDecode(Strin, StrOut: PAnsiChar; nInLen, nOutLen: Integer): Integer; stdcall; external 'FUTONG.DLL';
|
||||
//为解密函数入口参数为Strin,需解密的字符串
|
||||
// StrOut,解密后的字符串(要求预先分配空间)
|
||||
// nInLen,为Strin的长度
|
||||
// nOutLen,为解密后的长度
|
||||
|
||||
function PBEncode(Strin, StrOut: PAnsiChar; nInLen, nOutLen: Integer): Integer; stdcall; external 'FUTONG.DLL';
|
||||
//跟上面的函数对应,实现加密功能
|
||||
{
|
||||
//function ulong SQlfunc(ref string OutStr,ref string InStr,UINT len,UINT ID) LIBRARY "Futong.dll"
|
||||
//对应数据库扩展存储过程(实现加密功能)对应的解密函数
|
||||
// OutStr要求预先分配空间
|
||||
// len 为解密后内容长度
|
||||
// ID 算法因子(和存储过程对应)
|
||||
|
||||
function checkfunc(handle: Integer; DogFlag: String): Integer; stdcall; external 'FUTONG.DLL';
|
||||
//检查硬件狗函数
|
||||
// handle为主窗口句柄
|
||||
// DogFlag为从数据库中查询到的硬件狗信息
|
||||
// DLL自动检查硬件狗和DogFlag的信息是否相符,不符时将在3分钟左右自动重启计算机
|
||||
|
||||
function GetParm(flag: Integer; out len: Integer; outHex: PAnsiChar): Integer; stdcall; external 'FUTONG.DLL';
|
||||
//硬件狗中获取特定信息,如IP地址,数据库名称,用户名、口令等
|
||||
//自定义参数flag取值范围为0--4,存储空间一共为20个字节,为连续的地址空间
|
||||
//也即:参数0,最大可用长度为20,这时其他参数,将覆盖这个区域
|
||||
// 参数4,最大可用长度为4
|
||||
//DogFlag为字符串信息
|
||||
|
||||
function SetParm(flag, len: Integer; inHex: PAnsiChar): Integer; stdcall; external 'FUTONG.DLL';
|
||||
//flag=5IP,=6User,=7Pass,=8DB
|
||||
//硬件狗中设置参数,传入IP时,须设置为 “C8A00164”等形式传入(192.168.1.100)
|
||||
//自定义参数用法同上
|
||||
|
||||
function InfoFunc(order: Integer; info: PAnsiChar): Integer; stdcall; external 'FUTONG.DLL';
|
||||
//读取本机硬件信息,返回值为机器网卡个数
|
||||
//考虑到某些可移动的网卡,要查询固定的网卡信息
|
||||
//软件安装时要求移除可移动网卡
|
||||
//order为第几块网卡,从0开始
|
||||
|
||||
function GetHostIpAddr(DogParm, HostName, IPAddr: PAnsiChar): Integer; stdcall; external 'FUTONG.DLL';
|
||||
//获取硬件狗标识,本机IP地址(仅参考,因为机器有多个IP地址,获取的只是其中之一)
|
||||
//以及机器名称
|
||||
}
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
||||
84
Z99Dependency/ThreeFun/dllPas/getsvrcon.pas
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
unit getsvrcon;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Windows, Forms, IniFiles,strUtils;
|
||||
|
||||
function FTConSvr(H: THandle; ProdID, Address, Server, User, Pswd, DTBase: PChar): Integer; stdcall; external 'FTClient.dll';
|
||||
function GetSvrConn(
|
||||
H: THandle;
|
||||
ProdID: String;
|
||||
var Server: String;
|
||||
var User: String;
|
||||
var Pswd: String;
|
||||
var DTBase: String
|
||||
): Integer;
|
||||
|
||||
implementation
|
||||
|
||||
function GetSvrConn(
|
||||
H: THandle;
|
||||
ProdID: String;
|
||||
var Server: String;
|
||||
var User: String;
|
||||
var Pswd: String;
|
||||
var DTBase: String
|
||||
): Integer;
|
||||
var
|
||||
Ini: TIniFile;
|
||||
Address, Server1, User1, Pswd1, DTBase1,DtType: String;
|
||||
iPos:integer;
|
||||
begin
|
||||
Ini := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'consvr.ini');
|
||||
try
|
||||
Address := Ini.ReadString('SERVER', 'SERVER', '0.0.0.0');
|
||||
finally
|
||||
Ini.Free;
|
||||
end;
|
||||
|
||||
if Address = '0.0.0.0' then
|
||||
begin
|
||||
Application.MessageBox('¶ÁÎļþconsvr.ini´íÎó', '´íÎó', MB_ICONERROR);
|
||||
Application.Terminate;
|
||||
end;
|
||||
|
||||
Server1 := StringOfChar(#0, 20);
|
||||
User1 := StringOfChar(#0, 20);
|
||||
Pswd1 := StringOfChar(#0, 20);
|
||||
DTBase1 := StringOfChar(#0, 20);
|
||||
Result := FTConSvr(H, PChar(ProdID), Pchar(address),PChar(Server1), PChar(User1), PChar(Pswd1), PChar(DTBase1));
|
||||
|
||||
Server := Trim(Server1);
|
||||
User := Trim(User1);
|
||||
Pswd := Trim(Pswd1);
|
||||
DTBase := Trim(DTBase1);
|
||||
/////////////////////
|
||||
//database
|
||||
iPos:=pos('/',dtbase);
|
||||
if iPos>0 then
|
||||
begin
|
||||
DtType:=leftStr(dtbase,iPos-1);
|
||||
DTBase:=rightStr(dtBase,length(dtbase)-iPos);
|
||||
end
|
||||
else
|
||||
DtType:='';
|
||||
//////////////////////////////
|
||||
//user
|
||||
if DtType='' then
|
||||
begin
|
||||
iPos:=pos('/',User);
|
||||
if iPos>0 then
|
||||
begin
|
||||
DtType:=leftStr(User,iPos-1);
|
||||
User:=rightStr(User,length(User)-iPos);
|
||||
end
|
||||
else
|
||||
DtType:='';
|
||||
end;
|
||||
|
||||
if trim(DTType)<>'' then
|
||||
server:=server+'\'+DTType;
|
||||
end;
|
||||
|
||||
end.
|
||||