?? print_pifa.frm
字號:
VERSION 5.00
Begin VB.Form print_pifa
Caption = "打印批發單"
ClientHeight = 2460
ClientLeft = 60
ClientTop = 345
ClientWidth = 5685
LinkTopic = "Form1"
ScaleHeight = 2460
ScaleWidth = 5685
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Height = 2415
Left = 0
TabIndex = 0
Top = 0
Width = 5655
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 500
Left = 3960
Top = 1800
End
Begin VB.Label Label1
Caption = "Label1"
BeginProperty Font
Name = "幼圓"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 1
Top = 840
Width = 5415
End
End
End
Attribute VB_Name = "print_pifa"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Tr As New ADODB.Recordset
Sub PrintData()
On Error GoTo HandlePrint
If Tr.RecordCount > 0 Then Tr.MoveFirst
Printer.ScaleMode = 6
'Printer.FontName = "SYSTEM"
Printer.FontSize = 16
Printer.Print Tab(22); "批發表單"
Printer.Print Tab(19); "============================"
Printer.FontSize = 12
Printer.Print " ------------------------------------------------------------------------------------------------"
Printer.Print " 批發號:"; Tr.Fields("pifahao"); " 操作員:"; Tr.Fields("caozuoyuan"); " 往來單位:"; Tr.Fields("wanglaidanwei")
Printer.Print " ------------------------------------------------------------------------------------------------"
For I1 = 1 To Tr.RecordCount
Printer.Print " 藥品名稱:"; Tr.Fields("yaopinming"); " 規格:"; Tr.Fields("guige"); " 劑型:"; Tr.Fields("jixing"); " 類型:"; Tr.Fields("leixing")
Printer.Print " 生產日期:"; Tr.Fields("shengchanriqi"); " 有效期:"; Tr.Fields("youxiaoqi"); " 價格:"; Tr.Fields("jiage"); " 數量:"; Tr.Fields("shuliang"); " 金額:"; Tr.Fields("jine")
Printer.Print " 備注:"; Tr.Fields("beizhu")
Tr.MoveNext
Next
Printer.Print " --------------------------------------------------------------------------------------------------"
Printer.Print " "
Printer.EndDoc
Exit Sub
HandlePrint:
MsgBox "打印出錯,請檢查您的計算機是否已經正確的和打印機連接!", vbOKOnly + vbInformation, "提示"
End Sub
Private Sub Form_Load()
'set the window to the middle
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
On Error GoTo handle
Label1.Caption = "正在打印批發單,請稍候..."
With Tr
Set .ActiveConnection = SGWConnection
.CursorLocation = adUseServer
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "Select * from pifa where pifahao='" & PiFahao & "' order by id desc"
.Open
End With
Timer1.Enabled = True
Exit Sub
handle:
MsgBox "無法與數據庫服務器建立正確的連接,請檢查網絡或ODBC設置!", vbOKOnly + vbInformation, "提示"
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error GoTo exitme
Tr.Close
Set Tr = Nothing
Exit Sub
exitme:
End Sub
Private Sub Timer1_Timer()
PrintData
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -