📄 tsdbxg.frm
字号:
mySheet.Cells(curline, 10).Value = Data2.Recordset.Fields("baohao").Value
Else
curline = curline + 1
mySheet.Cells(curline, 1).Value = ""
mySheet.Cells(curline, 2).Value = ""
mySheet.Cells(curline, 3).Value = "种数:" & zhongsum & ";册数:" & cesum & ";码洋:¥" & Format(jesum, "#0.00")
'mySheet.Cells(curline, 4).Value = zhongsum
'mySheet.Cells(curline, 5).Value = "册数"
'mySheet.Cells(curline, 6).Value = cesum
' mySheet.Cells(curline, 7).Value = "码洋"
'mySheet.Cells(curline, 8).Value = jesum
'mySheet.Cells(curline, 9).Value = "实洋"
'mySheet.Cells(curline, 10).Value = discount_jesum
c_zhongsum = c_zhongsum + zhongsum
c_cesum = c_cesum + cesum
c_jesum = c_jesum + jesum
' discount_c_jesum = discount_c_jesum + discount_jesum
zhongsum = 1
cesum = Data2.Recordset.Fields("dgs").Value
jesum = Data2.Recordset.Fields("dgs").Value * Data2.Recordset.Fields("jg").Value
'discount_jesum = Data3.Recordset.Fields("dgs").Value * Data3.Recordset.Fields("jg").Value * Data3.Recordset.Fields("discount").Value
curline = curline + 2
mySheet.Cells(curline, 1).Value = r
mySheet.Cells(curline, 2).Value = Data2.Recordset.Fields("isbn").Value
mySheet.Cells(curline, 3).Value = Data2.Recordset.Fields("bookname").Value
mySheet.Cells(curline, 4).Value = Data2.Recordset.Fields("author").Value
mySheet.Cells(curline, 5).Value = Data2.Recordset.Fields("bms").Value
mySheet.Cells(curline, 6).Value = Data2.Recordset.Fields("bmn").Value
mySheet.Cells(curline, 7).Value = "¥" & Format(Val(Data2.Recordset.Fields("jg").Value), "#0.00")
'mySheet.Cells(curline, 8).Value = "'" & Format(Data3.Recordset.Fields("discount").Value, "#0.00")
mySheet.Cells(curline, 8).Value = Data2.Recordset.Fields("dgs").Value
'mySheet.Cells(curline, 10).Value = Data3.Recordset.Fields("fbl").Value
mySheet.Cells(curline, 9).Value = "¥" & Format(Data2.Recordset.Fields("dgs").Value * Data2.Recordset.Fields("jg").Value, "#0.00")
' mySheet.Cells(curline, 12).Value = "¥" & Format(Data3.Recordset.Fields("dgs").Value * Data3.Recordset.Fields("jg").Value * Data3.Recordset.Fields("discount").Value, "#0.00")
mySheet.Cells(curline, 10).Value = Data2.Recordset.Fields("baohao").Value
End If
backbh = curbh
Data2.Recordset.MoveNext
Me.Caption = "EXCEL格式打包数据正在输出......." & Str(r)
Next r
curline = curline + 1
mySheet.Cells(curline, 1).Value = ""
mySheet.Cells(curline, 2).Value = ""
mySheet.Cells(curline, 3).Value = "种数:" & zhongsum & ";册数:" & cesum & ";码洋:¥" & Format(jesum, "#0.00")
'mySheet.Cells(curline, 4).Value = zhongsum
'mySheet.Cells(curline, 5).Value = "册数"
' mySheet.Cells(curline, 6).Value = cesum
'mySheet.Cells(curline, 7).Value = "码洋"
'mySheet.Cells(curline, 8).Value = jesum
'mySheet.Cells(curline, 9).Value = "实洋"
'mySheet.Cells(curline, 10).Value = discount_jesum
c_zhongsum = c_zhongsum + zhongsum
c_cesum = c_cesum + cesum
c_jesum = c_jesum + jesum
' discount_c_jesum = discount_c_jesum + discount_jesum
curline = curline + 2
mySheet.Cells(curline, 1).Value = ""
mySheet.Cells(curline, 2).Value = ""
mySheet.Cells(curline, 3).Value = "总种数:" & c_zhongsum & ";总册数:" & c_cesum & ";总码洋:¥" & Format(c_jesum, "#0.00")
' mySheet.Cells(curline, 4).Value = "总种数"
'mySheet.Cells(curline, 5).Value = c_zhongsum
'mySheet.Cells(curline, 6).Value = "总册数"
'mySheet.Cells(curline, 7).Value = c_cesum
' mySheet.Cells(curline, 8).Value = "总金额"
'mySheet.Cells(curline, 9).Value = c_jesum
'mySheet.Cells(curline, 10).Value = "总实洋:"
' mySheet.Cells(curline, 11).Value = discount_c_jesum
myBook.SaveAs filenam1
myExcel.Quit
myExcel.Workbooks.Close
MsgBox "数据转为EXCEL完毕,EXCEL文件为:" & filenam1 & "数量:" & Str(rownum)
Me.Caption = "图书打包"
Set myExcel = Nothing
Set myBook = Nothing
Set mySheet = Nothing
End Sub
Private Sub Command7_Click()
' 打印打包清单
Dim cury As Double
Dim curx As Double
Dim zongsum As Long
Dim cesum As Long
Dim jesum As Double
Dim t_zongsum As Long
Dim t_cesum As Long
Dim t_jesum As Double
Dim suhao As Integer
'读参数
Dim db As Database
Dim rs As Recordset
Dim paperh As Double
Dim paperw As Double
Dim library As String
Dim faxizhan As String
Dim xiaoding As String
Dim riqi As String
Dim company As String
On Error Resume Next
If Data2.Recordset.RecordCount = 0 Then
MsgBox "没有记录!"
Exit Sub
End If
paperh = 29.7
paperw = 21
Set db = Workspaces(0).OpenDatabase("d:\cbssys\bookcgk.mdb")
Set rs = db.OpenRecordset("select * from 输出参数 where 名称='" & Combo4.Text & "'")
If rs.RecordCount = 0 Then
rs.Close
db.Close
MsgBox "请设置打印参数!"
Exit Sub
End If
rs.MoveFirst
If Combo4.Text <> "不打印表头和表尾" Then
cs_a = rs("收书单位").Value
cs_b = rs("单位地址").Value
cs_c = Text12.Text
cs_d = rs("发货单位").Value
cs_e = rs("收货电话").Value
End If
If IsNull(rs("纸张宽度").Value) Then
paperw = 21
Else
paperw = Val(rs("纸张宽度").Value)
End If
If IsNull(rs("纸张长度").Value) Then
paperh = 29.7
Else
paperh = Val(rs("纸张长度").Value)
End If
If paperh <= 0 Or paperw <= 0 Then
paperh = 29.7
paperw = 21
End If
rs.Close
db.Close
'读参数结束
suhao = 0
zongsum = 0
cesum = 0
jesum = 0
t_zongsum = 0
t_cesum = 0
t_jesum = 0
cury = 2
curx = 2
aab = MsgBox("是否输出上面表格中打包数据!", vbYesNo)
If aab = 7 Then
Exit Sub
End If
On Error GoTo bbb
Command7.Enabled = False
Data2.Recordset.MoveFirst
If Data2.Recordset.RecordCount = 0 Then
MsgBox "没有记录输出!"
Exit Sub
End If
'设置尺寸单位为cm
Printer.ScaleMode = vbCentimeters
'设置打印区域大小
Printer.Width = paperw
Printer.Height = paperh
'开始打印
'打印表头
If Combo4.Text <> "不打印表头和表尾" Then
Printer.Font.Name = "黑体"
Printer.Font.Size = 12
Printer.CurrentX = curx
Printer.CurrentY = cury
Printer.Print cs_a
cury = cury + 0.8
Printer.CurrentX = curx
Printer.CurrentY = cury
Printer.Print "单位地址:" & cs_b
cury = cury + 0.8
Printer.CurrentX = curx
Printer.CurrentY = cury
Printer.Print "提书单号:" & cs_c
cury = cury + 0.7
Printer.Line (curx - 1, cury)-(curx + 16, cury)
cury = cury + 0.2
End If
'打印表头结束
Printer.Font.Name = "宋体"
Printer.Font.Size = 11
Printer.CurrentX = curx - 1
Printer.CurrentY = cury
Printer.Print "序号"
Printer.CurrentX = curx
Printer.CurrentY = cury
Printer.Print "ISBN"
Printer.CurrentX = curx + 2.2
Printer.CurrentY = cury
Printer.Print "书名"
Printer.CurrentX = curx + 11
Printer.CurrentY = cury
Printer.Print "单价"
Printer.CurrentX = curx + 13
Printer.CurrentY = cury
Printer.Print "数量"
Printer.CurrentX = curx + 15
Printer.CurrentY = cury
Printer.Print "包"
Printer.CurrentX = curx
Printer.CurrentY = cury + 0.5
Printer.Line (curx - 1, cury + 0.5)-(curx + 16, cury + 0.5)
'打印出序号,ISBN、书名、价格、数量、包号
cury = cury + 0.6
If cury >= paperh - 3.7 Then
Printer.NewPage
cury = 2
Printer.Line (curx - 1, cury - 0.1)-(curx + 16, cury - 0.1)
End If
baohaobak = Data2.Recordset("baohao").Value
Do While Not Data2.Recordset.EOF
baohaonew = Data2.Recordset("baohao").Value
If baohaobak = baohaonew Then
suhao = suhao + 1
Printer.CurrentX = curx - 1
Printer.CurrentY = cury
Printer.Print suhao
Printer.CurrentX = curx
Printer.CurrentY = cury
Printer.Print Data2.Recordset("isbn").Value
Printer.CurrentX = curx + 2.2
Printer.CurrentY = cury
Printer.Print Trim(Left(Data2.Recordset("bookname").Value, 25))
Printer.CurrentX = curx + 11
Printer.CurrentY = cury
Printer.Print Data2.Recordset("jg").Value
Printer.CurrentX = curx + 13
Printer.CurrentY = cury
Printer.Print Data2.Recordset("dgs").Value
Printer.CurrentX = curx + 15
Printer.CurrentY = cury
Printer.Print Data2.Recordset("baohao").Value
Printer.Line (curx - 1, cury + 0.5)-(curx + 16, cury + 0.5)
zongsum = zongsum + 1
cesum = cesum + Data2.Recordset("dgs").Value
jesum = jesum + Data2.Recordset("dgs").Value * Val(Data2.Recordset("jg").Value)
'jesum_discount = jesum_discount + Data3.Recordset("dgs").Value * Val(Data3.Recordset("jg").Value) * Data3.Recordset("discount").Value
baohaobak = baohaonew
Else
'打印种册金额
'打印标题
Printer.Line (curx - 1, cury - 0.1)-(curx + 16, cury - 0.1)
Printer.CurrentX = curx + 3
Printer.CurrentY = cury
Printer.Print "种数:" & zongsum & " 册数:" & cesum & " 码洋:" & Format(jesum, "#0.00")
t_zongsum = t_zongsum + zongsum
t_cesum = t_cesum + cesum
t_jesum = t_jesum + jesum
't_jesum_dis = t_jesum_dis + jesum_discount
cury = cury + 2
If cury >= paperh - 3.7 Then
Printer.NewPage
cury = 2
Printer.Line (curx - 1, cury - 0.1)-(curx + 16, cury - 0.1)
End If
Printer.CurrentX = curx - 1
Printer.CurrentY = cury
Printer.Print "序号"
Printer.CurrentX = curx
Printer.CurrentY = cury
Printer.Print "ISBN"
Printer.CurrentX = curx + 2.2
Printer.CurrentY = cury
Printer.Print "书名"
Printer.CurrentX = curx + 11
Printer.CurrentY = cury
Printer.Print "单价"
Printer.CurrentX = curx + 13
Printer.CurrentY = cury
Printer.Print "数量"
Printer.CurrentX = curx + 15
Printer.CurrentY = cury
Printer.Print "包"
Printer.CurrentX = curx
Printer.CurrentY = cury + 0.5
Printer.Line (curx - 1, cury + 0.5)-(curx + 16, cury + 0.5)
zongsum = 0
cesum = 0
jesum = 0
' jesum_discount = 0
suhao = 0
baohaobak = baohaonew
Data2.Recordset.MovePrevious
End If
cury = cury + 0.6
If cury >= paperh - 3.7 Then
Printer.NewPage
cury = 2
Printer.Line (curx - 1, cury - 0.1)-(curx + 16, cury - 0.1)
End If
Data2.Recordset.MoveNext
Loop
Printer.Line (curx - 1, cury - 0.1)-(curx + 16, cury - 0.1)
Printer.CurrentX = curx + 3
Printer.CurrentY = cury
Printer.Print "种数:" & zongsum & " 册数:" & cesum & " 码洋:" & Format(jesum, "#0.00")
t_zongsum = t_zongsum + zongsum
t_cesum = t_cesum + cesum
t_jesum = t_jesum + jesum
' t_jesum_dis = t_jesum_dis + jesum_discount
'打印总的种、册、金额和尾
If Combo4.Text <> "不打印表头和表尾" Then
cury = cury + 1
Printer.Line (curx - 1, cury - 0.1)-(curx + 16, cury - 0.1)
Printer.CurrentX = curx
Printer.CurrentY = cury
Printer.Print "以上清单汇总:总种数:" & t_zongsum & " 总册数:" & t_cesum & " 总码洋:" & Format(t_jesum, "#0.00")
Printer.Line (curx - 1, cury + 0.5)-(curx + 16, cury + 0.5)
cury = cury + 0.6
If paperh - cury < 3 Then
Printer.NewPage
cury = 2
Printer.Line (curx - 1, cury - 0.1)-(curx + 16, cury - 0.1)
End If
'打印尾
cury = cury + 0.3
Printer.Font.Name = "黑体"
Printer.Font.Size = 11
Printer.CurrentX = curx
Printer.CurrentY = cury
Printer.Print "发货单位: " & cs_d
cury = cury + 0.5
Printer.CurrentX = curx
Printer.CurrentY = cury
Printer.Print "收货人电话:" & cs_e
End If
'结束
Printer.EndDoc
MsgBox "打印完成"
Command7.Enabled = True
Exit Sub
bbb:
MsgBox Err.Description
End Sub
Private Sub Command8_Click()
'上一包
currentbao = Val(Text11.Text)
currentbao = currentbao - 1
dwcode = Combo4.Text
dwdh = Text12.Text
If currentbao <= 0 Then currentbao = 1
Text11.Text = Trim(Str(currentbao))
Data2.RecordSource = "select * from 本馆数据 where baohao=" & currentbao & " and 名称='" & dwcode & "' and 单号='" & dwdh & "' order by modidate desc"
Data2.Refresh
Text1.SelStart = 0
Text1.SelLength = 20
Text1.SetFocus
End Sub
Private Sub Command9_Click()
'下一包
dwcode = Combo4.Text
dwdh = Text12.Text
currentbao = Val(Text11.Text)
currentbao = currentbao + 1
If currentbao <= 0 Then currentbao = 1
Text11.Text = Trim(Str(currentbao))
Data2.RecordSource = "select * from 本馆数据 where baohao=" & currentbao & " and 名称='" & dwcode & "' and 单号='" & dwdh & "' order by modidate desc"
Data2.Refresh
Text1.SelStart = 0
Text1.SelLength = 20
Text1.SetFocus
End Sub
Private Sub Form_Load()
Dim db As Database
Dim rs As Recordset
Dim dwcode As String '单位名称
Dim dwdh As String '单号
On Error Resume Next
Combo2.Text = "书 名"
Combo1.Text = "ISBN号"
Combo3.Text = "包 号"
Set db = Workspaces(0).OpenDatabase("d:\cbssys\bookcgk.mdb")
Set rs = db.OpenRecordset("select distinct 名称 from 输出参数 where 当前单位='1'")
Combo4.Clear
If rs.RecordCount <= 0 Then
MsgBox "请设置好出货单位!"
rs.Close
db.Close
End If
dwcode = rs("名称").Value
Combo4.AddItem rs("名称").Value
Combo4.ListIndex = 0
Set rs = db.OpenRecordset("select * from 单号参数 where 当前单='1' and 名称='" & dwcode & "'")
If rs.RecordCount <= 0 Then
MsgBox "请设置当前出货单号!"
rs.Close
db.Close
End If
dwdh = rs("发书单号").Value
Text12.Text = dwdh
rs.Close
db.Close
Data3.RecordSource = "select * from 预采数据 order by isbn"
Data3.Refresh
Data2.RecordSource = "select * from 本馆数据 where baohao=1 and 名称='" & dwcode & "' and 单号='" & dwdh & "' order by modidate desc"
Data2.Refresh
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then '回车
Call Command1_Click '选购
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -