yk_b_in.frm
来自「这是一个医院管理系统中的院长查询模块」· FRM 代码 · 共 939 行 · 第 1/3 页
FRM
939 行
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
'入库流水帐条件设置
MEXPRESS = "SELECT dddd AS 流水号,yp_NAME AS 药品名称,STANDARD AS 规格," _
+ "UNIT AS 单位,borrow_AMOUNT AS 数量,package as 包装," _
+ "WHOLE AS 进价,retail AS 零售价,price as 批发价,jz_DATE AS 入库日期," _
+ "jz_time as 记账时间,abstract as 供货单位," _
+ "invoice as 发票号,CODE AS 代码,jm as 简码,py as 拼音头,op_code as 操作员" _
+ " FROM yk1_mx WHERE j_flag='1' AND substring(CODE,1,1)='" _
+ mkind_code + "'"
MEXPRESS = MEXPRESS + " AND jz_date>= convert(datetime,'" + yp_date1.Text + "')" _
+ " AND jz_date<= convert(datetime,'" + yp_date2.Text + "')"
If yp_source.Text <> "" Then
MEXPRESS = MEXPRESS + " AND abstract_id='" + mcw_id + "'"
End If
' '判断拼音头是否为空
If Not (lib_data.Resultset.BOF And lib_data.Resultset.EOF) Then
MEXPRESS = MEXPRESS + " AND code= '" + lib_data.Resultset!代码 + "'"
End If
MEXPRESS = MEXPRESS + " order by jz_date,dddd"
' '入库流水帐显示控件刷新
all_data.DataSourceName = dbfname
all_data.Connect = dbfstr
'End If
all_data.SQL = MEXPRESS
all_data.Refresh
'合计清零
money0 = 0
money1 = 0
'计算合计
Do While Not all_data.Resultset.EOF
money0 = money0 + Format(all_data.Resultset!数量 * all_data.Resultset!进价, ".00")
money1 = money1 + Format(all_data.Resultset!数量 * all_data.Resultset!批发价, ".00")
all_data.Resultset.MoveNext
Loop
'入库流水帐显示控件停在第一条记录上
If Not (all_data.Resultset.BOF And all_data.Resultset.EOF) Then
all_data.Resultset.MoveFirst
End If
'显示合计
HJ_MONEY(0).Caption = CStr(money0) + "元"
HJ_MONEY(1).Caption = CStr(money1) + "元"
'入库流水帐显示控件为有效
all_data.Enabled = True
'焦点停留在拼音头
yp_pyt_Change
yp_pyt.SetFocus
End Sub
Private Sub print_com_Click()
Dim mname As String
Dim msource As String
Dim mamount As String
Dim mwhole As String
Dim mwhole_money As String
Dim mretail As String
Dim mretail_money As String
Dim mtemp As String
Dim mtemp1 As String
Dim mdddd As String
Dim mstandard As String
Dim mdate As String
all_data.Refresh
If all_data.DataSourceName = "" Then
MsgBox "无入库数据", , "退出打印"
Exit Sub
End If
If all_data.Enabled = False Then
MsgBox "无入库数据", , "退出打印"
Exit Sub
End If
If all_data.Resultset.BOF And all_data.Resultset.EOF Then
MsgBox "无入库数据", , "退出打印"
yp_pyt.SetFocus
Exit Sub
End If
'计算记录数,并停留在第一条记录
all_data.Resultset.MoveFirst
all_data.Resultset.MoveLast
mnumber = all_data.Resultset.RowCount
all_data.Resultset.MoveFirst
'计算页数
mline = 20
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
Printer.FontName = "隶书"
'合计清零
money00 = 0
money11 = 0
money22 = 0
'分页打印
For i = 1 To mpage
'打印名头
Printer.FontSize = 17
Printer.Print " 入 库 流 水 帐"
Printer.Print " "
Printer.FontSize = 9.5
Printer.Print " 类别: " + yp_kind.Text + Space(152 - DxLen(yp_kind.Text)) + "页数: " + RTrim(CStr(i)) + "/" + RTrim(CStr(mpage))
Printer.Print "┌───┬─────┬─────────┬─────┬──┬────┬────────────┬────────────┬────────────┬─────────────┐"
Printer.Print "│ │ │ │ │ │ │ 进 货 价 │ 批 发 价 │ 零 售 价 │ 药 品 来 源 │"
Printer.Print "│流水号│ 入库日期 │ 药 品 名 称 │ 规 格 │单位│ 数量 ├────┬───────┼────┬───────┼────┬───────┤ │"
Printer.Print "│ │ │ │ │ │ │ 单 价 │ 金 额 │ 单 价 │ 金 额 │ 单 价 │ 金 额 │ │"
'分页合计清零
money0 = 0
money1 = 0
money2 = 0
'打印记录
For j = 1 To mline
If Not all_data.Resultset.EOF Then
mtemp = Left(CStr(Format(all_data.Resultset!批发价, "##,###,##0.00")), 8)
mtemp1 = Left(CStr(Format(all_data.Resultset!批发价 * all_data.Resultset!数量, "##,###,##0.00")), 14)
mname = Left(all_data.Resultset!药品名称, 9)
mamount = Left(CStr(all_data.Resultset!数量), 8)
mwhole = Left(CStr(Format(all_data.Resultset!进价, "##,###,##0.00")), 8)
mwhole_money = Left(CStr(Format(all_data.Resultset!数量 * all_data.Resultset!进价, "##,###,##0.00")), 14)
mretail = Left(CStr(Format(all_data.Resultset!零售价, "##,###,##0.00")), 8)
mretail_money = Left(CStr(Format(all_data.Resultset!数量 * all_data.Resultset!零售价, "##,###,##0.00")), 14)
msource = Left(all_data.Resultset!供货单位, 13)
mdddd = Left(CStr(all_data.Resultset!流水号), 6)
mstandard = Left(all_data.Resultset!规格, 8)
mdate = CStr(all_data.Resultset!入库日期)
Printer.Print "├───┼─────┼─────────┼─────┼──┼────┼────┼───────┼────┼───────┼────┼───────┼─────────────┤"
Printer.Print "│" + mdddd + Space(6 - DxLen(mdddd)) _
; "│" + mdate + Space(10 - DxLen(mdate)) _
; "│" + mname + Space(18 - DxLen(mname)) _
; "│" + mstandard + Space(10 - DxLen(mstandard)) _
; "│" + all_data.Resultset!单位 + Space(4 - DxLen(all_data.Resultset!单位)) _
; "│" + Space(8 - DxLen(mamount)) + mamount _
; "│" + Space(8 - DxLen(mwhole)) + mwhole _
; "│" + Space(14 - DxLen(mwhole_money)) + mwhole_money _
; "│" + Space(8 - DxLen(mtemp)) + mtemp _
; "│" + Space(14 - DxLen(mtemp1)) + mtemp1 _
; "│" + Space(8 - DxLen(mretail)) + mretail _
; "│" + Space(14 - DxLen(mretail_money)) + mretail_money _
; "│" + msource + Space(26 - DxLen(msource)) _
; "│"
'计算分页合计
money0 = money0 + all_data.Resultset!数量 * all_data.Resultset!进价
money1 = money1 + all_data.Resultset!数量 * all_data.Resultset!零售价
money2 = money2 + all_data.Resultset!数量 * all_data.Resultset!批发价
'计算合计
money00 = money00 + all_data.Resultset!数量 * all_data.Resultset!进价
money11 = money11 + all_data.Resultset!数量 * all_data.Resultset!零售价
money22 = money22 + all_data.Resultset!数量 * all_data.Resultset!批发价
all_data.Resultset.MoveNext
If all_data.Resultset.EOF Then
Exit For
End If
End If
If all_data.Resultset.EOF Then
Exit For
End If
Next
Printer.Print "├───┼─────┼─────────┼─────┼──┼────┼────┼───────┼────┼───────┼────┼───────┼─────────────┤"
Printer.Print "│ │ │ 合 计 │ │ │ │ " _
+ "│" + Space(14 - DxLen(Left(CStr(Format(money0, "##,###,##0.00")), 14))) + Left(CStr(Format(money0, "##,###,##0.00")), 14) _
+ "│ " _
+ "│" + Space(14 - DxLen(Left(CStr(Format(money2, "##,###,##0.00")), 14))) + Left(CStr(Format(money2, "##,###,##0.00")), 14) _
+ "│ " _
+ "│" + Space(14 - DxLen(Left(CStr(Format(money1, "##,###,##0.00")), 14))) + Left(CStr(Format(money1, "##,###,##0.00")), 14) _
+ "│" + Space(26) _
+ "│"
Printer.Print "└───┴─────┴─────────┴─────┴──┴────┴────┴───────┴────┴───────┴────┴───────┴─────────────┘"
Printer.Print "保管员: 负责人: 录入员:"
If all_data.Resultset.EOF Then
Printer.Print "进货价合计:¥" + CStr(Format(money00, "##,###,##0.00")) + " 批发价合计:¥" + CStr(Format(money22, "##,###,##0.00")) + " 零售价合计:¥" + CStr(Format(money11, "##,###,##0.00"))
Exit For
Else
Printer.NewPage
End If
Next
Printer.EndDoc
MsgBox "打印结束", , "退出"
'打印结束后,停留在第一条记录
all_data.Resultset.MoveFirst
all_data.Enabled = True
'焦点在拼音头
yp_pyt.SetFocus
End Sub
Private Sub spy_Change()
'供货单位拼音头选择
If spy.Text Like "*'*" Then
spy.Text = ""
spy.SetFocus
Exit Sub
End If
'供货单位根据拼音头进行选择
source_data.SQL = "select * from yp_worksource where py like '%" + Trim(spy.Text) + "%'"
source_data.Refresh
'根据供货单位名称找到代码
If Not (source_data.Resultset.BOF And source_data.Resultset.EOF) Then
yp_source.Text = source_data.Resultset!cw_name
mcw_id = source_data.Resultset!cw_id
Else
yp_source.Text = ""
End If
End Sub
Private Sub yp_pyt_Change()
'根据药品拼音头找到药品
Dim MEXPRESS As String
If yp_pyt.Text Like "*'*" Then
yp_pyt.Text = ""
yp_pyt.SetFocus
Exit Sub
End If
If yp_pyt.Text <> "" Then
'寻找三类药品
lib_data.DataSourceName = dbfname
lib_data.Connect = dbfstr
MEXPRESS = "select code as 代码,yp_name as 药品名称,standard as 规格,UNIT AS 单位,py as 拼音头 from yp_library " _
+ " where py like '" + Trim(yp_pyt.Text) + "%' "
If yp_kind.Text = "西 药" Then
lib_data.SQL = MEXPRESS + " and substring(code,1,1)='A'"
End If
If yp_kind.Text = "中成药" Then
lib_data.SQL = MEXPRESS + " and substring(code,1,1)='B'"
End If
If yp_kind.Text = "饮 片" Then
lib_data.SQL = MEXPRESS + " and substring(code,1,1)='C'"
End If
lib_data.Refresh
Else
'拼音头为空
lib_data.SQL = "select code as 代码,yp_name as 药品名称,standard as 规格,UNIT AS 单位,py as 拼音头 from yp_library where code=''"
lib_data.Refresh
End If
End Sub
Private Sub UpDown1_DownClick()
'日期下调一天
If 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 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 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 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 yp_pyt_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc("'") Then
KeyAscii = 0
End If
If KeyAscii = 13 Then
lib_wind.SetFocus
End If
End Sub
Private Sub yp_source_Click(Area As Integer)
If yp_source.Text = "" Then
Exit Sub
End If
'供货单位根据拼音头进行选择
source_data.SQL = "select * from yp_worksource where cw_name='" + Trim(yp_source.Text) + "'"
source_data.Refresh
'根据供货单位名称找到代码
If Not (source_data.Resultset.BOF And source_data.Resultset.EOF) Then
mcw_id = source_data.Resultset!cw_id
Else
yp_source.Text = ""
End If
source_data.SQL = "select * from yp_worksource"
source_data.Refresh
End Sub
Private Sub quit_com_Click()
Unload Me
Form3.Enabled = True
Form3.Show
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?