⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmcustomersae.frm

📁 Inventory control system
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      BackStyle       =   0  'Transparent
      Caption         =   "Customer"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   345
      Left            =   330
      TabIndex        =   43
      Top             =   180
      Width           =   4905
   End
   Begin VB.Shape Shape1 
      Height          =   5715
      Left            =   150
      Top             =   630
      Width           =   10725
   End
   Begin VB.Label Label5 
      Alignment       =   1  'Right Justify
      Caption         =   "Credit Term"
      Height          =   240
      Left            =   240
      TabIndex        =   42
      Top             =   4350
      Width           =   1245
   End
   Begin VB.Label Label6 
      Alignment       =   1  'Right Justify
      Caption         =   "Credit Limit"
      Height          =   240
      Left            =   240
      TabIndex        =   41
      Top             =   4710
      Width           =   1245
   End
   Begin VB.Label Label7 
      Caption         =   "Remarks"
      Height          =   225
      Left            =   4260
      TabIndex        =   40
      Top             =   4170
      Width           =   1095
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Category"
      Height          =   240
      Index           =   11
      Left            =   240
      TabIndex        =   38
      Top             =   1125
      Width           =   1245
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Landline"
      Height          =   240
      Index           =   7
      Left            =   240
      TabIndex        =   37
      Top             =   3645
      Width           =   1245
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Mobile"
      Height          =   240
      Index           =   5
      Left            =   240
      TabIndex        =   36
      Top             =   3315
      Width           =   1245
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Owner's Name"
      Height          =   240
      Index           =   3
      Left            =   240
      TabIndex        =   35
      Top             =   1905
      Width           =   1245
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "TIN"
      Height          =   240
      Index           =   2
      Left            =   240
      TabIndex        =   34
      Top             =   1530
      Width           =   1245
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Store Name"
      Height          =   240
      Index           =   1
      Left            =   240
      TabIndex        =   33
      Top             =   795
      Width           =   1245
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Area Address"
      Height          =   240
      Index           =   12
      Left            =   240
      TabIndex        =   32
      Top             =   2280
      Width           =   1245
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Fax"
      Height          =   240
      Index           =   9
      Left            =   240
      TabIndex        =   31
      Top             =   3990
      Width           =   1245
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "City"
      Height          =   240
      Index           =   16
      Left            =   240
      TabIndex        =   30
      Top             =   2610
      Width           =   1245
   End
   Begin VB.Label Labels 
      Alignment       =   1  'Right Justify
      Caption         =   "Purchaser Name"
      Height          =   240
      Index           =   17
      Left            =   240
      TabIndex        =   29
      Top             =   2970
      Width           =   1245
   End
   Begin VB.Shape Shape2 
      FillColor       =   &H00C0C0C0&
      FillStyle       =   0  'Solid
      Height          =   435
      Left            =   150
      Top             =   150
      Width           =   10725
   End
   Begin VB.Shape Shape3 
      BorderWidth     =   2
      Height          =   6375
      Left            =   60
      Top             =   60
      Width           =   10935
   End
End
Attribute VB_Name = "frmCustomersAE"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public State                As FormState 'Variable used to determine on how the form used
Public PK                   As Long 'Variable used to get what record is going to edit
Public srcText              As TextBox 'Used in pop-up mode
Public srcTextAdd           As TextBox 'Used in pop-up mode -> Display the customer address
Public srcTextCP            As TextBox 'Used in pop-up mode -> Display the customer contact person
Public srcTextDisc          As Object  'Used in pop-up mode -> Display the customer Discount (can be combo or textbox)

Dim cIRowCount              As Integer
Dim blnRemarks              As Boolean
Dim HaveAction              As Boolean 'Variable used to detect if the user perform some action
Dim rs                      As New Recordset
Dim rsClientBank As New Recordset

