📄 drug_system.bas
字号:
Attribute VB_Name = "drug_system"
Option Explicit
Public Const dbfname As String = "bahis"
Public Const yuanming As String = "北 安 第 一 人 民 医 院" '院名
Public Const mingstr = "select yp_name as 药品名称,CODE AS 药品代码,hos_code as 编码," _
+ "STANDARD AS 规格,UNIT AS 单位,package as 包装," _
+ "price AS 进价,whole AS 批发价,FACTORY AS 生产厂家," _
+ "PY AS 拼音头,POSITION AS 货位,ld as 拉丁,heavy as 是否贵重药品"
Public dbfstr As String
Public mdbname As String
Public mop_code As String
Public mop_name As String
Public report_id As String
Public mpass As String
Public mpower As String
Public myk_group As Integer
Public myk_name As String
Public wrkODBC As Workspace
Public wrkJet As Workspace
Sub opendb(db As Database, rs As Recordset, strSql As String, Optional edit As Boolean = False)
On Error GoTo opendb
If edit Then
Set rs = db.OpenRecordset(strSql, dbOpenDynaset, 0, dbPessimistic)
Else
Set rs = db.OpenRecordset(strSql, dbOpenSnapshot)
End If
On Error GoTo 0
Exit Sub
opendb:
If ERR.Number = 91 Or ERR.Number = 3420 Then
Set db = DBEngine.Workspaces("ODBCWorkspace").OpenDatabase(dbfname, 0, False, dbfstr)
Resume
Else
ERR.Raise ERR.Number
ERR.Clear
End If
End Sub
Sub openmdb(db As Database, rs As Recordset, strSql As String, Optional edit As Boolean = False)
On Error GoTo opendb
If edit Then
Set rs = db.OpenRecordset(strSql, dbOpenDynaset)
Else
Set rs = db.OpenRecordset(strSql, dbOpenSnapshot)
End If
On Error GoTo 0
Exit Sub
opendb:
Set db = DBEngine.Workspaces("JetWorkspace").OpenDatabase(mdbname)
Resume
End Sub
Function NoNull(xValue As Variant) As Variant
If IsNull(xValue) Then
NoNull = " "
Else
If xValue = "" Then
NoNull = " "
Else
NoNull = xValue
End If
End If
End Function
Function iszero(xxx As Variant) As Variant
If Val(xxx) = 0 Then
iszero = " " + Space(Len(xxx) - 1)
Else
iszero = xxx
End If
End Function
Function iszero1(xxx As Variant) As Variant
If Val(xxx) = 0 Then
iszero1 = " " + Space(Len(xxx) - 1)
Else
iszero1 = Space(Len(xxx) - Len(CStr(Val(xxx)))) + CStr(Val(xxx))
End If
End Function
Function printmoney(yyy As Currency, n As Long, Optional wei As Integer = 0) As String
If wei = 0 Then
printmoney = Space(n - DxLen(Left(CStr(Format(yyy, "#,###,###,##0.00")), n))) + Left(CStr(Format(yyy, "#,###,###,##0.00")), n) + "│"
Else
printmoney = Space(n - DxLen(Left(CStr(Format(yyy, "#,###,###,##0.0000")), n))) + Left(CStr(Format(yyy, "#,###,###,##0.0000")), n) + "│"
End If
End Function
Function printstr(yyy As Variant, n As Long, Optional way As Integer = 0) As String
If way = 0 Then
printstr = Left(CStr(yyy), n) + Space(n - DxLen(Left(CStr(yyy), n))) + "│"
Else
printstr = Space(n - DxLen(Left(CStr(Trim(yyy)), n))) + Left(CStr(Trim(yyy)), n) + "│"
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -