📄 stuff_form_total.frm
字号:
Dim m1 As Date
Dim M2 As Date
Private Sub browse_Click()
Dim sss As String
If Not IsDate(b_date.Text) Then
MsgBox "起始日期错误", , "日期错误"
b_date.Text = Date
b_date.Text = DateAdd("m", -1, b_date.Text)
b_date.Text = DateAdd("d", 1, b_date.Text)
b_date.SetFocus
Exit Sub
End If
If Not IsDate(e_date.Text) Then
MsgBox "终止日期错误", , "日期错误"
e_date.Text = Date
e_date.SetFocus
Exit Sub
End If
If e_date < b_date Then
MsgBox "结束日期应晚于起始日期,请重输日期!", vbInformation, "提示"
b_date.Text = Date
b_date.Text = DateAdd("m", -1, b_date.Text)
b_date.Text = DateAdd("d", 1, b_date.Text)
e_date.Text = Date
b_date.SetFocus
Exit Sub
End If
If b_date.Text > Date Or b_date.Text < "2000-01-01" Then
MsgBox "输入年限超出范围", , "提示"
b_date.SetFocus
Exit Sub
End If
If e_date.Text > Date Or e_date.Text < "2000-01-01" Then
MsgBox "输入年限超出范围", , "提示"
e_date.SetFocus
Exit Sub
End If
Select Case report_id
Case 1
sss = "stuff_form_intotal'" '入库汇总表
Case 2
sss = "stuff_form_outtotal'" '出库汇总表
End Select
m1 = CDate(b_date.Text)
M2 = CDate(e_date.Text)
biao.SQL = sss + CStr(b_date.Text) + "','" + CStr(CDate(CDate(e_date.Text) + 1)) + "'"
biao.Refresh
print_COM.Enabled = True
End Sub
Private Sub Form_Load()
b_date.Text = Date
b_date.Text = DateAdd("m", -1, b_date.Text)
e_date.Text = Date
b_date.Text = DateAdd("d", 1, b_date.Text)
biao.DataSourceName = dbfname
biao.Connect = dbfstr
Select Case report_id
Case 1
Me.Caption = "入库汇总表"
Case 2
Me.Caption = "出库汇总表"
End Select
Screen.MousePointer = vbDefault
print_COM.Enabled = False
Form3.Visible = False
Form3.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form3.Enabled = True
Form3.Visible = True
End Sub
Private Sub quit_Click()
Unload Me
End Sub
Private Sub b_date_LostFocus()
If Not IsDate(b_date) Then
MsgBox "起始日期输入错误,请重输!", vbInformation, "提示"
b_date.Text = Date - 30
b_date.SetFocus
End If
End Sub
Private Sub e_date_LostFocus()
If Not IsDate(e_date) Then
MsgBox "结束日期输入错误,请重输!", vbInformation, "提示"
e_date.Text = Date
e_date.SetFocus
End If
End Sub
Private Sub updown_b_DownClick()
'日期下调一天
If b_date.Text <> "" Then
b_date.Text = CStr(CDate(b_date.Text) - 1)
End If
End Sub
Private Sub updown_b_UpClick()
'日期上调一天
If b_date.Text <> "" Then
b_date.Text = CStr(CDate(b_date.Text) + 1)
End If
End Sub
Private Sub updown_e_DownClick()
'日期下调一天
If e_date.Text <> "" Then
e_date.Text = CStr(CDate(e_date.Text) - 1)
End If
End Sub
Private Sub updown_e_UpClick()
'日期上调一天
If e_date.Text <> "" Then
e_date.Text = CStr(CDate(e_date.Text) + 1)
End If
End Sub
Private Sub print_com_Click()
'打印模块
Dim mname As String
Dim msource As String
Dim mabstract As String
Dim mkind As String
Dim money1 As String
Dim money11 As String
Dim money111 As String
Dim money2 As String
Dim money22 As String
Dim money222 As String
Dim money3 As String
Dim money33 As String
Dim money333 As String
Dim money0 As String
Dim money00 As String
Dim money000 As String
Dim mks_name As String
Dim mnumber As Long, mline As Long, mpage As Long, mlast As Long
Dim i As Integer, j As Integer
biao.Refresh
If biao.Resultset.RowCount = 1 Then
MsgBox "没有库存清单", , "退出"
Exit Sub
End If
If biao.Resultset.BOF And biao.Resultset.EOF Then
MsgBox "请先浏览", , "退出"
Exit Sub
End If
If biao.Resultset.RowCount = 1 Then
MsgBox "库存清单", , "退出"
Exit Sub
End If
'*********入库******************************************************
If report_id = 1 Then
'分页
biao.Resultset.MoveLast
mnumber = biao.Resultset.RowCount
biao.Resultset.MoveFirst
mline = 25
mpage = mnumber \ mline
mlast = mnumber Mod mline
If mlast <> 0 Then
mpage = mpage + 1
End If
'设置纸张型号,高度,宽度
Printer.PaperSize = 39
'分页打印
For i = 1 To mpage
'打印名头
Printer.FontName = "隶书"
Printer.FontSize = 18
Printer.Print " " + yuanming
Printer.FontSize = 5
Printer.Print " "
Printer.FontSize = 15
Printer.Print " [" + CStr(Year(M2)) + "年" + CStr(Month(M2)) + "月]材 料 入 库 汇 总 表 "
Printer.Print " "
Printer.FontSize = 9.5
Printer.FontName = "宋体"
Printer.Print "日期范围:" + CStr(m1) + "----" + CStr(M2) + " " + Space(50) + "页数: " + CStr(mpage) + "----" + CStr(RTrim(CStr(i))) + "/" + CStr(mpage)
Printer.Print "┌────────────────────┬───────────────┬───────────────┬───────────────┬───────────────┐"
Printer.Print "│ │ 卫 生 材 料 │ 卫 杂 材 料 │ 其 他 材 料 │ 合 计 │"
Printer.Print "│ 供 货 单 位 ├───────┬───────┼───────┬───────┼───────┬───────┼───────┬───────┤"
Printer.Print "│ │ 进 货 额 │ 零 售 额 │ 进 货 额 │ 零 售 额 │ 进 货 额 │ 零 售 额 │ 进 货 额 │ 零 售 额 │"
'打印记录
For j = 1 To mline
If Not biao.Resultset.EOF Then
msource = Left(CStr(biao.Resultset!供货单位), 20)
Printer.Print "├────────────────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤"
Printer.Print "│" + msource + Space(40 - DxLen(CStr(msource))) _
; "│" + iszero(biao.Resultset!卫生材料进货额) _
; "│" + iszero(biao.Resultset!卫生材料零售额) _
; "│" + iszero(biao.Resultset!卫杂材料进货额) _
; "│" + iszero(biao.Resultset!卫杂材料零售额) _
; "│" + iszero(biao.Resultset!其他材料进货额) _
; "│" + iszero(biao.Resultset!其他材料零售额) _
; "│" + iszero(biao.Resultset!进货额合计) _
; "│" + iszero(biao.Resultset!零售额合计) _
; "│"
biao.Resultset.MoveNext
If biao.Resultset.EOF Then Exit For
End If
Next j
Printer.Print "└────────────────────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘"
Printer.Print "制表人: " + mop_name + " 科(处)长: 审核: 打印日期 " + CStr(Date) + " " + CStr(Time)
If biao.Resultset.EOF Then
Exit For
Else
Printer.NewPage
End If
Next i
Printer.EndDoc
End If
'*********出库******************************************************
If report_id = 2 Then
'分页
biao.Resultset.MoveLast
mnumber = biao.Resultset.RowCount
biao.Resultset.MoveFirst
mline = 25
mpage = mnumber \ mline
mlast = mnumber Mod mline
If mlast <> 0 Then
mpage = mpage + 1
End If
'设置纸张型号,高度,宽度
Printer.PaperSize = 39
'分页打印
For i = 1 To mpage
'打印名头
Printer.FontName = "隶书"
Printer.FontSize = 18
Printer.Print " " + yuanming
Printer.FontSize = 5
Printer.Print " "
Printer.FontSize = 15
Printer.Print " [" + CStr(Year(M2)) + "年" + CStr(Month(M2)) + "月]材 料 出 库 汇 总 表 "
Printer.Print " "
Printer.FontSize = 10.5
Printer.FontName = "宋体"
Printer.Print "日期范围:" + CStr(m1) + "----" + CStr(M2) + " " + Space(50) + "页数: " + CStr(mpage) + "----" + CStr(RTrim(CStr(i))) + "/" + CStr(mpage)
Printer.Print "┌──────────┬───────────────┬───────────────┬───────────────┬───────────────┐"
Printer.Print "│ │ 卫 生 材 料 │ 卫 杂 材 料 │ 其 他 材 料 │ 合 计 │"
Printer.Print "│ 请 领 单 位 ├───────┬───────┼───────┬───────┼───────┬───────┼───────┬───────┤"
Printer.Print "│ │ 进 货 额 │ 零 售 额 │ 进 货 额 │ 零 售 额 │ 进 货 额 │ 零 售 额 │ 进 货 额 │ 零 售 额 │"
'打印记录
For j = 1 To mline
If Not biao.Resultset.EOF Then
mks_name = Left(CStr(biao.Resultset!请领单位), 20)
Printer.Print "├──────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤"
Printer.Print "│" + mks_name + Space(20 - DxLen(CStr(mks_name))) _
; "│" + iszero(biao.Resultset!卫生材料进货额) _
; "│" + iszero(biao.Resultset!卫生材料零售额) _
; "│" + iszero(biao.Resultset!卫杂材料进货额) _
; "│" + iszero(biao.Resultset!卫杂材料零售额) _
; "│" + iszero(biao.Resultset!其他材料进货额) _
; "│" + iszero(biao.Resultset!其他材料零售额) _
; "│" + iszero(biao.Resultset!进货额合计) _
; "│" + iszero(biao.Resultset!零售额合计) _
; "│"
biao.Resultset.MoveNext
If biao.Resultset.EOF Then Exit For
End If
Next j
Printer.Print "└──────────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘"
Printer.Print "制表人: " + mop_name + " 科(处)长: 审核: 打印日期 " + CStr(Date) + " " + CStr(Time)
If biao.Resultset.EOF Then
Exit For
Else
Printer.NewPage
End If
Next i
Printer.EndDoc
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -