📄 yk_form_stock.frm
字号:
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSRDC.MSRDC sort_big
Height = 345
Left = 1800
Top = 1395
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 609
_Version = 393216
Options = 0
CursorDriver = 1
BOFAction = 0
EOFAction = 0
RecordsetType = 1
LockType = 3
QueryType = 0
Prompt = 3
Appearance = 1
QueryTimeout = 30
RowsetSize = 100
LoginTimeout = 15
KeysetSize = 0
MaxRows = 0
ErrorThreshold = -1
BatchSize = 15
BackColor = -2147483643
ForeColor = -2147483640
Enabled = -1 'True
ReadOnly = 0 'False
Appearance = -1 'True
DataSourceName = ""
RecordSource = ""
UserName = ""
Password = ""
Connect = ""
LogMessages = ""
Caption = "MSRDC1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSRDC.MSRDC sort_little
Height = 330
Left = 165
Top = 2175
Visible = 0 'False
Width = 1320
_ExtentX = 2328
_ExtentY = 582
_Version = 393216
Options = 0
CursorDriver = 1
BOFAction = 0
EOFAction = 0
RecordsetType = 1
LockType = 3
QueryType = 0
Prompt = 3
Appearance = 1
QueryTimeout = 30
RowsetSize = 100
LoginTimeout = 15
KeysetSize = 0
MaxRows = 0
ErrorThreshold = -1
BatchSize = 15
BackColor = -2147483643
ForeColor = -2147483640
Enabled = -1 'True
ReadOnly = 0 'False
Appearance = -1 'True
DataSourceName = ""
RecordSource = ""
UserName = ""
Password = ""
Connect = ""
LogMessages = ""
Caption = "MSRDC1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "yk_form_stock.frx":0346
Height = 5715
Left = 105
OleObjectBlob = "yk_form_stock.frx":0355
TabIndex = 13
Top = 1050
Width = 9330
End
End
Attribute VB_Name = "yk_form_stock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mkind_code As String
Dim drug_att As String
Dim big_id As String
Dim little_id As String
Dim in_position As String
Private Sub browse_com_Click()
Dim sss As String
Dim mm As String
Dim nn As String
biao.SQL = "drugbank_form_stock '" + mkind_code + "','" + drug_att + "','" + little_id + "'"
biao.Refresh
print_COM.Enabled = True
End Sub
Private Sub drug_kind_Click()
If drug_kind.Text = "西 药" Then mkind_code = "A"
If drug_kind.Text = "中成药" Then mkind_code = "B"
If drug_kind.Text = "饮 片" Then mkind_code = "C"
If drug_kind.Text = "材 料" Then mkind_code = "D"
little_id = "%"
sort_big.SQL = "select * from pharmic_greatgenus where G_kind='" + mkind_code + "'order by G_id"
sort_big.Refresh
show_big.ListField = "G_NAME"
show_big.Text = ""
show_little.Text = ""
show_att = ""
drug_att = "%"
sort_att.DataSourceName = dbfname
sort_att.Connect = dbfstr
sort_att.SQL = "select * from pharmic_function where f_kind='" + mkind_code + "'"
sort_att.Refresh
End Sub
Private Sub drug_kind_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
show_att.SetFocus
End If
End Sub
Private Sub Form_Load()
biao.DataSourceName = dbfname
biao.Connect = dbfstr
sort_att.DataSourceName = dbfname
sort_att.Connect = dbfname
sort_little.DataSourceName = dbfname
sort_little.Connect = dbfstr
sort_big.DataSourceName = dbfname
sort_big.Connect = dbfstr
drug_kind.AddItem "西 药"
drug_kind.AddItem "中成药"
drug_kind.AddItem "饮 片"
drug_kind.AddItem "材 料"
drug_kind.Text = "西 药"
Form3.Enabled = False
Form3.Visible = False
print_COM.Enabled = False
Screen.MousePointer = vbDefault
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form3.Enabled = True
Form3.Visible = True
End Sub
Private Sub quit_com_Click()
Unload Me
End Sub
Private Sub show_att_Change()
Dim db As Database
Dim rs As Recordset
If Not (show_att.Text = "") Then
opendb db, rs, "select * from pharmic_function where f_name like '" + show_att.Text + "'", False
drug_att = rs!f_id
rs.Close
db.Close
Else
drug_att = "%"
End If
End Sub
Private Sub show_att_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
show_big.SetFocus
End If
End Sub
Private Sub show_big_Change()
big_id = ""
If Not (show_big.Text = "") Then
Dim db As Database
Dim rs As Recordset
opendb db, rs, "select * from pharmic_greatgenus where G_NAME like '" + show_big.Text + "'", False
big_id = rs!G_id
rs.Close
db.Close
show_little = ""
sort_little.DataSourceName = dbfname
sort_little.Connect = dbfstr
sort_little.SQL = "select * from pharmic_littlegenus WHERE G_id='" + big_id + "'"
sort_little.Refresh
show_little.ListField = "L_NAME"
little_id = big_id + "%"
browse_com_Click
End If
End Sub
Private Sub show_big_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
show_little.SetFocus
End If
End Sub
Private Sub show_little_Change()
Dim db As Database
Dim rs As Recordset
If Not (big_id = "" Or show_little = "") Then
opendb db, rs, "select * from pharmic_littlegenus where G_id='" + big_id + "'and L_NAME like '" + show_little.Text + "'", False
little_id = rs!L_id
rs.Close
db.Close
End If
End Sub
Private Sub show_little_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
browse_com.SetFocus
End If
End Sub
Private Sub print_com_Click()
Dim xh As Integer
xh = 0
Dim i As Integer
Dim j As Integer
Dim mnumber As Long, mline As Long, mpage As Long, mlast As Long
'分页
biao.Resultset.MoveLast
mnumber = biao.Resultset.RowCount
biao.Resultset.MoveFirst
mline = 45
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
'分页打印
Do
Do
mpy = InputBox("本次打印共计" + CStr(mpage) + "页,请输入打印起始页码:", "输入")
If mpy Like "*'*" = False Then Exit Do
Loop
If Trim(mpy) = "" Or Val(mpy) <= mpage Then Exit Do
Loop
If Trim(mpy) = "" Then
Screen.MousePointer = vbDefault
Exit Sub
Else
p_begin = Val(mpy)
End If
For s = 1 To ((p_begin - 1) * mline)
biao.Resultset.MoveNext
Next
For i = p_begin To mpage
'打印名头
Printer.FontName = "隶书"
Printer.FontSize = 18
Printer.Print " " + yuanming
Printer.FontSize = 5
Printer.Print " "
Printer.FontSize = 15
Printer.Print " 药库 (药品,卫生材料) 库存核算表 "
Printer.Print " "
Printer.FontName = "宋体"
Printer.FontSize = 10.5
Printer.Print "打印日期: " + CStr(Date) + Space(3) + CStr(Time) + Space(50) + "页数: " + RTrim(CStr(i)) + "/" + RTrim(CStr(mpage))
Printer.Print "┌───┬──────────┬───────┬──┬─────┬─────┬─────┬─────┬───────┬───────┬───────┬────┬────┬───────┐"
Printer.Print "│代 码│ 药 品 名 称 │ 规 格 │单位│ 零售单价 │ 批发单价 │ 购入单价 │ 数 量 │零 售 总 金 额│批 发 总 金 额│进 价 总 金 额│加 成 率│毛 利 率│让 利 收 入│"
'打印记录
Printer.Print "├───┼──────────┼───────┼──┼─────┼─────┼─────┼─────┼───────┼───────┼───────┼────┼────┼───────┤"
For j = 1 To mline
If Not biao.Resultset.EOF Then
If Trim(biao.Resultset!代码) <> "Z99999" Then
xh = xh + 1
Printer.Print "│" + CStr(biao.Resultset!代码) + Space(6 - DxLen(CStr(biao.Resultset!代码))) _
; "│" + CStr(biao.Resultset!药品名称) + Space(20 - DxLen(CStr(biao.Resultset!药品名称))) _
; "│" + CStr(biao.Resultset!规格) + Space(14 - DxLen(CStr(biao.Resultset!规格))) _
; "│" + CStr(biao.Resultset!单位) + Space(4 - DxLen(CStr(biao.Resultset!单位))) _
; "│" + biao.Resultset!零售单价 _
; "│" + biao.Resultset!批发单价 _
; "│" + biao.Resultset!购入单价 _
; "│" + biao.Resultset!库存数量 _
; "│" + biao.Resultset!零售总金额 _
; "│" + biao.Resultset!批发总金额 _
; "│" + biao.Resultset!进价总金额 _
; "│" + biao.Resultset!加成率 _
; "│" + biao.Resultset!毛利率 _
; "│" + iszero(biao.Resultset!让利收入) _
; "│"
Else
Printer.Print "├───┴──────────┴───────┴──┼─────┼─────┼─────┼─────┼───────┼───────┼───────┼────┼────┼───────┤"
Printer.Print "│ 合 计 │" _
; biao.Resultset!零售单价 _
; "│" + biao.Resultset!批发单价 _
; "│" + biao.Resultset!购入单价 _
; "│" + biao.Resultset!库存数量 _
; "│" + biao.Resultset!零售总金额 _
; "│" + biao.Resultset!批发总金额 _
; "│" + biao.Resultset!进价总金额 _
; "│" + biao.Resultset!加成率 _
; "│" + biao.Resultset!毛利率 _
; "│" + iszero(biao.Resultset!让利收入) _
; "│"
End If
biao.Resultset.MoveNext
If biao.Resultset.EOF Then Exit For
End If
Next j
If biao.Resultset.EOF Then
Printer.Print "└─────────────────────────┴─────┴─────┴─────┴─────┴───────┴───────┴───────┴────┴────┴───────┘"
Printer.Print "操作员: " + mop_code + " 库保员:"
Exit For
Else
Printer.Print "└───┴──────────┴───────┴──┴─────┴─────┴─────┴─────┴───────┴───────┴───────┴────┴────┴───────┘"
Printer.Print "操作员: " + mop_code + " 库保员:"
Printer.NewPage
End If
Next i
Printer.EndDoc
MsgBox "打印结束", , "确定"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -