601 lines
16 KiB
ObjectPascal
601 lines
16 KiB
ObjectPascal
unit U_GetDllForm;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, forms, OleCtnrs, DateUtils, SysUtils, ADODB, IniFiles,
|
||
dxCore, ActiveX;
|
||
|
||
function GetDllForm(App: Tapplication; FormH: hwnd; FormID: integer; Language: integer; WinStyle: integer; GCode: Pchar; GName: Pchar; DataBase: Pchar; Title: PChar; Parameters1: PChar; Parameters2: PChar; Parameters3: PChar; Parameters4: PChar; Parameters5: PChar; Parameters6: PChar; Parameters7: PChar; Parameters8: PChar; Parameters9: PChar; Parameters10: PChar; DataBaseStr: PChar): hwnd; export; stdcall;
|
||
|
||
function ConnData(): Boolean;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_Fun, U_YFCR, U_FKCR, U_YFFKList, U_YSCR, U_SKCR, U_YSSKList,
|
||
U_YSSKList_BZ, U_YSCRJZC, U_YSCR_Gd, U_SKCR_Gd, U_YFZDList_MX, U_YSZDList_MX,
|
||
U_YFMXlist, U_YSMXlist, U_FDINVOICE, U_FPINVOICE_TJ, U_FDINVOICE_X,
|
||
U_FDINVOICE_S, U_YF_Money_LL, U_YF_Money_LL_list, U_WorkDeptFeeChkList,
|
||
U_WorkDeptFeeList;
|
||
|
||
/////////////////////////////////////////////////////////////////
|
||
// 功能说明:取Dll中得窗体 //
|
||
// 参数说明:App>>调用应用程序; //
|
||
// FormH>>调用窗口句柄 ; //
|
||
// FormID>>窗口号; //
|
||
// Language>>语言种类; //
|
||
// WinStyle>>窗口类型; //
|
||
/////////////////////////////////////////////////////////////////
|
||
function GetDllForm(App: Tapplication; FormH: hwnd; FormID: integer; Language: integer; WinStyle: integer; GCode: Pchar; GName: Pchar; DataBase: Pchar; Title: PChar; Parameters1: PChar; Parameters2: PChar; Parameters3: PChar; Parameters4: PChar; Parameters5: PChar; Parameters6: PChar; Parameters7: PChar; Parameters8: PChar; Parameters9: PChar; Parameters10: PChar; DataBaseStr: PChar): hwnd;
|
||
var
|
||
mnewHandle: hwnd;
|
||
mstyle: TFormStyle; // 0:子窗口; 1:普通窗口
|
||
mstate: TWindowState;
|
||
mborderstyle: TFormBorderStyle;
|
||
begin
|
||
mnewHandle := 0;
|
||
DName := GName;
|
||
DCode := GCode;
|
||
DdataBase := DataBase;
|
||
DTitCaption := Title;
|
||
DParameters1 := Parameters1;
|
||
DParameters2 := Parameters2;
|
||
DParameters3 := Parameters3;
|
||
DParameters4 := Parameters4;
|
||
DParameters5 := Parameters5;
|
||
DParameters6 := Parameters6;
|
||
DParameters7 := Parameters7;
|
||
DParameters8 := Parameters8;
|
||
DParameters9 := Parameters9;
|
||
DParameters10 := Parameters10;
|
||
|
||
MainApplication := App;
|
||
DCurHandle := FormH;
|
||
IsDelphiLanguage := Language;
|
||
|
||
Application := TApplication(App);
|
||
DCurHandle := 0;
|
||
|
||
|
||
//赋值链接字符串
|
||
SetLength(server, 255);
|
||
SetLength(dtbase, 255);
|
||
SetLength(user, 255);
|
||
SetLength(pswd, 255);
|
||
|
||
// server := '121.40.233.100,7781';
|
||
// dtbase := 'junleidata';
|
||
// user := 'sa';
|
||
// pswd := 'rightsoft@123';
|
||
|
||
|
||
server := '101.132.143.144,7781';
|
||
// server:='.';
|
||
dtbase := 'shengxingfhdata';
|
||
user := 'rtsa';
|
||
pswd := 'rightsoft@5740';
|
||
|
||
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
|
||
|
||
if trim(DataBaseStr) <> '' then
|
||
DConString := DataBaseStr;
|
||
|
||
// DParameters1:='无订单号';
|
||
// DParameters1:='管理';//103
|
||
// DParameters2:='人民币';
|
||
// DParameters1:='高权限';
|
||
// DParameters1:='高权限';
|
||
// Parameters1:='高权限';
|
||
// DataBase:='高权限';
|
||
// DataBase:='1';
|
||
// DParameters1:='0';
|
||
// DParameters3:='项目分开';
|
||
// DParameters4:='对方单位分开';
|
||
// DParameters5:='开票';
|
||
// DParameters6:='其它'; //应付款
|
||
// DParameters7:='匹数'; //应收款
|
||
// DCode:='test';
|
||
// DName:='ADMIN';
|
||
// DParameters9:='支付台头';
|
||
// DParameters8:='FactoryNo1Name';
|
||
// DParameters10:='P_YSSK_ListTT';
|
||
if not ConnData() then
|
||
begin
|
||
result := 0;
|
||
exit;
|
||
end;
|
||
{ if IsINIFile() then
|
||
ReadINIFile()
|
||
else
|
||
WriteINIFile ;}
|
||
// 定义窗口类型 、状态
|
||
if WinStyle = 0 then
|
||
begin
|
||
mstyle := fsMDIChild;
|
||
mstate := wsMaximized;
|
||
mborderstyle := bsSizeable;
|
||
end
|
||
else
|
||
begin
|
||
mstyle := fsNormal;
|
||
mstate := wsNormal;
|
||
mborderstyle := bsSizeable;
|
||
end;
|
||
////////////////////
|
||
{ GetSWLDZ('192.168.1.246');
|
||
if IpCall<>0 then
|
||
begin
|
||
Result:=0;
|
||
Application.MessageBox('!!网络不通!!','提示',0);
|
||
Exit;
|
||
end;
|
||
if Trim(IpWLDZStr)<>'D4:AE:52:BE:9F:02' then
|
||
begin
|
||
Result:=0;
|
||
Application.MessageBox('!!数据库连接失败!!','提示',0);
|
||
Exit;
|
||
end; }
|
||
/////////////////////
|
||
//调用子模块窗口
|
||
case FormID of
|
||
1: //应付款登记
|
||
begin
|
||
if frmYFCR = nil then
|
||
begin
|
||
frmYFCR := TfrmYFCR.Create(application.MainForm);
|
||
with frmYFCR do
|
||
begin
|
||
caption := Trim(Title);
|
||
fmanage := trim(DParameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYFCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYFCR.Handle;
|
||
end;
|
||
|
||
2: //付款登记
|
||
begin
|
||
if frmFKCR = nil then
|
||
begin
|
||
frmFKCR := TfrmFKCR.Create(application.MainForm);
|
||
with frmFKCR do
|
||
begin
|
||
caption := Trim(Title);
|
||
fmanage := trim(DParameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFKCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFKCR.Handle;
|
||
end;
|
||
|
||
3: //应付款付款统计
|
||
begin
|
||
if frmYFFKList = nil then
|
||
begin
|
||
frmYFFKList := TfrmYFFKList.Create(application.MainForm);
|
||
with frmYFFKList do
|
||
begin
|
||
caption := Trim(Title);
|
||
// fDParameters1:=trim('0');
|
||
fDParameters1 := trim(DParameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYFFKList.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYFFKList.Handle;
|
||
|
||
end;
|
||
|
||
31: //应付款明细账单
|
||
begin
|
||
if frmYFZDList_MX = nil then
|
||
begin
|
||
frmYFZDList_MX := TfrmYFZDList_MX.Create(application.MainForm);
|
||
with frmYFZDList_MX do
|
||
begin
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYFZDList_MX.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYFZDList_MX.Handle;
|
||
|
||
end;
|
||
|
||
4: //应收款登记
|
||
begin
|
||
if frmYSCR = nil then
|
||
begin
|
||
frmYSCR := TfrmYSCR.Create(application.MainForm);
|
||
with frmYSCR do
|
||
begin
|
||
fflag := strtointdef(trim(DataBase), 0);
|
||
fmanage := trim(Parameters1);
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYSCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYSCR.Handle;
|
||
end;
|
||
|
||
5: //收款登记
|
||
begin
|
||
if frmSKCR = nil then
|
||
begin
|
||
frmSKCR := TfrmSKCR.Create(application.MainForm);
|
||
with frmSKCR do
|
||
begin
|
||
caption := Trim(Title);
|
||
fflag := strtointdef(trim(DataBase), 0);
|
||
fmanage := trim(Parameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmSKCR.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmSKCR.Handle;
|
||
end;
|
||
|
||
6: //应收款收款统计
|
||
begin
|
||
if frmYSSKList = nil then
|
||
begin
|
||
frmYSSKList := TfrmYSSKList.Create(application.MainForm);
|
||
with frmYSSKList do
|
||
begin
|
||
caption := Trim(Title);
|
||
fmanage := trim(DParameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYSSKList.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYSSKList.Handle;
|
||
|
||
end;
|
||
|
||
601: ////////////应收款收款不同币种分开统计////////////////////////
|
||
begin
|
||
if frmYSSKList_BZ = nil then
|
||
begin
|
||
frmYSSKList_BZ := TfrmYSSKList_BZ.Create(application.MainForm);
|
||
with frmYSSKList_BZ do
|
||
begin
|
||
caption := Trim(Title);
|
||
fmanage := trim(DParameters1);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYSSKList_BZ.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYSSKList_BZ.Handle;
|
||
|
||
end;
|
||
|
||
61: //应收款收款统计
|
||
begin
|
||
if frmYSZDList_MX = nil then
|
||
begin
|
||
frmYSZDList_MX := TfrmYSZDList_MX.Create(application.MainForm);
|
||
with frmYSZDList_MX do
|
||
begin
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYSZDList_MX.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYSZDList_MX.Handle;
|
||
|
||
end;
|
||
|
||
10: //账户流水
|
||
begin
|
||
if frmMoney_LL = nil then
|
||
begin
|
||
frmMoney_LL := TfrmMoney_LL.Create(application.MainForm);
|
||
with frmMoney_LL do
|
||
begin
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmMoney_LL.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmMoney_LL.Handle;
|
||
|
||
end;
|
||
|
||
101: //账户汇总
|
||
begin
|
||
if frmYF_Money_LL_list = nil then
|
||
begin
|
||
frmYF_Money_LL_list := TfrmYF_Money_LL_list.Create(application.MainForm);
|
||
with frmYF_Money_LL_list do
|
||
begin
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYF_Money_LL_list.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYF_Money_LL_list.Handle;
|
||
|
||
end;
|
||
20: //应付款对账单
|
||
begin
|
||
if frmYFMXlist = nil then
|
||
begin
|
||
frmYFMXlist := TfrmYFMXlist.Create(application.MainForm);
|
||
with frmYFMXlist do
|
||
begin
|
||
caption := Trim(Title);
|
||
fType := trim(DataBase);
|
||
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYFMXlist.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYFMXlist.Handle;
|
||
|
||
end;
|
||
|
||
201: //应收款对账单
|
||
begin
|
||
if frmYSMXlist = nil then
|
||
begin
|
||
frmYSMXlist := TfrmYSMXlist.Create(application.MainForm);
|
||
with frmYSMXlist do
|
||
begin
|
||
caption := Trim(Title);
|
||
// fType:='0';
|
||
fType := trim(DataBase);
|
||
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmYSMXlist.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmYSMXlist.Handle;
|
||
end;
|
||
|
||
202: //进项发票管理
|
||
begin
|
||
// IF frmFDINVOICE
|
||
if frmFDINVOICE = nil then
|
||
begin
|
||
frmFDINVOICE := TfrmFDINVOICE.Create(application.MainForm);
|
||
with frmFDINVOICE do
|
||
begin
|
||
fInvoiceFlag := '0';
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFDINVOICE.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFDINVOICE.Handle;
|
||
end;
|
||
|
||
203: //发票统计查询
|
||
begin
|
||
if frmFPInvoice_TJ = nil then
|
||
begin
|
||
frmFPInvoice_TJ := TfrmFPInvoice_TJ.Create(application.MainForm);
|
||
with frmFPInvoice_TJ do
|
||
begin
|
||
fInvoiceFlag := '1';
|
||
fInvoiceFlag := trim(DParameters1);
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFPInvoice_TJ.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFPInvoice_TJ.Handle;
|
||
end;
|
||
|
||
204: //销项发票
|
||
begin
|
||
if frmFDINVOICE_X = nil then
|
||
begin
|
||
frmFDINVOICE_X := TfrmFDINVOICE_X.Create(application.MainForm);
|
||
with frmFDINVOICE_X do
|
||
begin
|
||
fInvoiceFlag := '1';
|
||
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFDINVOICE_X.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFDINVOICE_X.Handle;
|
||
end;
|
||
|
||
205: //发票申请
|
||
begin
|
||
if frmFDINVOICE_S = nil then
|
||
begin
|
||
frmFDINVOICE_S := TfrmFDINVOICE_S.Create(application.MainForm);
|
||
with frmFDINVOICE_S do
|
||
begin
|
||
fInvoiceFlag := '2';
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmFDINVOICE_S.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmFDINVOICE_S.Handle;
|
||
end;
|
||
|
||
30: //费用申请
|
||
begin
|
||
if frmWorkDeptFeeList = nil then
|
||
begin
|
||
frmWorkDeptFeeList := TfrmWorkDeptFeeList.Create(application.MainForm);
|
||
with frmWorkDeptFeeList do
|
||
begin
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmWorkDeptFeeList.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmWorkDeptFeeList.Handle;
|
||
end;
|
||
|
||
301: //费用审核
|
||
begin
|
||
if frmWorkDeptFeeChkList = nil then
|
||
begin
|
||
frmWorkDeptFeeChkList := TfrmWorkDeptFeeChkList.Create(application.MainForm);
|
||
with frmWorkDeptFeeChkList do
|
||
begin
|
||
caption := Trim(Title);
|
||
FormStyle := mstyle;
|
||
windowState := mstate;
|
||
BorderStyle := mborderstyle;
|
||
//show;
|
||
end;
|
||
end
|
||
else
|
||
frmWorkDeptFeeChkList.BringToFront;
|
||
//句柄
|
||
mnewHandle := frmWorkDeptFeeChkList.Handle;
|
||
end;
|
||
end; // end case
|
||
|
||
Result := mnewHandle;
|
||
// NewDllApp:=Application ;
|
||
end;
|
||
//===========================================================
|
||
//建立数据库连接池
|
||
//===========================================================
|
||
|
||
function ConnData(): Boolean;
|
||
var
|
||
IniFile: TIniFile;
|
||
begin
|
||
try
|
||
IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + 'SYSTEMSET.INI');
|
||
PicSvr := IniFile.ReadString('SERVER', '服务器地址', '127.0.0.1');
|
||
finally
|
||
IniFile.Free;
|
||
end;
|
||
if not Assigned(DataLink_YSYF) then
|
||
DataLink_YSYF := TDataLink_YSYF.Create(Application);
|
||
try
|
||
with DataLink_YSYF.ADOLink do
|
||
begin
|
||
if not Connected then
|
||
begin
|
||
Connected := false;
|
||
ConnectionString := DConString;
|
||
LoginPrompt := false;
|
||
Connected := true;
|
||
end;
|
||
end;
|
||
Result := true;
|
||
except
|
||
Result := false;
|
||
application.MessageBox('数据库连接失败!', '错误', mb_Ok + MB_ICONERROR);
|
||
end;
|
||
end;
|
||
|
||
initialization
|
||
CoInitialize(nil);
|
||
dxUnitsLoader.Initialize;
|
||
|
||
|
||
finalization
|
||
DataLink_YSYF.Free;
|
||
application := NewDllApp;
|
||
dxUnitsLoader.Finalize;
|
||
|
||
end.
|
||
|