📄 frmpayment.frm
字号:
Public Sub Component(vPayment As COMEXDataSourceSingle)
Set m_Payment = vPayment
Set m_Store = m_Payment.CopyMe
LoadRecords
End Sub
Private Sub EnableToolbar(ByVal Dirty As Boolean)
On Error Resume Next
If Not Dirty Then
If m_EnableAttr And tbSave Then m_EnableAttr = m_EnableAttr Xor tbSave
If m_EnableAttr And tbCancel Then m_EnableAttr = m_EnableAttr Xor tbCancel
If Not (m_EnableAttr And tbRefresh) Then m_EnableAttr = m_EnableAttr Or tbRefresh
Else
If Not (m_EnableAttr And tbSave) Then m_EnableAttr = m_EnableAttr Or tbSave
If Not (m_EnableAttr And tbCancel) Then m_EnableAttr = m_EnableAttr Or tbCancel
If m_EnableAttr And tbRefresh Then m_EnableAttr = m_EnableAttr Xor tbRefresh
End If
m_Toolbar.RefreshEnabledState
End Sub
Private Sub LoadRecords()
On Error GoTo Err_LoadRecords
Dim ctl As Control, i As Long
m_flgLoading = True
With m_Payment
For i = 1 To .GetFieldCount
On Error Resume Next
Set ctl = Controls(.GetFieldName(i))
If Err = 0 Then
Select Case TypeName(ctl)
Case "Label"
Case "TextBox", "ComboBox", "MaskEdBox"
ctl = .GetData(i)
Case "CheckBox"
ctl.Value = Abs(.GetData(i))
Case "DTPicker"
ctl.Value = .GetData(i)
End Select
End If
Next
End With
m_EnableAttr = iForm_Attributes
EnableToolbar False
m_flgLoading = False
Done_LoadRecords:
Exit Sub
Err_LoadRecords:
ErrorMsg Err.Number, Err.Description, "LoadRecords", mcstrMod
Resume Done_LoadRecords
End Sub
Private Sub CardholdersName_Change()
On Error GoTo Err_CardholdersName_Change
If m_flgLoading Then Exit Sub
m_Payment.SetDatabyname CardholdersName.Name, CardholdersName
EnableToolbar True
Exit Sub
Err_CardholdersName_Change:
With CardholdersName
.SelStart = 0
.SelLength = Len(.Text)
.SelText = m_Payment.GetDataByName(CardholdersName.Name)
End With
End Sub
Private Sub CardholdersName_LostFocus()
On Error Resume Next
CardholdersName = m_Payment.GetDataByName(CardholdersName.Name)
End Sub
Private Sub CreditCardNumber_Change()
On Error GoTo Err_CreditCardNumber_Change
If m_flgLoading Then Exit Sub
m_Payment.SetDatabyname CreditCardNumber.Name, CreditCardNumber
EnableToolbar True
Exit Sub
Err_CreditCardNumber_Change:
With CreditCardNumber
.SelStart = 0
.SelLength = Len(.Text)
.SelText = m_Payment.GetDataByName(CreditCardNumber.Name)
End With
End Sub
Private Sub CreditCardNumber_LostFocus()
On Error Resume Next
CreditCardNumber = m_Payment.GetDataByName(CreditCardNumber.Name)
End Sub
Private Sub PaymentAmount_Change()
On Error GoTo Err_PaymentAmount_Change
If m_flgLoading Then Exit Sub
m_Payment.SetDatabyname PaymentAmount.Name, PaymentAmount
EnableToolbar True
Exit Sub
Err_PaymentAmount_Change:
With PaymentAmount
.SelStart = 0
.SelLength = Len(.Text)
.SelText = m_Payment.GetDataByName(PaymentAmount.Name)
End With
End Sub
Private Sub PaymentAmount_LostFocus()
On Error Resume Next
PaymentAmount = m_Payment.GetDataByName(PaymentAmount.Name)
End Sub
Private Sub PaymentID_Change()
On Error GoTo Err_PaymentID_Change
If m_flgLoading Then Exit Sub
m_Payment.SetDatabyname PaymentID.Name, PaymentID
EnableToolbar True
Exit Sub
Err_PaymentID_Change:
With PaymentID
.SelStart = 0
.SelLength = Len(.Text)
.SelText = m_Payment.GetDataByName(PaymentID.Name)
End With
End Sub
Private Sub PaymentID_LostFocus()
On Error Resume Next
PaymentID = m_Payment.GetDataByName(PaymentID.Name)
End Sub
Private Sub PaymentMethodID_Click()
On Error GoTo Err_PaymentMethodID_Click
m_Payment.SetDatabyname PaymentMethodID.Name, PaymentMethodID
EnableToolbar True
Exit Sub
Err_PaymentMethodID_Click:
PaymentMethodID = m_Payment.GetDataByName(PaymentMethodID.Name)
End Sub
Private Sub PaymentMethodID_LostFocus()
On Error Resume Next
PaymentMethodID = m_Payment.GetDataByName(PaymentMethodID.Name)
End Sub
Private Sub ProjectID_Click()
On Error GoTo Err_ProjectID_Click
m_Payment.SetDatabyname ProjectID.Name, ProjectID
EnableToolbar True
Exit Sub
Err_ProjectID_Click:
ProjectID = m_Payment.GetDataByName(ProjectID.Name)
End Sub
Private Sub ProjectID_LostFocus()
On Error Resume Next
ProjectID = m_Payment.GetDataByName(ProjectID.Name)
End Sub
Private Sub CreditCardExpDate_Change()
On Error GoTo Err_CreditCardExpDate_Change
If m_flgLoading Then Exit Sub
m_Payment.SetDatabyname CreditCardExpDate.Name, CreditCardExpDate.Value
EnableToolbar True
Exit Sub
Err_CreditCardExpDate_Change:
With CreditCardExpDate
.Value = m_Payment.GetDataByName(CreditCardExpDate.Name)
End With
End Sub
Private Sub CreditCardExpDate_LostFocus()
On Error Resume Next
CreditCardExpDate = m_Payment.GetDataByName(CreditCardExpDate.Name)
End Sub
Private Sub PaymentDate_Change()
On Error GoTo Err_PaymentDate_Change
If m_flgLoading Then Exit Sub
m_Payment.SetDatabyname PaymentDate.Name, PaymentDate.Value
EnableToolbar True
Exit Sub
Err_PaymentDate_Change:
With PaymentDate
.Value = m_Payment.GetDataByName(PaymentDate.Name)
End With
End Sub
Private Sub PaymentDate_LostFocus()
On Error Resume Next
PaymentDate = m_Payment.GetDataByName(PaymentDate.Name)
End Sub
Private Sub Form_Activate()
m_Toolbar.Activate m_Guid
End Sub
Private Sub Form_Load()
Dim vPayment As New Payment, strCombo As String
m_Guid = GUID
m_Toolbar.Attach Me, m_Guid
CaptionBar1.Caption = Caption
Set CaptionBar1.Picture = Me.Icon
strCombo = vPayment.GetPaymentMethodsList
FillCombo PaymentMethodID, strCombo
PaymentMethodID.Tag = strCombo
strCombo = vPayment.GetProjectsList
FillCombo ProjectID, strCombo
ProjectID.Tag = strCombo
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If m_EnableAttr And tbSave Then
Select Case MsgBox("Record has been changed. Do you want To save it?" _
, vbYesNoCancel + vbQuestion)
Case vbYes
m_Payment.Save
Case vbNo
Case vbCancel
Cancel = True
End Select
End If
End Sub
Private Sub Form_Resize()
On Error Resume Next
If Me.WindowState <> vbMinimized Then
With CaptionBar1
.Move 0, .Top, Me.ScaleWidth, .height
End With
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
m_Toolbar.Detach m_Guid
End Sub
Private Sub iForm_MainMenu()
'n/a
End Sub
Private Property Get iForm_Attributes() As ToolBarItems
iForm_Attributes = tbCancel + tbCloseMe + tbRefresh + tbSave
End Property
Private Sub iForm_Cancel()
Set m_Payment = m_Store.CopyMe
LoadRecords
End Sub
Private Sub iForm_CloseMe()
Unload Me
End Sub
Private Sub iForm_delete()
'n/a
End Sub
Private Property Get iForm_EnableAttributes() As ToolBarItems
iForm_EnableAttributes = m_EnableAttr
End Property
Private Sub iForm_Find(ByVal Key As String)
'n/a
End Sub
Private Sub iForm_Refresh()
Dim aPayment As Payment
Set aPayment = m_Payment
aPayment.Load aPayment.PaymentID
Set m_Payment = aPayment
LoadRecords
End Sub
Private Function iForm_Save() As Boolean
If m_Payment.Save Then
Set m_Store = m_Payment.CopyMe
iForm_Refresh
End If
End Function
Private Sub iForm_AddNew()
'n/a
End Sub
Private Sub iForm_ShowFormView()
'n/a
End Sub
Private Property Get iForm_FindSubTools() As cFindSubTools
'n/a
End Property
Private Sub iForm_HelpAbout()
'n/a
End Sub
Private Function iForm_OpenDB() As Boolean
'n/a
End Function
Private Sub iForm_DeleteRow()
'n/a
End Sub
Private Sub iForm_PrintOut()
'n/a
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -