📄 yk_pdb.frm
字号:
Dim lx As String
Dim MEX As String
Private Sub browse_Click()
Dim sss As String
Dim mm As String
Dim nn 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
mm = "'%'"
lx = Combo2.Text
If lx = "西 药" Then
If Option0.Value = True Then
mm = "'0'"
MEX = "[片剂]"
End If
If Option1.Value = True Then
mm = "'1'"
MEX = "[外用药品]"
End If
If Option2.Value = True Then
mm = "'2'"
MEX = "[毒麻药品]"
End If
If Option3.Value = True Then
mm = "'3'"
MEX = "[针剂]"
End If
If Option4.Value = True Then
mm = "'4'"
MEX = "[大输液]"
End If
End If
nn = "'%'"
If Combo2.Text = "西 药" Then
nn = "'A'"
End If
If Combo2.Text = "中成药" Then
nn = "'B'"
End If
If Combo2.Text = "饮 片" Then
nn = "'C'"
End If
If Combo2.Text = "卫 材" Then
nn = "'D'"
End If
m1 = yp_date1.Text
M2 = yp_date2.Text
sss = "yk1_tjb_xx'" + CStr(m1) + "','" + CStr(M2) + "'," + mm + "," + nn
biao.SQL = sss
print_COM.Enabled = True
biao.Refresh
End Sub
Private Sub Combo2_Click()
If Combo2.Text = "西 药" Then Frame1.Enabled = True
If Combo2.Text = "中成药" Then Frame1.Enabled = False
If Combo2.Text = "饮 片" Then Frame1.Enabled = False
If Combo2.Text = "卫 材" Then Frame1.Enabled = False
If Combo2.Text = " " Then Frame1.Enabled = False
End Sub
Private Sub Command1_Click()
Dim s As Integer
Dim j As Integer
Dim mnumber
Dim mline
Dim mpage
mline = 28
Dim mlast
Dim xh As Integer
biao.Refresh
If biao.SQL = "" Then
MsgBox "没有数据", , "错误"
Exit Sub
End If
If (biao.Resultset.EOF And biao.Resultset.BOF) Then
MsgBox "没有数据", , "错误"
Exit Sub
End If
If biao.Resultset.RowCount = 1 Then
MsgBox "没有数据", , "错误"
Exit Sub
End If
mnumber = biao.Resultset.RowCount
mpage = mnumber \ mline
mlast = mnumber Mod mline
If mlast <> 0 Then mpage = mpage + 1
biao.Resultset.MoveFirst
Screen.MousePointer = 11
'打印
Printer.PaperSize = 1
xh = 0
For s = 1 To mpage
Printer.FontSize = 20
Printer.Print Space(17) + yuanming
Printer.FontSize = 15
Printer.FontName = "隶书"
Printer.Print Space(26) + "药 库 药 品 清 单"
Printer.Print ""
Printer.FontSize = 10.5
Printer.Print " 类型:" + CStr(Combo2.Text) + Space(5) + MEX + Space(18) + CStr(m1) + "--" + CStr(M2) + Space(25) + "第" + CStr(s) + "页/共" + CStr(mpage) + "页"
Printer.FontName = "宋体"
Printer.Print "┌──┬───┬──────────┬───────┬──┬─────┬───────┬───────┐"
Printer.Print "│序号│代 码│ 药 品 名 称 │ 规 格 │单位│ 批 发 价 │ 数 量 │ 结存金额 │"
For j = 1 To mline
If Not biao.Resultset.EOF Then
If Trim(biao.Resultset!代码) <> "xxxxxx" Then
xh = xh + 1
Printer.Print "├──┼───┼──────────┼───────┼──┼─────┼───────┼───────┤"
Printer.Print "│" + Space(4 - DxLen(CStr(xh))) + CStr(xh) _
; "│" + CStr(biao.Resultset!代码) _
; "│" + CStr(biao.Resultset!药品名称) _
; "│" + CStr(biao.Resultset!规格) _
; "│" + CStr(biao.Resultset!单位) _
; "│" + iszero(biao.Resultset!批发单价) _
; "│" + iszero1(biao.Resultset!本月结存数量) _
; "│" + iszero(biao.Resultset!本月结存金额) _
; "│"
Else
Printer.Print "├──┴───┴──────────┴───────┴──┼─────┼───────┼───────┤"
Printer.Print "│ 合 计 │ │" _
+ iszero1(biao.Resultset!本月结存数量) _
; "│" + iszero(biao.Resultset!本月结存金额) _
; "│"
End If
biao.Resultset.MoveNext
End If
Next j
If biao.Resultset.EOF Then
Printer.Print "└────────────────────────────┴─────┴───────┴───────┘"
Printer.Print "药剂科负责人: 报表人: 药品会计: 调剂员: 打印日期:" + CStr(Date) + " 打印时间:" + CStr(Time)
Exit For
Else
Printer.Print "└──┴───┴──────────┴───────┴──┴─────┴───────┴───────┘"
Printer.Print "药剂科负责人: 报表人: 药品会计: 调剂员: 打印日期:" + CStr(Date) + " 打印时间:" + CStr(Time)
Printer.NewPage
End If
Next s
Printer.EndDoc
Screen.MousePointer = 0
MsgBox "打印结束", , "确定"
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
Me.Caption = " 药 库 药 品 盘 点 卫 材 核 算 表 "
Combo2.AddItem "西 药"
Combo2.AddItem "中成药"
Combo2.AddItem "饮 片"
Combo2.AddItem "卫 材"
Combo2.AddItem " "
Combo2.Text = " "
Option5.Value = True
Screen.MousePointer = vbDefault
print_COM.Enabled = False
End Sub
Private Sub print_com_Click()
Dim s As Integer
Dim j As Integer
Dim mnumber
Dim mline
Dim mpage
mline = 20
Dim mlast
Dim xh As Integer
If biao.Resultset.RowCount = 1 Then
MsgBox "没有库存清单", , "退出"
Exit Sub
End If
biao.Refresh
If biao.Resultset.EOF And biao.Resultset.BOF Then
MsgBox "没有数据", , "错误"
print_COM.Enabled = False
Exit Sub
End If
If biao.Resultset.RowCount = 1 Then
MsgBox "没有数据", , "错误"
print_COM.Enabled = False
Exit Sub
End If
mnumber = biao.Resultset.RowCount
mpage = mnumber \ mline
mlast = mnumber Mod mline
If mlast <> 0 Then mpage = mpage + 1
biao.Resultset.MoveFirst
'Screen.MousePointer = 11
'打印
Printer.PaperSize = 39
'Printer.Height = 8000
'Printer.Width = 24000
Printer.FontName = "隶书"
xh = 0
For s = 1 To mpage
Printer.FontSize = 20
Printer.Print Space(36) + yuanming
Printer.FontSize = 15
Printer.Print Space(44) + "药 库 (药 品 卫 材) 盘 点 核 算 表 "
Printer.Print ""
Printer.FontSize = 9.5
Printer.Print " 类型:" + CStr(lx) + Space(5) + MEX + Space(38) + CStr(m1) + "--" + CStr(M2) + Space(55) + "第" + CStr(s) + "页/共" + CStr(mpage) + "页"
Printer.FontName = "宋体"
Printer.Print "┌──┬───┬──────────┬───────┬──┬─────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┐"
Printer.Print "│序号│代 码│ 药 品 名 称 │ 规 格 │单位│ 批发单价 │ 上月结存 │ 本月入库 │ 本月出库 │ 药房返库 │ 返回厂家 │ 本月清查 │ 本月调价 │ 本月结存 │"
For j = 1 To mline
If Not biao.Resultset.EOF Then
If Trim(biao.Resultset!代码) <> "xxxxxx" Then
xh = xh + 1
Printer.Print "├──┼───┼──────────┼───────┼──┼─────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤"
Printer.Print "│" + Space(4) _
; "│" + Space(6) _
; "│" + Space(20) _
; "│" + Space(14) _
; "│" + Space(4) _
; "│ 数 量 " _
; "│" + iszero1(biao.Resultset!上月结存数量) _
; "│" + iszero1(biao.Resultset!本月入库数量) _
; "│" + iszero1(biao.Resultset!本月出库数量) _
; "│" + iszero1(biao.Resultset!药房返库数量) _
; "│" + iszero1(biao.Resultset!返回厂家数量) _
; "│" + iszero1(biao.Resultset!本月清查数量) _
; "│" + iszero1(biao.Resultset!本月调价数量) _
; "│" + iszero1(biao.Resultset!本月结存数量) _
; "│"
Printer.Print "│" + Space(4 - DxLen(CStr(xh))) + CStr(xh) _
; "│" + CStr(biao.Resultset!代码) _
; "│" + CStr(biao.Resultset!药品名称) _
; "│" + CStr(biao.Resultset!规格) _
; "│" + CStr(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!本月结存金额) _
; "│"
Else
Printer.Print "├──┴───┴──────────┴───────┴──┼─────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤"
Printer.Print "│ 合 计 │ │" _
+ iszero(biao.Resultset!上月结存金额) _
; "│" + iszero(biao.Resultset!本月入库金额) _
; "│" + iszero(biao.Resultset!本月出库金额) _
; "│" + iszero(biao.Resultset!药房返库金额) _
; "│" + iszero(biao.Resultset!返回厂家金额) _
; "│" + iszero(biao.Resultset!本月清查金额) _
; "│" + iszero(biao.Resultset!本月调价金额) _
; "│" + iszero(biao.Resultset!本月结存金额) _
; "│"
End If
biao.Resultset.MoveNext
End If
Next j
If biao.Resultset.EOF Then
Printer.Print "└────────────────────────────┴─────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘"
Printer.Print "药剂科负责人: 报表人: 药品会计: 调剂员: 打印日期:" + CStr(Date) + " 打印时间:" + CStr(Time)
Exit For
Else
Printer.Print "└──┴───┴──────────┴───────┴──┴─────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘"
Printer.Print "药剂科负责人: 报表人: 药品会计: 调剂员: 打印日期:" + CStr(Date) + " 打印时间:" + CStr(Time)
Printer.NewPage
End If
Next s
Printer.EndDoc
MsgBox "打印结束", , "确定"
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 yp_date1.Text <> "" Then
yp_date1.Text = CStr(CDate(yp_date1.Text) - 1)
End If
End Sub
Private Sub UpDown1_UpClick()
'日期上调一天
If yp_date1.Text <> "" Then
yp_date1.Text = CStr(CDate(yp_date1.Text) + 1)
End If
End Sub
Private Sub UpDown2_DownClick()
'日期下调一天
If yp_date2.Text <> "" Then
yp_date2.Text = CStr(CDate(yp_date2.Text) - 1)
End If
End Sub
Private Sub UpDown2_UpClick()
'日期上调一天
If yp_date2.Text <> "" Then
yp_date2.Text = CStr(CDate(yp_date2.Text) + 1)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -