📄 yk_b_out.frm
字号:
'浏览模块
Dim MEXPRESS As String
Dim money0 As Currency
Dim money1 As Currency
Dim sn As Recordset
'设置显示控件
MEXPRESS = "SELECT dddd AS 流水号,yp_NAME AS 药品名称,STANDARD AS 规格," _
+ "UNIT AS 单位,lend_AMOUNT AS 数量,package as 包装," _
+ "WHOLE AS 进价,retail AS 零售价,price as 批发价,jz_DATE AS 出库日期," _
+ "jz_time as 出库时间,abstract as 请领科室," _
+ "CODE AS 代码,jm as 简码,py as 拼音头,op_code as 操作员" _
+ " FROM yk1_mx WHERE j_flag='2' AND substring(CODE,1,1)='" _
+ mkind_code + "'"
'判断请领科室是否为空
If yp_source.Text Like "*'*" = False And yp_source.Text <> "" Then
Set sn = db.OpenRecordset("select * from ks_table where ks_name='" + Trim(yp_source.Text) + "'")
If Not (sn.EOF And sn.EOF) Then
MEXPRESS = MEXPRESS + " AND abstract_id='" + sn!ks_id + "'"
End If
End If
'判断月份是否为空
If Not IsDate(yp_date1.Text) Then
MsgBox "起始日期错误", , "日期错误"
yp_date1.Text = " - - "
yp_date1.SetFocus
Exit Sub
End If
If Not IsDate(yp_date2.Text) Then
MsgBox "终止日期错误", , "日期错误"
yp_date2.Text = " - - "
yp_date2.SetFocus
Exit Sub
End If
If CDate(yp_date1.Text) > CDate(yp_date2.Text) Then
MsgBox "起始日期不能大于终止日期", , "日期错误"
yp_date1.Text = CStr(DateAdd(M, -1, Date))
yp_date1.Text = CStr(DateAdd(D, 1, CDate(yp_date1.Text)))
yp_date2.Text = CStr(Date)
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
MEXPRESS = MEXPRESS + " AND jz_date>= convert(datetime,'" + yp_date1.Text + "')" _
+ " AND jz_date<= convert(datetime,'" + yp_date2.Text + "')"
'判断拼音头是否为空
If Not (lib_data.Resultset.BOF And lib_data.Resultset.EOF) Then
MEXPRESS = MEXPRESS + " AND code= '" + xcode + "'"
End If
' If Text2.Text <> "" Then
' mexpress = mexpress + "and code='" + xcode + "'"
' End If
'判断流水号是否为空
' If lsh.Text <> "" Then
' mexpress = mexpress + " AND convert(int,dddd)= '" + Trim(lsh.Text) + "'"
' End If
MEXPRESS = MEXPRESS + " order by jz_date,dddd"
'显示控件刷新
all_data.DataSourceName = dbfname
all_data.Connect = dbfstr
all_data.SQL = MEXPRESS
all_data.Refresh
'合计清零
money0 = 0
money1 = 0
'计算合计
Do While Not all_data.Resultset.EOF
money0 = money0 + all_data.Resultset!数量 * all_data.Resultset!进价
money1 = money1 + all_data.Resultset!数量 * all_data.Resultset!批发价
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 mtemp As String
Dim mtemp1 As String
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 mstandard As String
Dim mdddd As String
Dim mdate As String
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.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(132 - 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!请领科室, 8)
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(16 - 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(16) _
+ "│"
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.Enabled = True
'焦点定到拼音头
yp_pyt.SetFocus
End Sub
Private Sub yp_pyt_Change()
'拼音头异常判断
If yp_pyt.Text Like "*'*" Then
yp_pyt.Text = ""
yp_pyt.SetFocus
Exit Sub
End If
If yp_pyt.Text <> "" Then
'拼音头不为空,寻找相应的药品
lib_data.SQL = "select code as 代码,yp_name as 药品名称,standard as 规格,UNIT AS 单位" _
+ " from yp_library where py like '%" + Trim(yp_pyt.Text) _
+ "%' and substring(code,1,1)='" + mkind_code + "'"
lib_data.Refresh
Else
lib_data.SQL = "select code as 代码,yp_name as 药品名称,standard as 规格,UNIT AS 单位" _
+ " from yp_library where code=''"
lib_data.Refresh
End If
yp_pyt.SetFocus
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 quit_com_Click()
Unload Me
Form3.Enabled = True
Form3.Show
End Sub
Private Sub yp_pyt_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If Not (lib_data.Resultset.EOF And lib_data.Resultset.BOF) Then
lib_wind.SetFocus
End If
End If
End Sub
Private Sub yp_pyt_KeyPress(KeyAscii As Integer)
If KeyAscii = Asc("'") Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -