📄 createit3.bas
字号:
Selection.Clear()
StaticGroup = AddGroup()
MasterGroup = AddGroup()
DetailGroup = AddGroup()
i=0
while i < UnitCount
d = Units[i]
if d.ClassName = 'Text' then
s = d.Text
ln = Len( s )
if ln >= 2 then
if Chr(s[0]) = '&' then
s = substr( s, 2, Len( s ) )
pos = At( '.', s )
t = SubStr( s, 1, pos - 1 )
if t = "交易明细表" then
DetailGroup.Add( d )
else
MasterGroup.Add( d )
end if
d.Text = SubStr( s, pos + 1, Len( s ) )
d.Tag = 1
end if
end if
end if
i = i + 1
wend
mastertop = MasterGroup.Top
masterbottom = MasterGroup.Top + MasterGroup.Height
detailtop = DetailGroup.Top
detailbottom = DetailGroup.Top + DetailGroup.Height
客户资料表.SQL = "Select * From Customer"
客户资料表.Open()
交易明细表.Close()
i = 0
while i < UnitCount
d = Units[i]
if d.top >= detailtop and d.top + d.height <= detailbottom then
if DetailGroup.FindUnit( d ) = -1 then
DetailGroup.Add( d )
end if
else if d.top >= mastertop and d.top + d.height <= masterbottom then
if MasterGroup.FindUnit( d ) = -1 then
MasterGroup.Add( d )
end if
else if d.Visible then
StaticGroup.Add( d )
end if
i = i + 1
wend
while not 客户资料表.Eof()
ThisSheet = AddSheet()
ThisSheet.CopyGroup( StaticGroup )
ThisSheet.CopyGroup( MasterGroup )
i = 0
while i < ThisSheet.Selection.UnitCount
d = ThisSheet.Selection.Units[i]
if d.Tag = 1 then
ThisSheet.Selection.Units[i].Text = 客户资料表.GetFieldValue( d.Text )
end if
i = i + 1
wend
if not 交易明细表.Active() then
交易明细表.SQL = "Select * From Orders Where CustNo = " + 客户资料表.GetFieldValue( "CustNo" )
交易明细表.Open()
end if
h = 0
while not 交易明细表.Eof()
ThisSheet.CopyGroup( DetailGroup )
ThisSheet.Selection.MoveTo( ThisSheet.Selection.Left, ThisSheet.Selection.Top + h )
i=0
while i < ThisSheet.Selection.UnitCount
d = ThisSheet.Selection.Units[i]
if d.Tag = 1 then
ThisSheet.Selection.Units[i].Text = 交易明细表.GetFieldValue( d.Text )
end if
i = i + 1
wend
h = h + ThisSheet.Selection.Height
交易明细表.Next()
if ThisSheet.Selection.Top + 2 * ThisSheet.Selection.Height > Page.Top + Page.Height - Page.Margin.Bottom / Page.PaperHeight * Page.Height then
break
end if
wend
if 交易明细表.Eof() then
客户资料表.Next()
交易明细表.Close()
end if
wend
客户资料表.Close()
交易明细表.Close()
StaticGroup.Clear()
DeleteGroup( StaticGroup )
MasterGroup.Clear()
DeleteGroup( MasterGroup )
DetailGroup.Clear()
DeleteGroup( DetailGroup )
ActiveSheetIndex = 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -