⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yj_pdb.frm

📁 这是一个医院管理系统中的院长查询模块
💻 FRM
📖 第 1 页 / 共 2 页
字号:
Dim M2 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.Text = DateAdd("d", 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.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_date1.Text = DateAdd("d", 1, yp_date1.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.Text = Date
        yp_date1.Text = DateAdd("m", -1, yp_date1.Text)
        yp_date1.Text = DateAdd("d", 1, yp_date1.Text)
        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.Text = Date
        yp_date2.SetFocus
        Exit Sub
    End If
    mm = "'%'"
    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
    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


m1 = yp_date1.Text
M2 = yp_date2.Text
If yj_code = 1 Then sss = "yj1_xxbb'" + CStr(m1) + "','" + CStr(M2) + "'," + mm + "," + nn
If yj_code = 2 Then sss = "yj2_xxbb'" + CStr(m1) + "','" + CStr(M2) + "'," + mm + "," + nn
If yj_code = 3 Then sss = "yj3_xxbb'" + CStr(m1) + "','" + CStr(M2) + "'," + mm + "," + nn
biao.SQL = sss
biao.Refresh
print_COM.Enabled = True
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 = "隶书"
        If yj_code = 1 Then Printer.Print Space(23) + "门 诊 药 房 药 品 清 单"
        If yj_code = 2 Then Printer.Print Space(23) + "门 诊 草 药 房 药 品 清 单"
        If yj_code = 3 Then Printer.Print Space(23) + "住 院 草 药 房 药 品 清 单"
    
    
        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!代码) <> "合计" 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_date1.Text = DateAdd("d", 1, yp_date1.Text)
Dim dbfstr As String
dbfstr = "ODBC;DATABASE=netba;UID=zc;PWD=1234"
biao.DataSourceName = "207his"
biao.Connect = dbfstr
If yj_code = 1 Then
    Me.Caption = "药品详细统计表(门诊药局)"
    Combo2.AddItem "西  药"
    Combo2.AddItem "中成药"
    Combo2.AddItem " "
    Combo2.Text = " "
End If
If yj_code = 2 Then
    Me.Caption = "药品详细统计表(门诊草药局)"
    Combo2.AddItem "饮  片"
    Combo2.Text = "饮  片"
End If
If yj_code = 3 Then
    Me.Caption = "药品详细统计表(住院药局)"
    Combo2.AddItem "西  药"
    Combo2.AddItem "中成药"
    Combo2.AddItem " "
    Combo2.Text = " "
End If

   Option5.Value = True
print_COM.Enabled = False
Screen.MousePointer = vbDefault
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

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(39) + yuanming
Printer.FontSize = 15
If yj_code = 1 Then Printer.Print Space(42) + "门 诊 药 房 药 品 盘 点、 销 售 统 计 表 "
If yj_code = 2 Then Printer.Print Space(42) + "门 诊 草 药 房 药 品 盘 点、 销 售 统 计 表 "
If yj_code = 3 Then Printer.Print Space(42) + "住 院 药 房 药 品 盘 点、 销 售 统 计 表 "


Printer.Print ""
Printer.FontSize = 9.5

Printer.Print " 类型:" + CStr(Combo2.Text) + Space(5) + MEX + Space(38) + CStr(m1) + "--" + CStr(M2) + Space(55) + "第" + CStr(s) + "页/共" + CStr(mpage) + "页"
Printer.FontName = "宋体"

Printer.Print "┌──┬───┬──────────┬───────┬──┬─────┬───────┬───────┬───────┬───────┬───────────────┬───────┬───────┐"
Printer.Print "│ 序 │      │                    │              │    │ 零 售 价 │   上月结存   │   本月请领   │   本月调价   │   本月退库   │     本    月    销    售     │ 本月销售其他 │ 月末盘点结存 │"
Printer.Print "│    │代  码│   药  品  名  称   │ 规        格 │单位├─────┼───────┼───────┼───────┼───────┼───────┬───────┼───────┼───────┤"
Printer.Print "│ 号 │      │                    │              │    │ 批 发 价 │  批发总金额  │  批发总金额  │  批发总金额  │  批发总金额  │  批发总金额  │  零售总金额  │  批发总金额  │  批发总金额  │"
For j = 1 To mline
       If Not biao.Resultset.EOF Then
          If Trim(biao.Resultset!代码) <> "合计" Then
               xh = xh + 1
Printer.Print "├──┼───┼──────────┼───────┼──┼─────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤"
                
                Printer.Print "│" + Space(4) _
                        ; "│" + Space(6) _
                        ; "│" + Space(20) _
                        ; "│" + Space(14) _
                        ; "│" + Space(4) _
                        ; "│" + iszero(biao.Resultset!零售单价) _
                        ; "│" + iszero1(biao.Resultset!上月结存数量) _
                        ; "│" + iszero1(biao.Resultset!本月请领数量) _
                        ; "│" + iszero1(biao.Resultset!本月调价数量) _
                        ; "│" + iszero1(biao.Resultset!本月退库数量) _
                        ; "│" + iszero1(biao.Resultset!本月销售数量) _
                        ; "│" + Space(14) _
                        ; "│" + 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
Screen.MousePointer = 0
MsgBox "打印结束", , "确定"
End Sub

Private Sub quit_Click()
Unload Me
Form3.Show
End Sub



Private Sub UpDown1_DownClick()
  '日期下调一天
  If IsDate(yp_date1.Text) Then
     yp_date1.Text = CStr(CDate(yp_date1.Text) - 1)
     End If
End Sub
Private Sub UpDown1_UpClick()
  '日期上调一天
  If IsDate(yp_date1.Text) Then
    yp_date1.Text = CStr(CDate(yp_date1.Text) + 1)
     End If
End Sub
Private Sub UpDown2_DownClick()
  '日期下调一天
  If IsDate(yp_date2.Text) Then
  yp_date2.Text = CStr(CDate(yp_date2.Text) - 1)
  End If
End Sub
Private Sub UpDown2_UpClick()
  '日期上调一天
  If IsDate(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 + -