?? frmbookdengji.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmBookDengJi
BorderStyle = 3 'Fixed Dialog
Caption = "新書入庫"
ClientHeight = 4710
ClientLeft = 45
ClientTop = 330
ClientWidth = 7425
Icon = "FrmBookDengJi.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4710
ScaleWidth = 7425
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 6000
Top = 3840
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox TxtMemo
Height = 1455
Left = 960
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 4
Top = 3000
Width = 4695
End
Begin VB.TextBox TxtJinE
Height = 375
Left = 960
TabIndex = 3
Top = 2520
Width = 4695
End
Begin VB.TextBox TxtZheKou
Height = 375
Left = 960
TabIndex = 2
Top = 2040
Width = 4695
End
Begin VB.TextBox TxtDanJia
Height = 375
Left = 960
TabIndex = 1
Top = 1560
Width = 4695
End
Begin VB.TextBox TxtShuLiang
Height = 375
Left = 960
TabIndex = 0
Top = 1080
Width = 4695
End
Begin VB.TextBox TxtBook
Height = 375
Left = 960
Locked = -1 'True
TabIndex = 10
Top = 600
Width = 4695
End
Begin VB.TextBox TxtGYS
Height = 375
Left = 960
Locked = -1 'True
TabIndex = 8
Top = 120
Width = 4695
End
Begin VB.CommandButton CmdCancel
Caption = "取消(&C)"
Height = 375
Left = 6000
TabIndex = 6
Top = 960
Width = 1095
End
Begin VB.CommandButton CmdOK
Caption = "入帳(&D)"
Height = 375
Left = 6000
TabIndex = 5
Top = 240
Width = 1095
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "備注:"
Height = 180
Left = 300
TabIndex = 15
Top = 3120
Width = 540
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "金額:"
Height = 180
Left = 300
TabIndex = 14
Top = 2640
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "折扣:"
Height = 180
Left = 300
TabIndex = 13
Top = 2160
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "單價:"
Height = 180
Left = 300
TabIndex = 12
Top = 1680
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "數量:"
Height = 180
Left = 300
TabIndex = 11
Top = 1200
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "品種:"
Height = 180
Left = 300
TabIndex = 9
Top = 720
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "供應商:"
Height = 180
Left = 120
TabIndex = 7
Top = 240
Width = 720
End
End
Attribute VB_Name = "FrmBookDengJi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdCancel_Click()
Unload Me
End Sub
Private Sub CmdOK_Click()
On Error GoTo errEnd
Dim QD As Integer
If TxtShuLiang.Text = "" Then
MsgBox "請填寫進書的數量.", vbOKOnly + vbExclamation, "新書入庫"
TxtShuLiang.SetFocus
Exit Sub
End If
If TxtDanJia.Text = "" Then
MsgBox "請填寫進書的單價.", vbOKOnly + vbExclamation, "新書入庫"
TxtDanJia.SetFocus
Exit Sub
End If
If TxtZheKou.Text = "" Then
MsgBox "請填寫進書的折扣,沒有折扣請填 1 .", vbOKOnly + vbExclamation, "新書入庫"
TxtZheKou.SetFocus
Exit Sub
End If
If CInt(TxtZheKou.Text) > 1 Or CInt(TxtZheKou.Text) <= 0 Then
MsgBox "進書折扣填寫錯誤,請在 0 與 1 之間選擇.", vbOKOnly + vbExclamation, "新書入庫"
TxtZheKou.SetFocus
Exit Sub
End If
If TxtJinE.Text = "" Then
MsgBox "請填寫進書實際支付的金額.", vbOKOnly + vbExclamation, "新書入庫"
TxtJinE.SetFocus
Exit Sub
End If
If TxtMemo.Text = "" Then TxtMemo.Text = "無"
QD = MsgBox("確定入帳嗎?", vbOKCancel + vbQuestion, "確認入帳")
If QD = vbCancel Then
'Unload Me
Exit Sub
End If
Screen.MousePointer = 11
BeginTrans
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "進書記錄"
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset!供應商編號 = GongYingShangID
Adodc1.Recordset!圖書編號 = TuShuBianHao
Adodc1.Recordset!數量 = CInt(TxtShuLiang.Text)
Adodc1.Recordset!單價 = TxtDanJia.Text
Adodc1.Recordset!折扣 = TxtZheKou.Text
Adodc1.Recordset!金額 = TxtJinE.Text
Adodc1.Recordset!進書日期 = Now()
Adodc1.Recordset!備注 = TxtMemo.Text
Adodc1.Recordset.Update
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from [Book] where [圖書編號]=""" & TuShuBianHao & """"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
Rollback
Screen.MousePointer = vbDefault
MsgBox "圖書資料丟失,請與程序員聯系!", vbOKOnly + vbExclamation, "新書入庫"
Exit Sub
End If
Adodc1.Recordset.MoveFirst
Adodc1.Recordset!庫存量 = Adodc1.Recordset!庫存量 + CInt(TxtShuLiang.Text)
Adodc1.Recordset.Update
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from [圖書進價表] where [圖書編號]=""" & TuShuBianHao & """"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset!進價 = TxtDanJia.Text
Adodc1.Recordset!進書日期 = Now()
Adodc1.Recordset.Update
Else
Adodc1.Recordset.AddNew
Adodc1.Recordset!圖書編號 = TuShuBianHao
Adodc1.Recordset!進價 = TxtDanJia.Text
Adodc1.Recordset!進書日期 = Now()
Adodc1.Recordset.Update
End If
CommitTrans
Screen.MousePointer = vbDefault
MsgBox "本次入帳操作成功!", vbOKOnly + vbInformation, "操作成功"
Unload Me
Exit Sub
errEnd:
Rollback
Screen.MousePointer = vbDefault
MsgBox "更新數據庫失敗!無法完成入庫操作!", vbOKOnly + vbExclamation, "更新失敗"
End Sub
Private Sub Form_Activate()
TxtGYS.Text = GongYingShang
TxtBook.Text = ShuMing
End Sub
Private Sub Form_Load()
Dim dbName As String
Dim connSTR As String
On Error GoTo errEnd
ChDir App.Path
dbName = App.Path
If Right(dbName, 1) <> "\" Then dbName = dbName + "\"
dbName = dbName + "DataBase\WFSSDataBase.mdb"
connSTR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbName & ";Persist Security Info=False"
Adodc1.ConnectionString = connSTR
Exit Sub
errEnd:
MsgBox "連接數據庫失敗!", vbOKOnly + vbExclamation, "打開數據庫出錯"
End
End Sub
Private Sub TxtDanJia_KeyUp(KeyCode As Integer, Shift As Integer)
If Not (KeyCode >= 48 And KeyCode <= 57) Then
If Not (KeyCode >= 96 And KeyCode <= 105) Then
If KeyCode <> 13 And KeyCode <> 190 And KeyCode <> 110 And KeyCode <> 8 And KeyCode <> 46 Then
MsgBox "圖書單價填寫錯誤!", vbOKOnly + vbExclamation, "填寫錯誤"
TxtDanJia.Text = ""
TxtDanJia.SetFocus
End If
End If
End If
End Sub
Private Sub TxtJinE_GotFocus()
If TxtZheKou.Text <> "" Then
If TxtZheKou.Text <= 0 Or TxtZheKou.Text > 1 Then
MsgBox "圖書折扣填寫錯誤,請在 0 與 1 之間選擇!", vbOKOnly + vbExclamation, "填寫錯誤"
TxtZheKou.SetFocus
Exit Sub
End If
End If
If TxtShuLiang.Text <> "" And TxtDanJia.Text <> "" And TxtZheKou.Text <> "" Then
TxtJinE.Text = TxtShuLiang.Text * TxtDanJia.Text * TxtZheKou.Text
End If
End Sub
Private Sub TxtJinE_KeyUp(KeyCode As Integer, Shift As Integer)
If Not (KeyCode >= 48 And KeyCode <= 57) Then
If Not (KeyCode >= 96 And KeyCode <= 105) Then
If KeyCode <> 13 And KeyCode <> 190 And KeyCode <> 110 And KeyCode <> 8 And KeyCode <> 46 Then
MsgBox "進貨金額填寫錯誤!", vbOKOnly + vbExclamation, "填寫錯誤"
TxtJinE.Text = ""
TxtJinE.SetFocus
End If
End If
End If
End Sub
Private Sub TxtShuLiang_KeyUp(KeyCode As Integer, Shift As Integer)
If Not (KeyCode >= 48 And KeyCode <= 57) Then
If Not (KeyCode >= 96 And KeyCode <= 105) Then
If KeyCode <> 13 And KeyCode <> 8 And KeyCode <> 46 Then
MsgBox "圖書數量填寫錯誤!", vbOKOnly + vbExclamation, "填寫錯誤"
TxtShuLiang.Text = ""
TxtShuLiang.SetFocus
End If
End If
End If
End Sub
Private Sub TxtZheKou_KeyUp(KeyCode As Integer, Shift As Integer)
If Not (KeyCode >= 48 And KeyCode <= 57) Then
If Not (KeyCode >= 96 And KeyCode <= 105) Then
If KeyCode <> 13 And KeyCode <> 190 And KeyCode <> 110 And KeyCode <> 8 And KeyCode <> 46 Then
MsgBox "圖書折扣填寫錯誤!", vbOKOnly + vbExclamation, "填寫錯誤"
TxtZheKou.Text = ""
TxtZheKou.SetFocus
End If
End If
End If
End Sub
'此源碼由程序太平洋收集整理發布,任何人都可自由轉載,但需保留本站信息
'╭⌒╮┅~ ¤ 歡迎光臨程序太平洋╭⌒╮
'╭⌒╭⌒╮╭⌒╮~╭⌒╮ ︶ ,︶︶
',︶︶︶︶,''︶~~ ,''~︶︶ ,''
'╔ ╱◥███◣═╬╬╬╬╬╬╬╬╬╗
'╬ ︱田︱田 田 ︱ ╬
'╬ http://www.5ivb.net ╬
'╬ ╭○╮● ╬
'╬ /■\/■\ ╬
'╬ <| || 有希望,就有成功! ╬
'╬ ╬
'╚╬╬╬╬╬╬╬╬╬╬╗ ╔╬╬╬╬╝
'
'說明:
'專業提供VB、.NET、Delphi、ASP、PB源碼下載
'包括:程序源碼,控件,商業源碼,系統方案,開發工具,書籍教程,技術文檔
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -