怎样在自己的进销存里导入速达、管家婆和用友的…

2008-04-10 02:57:31来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

unit UpdateSD3000;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, EditForm, KsControls, KsLabels, KsSkinLabels, dxEditor,
dxExEdtr, dxEdLib, dxCntner, KsButtons, KsSkinButtons, KsTabs,
KsSkinTabs, KsHooks, KsForms, KsSkinForms, KsEdits, KsComboBoxs,
KsSkinComboBoxs, DB, IBDatabase, Registry, SysPublic, IBCustomDataSet,
Grids, DBGrids, ADODB;

type
TfrmUpdateSD3000 = class(TfrmEditForm)
PageControl: TSeSkinPageControl;
TabSD3000: TKsCustomTabSheet;
KsCustomTabSheet2: TKsCustomTabSheet;
bbOk: TSeSkinButton;
bbNo: TSeSkinButton;
OpenDlg: TOpenDialog;
edtSDData: TdxButtonEdit;
SeSkinLabel1: TSeSkinLabel;
SeSkinLabel2: TSeSkinLabel;
SeSkinLabel3: TSeSkinLabel;
SeSkinLabel4: TSeSkinLabel;
SeSkinLabel5: TSeSkinLabel;
edtServeName: TdxEdit;
SeSkinLabel6: TSeSkinLabel;
SeSkinLabel7: TSeSkinLabel;
edtLoginName: TdxEdit;
SeSkinLabel8: TSeSkinLabel;
edtLoginPass: TdxEdit;
bbLinkServer: TSeSkinButton;
SeSkinLabel9: TSeSkinLabel;
SeSkinLabel10: TSeSkinLabel;
SeSkinLabel11: TSeSkinLabel;
IBDatabase1: TIBDatabase;
IBTransaction1: TIBTransaction;
IBDataSet1: TIBDataSet;
AdoDataSet: TADODataSet;
KsCustomTabSheet3: TKsCustomTabSheet;
SeSkinLabel15: TSeSkinLabel;
edtYYData: TdxButtonEdit;
SeSkinLabel12: TSeSkinLabel;
SeSkinLabel13: TSeSkinLabel;
SeSkinLabel14: TSeSkinLabel;
SeSkinLabel16: TSeSkinLabel;
SQLADOConnet: TADOConnection;
SQLDataSet: TADODataSet;
cbxSQLDB: TdxPickEdit;
procedure edtSDDataButtonClick(Sender: TObject; AbsoluteIndex: Integer);
procedure bbNoClick(Sender: TObject);
procedure bbOkClick(Sender: TObject);
procedure edtYYDataButtonClick(Sender: TObject;
AbsoluteIndex: Integer);
procedure bbLinkServerClick(Sender: TObject);
private
{ Private declarations }
bReturn: Boolean;
function GetSD3000Path: string; //得到速达的安装目录
function GetUFERPPath: string; //得到用友的安装目录
function ConectGrasp(sData: string): Boolean;
function ConectSD3000(sDBPath: string): Boolean;
function OpenIBDataSet(sDBName: string): Boolean;
procedure InputGrasp(sSql1, sSql2, sField1, sField2, sConst: string);
procedure InputSD3000(sSql1, sSql2, sField1, sField2, sConst: string);
procedure InputAllSD3000Data; //全部速达数据
procedure InputAllGraspData; //全部管家婆数据
procedure InputAllUfSoft80Data; //全部用友数据
procedure MainShow;
procedure LoadData;
public
{ Public declarations }
end;

function UpdateSD3000Show: Boolean;
implementation

uses DBData;
{$R *.dfm}

function UpdateSD3000Show: Boolean;
var
frmUpdateSD3000: TfrmUpdateSD3000;
begin
frmUpdateSD3000 := TfrmUpdateSD3000.Create(Application);
with frmUpdateSD3000 do
begin
MainShow;
Result := bReturn;
Free;
end;
end;

procedure TfrmUpdateSD3000.MainShow;
begin
LoadData;
ShowModal;
end;

function TfrmUpdateSD3000.GetSD3000Path: string;
var
Reg: TRegistry;
begin
Result := '''''''';
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey(''''\Software\SuperData\SD3000\net'''', False) then
Result := Reg.ReadString(''''RemoteDBDir'''')
finally
Reg.CloseKey;
Reg.Free;
end;
end;

function TfrmUpdateSD3000.GetUFERPPath: string;
var
Reg: TRegistry;
begin
Result := '''''''';
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey(''''\Software\SuperData\SD3000\net'''', False) then
Result := Reg.ReadString(''''RemoteDBDir'''')
finally
Reg.CloseKey;
Reg.Free;
end;
end;

procedure TfrmUpdateSD3000.LoadData;
begin
PageControl.TabIndex := 0;
edtSDData.Text := GetSD3000Path;
edtYYData.text := GetUFERPPath;
end;

procedure TfrmUpdateSD3000.edtSDDataButtonClick(Sender: TObject;
AbsoluteIndex: Integer);
var
sFileName: string;
begin
inherited;
OpenDlg.FileName := edtSDData.Text;
if OpenDlg.Execute then
begin
sFileName := OpenDlg.FileName;
edtSDData.Text := sFileName;
end;
end;

function TfrmUpdateSD3000.ConectSD3000(sDBPath: string): Boolean;
begin
Result := False;
if Trim(sDBPath) = '''''''' then
begin
ShowMsg(''''请输入数据库路径!'''');
Exit;
end;
if not FileExists(sDBPath) then
begin
ShowMsg(''''数据库路径不正确,系统找不到指定的文件!'''');
Exit;
end;
IBDatabase1.DefaultTransaction := IBTransaction1;
IBDatabase1.DatabaseName := sDBPath;

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:数据录入时自动复制原记录

下一篇:如何在程序中使用自己的库单元