📄 yk_list.frm
字号:
Dim m1 As Date
Dim M2 As Date
Private Sub browse_Click()
Dim sss As String
If Not IsDate(yp_date1.Text) Then
MsgBox "起始日期错误", , "日期错误"
yp_date1.Text = Date
yp_date1.Text = DateAdd("m", -1, yp_date1.Text)
yp_date1.SetFocus
Exit Sub
End If
If Not IsDate(yp_date2.Text) Then
MsgBox "终止日期错误", , "日期错误"
yp_date2.Text = Date
yp_date2.Text = DateAdd("d", -1, yp_date2.Text)
yp_date2.SetFocus
Exit Sub
End If
If yp_date2 < yp_date1 Then
MsgBox "结束日期应晚于起始日期,请重输日期!", vbInformation, "提示"
yp_date1.Text = Date
yp_date1.Text = DateAdd("m", -1, yp_date1.Text)
yp_date2.Text = Date
yp_date2.Text = DateAdd("d", -1, yp_date2.Text)
yp_date1.SetFocus
Exit Sub
End If
If yp_date1.Text > "2099-12-31" Or yp_date1.Text < "2000-01-01" Then
MsgBox "输入年限超出范围", , "提示"
yp_date1.SetFocus
Exit Sub
End If
If yp_date2.Text > "2099-12-31" Or yp_date2.Text < "2000-01-01" Then
MsgBox "输入年限超出范围", , "提示"
yp_date2.SetFocus
Exit Sub
End If
Select Case report_id
Case 1
sss = "yk1_r_in'" '入库汇总表
Case 2
sss = "yk1_r_out'" '出库汇总表
Case 3
sss = "yk1_r_search'" '清查汇总表
Case 4
sss = "yk1_r_move'" '调拨汇总表
Case 5
sss = "yk1_r_price'" '调价汇总表
Case 6
sss = "yk1_r_store'" '库存动态汇总表
End Select
m1 = CDate(yp_date1.Text)
M2 = CDate(yp_date2.Text)
sss = sss + CStr(yp_date1.Text) + "','" + CStr(yp_date2.Text) + "'"
biao.SQL = sss
biao.Refresh
print_COM.Enabled = True
End Sub
Private Sub Form_Load()
yp_date1.Text = Date
yp_date1.Text = DateAdd("m", -1, yp_date1.Text)
yp_date2.Text = Date
yp_date2.Text = DateAdd("d", -1, yp_date2.Text)
Dim dbfstr As String
dbfstr = "ODBC;DATABASE=netba;UID=zc;PWD=1234"
biao.DataSourceName = "207his"
biao.Connect = dbfstr
Select Case report_id
Case 1
Me.Caption = " 入 库 汇 总 表"
Case 2
Me.Caption = " 出 库 汇 总 表"
Case 3
Me.Caption = " 清 查 汇 总 表"
Case 4
Me.Caption = " 调 拨 汇 总 表"
Case 5
Me.Caption = " 调 价 汇 总 表"
Case 6
Me.Caption = " 库 存 动 态 汇 总 表"
End Select
Screen.MousePointer = vbDefault
print_COM.Enabled = False
End Sub
Private Sub quit_Click()
Unload Me
Form3.Show
End Sub
Private Sub yp_date1_LostFocus()
If Not IsDate(yp_date1) Then
MsgBox "起始日期输入错误,请重输!", vbInformation, "提示"
yp_date1.Text = Date - 30
yp_date1.SetFocus
End If
End Sub
Private Sub yp_date2_LostFocus()
If Not IsDate(yp_date2) Then
MsgBox "结束日期输入错误,请重输!", vbInformation, "提示"
yp_date2.Text = Date - 30
yp_date2.SetFocus
End If
End Sub
Private Sub UpDown1_DownClick()
'日期下调一天
If IsDate(yp_date1.Text) Then
'yp_day.Enabled = True
yp_date1.Text = CStr(CDate(yp_date1.Text) - 1)
'yp_day.Enabled = False
End If
End Sub
Private Sub UpDown1_UpClick()
'日期上调一天
If IsDate(yp_date1.Text) Then
'yp_date.Enabled = True
yp_date1.Text = CStr(CDate(yp_date1.Text) + 1)
' yp_day.Enabled = False
End If
End Sub
Private Sub UpDown2_DownClick()
'日期下调一天
If IsDate(yp_date2.Text) Then
'yp_day.Enabled = True
yp_date2.Text = CStr(CDate(yp_date2.Text) - 1)
'yp_day.Enabled = False
End If
End Sub
Private Sub UpDown2_UpClick()
'日期上调一天
If IsDate(yp_date2.Text) Then
'yp_date.Enabled = True
yp_date2.Text = CStr(CDate(yp_date2.Text) + 1)
' yp_day.Enabled = False
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 = 10
mpage = mnumber \ mline
mlast = mnumber Mod mline
If mlast <> 0 Then
mpage = mpage + 1
End If
'设置纸张型号,高度,宽度
' Printer.PaperSize = 256
Printer.Height = 8000
Printer.Width = 24000
'分页打印
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!卫生材料批发额) _
; "│" + iszero(biao.Resultset!进货额合计) _
; "│" + iszero(biao.Resultset!批发额合计) _
; "│"
biao.Resultset.MoveNext
If biao.Resultset.EOF Then Exit For
End If
Next j
Printer.Print "└────────────────────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘"
Printer.Print "制表人: 科(处)长: 审核: 打印日期 " + 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
' Printer.Height = 8000
' Printer.Width = 24000
'分页打印
For i = 1 To mpage
'打印名头
Printer.FontSize = 18
Printer.Print " " + yuanming
Printer.FontSize = 5
Printer.Print " "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -