D7wmguihua/应收应付/U_GetDllForm.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

742 lines
19 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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_ProductOrderCost,U_YFFP,U_YSFP,
U_YSCRJZC,U_YSCR_Gd,U_SKCR_Gd,U_YFZDList_MX,U_YSZDList_MX,U_YFMXlist,U_YSMXlist,U_FKCR_GD,U_YFCR_GD,
U_YF_Money_LL,U_YF_Money_LL_list,U_FYDJ,U_FYDJ_TJ;
/////////////////////////////////////////////////////////////////
// 功能说明:取Dll中得窗体 //
// 参数说明App>>调用应用程序; //
// FormH>>调用窗口句柄 //
// FormID>>窗口号; //
// Language>>语言种类; //
// WinStyle>>窗口类型; //
/////////////////////////////////////////////////////////////////
var
frmSKCR,frmSKCRYP: TfrmSKCR;
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
i: Integer;
bFound: Boolean;
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:='192.168.1.99'; //192.168.1.113
server:='47.100.182.1,7781';
dtbase:='guihuadata';
user:='sa';
pswd:='rightsoft@123';
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:='人民币';
// DataBase:='高权限';
// DParameters4:='0';
Parameters5:='桂华纺织';
// DParameters3:='项目分开';
// DParameters4:='对方单位分开';
//DParameters5:='开票';
//DParameters6:='其它'; //应付款
//DParameters7:='匹数'; //应收款
//DCode:='test';
//DName:='虞晓';
//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;
////////////////////
/////////////////////
//调用子模块窗口
case FormId of
1: //应付款登记
begin
if frmYFCR=nil then
begin
frmYFCR:= TfrmYFCR.Create(application.MainForm);
with frmYFCR do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYFCR.BringToFront;
//句柄
mNewHandle:=frmYFCR.Handle;
end ;
14: //应付款登记
begin
if frmYFCR_GD=nil then
begin
frmYFCR_GD:= TfrmYFCR_GD.Create(application.MainForm);
with frmYFCR_GD do
begin
// fflag:=1;
fflag:=strtointdef(trim(DataBase),0);
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYFCR_GD.BringToFront;
//句柄
mNewHandle:=frmYFCR_GD.Handle;
end ;
141: //应付款登记
begin
if frmYFCR_GD=nil then
begin
frmYFCR_GD:= TfrmYFCR_GD.Create(application.MainForm);
with frmYFCR_GD do
begin
TBADD.Visible:=false;
TBDel.Visible:=false;
Label7.Visible:=false;
Edit1.Visible:=false;
Button1.Visible:=false;
CheckBox1.Visible:=false;
tv2.OptionsData.Editing:=false;
fflag:=strtointdef(trim(DataBase),0);
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYFCR_GD.BringToFront;
//句柄
mNewHandle:=frmYFCR_GD.Handle;
end ;
2: //付款登记
begin
if frmFKCR=nil then
begin
frmFKCR:= TfrmFKCR.Create(application.MainForm);
with frmFKCR do
begin
fSYRName:=trim(Parameters5);
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmFKCR.BringToFront;
//句柄
mNewHandle:=frmFKCR.Handle;
end ;
24: //付款登记
begin
if frmFKCR_GD=nil then
begin
frmFKCR_GD:= TfrmFKCR_GD.Create(application.MainForm);
with frmFKCR_GD do
begin
fflag:=strtointdef(trim(DataBase),0);
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmFKCR_GD.BringToFront;
//句柄
mNewHandle:=frmFKCR_GD.Handle;
end ;
241: //付款登记
begin
if frmFKCR_GD=nil then
begin
frmFKCR_GD:= TfrmFKCR_GD.Create(application.MainForm);
with frmFKCR_GD do
begin
TBADD.Visible:=false;
TBDel.Visible:=false;
// Label7.Visible:=false;
// Edit1.Visible:=false;
// Button1.Visible:=false;
// CheckBox1.Visible:=false;
tv2.OptionsData.Editing:=false;
fflag:=strtointdef(trim(DataBase),0);
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmFKCR_GD.BringToFront;
//句柄
mNewHandle:=frmFKCR_GD.Handle;
end ;
3: //应付款付款统计
begin
if frmYFFKList=nil then
begin
frmYFFKList:= TfrmYFFKList.Create(application.MainForm);
with frmYFFKList do
begin
caption:=Trim(Title);
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 frmYSCR.Free;
if frmYSCR=nil then
begin
frmYSCR:= TfrmYSCR.Create(application.MainForm);
with frmYSCR do
begin
caption:=Trim(Title);
fDParameters1:=trim(DParameters4);
fDParameters3:=trim(DParameters3);
fSYRName:=trim(Parameters5);
fstr2:=trim(Parameters6);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYSCR.BringToFront;
//句柄
mNewHandle:=frmYSCR.Handle;
end ;
44: //应收款登记(广东)
begin
if frmYSCR_Gd=nil then
begin
frmYSCR_Gd:= TfrmYSCR_Gd.Create(application.MainForm);
with frmYSCR_Gd do
begin
caption:=Trim(Title);
fmanage:=Trim(DataBase);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYSCR_Gd.BringToFront;
//句柄
mNewHandle:=frmYSCR_Gd.Handle;
end ;
{ 5: //收款登记
begin
// IF frmSKCR<>nil then frmSKCR.Free;
if frmSKCR=nil then
begin
frmSKCR:= TfrmSKCR.Create(application.MainForm);
with frmSKCR do
begin
caption:=Trim(Title);
fSYRName:=trim(Parameters5);
fDParameters1:=trim(DParameters4);
fDParameters3:=trim(DParameters3);
fstr2:=trim(Parameters6);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmSKCR.BringToFront;
//句柄
mNewHandle:=frmSKCR.Handle;
end ; }
5:
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '大货收款登记' then
begin
BringWindowToTop(frmSKCR.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmSKCR := TfrmSKCR.Create(application.MainForm);
with frmSKCR do
begin
Title := '大货收款登记';
fSYRName:=trim(Parameters5);
fDParameters1:=trim(DParameters4);
fDParameters3:=trim(DParameters3);
fstr2:=trim(Parameters6);
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmSKCR.BringToFront;
//句柄
mnewHandle := frmSKCR.Handle;
end;
51:
begin
bFound := FALSE;
for i := (App.MainForm.MDIChildCount - 1) downto 0 do
begin
if App.MainForm.MDIChildren[i].Caption = '样品收款登记' then
begin
BringWindowToTop(frmSKCRYP.Handle);
bFound := TRUE;
Break;
end;
end;
if not bFound then
begin
frmSKCRYP:=TfrmSKCR.Create(application.MainForm);
with frmSKCRYP do
begin
Title := '样品收款登记';
fSYRName:=trim(Parameters5);
fDParameters1:=trim(DParameters4);
fDParameters3:=trim(DParameters3);
fstr2:=trim(Parameters6);
caption := Trim(Title);
FormStyle := mstyle;
windowState := mstate;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmSKCRYP.BringToFront;
//句柄
mnewHandle := frmSKCRYP.Handle;
end;
54: //收款登记(广东)
begin
if frmSKCR_Gd=nil then
begin
frmSKCR_Gd:= TfrmSKCR_Gd.Create(application.MainForm);
with frmSKCR_Gd do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmSKCR_Gd.BringToFront;
//句柄
mNewHandle:=frmSKCR_Gd.Handle;
end ;
6: //应收款收款统计
begin
if frmYSSKList=nil then
begin
frmYSSKList:= TfrmYSSKList.Create(application.MainForm);
with frmYSSKList do
begin
caption:=Trim(Title);
fDParameters1:=trim(DParameters1);
fsyrName:=trim(Parameters5);
fstr2:=trim(Parameters6);
fDParameters3:=trim(DParameters3);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYSSKList.BringToFront;
//句柄
mNewHandle:=frmYSSKList.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 ;
7: //应收款收款统计
begin
IF frmFYDJ<>nil then frmFYDJ.Free;
if frmFYDJ=nil then
begin
frmFYDJ:= TfrmFYDJ.Create(application.MainForm);
with frmFYDJ do
begin
caption:=Trim(Title);
fflag:=strtointdef(trim(Parameters4),0);
fSYRName:=trim(Parameters5);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmFYDJ.BringToFront;
//句柄
mNewHandle:=frmFYDJ.Handle;
end ;
71: //应收款收款统计
begin
IF frmFYDJ_TJ<>nil then frmFYDJ_TJ.Free;
if frmFYDJ_TJ=nil then
begin
frmFYDJ_TJ:= TfrmFYDJ_TJ.Create(application.MainForm);
with frmFYDJ_TJ do
begin
caption:=Trim(Title);
fSYRName:=trim(Parameters5);
fflag:=strtointdef(trim(Parameters4),0);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmFYDJ_TJ.BringToFront;
//句柄
mNewHandle:=frmFYDJ_TJ.Handle;
end ;
8: //进项发票登记
begin
if frmYFFP=nil then
begin
frmYFFP:= TfrmYFFP.Create(application.MainForm);
with frmYFFP do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYFFP.BringToFront;
//句柄
mNewHandle:=frmYFFP.Handle;
end;
9: //销项发票登记
begin
if frmYSFP=nil then
begin
frmYSFP:= TfrmYSFP.Create(application.MainForm);
with frmYSFP do
begin
caption:=Trim(Title);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYSFP.BringToFront;
//句柄
mNewHandle:=frmYSFP.Handle;
end;
10: //银行流水
begin
if frmMoney_LL=nil then
begin
frmMoney_LL:= TfrmMoney_LL.Create(application.MainForm);
with frmMoney_LL do
begin
fSYRName:=trim(Parameters5);
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
fSYRName:=trim(Parameters5);
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: //应收账款明细OLJ
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: //应收账款明细OLJ
begin
if frmYSMXlist=nil then
begin
frmYSMXlist:= TfrmYSMXlist.Create(application.MainForm);
with frmYSMXlist do
begin
caption:=Trim(Title);
// fType:=trim(DataBase);
fDParameters1:=trim(DParameters1);
fsyrName:=trim(Parameters5);
fDParameters3:=trim(DParameters3);
fstr2:=trim(Parameters6);
FormStyle := mstyle ;
windowState := mstate ;
BorderStyle := mborderstyle;
//show;
end;
end
else
frmYSMXlist.BringToFront;
//句柄
mNewHandle:=frmYSMXlist.Handle;
end;
end ; // end case
Result:= mnewHandle;
// NewDllApp:=Application ;
end;
//===========================================================
//建立数据库连接池
//===========================================================
function ConnData():Boolean;
begin
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.