Private Sub btnAdd_Click()
    If nsdBank.Text = "" Or txtAcctNo.Text = "" Or txtAcctName.Text = "" Then nsdBank.SetFocus: Exit Sub

    Dim CurrRow As Integer
    Dim intBankID As Integer
    
    If nsdBank.BoundText = "" Then
        CurrRow = getFlexPos(Grid, 5, nsdBank.Tag)
        intBankID = nsdBank.Tag
    Else
        CurrRow = getFlexPos(Grid, 5, nsdBank.BoundText)
        intBankID = nsdBank.BoundText
    End If

    'Add to grid
    With Grid
        If CurrRow < 0 Then
            'Perform if the record is not exist
            If .Rows = 2 And .TextMatrix(1, 5) = "" Then
                .TextMatrix(1, 1) = nsdBank.Text
                .TextMatrix(1, 2) = txtBranch.Text
                .TextMatrix(1, 3) = txtAcctNo.Text
                .TextMatrix(1, 4) = txtAcctName.Text
                .TextMatrix(1, 5) = intBankID
            Else
                .Rows = .Rows + 1
                .TextMatrix(.Rows - 1, 1) = nsdBank.Text
                .TextMatrix(.Rows - 1, 2) = txtBranch.Text
                .TextMatrix(.Rows - 1, 3) = txtAcctNo.Text
                .TextMatrix(.Rows - 1, 4) = txtAcctName.Text
                .TextMatrix(.Rows - 1, 5) = intBankID

                .Row = .Rows - 1
            End If
            'Increase the record count
            cIRowCount = cIRowCount + 1
        Else
            If MsgBox("Item already added. Do you want to replace it?", vbQuestion + vbYesNo) = vbYes Then
                .Row = CurrRow
                
                .TextMatrix(CurrRow, 1) = nsdBank.Text
                .TextMatrix(CurrRow, 2) = txtBranch.Text
                .TextMatrix(CurrRow, 3) = txtAcctNo.Text
                .TextMatrix(CurrRow, 4) = txtAcctName.Text
                .TextMatrix(CurrRow, 5) = intBankID
            Else
                Exit Sub
            End If
        End If
        
        'Highlight the current row's column
        .ColSel = 5
        'Display a remove button
        Grid_Click
    End With
End Sub

Private Sub DisplayForEditing()
    On Error GoTo err
    Dim rsClients As New Recordset
    
    rsClients.CursorLocation = adUseClient
    rsClients.Open "SELECT * FROM qry_Clients WHERE ClientID = " & PK, CN, adOpenStatic, adLockOptimistic
    
    With rsClients
        txtEntry(1).Text = .Fields("Company")
        dcCategory.BoundText = .Fields![CategoryID]
        txtEntry(2).Text = .Fields("Tin")
        txtEntry(3).Text = .Fields("OwnersName")
        txtEntry(4).Text = .Fields("Address")
        dcCity.BoundText = .Fields![CityID]
        txtEntry(6).Text = .Fields("PurchaserName")
        txtEntry(7).Text = .Fields("Mobile")
        txtEntry(8).Text = .Fields("Landline")
        txtEntry(9).Text = .Fields("Fax")
        txtEntry(14).Text = .Fields("CreditTerm")
        txtEntry(15).Text = .Fields("CreditLimit")
        chkBlackListed.Value = IIf(.Fields("BlackListed") = True, 1, 0)
        txtEntry(16).Text = .Fields("Remarks")
    End With
    
    'Display the details
    Dim rsClientBank As New Recordset

    cIRowCount = 0
    
    rsClientBank.CursorLocation = adUseClient
    rsClientBank.Open "SELECT * FROM qry_Clients_Bank WHERE ClientID=" & PK, CN, adOpenStatic, adLockOptimistic
    
    If rsClientBank.RecordCount > 0 Then
        rsClientBank.MoveFirst
        While Not rsClientBank.EOF
          cIRowCount = cIRowCount + 1     'increment
            With Grid
                If .Rows = 2 And .TextMatrix(1, 5) = "" Then
                    .TextMatrix(1, 1) = rsClientBank![Bank]
                    .TextMatrix(1, 2) = rsClientBank![Branch]
                    .TextMatrix(1, 3) = rsClientBank![AccountNo]
                    .TextMatrix(1, 4) = rsClientBank![AccountName]
                    .TextMatrix(1, 5) = rsClientBank![BankID]
                Else
                    .Rows = .Rows + 1
                    .TextMatrix(.Rows - 1, 1) = rsClientBank![Bank]
                    .TextMatrix(.Rows - 1, 2) = rsClientBank![Branch]
                    .TextMatrix(.Rows - 1, 3) = rsClientBank![AccountNo]
                    .TextMatrix(.Rows - 1, 4) = rsClientBank![AccountName]
                    .TextMatrix(.Rows - 1, 5) = rsClientBank![BankID]
                End If
            End With
            rsClientBank.MoveNext
        Wend
        Grid.Row = 1
        Grid.ColSel = 5
        'Set fixed cols
        If State = adStateEditMode Then
            Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree
            Grid.FixedCols = 1
        End If
    End If

    rsClientBank.Close
    'Clear variables
    Set rsClientBank = Nothing
        
    'txtEntry(1).SetFocus
    Exit Sub
err:
    If err.Number = 94 Then Resume Next
    
    prompt_err err, Name, "DisplayForEditing"
    Screen.MousePointer = vbDefault
End Sub

Private Sub btnRemove_Click()
    'Remove selected load product
    With Grid
        'Update the record count
        cIRowCount = cIRowCount - 1
        
        If .Rows = 2 Then Grid.Rows = Grid.Rows + 1
        .RemoveItem (.RowSel)
    End With

    btnRemove.Visible = False
    Grid_Click
End Sub

Private Sub cmdCancel_Click()
    Unload Me

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -