hotel
TRANSCRIPT
Form1 - 1 VERSION 5.00Begin VB.Form Form1 Caption = "Form1" ClientHeight = 8385 ClientLeft = 60 ClientTop = 345 ClientWidth = 8055 LinkTopic = "Form1" ScaleHeight = 8385 ScaleWidth = 8055 StartUpPosition = 3 'Windows Default Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 581 TabIndex = 4 Top = 0 Width = 8715 Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 6 Top = 360 Width = 3900 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Payments" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 5 Top = 30 Width = 1395 End Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB&
Form1 - 2 Height = 7005 Left = -30 ScaleHeight = 467 ScaleMode = 3 'Pixel ScaleWidth = 463 TabIndex = 0 Top = 570 Width = 6945 Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 1 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 240 ScaleHeight = 30 ScaleWidth = 5985 TabIndex = 2 Top = 6060 Width = 5985 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165 Left = 9450 TabIndex = 3 Top = 3030 Width = 45 End EndEnd
PaymentsFill all fields or fields with '*' then click 'Save' button to update.
frmAbout - 1 Option Explicit
' Reg Key SecuritConst READ_CONTROConst KEY_QUERY_VConst KEY_SET_VALConst KEY_CREATE_Const KEY_ENUMERAConst KEY_NOTIFY Const KEY_CREATE_Const KEY_ALL_ACC
frmAbout - 2
Public Function GetKeyValue(KeyRoot As Long, KeyName As String, SubKeyRef As String, ByRef KeyVal As String) As Boolean Dim i As Long ' Loop Counter Dim rc As Long ' Return Code Dim hKey As Long ' Handle To An Open Registry Key Dim hDepth As Long ' Dim KeyValType As Long ' Data Type Of A Registry Key Dim tmpVal As String ' Tempory Storage For A Registry Key Value Dim KeyValSize As Long ' Size Of Registry Key Variable '------------------------------------------------------------ ' Open RegKey Under KeyRoot {HKEY_LOCAL_MACHINE...} '------------------------------------------------------------ rc = RegOpenKeyEx(KeyRoot, KeyName, 0, KEY_ALL_ACCESS, hKey) ' Open Registry Key If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Error... tmpVal = String$(1024, 0) ' Allocate Variable Space KeyValSize = 1024 ' Mark Variable Size '------------------------------------------------------------ ' Retrieve Registry Key Value... '------------------------------------------------------------ rc = RegQueryValueEx(hKey, SubKeyRef, 0, _ KeyValType, tmpVal, KeyValSize) ' Get/Create Key Value If (rc <> ERROR_SUCCESS) Then GoTo GetKeyError ' Handle Errors If (Asc(Mid(tmpVal, KeyValSize, 1)) = 0) Then ' Win95 Adds Null Terminated String... tmpVal = Left(tmpVal, KeyValSize - 1) ' Null Found, Extract From String Else ' WinNT Does NOT Null Terminate String... tmpVal = Left(tmpVal, KeyValSize) ' Null Not Found, Extract String Only End If '------------------------------------------------------------ ' Determine Key Value Type For Conversion... '------------------------------------------------------------ Select Case KeyValType ' Search Data Types... Case REG_SZ ' String Registry Key Data Type KeyVal = tmpVal ' Copy String Value Case REG_DWORD ' Double Word Registry Key Data Type For i = Len(tmpVal) To 1 Step -1 ' Convert Each Bit KeyVal = KeyVal + Hex(Asc(Mid(tmpVal, i, 1))) ' Build Value Char. By Char. Next KeyVal = Format$("&h" + KeyVal) ' Convert Double Word To String End Select GetKeyValue = True ' Return Success rc = RegCloseKey(hKey) ' Close Registry Key Exit Function ' Exit GetKeyError: ' Cleanup After An Error Has Occured... KeyVal = "" ' Set Return Val To Empty String GetKeyValue = False ' Return Failure rc = RegCloseKey(hKey) ' Close Registry KeyEnd Function
frmAbout - 1 VERSION 5.00Begin VB.Form frmAbout BorderStyle = 3 'Fixed Dialog Caption = "About 3JNet" ClientHeight = 3555 ClientLeft = 2340 ClientTop = 1935 ClientWidth = 5730 ClipControls = 0 'False LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2453.724 ScaleMode = 0 'User ScaleWidth = 5380.766 ShowInTaskbar = 0 'False StartUpPosition = 2 'CenterScreen Begin VB.TextBox Text1 Appearance = 0 'Flat Height = 1095 Left = 1050 MultiLine = -1 'True TabIndex = 6 Top = 1200 Width = 4095 End Begin VB.PictureBox picIcon AutoSize = -1 'True ClipControls = 0 'False Height = 540 Left = 240 Picture = (Icon) ScaleHeight = 337.12 ScaleMode = 0 'User ScaleWidth = 337.12 TabIndex = 1 Top = 240 Width = 540 End Begin VB.CommandButton cmdOK Cancel = -1 'True Caption = "OK" Default = -1 'True Height = 345 Left = 4245 TabIndex = 0 Top = 2625 Width = 1260 End Begin VB.CommandButton cmdSysInfo Caption = "&System Info..." Height = 345 Left = 4260 TabIndex = 2 Top = 3075 Width = 1245 End Begin VB.Line Line1 BorderColor = &H00808080& BorderStyle = 6 'Inside Solid Index = 1 X1 = 84.515 X2 = 5309.398 Y1 = 1687.583 Y2 = 1687.583 End Begin VB.Label lblTitle Caption = "Application Title" ForeColor = &H00000000& Height = 480 Left = 1050 TabIndex = 4 Top = 240 Width = 3885 End Begin VB.Line Line1 BorderColor = &H00FFFFFF&
frmAbout - 2 BorderWidth = 2 Index = 0 X1 = 98.6 X2 = 5309.398 Y1 = 1697.936 Y2 = 1697.936 End Begin VB.Label lblVersion Caption = "Version" Height = 225 Left = 1050 TabIndex = 5 Top = 780 Width = 3885 End Begin VB.Label lblDisclaimer Caption = "Warning: Unauthorized reproduction or distribution of this program, or an ForeColor = &H00000000& Height = 825 Left = 255 TabIndex = 3 Top = 2625 Width = 3870 EndEnd
Warning: Unauthorized reproduction or distribution of
this program, or any portion of it is strictly prohibited.
Version
Application Title
frmAccountReceiva Public PK Public Company Public Balance Public AmountPaid
Dim cIRowCount Dim Amount
Private Sub btnRe 'Remove selec With Grid
frmAccountReceivable - 2
Public Sub cmdSave_Click() Dim rsPayments As New Recordset
rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM [Accounts Receivable] WHERE AccRecID=" & PK, CN, adOpenStatic, adLockOptimistic With rsPayments .Fields("Debit") = txtAmountPaid.Text .Update End With DeleteItems Dim rsPaymentRec As New Recordset rsPaymentRec.CursorLocation = adUseClient rsPaymentRec.Open "SELECT * FROM [Payments Received] WHERE AccRecID=" & PK, CN, adOpenStatic, adLockOptimistic
Dim c As Integer With Grid 'Save the details of the records For c = 1 To cIRowCount .Row = c If .TextMatrix(c, 1) = "" Then rsPaymentRec.AddNew rsPaymentRec![AccRecID] = PK Else rsPaymentRec.Filter = "RecievedPaymentID = " & toNumber(.TextMatrix(c, 1)) ' If rsPaymentRec.RecordCount = 0 Then' rsPaymentRec.AddNew'' rsPaymentRec![AccRecID] = PK' End If End If
rsPaymentRec![Date] = .TextMatrix(c, 2) rsPaymentRec![PaymentTypeID] = .TextMatrix(c, 3) rsPaymentRec![Amount] = .TextMatrix(c, 5)
rsPaymentRec.Update Next c End With
'Clear variables c = 0 Set rsPayments = Nothing Set rsPaymentRec = Nothing Unload frmAccountReceivableEnd Sub
Private Sub cmdUpdate_Click() If Trim(txtAmount.Text) = "0.00" Then Exit Sub txtBalance.Text = toMoney(txtBalance.Text) + Amount txtAmountPaid.Text = toMoney(txtAmountPaid.Text) - Amount
txtBalance.Text = toMoney(toNumber(txtBalance.Text) - toNumber(txtAmount.Text)) txtAmountPaid.Text = toMoney(toNumber(txtAmountPaid.Text) + toNumber(txtAmount.Text)) With Grid .TextMatrix(.RowSel, 2) = dtpDate.Value .TextMatrix(.RowSel, 3) = dcPaymentType.BoundText .TextMatrix(.RowSel, 4) = dcPaymentType.Text .TextMatrix(.RowSel, 5) = toMoney(txtAmount.Text) End With
Call Grid_Click Call ResetFields
frmAccountReceivable - 3 End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() Call InitGrid bind_dc "SELECT * FROM [Payment Type]", "PaymentType", dcPaymentType, "paymentTypeID", True
txtCompany.Text = Company txtBalance.Text = toMoney(Balance) txtAmountPaid.Text = toMoney(AmountPaid) dtpDate.Value = Date DisplayForEditing If Balance = "0.00" Then Grid.Height = 3000 Grid.Top = 2160 dtpDate.Visible = False dcPaymentType.Visible = False txtAmount.Visible = False cmdAdd.Visible = False cmdUpdate.Visible = False lblPaid.Visible = True End IfEnd Sub
'Procedure used to initialize the gridPrivate Sub InitGrid() cIRowCount = 0 With Grid .Clear .ClearStructure .Rows = 2 .FixedRows = 1 .FixedCols = 1 .Cols = 6 .ColSel = 5 'Initialize the column size .ColWidth(0) = 315 .ColWidth(1) = 0 .ColWidth(2) = 1200 .ColWidth(3) = 0 .ColWidth(4) = 1200 .ColWidth(5) = 1200
'Initialize the column name .TextMatrix(0, 0) = "" .TextMatrix(0, 1) = "RecievedPaymentID" .TextMatrix(0, 2) = "Date" .TextMatrix(0, 3) = "Payment Type ID" .TextMatrix(0, 4) = "Payment Type" .TextMatrix(0, 5) = "Amount" End WithEnd Sub
Private Sub Form_Unload(Cancel As Integer) frmAccountReceivableList.RefreshRecords Set frmAccountReceivable = NothingEnd Sub
Private Sub Grid_Click() With Grid dtpDate.Value = .TextMatrix(.RowSel, 2) dcPaymentType.BoundText = .TextMatrix(.RowSel, 3) txtAmount.Text = toMoney(.TextMatrix(.RowSel, 5)) Amount = .TextMatrix(.RowSel, 5)
frmAccountReceivable - 4 If Grid.Rows = 2 And Grid.TextMatrix(1, 2) = "" Then btnRemove.Visible = False Else btnRemove.Visible = True btnRemove.Top = (Grid.CellTop + Grid.Top) - 20 btnRemove.Left = Grid.Left + 50 End If End WithEnd Sub
Private Sub ResetFields() txtAmount.Text = "" txtAmount.SetFocusEnd Sub
Private Sub DisplayForEditing() On Error GoTo err 'Display the details Dim rsPayments As New Recordset
cIRowCount = 0 rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM [qry_Payment_Received] WHERE AccRecID=" & PK, CN, adOpenStatic, adLockOptimistic If rsPayments.RecordCount > 0 Then rsPayments.MoveFirst While Not rsPayments.EOF cIRowCount = cIRowCount + 1 'increment With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsPayments!RecievedPaymentID .TextMatrix(1, 2) = rsPayments!Date .TextMatrix(1, 3) = rsPayments!PaymentTypeID .TextMatrix(1, 4) = rsPayments!PaymentType .TextMatrix(1, 5) = toMoney(rsPayments!Amount) Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsPayments!RecievedPaymentID .TextMatrix(.Rows - 1, 2) = rsPayments!Date .TextMatrix(.Rows - 1, 3) = rsPayments!PaymentTypeID .TextMatrix(.Rows - 1, 4) = rsPayments!PaymentType .TextMatrix(.Rows - 1, 5) = toMoney(rsPayments!Amount) End If End With ' AmountPaid = rsPayments!Amount rsPayments.MoveNext Wend Grid.Row = 1 Grid.ColSel = 5 'Set fixed cols
Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If
rsPayments.Close 'Clear variables Set rsPayments = Nothing
Exit Suberr: If err.Number = 94 Then Resume Next prompt_err err, Name, "DisplayForEditing" Screen.MousePointer = vbDefaultEnd Sub
Private Sub DeleteItems() Dim CurrRow As Integer Dim rsPayments As New Recordset
frmAccountReceivable - 5 rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM [Payments Received] WHERE AccRecID=" & PK, CN, adOpenStatic, adLockOptimistic If rsPayments.RecordCount > 0 Then rsPayments.MoveFirst While Not rsPayments.EOF CurrRow = getFlexPos(Grid, 1, rsPayments!RecievedPaymentID) 'Add to grid With Grid If CurrRow < 0 Then 'Delete record if doesnt exist in flexgrid DelRecwSQL "Payments", "RecievedPaymentID", "", True, rsPayments!RecievedPaymentID End If End With rsPayments.MoveNext Wend End IfEnd Sub
Private Sub txtAmount_GotFocus() HLText txtAmountEnd Sub
Private Sub txtAmount_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtAmount_Validate(Cancel As Boolean) txtAmount.Text = toMoney(txtAmount.Text)End Sub
frmAccountReceivable - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"Begin VB.Form frmAccountReceivable BorderStyle = 1 'Fixed Single Caption = "Payments" ClientHeight = 5970 ClientLeft = 45 ClientTop = 330 ClientWidth = 7380 ControlBox = 0 'False KeyPreview = -1 'True LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5970 ScaleWidth = 7380 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 457 TabIndex = 9 Top = 0 Width = 6855 Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 11 Top = 360 Width = 3900 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Payments" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 10 Top = 30 Width = 1395 End Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30
frmAccountReceivable - 2 Width = 480 End End Begin VB.CommandButton btnRemove Height = 275 Left = 300 Picture = (Icon) Style = 1 'Graphical TabIndex = 8 ToolTipText = "Remove" Top = 3270 Visible = 0 'False Width = 275 End Begin VB.TextBox txtCompany Appearance = 0 'Flat Height = 315 Left = 1080 Locked = -1 'True TabIndex = 7 Top = 840 Width = 1815 End Begin VB.TextBox txtBalance Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 315 Left = 1080 Locked = -1 'True TabIndex = 6 Top = 1290 Width = 1815 End Begin VB.TextBox txtAmountPaid Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 315 Left = 4440 Locked = -1 'True TabIndex = 5 Top = 1290 Width = 1815 End Begin VB.CommandButton cmdAdd Caption = "Add" Height = 375 Left = 5400 TabIndex = 4 Top = 2460 Width = 825 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 375 Left = 6120 TabIndex = 3 Top = 5490 Width = 1005 End Begin VB.CommandButton cmdUpdate Caption = "Update" Height = 375 Left = 6330 TabIndex = 2 Top = 2460 Width = 795 End Begin VB.CommandButton cmdSave Caption = "Save" Height = 375 Left = 5160 TabIndex = 1 Top = 5490 Width = 885 End Begin VB.TextBox txtAmount Alignment = 1 'Right Justify
frmAccountReceivable - 3 Height = 315 Left = 4050 TabIndex = 0 Text = "0.00" Top = 2490 Width = 1245 End Begin VB.PictureBox b8Line5 Height = 30 Left = 180 ScaleHeight = 30 ScaleWidth = 7005 TabIndex = 12 Top = 5340 Width = 7005 End Begin MSComCtl2.DTPicker dtpDate Height = 315 Left = 240 TabIndex = 13 Top = 2490 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Format = 104136705 CurrentDate = 39539 End Begin VB.PictureBox b8GradLine2 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 180 ScaleHeight = 180 ScaleWidth = 6945 TabIndex = 14 Top = 1830 Width = 7005 End Begin MSDataListLib.DataCombo dcPaymentType Height = 315 Left = 2160 TabIndex = 15 Top = 2490 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid Height = 2190 Left = 240 TabIndex = 16 Top = 2970 Width = 6915 _ExtentX = 12197 _ExtentY = 3863 _Version = 393216 Rows = 0 FixedRows = 0 FixedCols = 0 RowHeightMin = 275 ForeColorFixed = -2147483640 BackColorSel = 1091552 ForeColorSel = 16777215 BackColorBkg = -2147483643 GridColor = -2147483633
frmAccountReceivable - 4 GridColorFixed = -2147483633 GridColorUnpopulated= -2147483633 AllowBigSelection= 0 'False FocusRect = 0 SelectionMode = 1 AllowUserResizing= 3 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty _NumberOfBands = 1 _Band(0).Cols = 2 _Band(0).GridLinesBand= 1 _Band(0).TextStyleBand= 0 _Band(0).TextStyleHeader= 0 End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 5415 Left = 0 ScaleHeight = 361 ScaleMode = 3 'Pixel ScaleWidth = 491 TabIndex = 17 Top = 570 Width = 7365 Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 18 Top = 0 Width = 11595 End Begin VB.Label lblPaid BackStyle = 0 'Transparent Caption = "PAID" BeginProperty Font Name = "Andalus" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000000FF& Height = 435 Left = 4410 TabIndex = 26 Top = 150 Visible = 0 'False Width = 795 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165 Left = 9450
frmAccountReceivable - 5 TabIndex = 25 Top = 3030 Width = 45 End Begin VB.Label Label6 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Amount" Height = 195 Left = 4050 TabIndex = 24 Top = 1680 Width = 540 End Begin VB.Label Label5 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Date" Height = 195 Left = 270 TabIndex = 23 Top = 1650 Width = 345 End Begin VB.Label Label3 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Amount Paid" Height = 195 Left = 3450 TabIndex = 22 Top = 780 Width = 900 End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Balance" Height = 195 Left = 120 TabIndex = 21 Top = 810 Width = 585 End Begin VB.Label Label7 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Payment Type" Height = 195 Left = 2160 TabIndex = 20 Top = 1680 Width = 1020 End Begin VB.Label Label1 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Company" Height = 195 Left = 120 TabIndex = 19 Top = 300 Width = 660 End EndEnd
Company
Payment Type
Balance Amount Paid
Date Amount
PAIDPAIDPAIDPAID
6
PaymentsFill all fields or fields with '*' then click 'Save' button to update.
frmAccountReceiva Option Explicit
Dim CURR_COL As IDim rsAccRec As NDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmAccountReceivableList - 2 MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsAccRec If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmAccountReceivableList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Company,FolioNumber,Total,AmountPaid,Balance,AccRecID" .Tables = "[qry_Account_Receivable]" .SortOrder = "Company ASC" .SaveStatement End With rsAccRec.CursorLocation = adUseClient rsAccRec.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsAccRec, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsAccRec, RecordPage.PageStart, RecordPage.PageEnd, 5, 2, False, True, , , , "AccRecID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmAccountReceivableList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then
frmAccountReceivableList - 4 btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmAccountReceivableList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmAccountReceivableList Caption = "Account Receivable" ClientHeight = 5880 ClientLeft = 60 ClientTop = 345 ClientWidth = 8445 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5880 ScaleWidth = 8445 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8445 TabIndex = 2 Top = 5505 Width = 8445 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmAccountReceivableList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8445 TabIndex = 1 Top = 5475 Width = 8445 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8445 TabIndex = 0 Top = 5490 Width = 8445 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 450 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 6 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Company" Object.Width = 6288 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Folio Number" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmAccountReceivableList - 3 SubItemIndex = 2 Text = "Total" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Amount Paid" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 4 Text = "Balance" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 5 Text = "AccRecID" Object.Width = 0 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Payments" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 150 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 150 Width = 6915 EndEnd
Payments
Selected Record: 0 0 - 0 of 0
frmBusinessSource - 1 Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ On Error GoTo
frmBusinessSource - 2 "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Business Source] WHERE BusinessSourceID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmBusinessSourceList.RefreshRecords End If End If Set frmBusinessSource = NothingEnd Sub
frmBusinessSource - 1 VERSION 5.00Begin VB.Form frmBusinessSource BorderStyle = 1 'Fixed Single Caption = "Business Source" ClientHeight = 1725 ClientLeft = 45 ClientTop = 330 ClientWidth = 5655 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1725 ScaleWidth = 5655 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox b8Line1 Height = 30 Left = 150 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 5 Top = 870 Width = 5205 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 330 TabIndex = 3 Top = 1155 Width = 1680 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3870 TabIndex = 2 Top = 1155 Width = 1335 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2430 TabIndex = 1 Top = 1155 Width = 1335 End Begin VB.TextBox txtEntry Height = 285 Left = 1770 MaxLength = 100 TabIndex = 0 Tag = "Category" Top = 240 Width = 3030 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Business Source" Height = 240 Left = 450 TabIndex = 4 Top = 240 Width = 1215 EndEnd
Business
Source
frmBusinessSource Option Explicit
Dim CURR_COL As IDim rsBusinessSouDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmBusinessSourceList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsBusinessSource If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmBusinessSourceList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "BusinessSource,BusinessSourceID" .Tables = "[Business Source]" .SortOrder = "BusinessSource ASC" .SaveStatement End With rsBusinessSource.CursorLocation = adUseClient rsBusinessSource.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsBusinessSource, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsBusinessSource, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "BusinessSourceID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmBusinessSourceList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmBusinessSourceList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmBusinessSourceList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmBusinessSourceList Caption = "Business Source" ClientHeight = 6840 ClientLeft = 60 ClientTop = 345 ClientWidth = 9510 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 6840 ScaleWidth = 9510 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9510 TabIndex = 9 Top = 6450 Width = 9510 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9510 TabIndex = 8 Top = 6435 Width = 9510 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9510 TabIndex = 0 Top = 6465 Width = 9510 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmBusinessSourceList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = -30 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Business Source" BeginProperty Font Name = "Tahoma"
frmBusinessSourceList - 3 Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 45 TabIndex = 11 Top = 180 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = -30 Top = 180 Width = 6915 EndEnd
Business Source
Selected Record: 0 0 - 0 of 0
frmChangeRoom - 1 Private Sub cmdCa frmCheckIn.bl Unload MeEnd Sub
Private Sub CmdCh With frmCheckIn If dtpSta MsgBo
frmChangeRoom - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmChangeRoom BorderStyle = 1 'Fixed Single ClientHeight = 5805 ClientLeft = 15 ClientTop = 15 ClientWidth = 6405 ControlBox = 0 'False KeyPreview = -1 'True LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5805 ScaleWidth = 6405 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 417 TabIndex = 10 Top = 0 Width = 6255 Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Change Room" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 12 Top = 30 Width = 1995 End Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 11 Top = 360 Width = 3900 End
frmChangeRoom - 2 End Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 375 Left = 4950 TabIndex = 9 Top = 5190 Width = 1215 End Begin VB.CommandButton CmdChangeRoom Caption = "Change Room" Height = 375 Left = 3690 TabIndex = 8 Top = 5190 Width = 1215 End Begin VB.TextBox txtTo Height = 375 Left = 5190 TabIndex = 7 Top = 930 Width = 645 End Begin VB.TextBox txtFrom Height = 345 Left = 3780 TabIndex = 5 Top = 930 Width = 765 End Begin MSComCtl2.DTPicker dtpStartDate Height = 375 Left = 1200 TabIndex = 2 Top = 900 Width = 1725 _ExtentX = 3043 _ExtentY = 661 _Version = 393216 Format = 104136705 CurrentDate = 39564 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 60 TabIndex = 0 Top = 1650 Width = 6180 _ExtentX = 10901 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 3 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Room Number" Object.Width = 2937 EndProperty
frmChangeRoom - 3 BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Room Type" Object.Width = 3528 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 2 Text = "Room Status" Object.Width = 3334 EndProperty End Begin VB.Label Label3 Caption = "To" Height = 285 Left = 4830 TabIndex = 6 Top = 960 Width = 315 End Begin VB.Label Label2 Caption = "From" Height = 345 Left = 3270 TabIndex = 4 Top = 930 Width = 465 End Begin VB.Label Label1 Caption = "Starting Date" Height = 345 Left = 60 TabIndex = 3 Top = 900 Width = 1065 End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Available Rooms" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 135 TabIndex = 1 Top = 1350 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 60 Top = 1350 Width = 6195 EndEnd
Available Rooms
Starting Date From To
Fill all fields or fields with '*' then click 'Save' button to update.
Change Room
frmChargeType - 1 Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ On Error GoTo
frmChargeType - 2 "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Charge Type] WHERE ChargeTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmChargeTypeList.RefreshRecords End If End If Set frmChargeType = NothingEnd Sub
frmChargeType - 1 VERSION 5.00Begin VB.Form frmChargeType BorderStyle = 1 'Fixed Single Caption = "Charge Type" ClientHeight = 1845 ClientLeft = 45 ClientTop = 330 ClientWidth = 5460 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1845 ScaleWidth = 5460 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1710 MaxLength = 100 TabIndex = 4 Tag = "Category" Top = 180 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2370 TabIndex = 3 Top = 1095 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3810 TabIndex = 2 Top = 1095 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 270 TabIndex = 1 Top = 1095 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 90 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 0 Top = 810 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Charge Type" Height = 240 Left = 390 TabIndex = 5 Top = 180 Width = 1215 EndEnd
Charge Type
frmChargeTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsChargeType Dim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmChargeTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsChargeType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmChargeTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "ChargeType,ChargeTypeID" .Tables = "[Charge Type]" .SortOrder = "ChargeType ASC" .SaveStatement End With rsChargeType.CursorLocation = adUseClient rsChargeType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsChargeType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsChargeType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "ChargeTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmChargeTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmChargeTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmChargeTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmChargeTypeList Caption = "Charge Type" ClientHeight = 6330 ClientLeft = 60 ClientTop = 345 ClientWidth = 9105 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 6330 ScaleWidth = 9105 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9105 TabIndex = 2 Top = 5955 Width = 9105 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmChargeTypeList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9105 TabIndex = 1 Top = 5940 Width = 9105 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9105 TabIndex = 0 Top = 5925 Width = 9105 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Charge Type" BeginProperty Font Name = "Tahoma"
frmChargeTypeList - 3 Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 180 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 180 Width = 6915 EndEnd
Charge Type
Selected Record: 0 0 - 0 of 0
frmCheckIn - 1 Option Explicit
Public State Public PK Public PopupPK Public Room Public AmountPaidPublic OtherChargPublic blnChangeR
Dim HaveAction
frmCheckIn - 2 End Sub
Private Sub cmdCancel_Click()On Error GoTo err
CN.BeginTrans CN.Execute "DELETE FolioNumber " & _ "From [Rate Per Period] " & _ "WHERE FolioNumber='" & txtFolioNumber.Text & "'" CN.Execute "INSERT INTO [Rate Per Period] " & _ "SELECT [Rate Per Period Temp].* " & _ "FROM [Rate Per Period Temp] " & _ "Where ((([Rate Per Period Temp].FolioNumber) = '" & txtFolioNumber.Text & "')) " & _ "ORDER BY [Rate Per Period Temp].Date;"
CN.CommitTrans Unload Me Exit Sub err: CN.RollbackTrans prompt_err err, Name, "CmdCancel_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub ResetFields()' clearText Me'' txtEntry(15).Text = "0.00"' txtEntry(1).SetFocusEnd Sub
Private Sub CmdChangeRoom_Click()On Error GoTo err
Dim OldRoomNumber As Integer CN.BeginTrans With frmChangeRoom OldRoomNumber = txtRoomNumber.Text .txtFrom = OldRoomNumber .Show vbModal End With If blnChangeRoom = False Then Exit Sub ChangeValue CN, "Rooms", "RoomStatusID", 2, True, "WHERE RoomNumber = " & txtRoomNumber.Text ChangeValue CN, "Rooms", "RoomStatusID", 3, True, "WHERE RoomNumber = " & OldRoomNumber CN.Execute "UPDATE [Inventory] SET [Inventory].RoomNumber = " & txtRoomNumber.Text & " " & _ "WHERE RoomNumber=" & OldRoomNumber & " AND ID='" & txtFolioNumber.Text & "' AND Status='Check In'"
CN.CommitTrans
Exit Sub err: CN.RollbackTrans prompt_err err, Name, "CmdChangeRoom_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub cmdCheckInOut_Click() Dim strCaption As String Dim RoomNumber As Integer strCaption = cmdCheckInOut.Caption RoomNumber = txtRoomNumber.Text
frmCheckIn - 3 Call SaveAdd
If HaveAction = False Then Exit Sub End If If State = adStateAddMode Then MsgBox "New record has been successfully saved.", vbInformation
Unload frmCheckIn Else MsgBox "Changes in record has been successfully saved.", vbInformation Unload frmCheckIn End If
If strCaption = "Check Out" Then With frmCheckOut .RoomNumber = RoomNumber .AutoCheckOut = False .Show vbModal End With End IfEnd Sub
Private Sub SaveAdd()On Error GoTo err Dim rsCustomers As New Recordset Dim CustomerID As Integer Dim CompanyID As Integer If Trim(txtLastName.Text) = "" Or Trim(txtFirstName.Text) = "" Then MsgBox "Please complete the name of a guest.", vbInformation Exit Sub End If CN.BeginTrans
'Save customer's record With rsCustomers .Open "SELECT * FROM Customers WHERE LastName = '" & txtLastName.Text & "' AND FirstName = '" & txtFirstName.Text & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtLastName.Tag = .Fields("CustomerID") Else .AddNew CustomerID = getIndex("Customers") txtLastName.Tag = CustomerID .Fields("CustomerID") = CustomerID .Fields("LastName") = txtLastName.Text .Fields("FirstName") = txtFirstName.Text .Update End If .Close If txtCompany.Text = "" Then GoSub ContinueSave 'Save company's record .Open "SELECT * FROM Company WHERE Company = '" & txtCompany.Text & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtCompany.Tag = .Fields("CompanyID") Else .AddNew
CompanyID = getIndex("Company") txtCompany.Tag = CompanyID
frmCheckIn - 4 .Fields("CompanyID") = CompanyID .Fields("Company") = txtCompany.Text .Update End If .Close End With ContinueSave:
If State = adStateAddMode Then RS.AddNew RS.Fields("FolioNumber") = txtFolioNumber.Text RS.Fields("CheckInBy") = CurrUser.USER_PK RS.Fields("AddedByFK") = CurrUser.USER_PK Else RS.Fields("DateModified") = Now RS.Fields("LastUserFK") = CurrUser.USER_PK End If With RS .Fields("RCardNo") = txtRCardNo.Text .Fields("CustomerID") = txtLastName.Tag .Fields("Address") = txtAddress.Text .Fields("CountryID") = dcCountry.BoundText .Fields("CompanyID") = IIf(txtCompany.Tag = "", Null, txtCompany.Tag) .Fields("IDTypeID") = dcIDType.BoundText .Fields("IDNumber") = txtIDNumber.Text .Fields("RoomNumber") = txtRoomNumber.Text .Fields("DateIn") = dtpDateIn.Value .Fields("DateOut") = dtpDateOut.Value .Fields("RateType") = dcRateType.BoundText .Fields("Rate") = txtRate.Text .Fields("OtherCharges") = txtOtherCharges.Text .Fields("Discount") = txtDiscount.Text .Fields("AmountPaid") = txtAmountPaid.Text .Fields("Days") = txtDays.Text .Fields("Adults") = txtAdults.Text .Fields("Childrens") = txtChildrens.Text .Fields("Total") = txtTotal.Text .Fields("BusinessSourceID") = dcBusSource.BoundText .Fields("VehicleID") = IIf(dcVehicle.BoundText = "", Null, dcVehicle.BoundText) .Fields("VehicleModel") = txtVehicleModel.Text .Fields("PlateNo") = txtPlateNo.Text .Fields("Notes") = txtNotes.Text
.Update End With '---------------------------- 'Delete record from Inventory and add a new check in/out date CN.Execute "DELETE ID, Status " & _ "From [Inventory] " & _ "WHERE ID='" & txtFolioNumber.Text & "' AND Status='Check In'" Dim dtpStartDate As Date dtpStartDate = dtpDateIn.Value Do Until dtpStartDate = dtpDateOut.Value CN.Execute "INSERT INTO [Inventory] ( ID, RoomNumber, [Date], CustomerID, Status ) " & _ "VALUES ('" & txtFolioNumber.Text & "', " & txtRoomNumber.Text & ", #" & dtpStartDate & "#, " & txtLastName.Tag & ", 'Check In')"
dtpStartDate = dtpStartDate + 1 Loop '---------------------------- ChangeValue CN, "Rooms", "RoomStatusID", 2, True, "WHERE RoomNumber = " & txtRoomNumber.Text Call frmPayment.cmdSave_Click Call frmOtherCharges.cmdSave_Click If txtCompany.Text <> "" Then Dim rsAccRec As New Recordset
frmCheckIn - 5 With rsAccRec .Open "SELECT * FROM [Accounts Receivable] WHERE CompanyID = " & txtCompany.Tag & " AND FolioNumber = '" & txtFolioNumber & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then .Fields("Debit") = txtBalance.Text Else .AddNew .Fields("CompanyID") = txtCompany.Tag .Fields("FolioNumber") = txtFolioNumber.Text .Fields("Credit") = txtBalance.Text End If .Update End With ElseIf State = adStateEditMode Then 'delete record from accounts receivable table since the company field becomes blank. CN.Execute "DELETE [Accounts Receivable].FolioNumber " & _ "From [Accounts Receivable] " & _ "WHERE FolioNumber= '" & txtFolioNumber.Text & "'" End If CN.CommitTrans
HaveAction = True Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "cmdSave_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub cmdLookupComp_Click() With frmCompanyLookup Set .RefForm = Me .Show vbModal End WithEnd Sub
Private Sub cmdLookupCust_Click() With frmCustomerLookup Set .RefForm = Me .Show vbModal End WithEnd Sub
Private Sub CmdPrint_Click() If State = adStatePopupMode Then GoSub JumpHere End If If MsgBox("This will save the record before printing a folio. " & vbCrLf & vbCrLf & "Are you sure you want to continue?", vbYesNo + vbInformation) = vbYes Then Call SaveAdd Else Exit Sub End If
JumpHere: With frmReports .strReport = "Folio" If State = adStatePopupMode Then .strWhere = "{qry_RPT_Customers.FolioNumber} = '" & txtFolioNumber.Text & "' AND {qry_RPT_Customers.Status} = 'Check Out'" Else .strWhere = "{qry_RPT_Customers.FolioNumber} = '" & txtFolioNumber.Text & "' AND {qry_RPT_Customers.Status} = 'Check In'" End If
frmCheckIn - 6 frmReports.Show vbModal End WithEnd Sub
Private Sub cmdUpdateDelete_Click() If cmdUpdateDelete.Caption = "Update" Then Call SaveAdd If State = adStateAddMode Then MsgBox "New record has been successfully saved.", vbInformation ' Unload frmCheckIn Else MsgBox "Changes in record has been successfully saved.", vbInformation ' Unload frmCheckIn End If End IfEnd Sub
Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub dcRateType_Click(Area As Integer)On Error GoTo err
Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & txtRoomNumber.Text & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Text = !NoofPerson hsAdults.Min = !NoofPerson hsAdults.Value = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With rsRoomRates.Close Call ComputeRate Exit Sub err: CN.RollbackTrans prompt_err err, Name, "dcRateType_Click" Screen.MousePointer = vbDefaultEnd Sub
frmCheckIn - 7
Private Sub dtpDateIn_Change() Call dtpDateOut_ChangeEnd Sub
Public Sub dtpDateOut_Change() If dtpDateOut.Value <= dtpDateIn.Value Then dtpDateOut.Value = dtpDateIn.Value + 1 End If txtDays.Text = dtpDateOut.Value - dtpDateIn.Value hsDays.Value = txtDays.Text Call ComputeRateEnd Sub
Private Sub dtpDateOut_LostFocus() If dtpDateOut.Value < dtpDateIn.Value Then MsgBox "Date Out must be greater than Date In.", vbExclamation: dtpDateOut.SetFocusEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load()On Error GoTo err
RS.CursorLocation = adUseClient
CN.BeginTrans
bind_dc "SELECT * FROM Countries", "Country", dcCountry, "CountryID", True bind_dc "SELECT * FROM [ID Type]", "IDType", dcIDType, "IDTypeID", True bind_dc "SELECT * FROM [Rate Type]", "RateType", dcRateType, "RateTypeID", True bind_dc "SELECT * FROM [Business Source]", "BusinessSource", dcBusSource, "BusinessSourceID", True bind_dc "SELECT * FROM [Vehicles]", "Vehicle", dcVehicle, "VehicleID", False dcCountry.Text = "Philippines" Dim rsRoomRates As New ADODB.Recordset 'Check the form state If State = adStateAddMode Then RS.Open "SELECT * FROM Transactions WHERE FolioNumber = '" & PK & "'", CN, adOpenStatic, adLockOptimistic cmdUsrHistory.Enabled = False txtRoomNumber.Text = Room dtpDateIn.Value = Date dtpDateOut.Value = dtpDateIn.Value + 1 GeneratePK rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & txtRoomNumber.Text & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Text = !NoofPerson hsAdults.Min = !NoofPerson hsAdults.Value = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
Call txtDays_Change Call ComputeRate ElseIf State = adStateEditMode Then RS.Open "SELECT * FROM Transactions WHERE RoomNumber = " & PK & " AND Status = 'Check In'",
frmCheckIn - 8 CN, adOpenStatic, adLockOptimistic rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & PK & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) hsAdults.Min = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
DisplayForEditing cmdCheckInOut.Caption = "Check Out" CmdChangeRoom.Enabled = True cmdUpdateDelete.Enabled = True CmdPrint.Visible = True Call txtDays_Change Call ComputeRate Else 'adStatePopupMode RS.Open "SELECT * FROM Transactions WHERE FolioNumber = '" & PopupPK & "'", CN, adOpenStatic, adLockOptimistic rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & PK & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) hsAdults.Min = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
DisplayForEditing cmdCheckInOut.Caption = "Check Out" Me.CmdChangeRoom.Enabled = True Me.cmdUpdateDelete.Enabled = True Call ComputeRate CmdPrint.Visible = True CmdPrint.Left = 634 CmdPrint.Top = 442 CmdChangeRoom.Visible = False cmdCheckInOut.Visible = False cmdUpdateDelete.Visible = False End If rsRoomRates.Close CN.Execute "DELETE FolioNumber " & _ "From [Rate Per Period Temp] " & _ "WHERE FolioNumber='" & txtFolioNumber.Text & "'"
CN.Execute "INSERT INTO [Rate Per Period Temp] " & _ "SELECT [Rate Per Period].* " & _ "From [Rate Per Period] " & _ "WHERE FolioNumber='" & txtFolioNumber.Text & "'" CN.CommitTrans Exit Sub err: CN.RollbackTrans prompt_err err, Name, "Form_Load" Screen.MousePointer = vbDefaultEnd Sub
frmCheckIn - 9 'Procedure used to generate PKPrivate Sub GeneratePK() PK = getIndex("Transactions") txtFolioNumber.Text = GenerateID(PK, Format$(Date, "yy") & "-", "00000")End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) lblAmountPaid.FontUnderline = False lblRatePerPeriod.FontUnderline = False lblOtherCharges.FontUnderline = FalseEnd Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then frmRoomsWindow.RefreshRecords End If Unload frmRatePerPeriod Unload frmOtherCharges Unload frmPayment Set frmRatePerPeriod = Nothing Set frmOtherCharges = Nothing Set frmPayment = Nothing Set frmCheckIn = NothingEnd Sub
Private Sub ResetEntry()' txtBranch.Text = ""' txtAcctNo.Text = ""' txtAcctName.Text = ""End Sub
Private Sub hsAdults_Change() txtAdults.Text = hsAdults.Value Call ComputeAdultsRate Call ComputeRateEnd Sub
Private Sub hsChildrens_Change() txtChildrens.Text = hsChildrens.Value Call ComputeChildrensRate Call ComputeRateEnd Sub
Private Sub hsDays_Change() dtpDateOut.Value = dtpDateIn.Value + hsDays.Value txtDays.Text = hsDays.Value Call ComputeRateEnd Sub
Private Sub ComputeRate() txtTotalCharges.Text = toMoney(ComputeRatePerPeriod) txtSubTotal.Text = toMoney(toNumber(txtTotalCharges.Text) + toNumber(txtOtherCharges.Text)) txtTotal.Text = toMoney(toNumber(txtSubTotal.Text) - (toNumber(txtSubTotal.Text) * toNumber(txtDiscount.Text) / 100)) txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
Private Sub lblAmountPaid_Click() With frmPayment .FolioNumber = txtFolioNumber.Text .GuestName = txtFirstName.Text & " " & txtLastName.Text .Balance = txtBalance.Text .RefreshBalance Set .RefForm = Me .Show vbModal txtAmountPaid.Text = toMoney(AmountPaid) End WithEnd Sub
frmCheckIn - 10
Private Sub lblAmountPaid_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblAmountPaid.FontUnderline = TrueEnd Sub
Private Sub lblOtherCharges_Click() With frmOtherCharges .FolioNumber = txtFolioNumber.Text .GuestName = txtFirstName.Text & " " & txtLastName.Text Set .RefForm = Me .Show vbModal txtOtherCharges.Text = toMoney(OtherCharges) End With Call ComputeRateEnd Sub
Private Sub lblOtherCharges_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblOtherCharges.FontUnderline = TrueEnd Sub
Private Sub lblRatePerPeriod_Click() With frmRatePerPeriod .FolioNumber = txtFolioNumber.Text .Show vbModal Call ComputeRate End WithEnd Sub
Private Sub lblRatePerPeriod_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblRatePerPeriod.FontUnderline = TrueEnd Sub
Private Sub ComputeAdultsRate()On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset
If txtAdults.Tag = "" Then Exit Sub CN.BeginTrans Dim intAdults As Integer If txtAdults.Text = hsAdults.Min Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - hsAdults.Min End If
With rsRatePerPeriod .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtFolioNumber.Text & "' AND [Date] = #" & dtpDateOut.Value - 1 & "#", CN, adOpenStatic, adLockOptimistic If .RecordCount = 1 Then .Fields("Adults") = txtAdults.Tag * intAdults .Update End If End With CN.CommitTrans rsRatePerPeriod.Close
Exit Sub
frmCheckIn - 11 err: CN.RollbackTrans prompt_err err, Name, "ComputeAdultsRate" Screen.MousePointer = vbDefaultEnd Sub
Private Sub ComputeChildrensRate()On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset
If txtChildrens.Tag = "" Then Exit Sub CN.BeginTrans With rsRatePerPeriod .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtFolioNumber.Text & "' AND [Date] = #" & dtpDateOut.Value - 1 & "#", CN, adOpenStatic, adLockOptimistic If .RecordCount = 1 Then .Fields("Childrens") = txtChildrens.Tag * txtChildrens.Text .Update End If End With CN.CommitTrans rsRatePerPeriod.Close
Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "ComputeChildrensRate" Screen.MousePointer = vbDefaultEnd Sub
Private Sub txtAmountPaid_Change() txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
Private Sub txtDays_Change()On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset Dim tmpDate As Date
tmpDate = dtpDateIn.Value If txtAdults.Tag = "" Then Exit Sub CN.BeginTrans CN.Execute "DELETE [Date] " & _ "FROM [Rate Per Period] " & _ "WHERE [Date]>#" & dtpDateOut - 1 & "#"
Dim intAdults As Integer If txtAdults.Text = hsAdults.Min Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - hsAdults.Min End If
With rsRatePerPeriod .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtFolioNumber.Text & "' ORDER BY [Date]", CN, adOpenStatic, adLockOptimistic
Do Until tmpDate > dtpDateOut.Value - 1 .Filter = "[Date] = #" & tmpDate & "#" If .RecordCount = 0 Then .AddNew .Fields("FolioNumber") = txtFolioNumber.Text
frmCheckIn - 12 .Fields("Date") = tmpDate .Fields("RoomNumber") = txtRoomNumber.Text .Fields("RateTypeID") = dcRateType.BoundText .Fields("Rate") = txtRate.Text .Fields("Adults") = txtAdults.Tag * intAdults .Fields("Childrens") = toMoney(txtChildrens.Tag) * toNumber(txtChildrens.Text) .Update End If tmpDate = tmpDate + 1 Loop End With CN.CommitTrans rsRatePerPeriod.Close
Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "txtDays_Change" Screen.MousePointer = vbDefaultEnd Sub
Private Sub txtDiscount_Change() Call ComputeRateEnd Sub
Private Function ComputeRatePerPeriod() As CurrencyOn Error GoTo err
Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtFolioNumber.Text & "'", CN, adOpenStatic, adLockOptimistic Do Until .EOF ComputeRatePerPeriod = ComputeRatePerPeriod + toMoney(!Rate) + toMoney(!Adults) + toMoney(!Childrens) .MoveNext Loop End With rsRoomRates.Close Exit Function
err: CN.RollbackTrans prompt_err err, Name, "ComputeRatePerPeriod" Screen.MousePointer = vbDefaultEnd Function
Private Sub txtDiscount_GotFocus() HLText txtDiscountEnd Sub
Private Sub txtDiscount_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtDiscount_Validate(Cancel As Boolean) txtDiscount.Text = toMoney(txtDiscount.Text)End Sub
Private Sub txtRate_GotFocus() HLText txtRateEnd Sub
Private Sub txtRate_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtRate_Validate(Cancel As Boolean)
frmCheckIn - 13 txtRate.Text = toMoney(txtRate.Text)End Sub
frmCheckIn - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmCheckIn BorderStyle = 1 'Fixed Single Caption = "Check In" ClientHeight = 8310 ClientLeft = 45 ClientTop = 345 ClientWidth = 11265 KeyPreview = -1 'True LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 8310 ScaleWidth = 11265 StartUpPosition = 2 'CenterScreen Begin MSComctlLib.StatusBar StatusBar1 Align = 2 'Align Bottom Height = 375 Left = 0 TabIndex = 69 Top = 7935 Width = 11265 _ExtentX = 19870 _ExtentY = 661 _Version = 393216 BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} NumPanels = 4 BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} AutoSize = 1 Object.Width = 4921 Text = "Reserved By:" TextSave = "Reserved By:" EndProperty BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} AutoSize = 1 Object.Width = 4921 Text = "Check In By:" TextSave = "Check In By:" EndProperty BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} AutoSize = 1 Object.Width = 4921 Text = "Check Out By:" TextSave = "Check Out By:" EndProperty BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} AutoSize = 1 Object.Width = 4921 Text = "Business Source:" TextSave = "Business Source:" EndProperty EndProperty End Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 687 TabIndex = 35 Top = 0 Width = 10305 Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75
frmCheckIn - 2 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 37 Top = 360 Width = 3900 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Check In" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 36 Top = 30 Width = 1260 End Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 7395 Left = -30 ScaleHeight = 493 ScaleMode = 3 'Pixel ScaleWidth = 775 TabIndex = 38 Top = 540 Width = 11625 Begin VB.TextBox txtRCardNo Height = 345 Left = 1680 TabIndex = 1 Top = 1050 Width = 1815 End Begin VB.CommandButton CmdPrint Caption = "&Print" Height = 315 Left = 6810 TabIndex = 80 Top = 6630 Visible = 0 'False Width = 1335 End Begin VB.CommandButton cmdLookupComp Caption = ">>" Height = 315 Left = 3540 TabIndex = 8 TabStop = 0 'False Top = 3270
frmCheckIn - 3 Width = 375 End Begin VB.CommandButton cmdLookupCust Caption = ">>" Height = 315 Left = 3540 TabIndex = 3 TabStop = 0 'False Top = 1500 Width = 375 End Begin VB.TextBox txtNotes Height = 1485 Left = 4530 TabIndex = 29 Top = 4500 Width = 3045 End Begin VB.TextBox txtPlateNo Height = 345 Left = 1650 TabIndex = 13 Top = 6210 Width = 1815 End Begin VB.TextBox txtVehicleModel Height = 345 Left = 1650 TabIndex = 12 Top = 5790 Width = 1815 End Begin VB.TextBox txtTotal Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 26 Text = "0.00" Top = 3600 Width = 1815 End Begin VB.TextBox txtSubTotal Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 24 Text = "0.00" Top = 2760 Width = 1815 End Begin VB.TextBox txtOtherCharges Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 23 Text = "0.00" Top = 2340 Width = 1815 End Begin VB.CommandButton cmdUpdateDelete Caption = "Update" Enabled = 0 'False Height = 315 Left = 8160 TabIndex = 32 Top = 7020 Width = 1335 End Begin VB.CommandButton cmdChangeRoom Caption = "Change Room" Enabled = 0 'False Height = 315 Left = 8160 TabIndex = 30
frmCheckIn - 4 Top = 6630 Width = 1335 End Begin VB.TextBox txtFolioNumber Appearance = 0 'Flat Height = 345 Left = 1680 TabIndex = 0 Top = 600 Width = 1815 End Begin VB.TextBox txtLastName Height = 345 Left = 1680 TabIndex = 2 Top = 1500 Width = 1815 End Begin VB.TextBox txtFirstName Height = 345 Left = 1680 TabIndex = 4 Top = 1950 Width = 1815 End Begin VB.TextBox txtAddress Height = 345 Left = 1680 TabIndex = 5 Top = 2400 Width = 1815 End Begin VB.TextBox txtCompany Height = 345 Left = 1680 TabIndex = 7 Top = 3270 Width = 1815 End Begin VB.TextBox txtIDNumber Height = 345 Left = 1680 TabIndex = 10 Top = 4650 Width = 1815 End Begin VB.TextBox txtRoomNumber Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5760 Locked = -1 'True TabIndex = 45 Top = 630 Width = 825 End Begin VB.TextBox txtRate Alignment = 1 'Right Justify Height = 345 Left = 9090 TabIndex = 21 Text = "0.00" Top = 1500 Width = 1815 End Begin VB.TextBox txtDiscount Alignment = 1 'Right Justify Height = 345 Left = 9090 TabIndex = 25 Text = "0.00" Top = 3180 Width = 1575 End Begin VB.TextBox txtDays Alignment = 2 'Center Height = 345
frmCheckIn - 5 Left = 5760 Locked = -1 'True TabIndex = 16 Text = "1" Top = 1920 Width = 465 End Begin VB.TextBox txtAdults Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 17 Text = "1" Top = 2340 Width = 465 End Begin VB.TextBox txtChildrens Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 18 Text = "0" Top = 2760 Width = 465 End Begin VB.CommandButton cmdCheckInOut Caption = "Check In" Height = 315 Left = 9510 TabIndex = 31 Top = 6630 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 9510 TabIndex = 33 Top = 7020 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 420 TabIndex = 34 Top = 6660 Width = 1680 End Begin VB.TextBox txtTotalCharges Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 22 Text = "0.00" Top = 1920 Width = 1815 End Begin VB.TextBox txtAmountPaid Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 27 Text = "0.00" Top = 4050 Width = 1815 End Begin VB.TextBox txtBalance Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 28
frmCheckIn - 6 Text = "0.00" Top = 4440 Width = 1815 End Begin VB.HScrollBar hsDays Height = 315 Left = 6330 Min = 1 TabIndex = 44 Top = 1920 Value = 1 Width = 495 End Begin VB.HScrollBar hsChildrens Height = 315 Left = 6330 TabIndex = 43 Top = 2760 Width = 495 End Begin VB.HScrollBar hsAdults Height = 315 Left = 6330 Min = 1 TabIndex = 42 Top = 2340 Value = 1 Width = 495 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 39 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 270 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 41 Top = 6570 Width = 11595 End Begin MSDataListLib.DataCombo dcCountry Height = 315 Left = 1680 TabIndex = 6 Top = 2850 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSComCtl2.DTPicker dtpDateIn Height = 345 Left = 5760 TabIndex = 14 Top = 1080 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin VB.PictureBox b8GradLine1 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700
frmCheckIn - 7 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 180 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 46 Top = 240 Width = 3495 End Begin VB.PictureBox b8GradLine3 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 210 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 47 Top = 3780 Width = 3495 End Begin VB.PictureBox b8GradLine4 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 4050 ScaleHeight = 180 ScaleWidth = 4545 TabIndex = 48 Top = 240 Width = 4605 End Begin MSComCtl2.DTPicker dtpDateOut Height = 345 Left = 9090 TabIndex = 20 Top = 1050 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin MSDataListLib.DataCombo dcIDType Height = 315 Left = 1680 TabIndex = 9 Top = 4230 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcRateType Height = 315
frmCheckIn - 8 Left = 5760 TabIndex = 15 Top = 1530 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcBusSource Height = 315 Left = 5760 TabIndex = 19 Top = 3210 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.PictureBox b8GradLine2 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 240 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 75 Top = 5100 Width = 3495 End Begin MSDataListLib.DataCombo dcVehicle Height = 315 Left = 1650 TabIndex = 11 Top = 5370 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.Label Label7 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "R Card No." Height = 300 Left = 240 TabIndex = 81 Top = 1050 Width = 1395 End Begin VB.Label Label16 BackStyle = 0 'Transparent Caption = "Notes" Height = 285 Left = 4530 TabIndex = 79 Top = 4230 Width = 585 End Begin VB.Label Label29 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Plate No." Height = 300
frmCheckIn - 9 Left = 210 TabIndex = 78 Top = 6210 Width = 1395 End Begin VB.Label Label28 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Vehicle Make" Height = 300 Left = 210 TabIndex = 77 Top = 5370 Width = 1395 End Begin VB.Label Label23 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Model" Height = 300 Left = 210 TabIndex = 76 Top = 5790 Width = 1395 End Begin VB.Label Label9 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 74 Top = 3630 Width = 1395 End Begin VB.Label Label24 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Balance" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 73 Top = 4470 Width = 1395 End Begin VB.Label lblAmountPaid Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Amount Paid" ForeColor = &H00FF0000& Height = 300 Left = 7650 TabIndex = 72 Top = 4080 Width = 1395 End Begin VB.Label Label8 Alignment = 1 'Right Justify BackStyle = 0 'Transparent
frmCheckIn - 10 Caption = "Sub Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 71 Top = 2790 Width = 1395 End Begin VB.Label lblOtherCharges Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Other Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FF0000& Height = 300 Left = 7650 TabIndex = 70 Top = 2370 Width = 1395 End Begin VB.Line Line1 BorderStyle = 3 'Dot X1 = 516 X2 = 516 Y1 = 44 Y2 = 274 End Begin VB.Label Label25 BackStyle = 0 'Transparent Caption = "%" Height = 315 Left = 10680 TabIndex = 68 Top = 3180 Width = 165 End Begin VB.Label Label1 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Folio Number" Height = 300 Left = 240 TabIndex = 67 Top = 630 Width = 1395 End Begin VB.Label Label2 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Last Name" Height = 300 Left = 240 TabIndex = 66 Top = 1530 Width = 1395 End Begin VB.Label Label3 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "First name" Height = 300
frmCheckIn - 11 Left = 240 TabIndex = 65 Top = 1980 Width = 1395 End Begin VB.Label Label4 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Address" Height = 300 Left = 240 TabIndex = 64 Top = 2430 Width = 1395 End Begin VB.Label Label5 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Company" Height = 300 Left = 240 TabIndex = 63 Top = 3300 Width = 1395 End Begin VB.Label Label6 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Country" Height = 300 Left = 240 TabIndex = 62 Top = 2850 Width = 1395 End Begin VB.Label Label10 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "ID Number" Height = 300 Left = 240 TabIndex = 61 Top = 4650 Width = 1395 End Begin VB.Label Label11 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "ID Type" Height = 300 Left = 240 TabIndex = 60 Top = 4230 Width = 1395 End Begin VB.Label Label12 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Room Number" Height = 300 Left = 4320 TabIndex = 59 Top = 660 Width = 1395 End Begin VB.Label Label13 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date In" Height = 300 Left = 4320 TabIndex = 58 Top = 1110 Width = 1395 End Begin VB.Label Label14 Alignment = 1 'Right Justify
frmCheckIn - 12 BackStyle = 0 'Transparent Caption = "Date Out" Height = 300 Left = 7650 TabIndex = 57 Top = 1080 Width = 1395 End Begin VB.Label Label15 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate Type" Height = 300 Left = 4320 TabIndex = 56 Top = 1530 Width = 1395 End Begin VB.Label lblRatePerPeriod Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate/Period" ForeColor = &H00FF0000& Height = 300 Left = 7650 TabIndex = 55 Top = 1500 Width = 1395 End Begin VB.Label Label17 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Discount" Height = 300 Left = 7650 TabIndex = 54 Top = 3210 Width = 1395 End Begin VB.Label Label18 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Days" Height = 300 Left = 4320 TabIndex = 53 Top = 1950 Width = 1395 End Begin VB.Label Label19 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Adults" Height = 300 Left = 4320 TabIndex = 52 Top = 2370 Width = 1395 End Begin VB.Label Label20 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Childrens" Height = 300 Left = 4320 TabIndex = 51 Top = 2790 Width = 1395 End Begin VB.Label Label21 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Business Source" Height = 300 Left = 4320 TabIndex = 50 Top = 3210
frmCheckIn - 13 Width = 1395 End Begin VB.Label Label22 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 49 Top = 1950 Width = 1395 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165 Left = 9450 TabIndex = 40 Top = 3030 Width = 45 End EndEnd
Total Charges
Business Source
No. of Childrens
No. of Adults
No. of Days
Discount
Rate/PeriodRate Type
Date OutDate In
Room Number
ID Type
ID Number
Country
Company
Address
First name
Last Name
Folio Number
%
Other Charges
Sub Total
Amount Paid
Balance
Total
Model
Vehicle Make
Plate No.
Notes
R Card No.
6
6
6
6
6
Check InFill all fields or fields with '*' then click 'Save' button to update.
frmCheckInList - 1 Dim CURR_COL As I
Dim rsTransactionDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub Filter SQLParser.Res SQLParser.wCo
frmCheckInList - 2 Exit Sub 'Trap the errorerr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Else MsgBox err.Number & " " & err.Description End If Me.MousePointer = vbDefaultEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsTransactions If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub btnRecOp_Click() frmCustomerRecOp.Show vbModalEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "fftfttt"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
frmCheckInList - 3
Private Sub Form_Load()' mdiMain.AddToWin Me.Caption, Name 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "[Name], RoomNumber, DateIn, DateOut, FolioNumber" .Tables = "qry_CheckIn" .wCondition = "Status = 'Check Out'" .SortOrder = "Name ASC" .SaveStatement End With If rsTransactions.State = 1 Then rsTransactions.Close rsTransactions.CursorLocation = adUseClient Debug.Print CN rsTransactions.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsTransactions, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsTransactions, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "FolioNumber") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCheckInList = NothingEnd Sub
frmCheckInList - 4 Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)' lvList.ToolTipText = lvList.SelectedItem.SubItems(2)End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmCheckInList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCheckInList Caption = "Check In List" ClientHeight = 6120 ClientLeft = 120 ClientTop = 420 ClientWidth = 9195 LinkTopic = "Form1" MDIChild = -1 'True ScaleHeight = 6120 ScaleWidth = 9195 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9195 TabIndex = 9 Top = 5730 Width = 9195 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9195 TabIndex = 8 Top = 5715 Width = 9195 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9195 TabIndex = 0 Top = 5745 Width = 9195 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmCheckInList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 420 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 5 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Name" Object.Width = 4701 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Room" Object.Width = 2240 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmCheckInList - 3 SubItemIndex = 2 Text = "Date In" Object.Width = 3863 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Date Out" Object.Width = 4762 EndProperty BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 4 Text = "Folio Number" Object.Width = 2424 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Check In List" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 120 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 120 Width = 6915 EndEnd
Check In List
Selected Record: 0 0 - 0 of 0
frmCheckOut - 1 Public RoomNumberPublic AmountPaidPublic OtherChargPublic AutoCheckO
Dim RS
Private Sub cmdCaOn Error GoTo err
CN.BeginTrans
frmCheckOut - 2 Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "cmdCheckOut_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub PrintFolio() With frmReports .strReport = "Folio" .strWhere = "{qry_RPT_Customers.FolioNumber} = '" & txtGuestName.Tag & "' AND {qry_RPT_Customers.Status} = 'Check Out'"
frmReports.Show vbModal End WithEnd Sub
Private Sub dtpDateOut_Change() txtDays.Text = dtpDateOut.Value - CDate(txtDateIn.Text) Call ComputeRateEnd Sub
Private Sub dtpDateOut_LostFocus() If CDate(txtDateIn.Text) > dtpDateOut.Value Then MsgBox "Check In date must be below check out date. Please enter another check out date.", vbInformation dtpDateOut.SetFocus End IfEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load()On Error GoTo err
CN.BeginTrans
RS.CursorLocation = adUseClient RS.Open "SELECT * FROM Transactions WHERE RoomNumber = " & RoomNumber & " AND Status = 'Check In'", CN, adOpenStatic, adLockOptimistic
bind_dc "SELECT * FROM [Rate Type]", "RateType", dcRateType, "RateTypeID", True
txtRoomNumber.Text = RoomNumber With RS txtGuestName.Tag = .Fields("FolioNumber") txtGuestName.Text = getValueAt("SELECT [Name] FROM qry_CheckIn WHERE FolioNumber = '" & .Fields("FolioNumber") & " '", "Name") txtDateIn.Text = .Fields("DateIn") If AutoCheckOut = True Then If .Fields("DateOut") >= Date Then dtpDateOut.Value = .Fields("DateOut") Else dtpDateOut.Value = Date End If Else dtpDateOut.Value = .Fields("DateOut") End If dcRateType.BoundText = .Fields("RateType") txtDays.Text = dtpDateOut.Value - CDate(txtDateIn.Text) txtAdults.Text = .Fields("Adults") txtChildrens.Text = .Fields("Childrens") txtRate.Text = toMoney(.Fields("Rate")) txtOtherCharges.Text = toMoney(.Fields("OtherCharges")) txtDiscount.Text = toMoney(.Fields("Discount")) txtAmountPaid.Text = toMoney(.Fields("AmountPaid")) End With
frmCheckOut - 3 dcRateType.Enabled = False Call ComputeAddRate Call ComputeRate
CN.Execute "DELETE FolioNumber " & _ "From [Rate Per Period Temp] " & _ "WHERE FolioNumber='" & txtGuestName.Tag & "'"
CN.Execute "INSERT INTO [Rate Per Period Temp] " & _ "SELECT [Rate Per Period].* " & _ "From [Rate Per Period] " & _ "WHERE FolioNumber='" & txtGuestName.Tag & "'" CN.CommitTrans Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "txtDays_Change" Screen.MousePointer = vbDefaultEnd Sub
Private Sub ComputeRate() txtTotalCharges.Text = toMoney(ComputeRatePerPeriod) txtSubTotal.Text = toMoney(toNumber(txtTotalCharges.Text) + toNumber(txtOtherCharges.Text)) txtTotal.Text = toMoney(toNumber(txtSubTotal.Text) - (toNumber(txtSubTotal.Text) * toNumber(txtDiscount.Text) / 100)) txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
'Compute additional rate (no. of days & childrens)Private Sub ComputeAddRate() Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & RoomNumber & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With rsRoomRates.CloseEnd Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) lblRatePerPeriod.FontUnderline = False lblAmountPaid.FontUnderline = False lblOtherCharges.FontUnderline = FalseEnd Sub
Private Sub Form_Unload(Cancel As Integer) frmRoomsWindow.RefreshRecords Unload frmPayment Set frmPayment = Nothing Set frmCheckOut = NothingEnd Sub
Private Sub lblAmountPaid_Click() With frmPayment .FolioNumber = txtGuestName.Tag .GuestName = txtGuestName.Text .Balance = txtBalance.Text .RefreshBalance Set .RefForm = Me .Show vbModal txtAmountPaid.Text = toMoney(AmountPaid)
frmCheckOut - 4 End WithEnd Sub
Private Sub lblAmountPaid_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblAmountPaid.FontUnderline = TrueEnd Sub
Private Function ComputeRatePerPeriod() As Currency Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtGuestName.Tag & "'", CN, adOpenStatic, adLockOptimistic Do Until .EOF ComputeRatePerPeriod = ComputeRatePerPeriod + toMoney(!Rate) + toMoney(!Adults) + toMoney(!Childrens) .MoveNext Loop End With rsRoomRates.CloseEnd Function
Private Sub lblOtherCharges_Click() With frmOtherCharges .FolioNumber = txtGuestName.Tag .GuestName = txtGuestName.Text Set .RefForm = Me .Show vbModal txtOtherCharges.Text = toMoney(OtherCharges) End WithEnd Sub
Private Sub lblOtherCharges_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblOtherCharges.FontUnderline = TrueEnd Sub
Private Sub lblRatePerPeriod_Click() With frmRatePerPeriod .FolioNumber = txtGuestName.Tag .Show vbModal Call ComputeRate End WithEnd Sub
Private Sub lblRatePerPeriod_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) SetHandCur True lblRatePerPeriod.FontUnderline = TrueEnd Sub
Private Sub txtAmountPaid_Change() txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
Private Sub txtDays_Change()On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset Dim tmpDate As Date Dim minNoofPerson As Integer tmpDate = txtDateIn.Text If txtAdults.Tag = "" Then Exit Sub CN.BeginTrans
frmCheckOut - 5 CN.Execute "DELETE [Date] " & _ "FROM [Rate Per Period] " & _ "WHERE [Date]>#" & dtpDateOut - 1 & "#"
Dim intAdults As Integer minNoofPerson = getValueAt("SELECT * FROM [Room Rates] WHERE RoomNumber = " & RoomNumber & " AND RateTypeID = " & dcRateType.BoundText, "NoofPerson") If txtAdults.Text = minNoofPerson Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - minNoofPerson End If
With rsRatePerPeriod .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & txtGuestName.Tag & "' ORDER BY [Date]", CN, adOpenStatic, adLockOptimistic
Do Until tmpDate > dtpDateOut.Value - 1 .Filter = "[Date] = #" & tmpDate & "#" If .RecordCount = 0 Then .AddNew .Fields("FolioNumber") = txtGuestName.Tag .Fields("Date") = tmpDate .Fields("RoomNumber") = txtRoomNumber.Text .Fields("RateTypeID") = dcRateType.BoundText .Fields("Rate") = txtRate.Text .Fields("Adults") = txtAdults.Tag * intAdults .Fields("Childrens") = toMoney(txtChildrens.Tag) * toNumber(txtChildrens.Text) .Update End If tmpDate = tmpDate + 1 Loop End With CN.CommitTrans rsRatePerPeriod.Close
Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "txtDays_Change" Screen.MousePointer = vbDefaultEnd Sub
frmCheckOut - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmCheckOut BorderStyle = 1 'Fixed Single Caption = "Check Out" ClientHeight = 6615 ClientLeft = 45 ClientTop = 330 ClientWidth = 8130 ControlBox = 0 'False KeyPreview = -1 'True LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 6615 ScaleWidth = 8130 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 6075 Left = 0 ScaleHeight = 405 ScaleMode = 3 'Pixel ScaleWidth = 541 TabIndex = 21 Top = 540 Width = 8115 Begin VB.TextBox txtGuestName Appearance = 0 'Flat Height = 375 Left = 1620 TabIndex = 1 Top = 630 Width = 3015 End Begin VB.TextBox txtTotal Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 13 Text = "0.00" Top = 3930 Width = 1815 End Begin VB.TextBox txtSubTotal Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 11 Text = "0.00" Top = 3090 Width = 1815 End Begin VB.TextBox txtOtherCharges Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 10 Text = "0.00" Top = 2670 Width = 1815 End Begin VB.TextBox txtRoomNumber Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 0 Top = 210 Width = 825
frmCheckOut - 2 End Begin VB.TextBox txtRate Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5070 TabIndex = 8 Text = "0.00" Top = 1830 Width = 1815 End Begin VB.TextBox txtDiscount Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 12 Text = "0.00" Top = 3510 Width = 1575 End Begin VB.TextBox txtDays Alignment = 2 'Center Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 4 Text = "1" Top = 2250 Width = 465 End Begin VB.TextBox txtAdults Alignment = 2 'Center Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 5 Text = "1" Top = 2670 Width = 465 End Begin VB.TextBox txtChildrens Alignment = 2 'Center Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 6 Text = "0" Top = 3090 Width = 465 End Begin VB.TextBox txtTotalCharges Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 9 Text = "0.00" Top = 2250 Width = 1815 End Begin VB.TextBox txtAmountPaid Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 14 Text = "0.00" Top = 4350 Width = 1815 End Begin VB.TextBox txtBalance Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 345 Left = 5040 TabIndex = 15
frmCheckOut - 3 Text = "0.00" Top = 4770 Width = 1815 End Begin VB.TextBox txtDateIn Appearance = 0 'Flat Height = 345 Left = 1620 TabIndex = 2 Top = 1410 Width = 1245 End Begin VB.CommandButton cmdCheckOut Appearance = 0 'Flat Caption = "Check Out" Height = 315 Left = 4860 TabIndex = 16 Top = 5520 Width = 1335 End Begin VB.CommandButton cmdCancel Appearance = 0 'Flat Caption = "Cancel" Height = 315 Left = 6150 TabIndex = 17 Top = 5520 Width = 1335 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 22 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 240 ScaleHeight = 30 ScaleWidth = 7425 TabIndex = 23 Top = 5280 Width = 7425 End Begin MSComCtl2.DTPicker dtpDateOut Height = 345 Left = 5040 TabIndex = 7 Top = 1380 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin MSDataListLib.DataCombo dcRateType Height = 315 Left = 1620 TabIndex = 3 Top = 1860 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Appearance = 0 Style = 2 Text = "" End Begin VB.Label Label25 BackStyle = 0 'Transparent Caption = "%" Height = 315
frmCheckOut - 4 Left = 6630 TabIndex = 41 Top = 3540 Width = 165 End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Guest Name" Height = 195 Left = 690 TabIndex = 40 Top = 660 Width = 885 End Begin VB.Label Label9 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 3600 TabIndex = 39 Top = 3960 Width = 1395 End Begin VB.Label Label24 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Balance" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 3600 TabIndex = 38 Top = 4800 Width = 1395 End Begin VB.Label lblAmountPaid Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Amount Paid" ForeColor = &H00FF0000& Height = 300 Left = 3600 TabIndex = 37 Top = 4410 Width = 1395 End Begin VB.Label Label8 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Sub Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty
frmCheckOut - 5 Height = 300 Left = 3600 TabIndex = 36 Top = 3120 Width = 1395 End Begin VB.Label lblOtherCharges Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Other Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FF0000& Height = 300 Left = 3600 TabIndex = 35 Top = 2700 Width = 1395 End Begin VB.Line Line1 BorderStyle = 3 'Dot X1 = 248 X2 = 248 Y1 = 90 Y2 = 340 End Begin VB.Label Label12 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Room Number" Height = 300 Left = 180 TabIndex = 34 Top = 240 Width = 1395 End Begin VB.Label Label13 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date In" Height = 300 Left = 180 TabIndex = 33 Top = 1440 Width = 1395 End Begin VB.Label Label14 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date Out" Height = 300 Left = 3600 TabIndex = 32 Top = 1410 Width = 1395 End Begin VB.Label Label15 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate Type" Height = 300 Left = 180 TabIndex = 31 Top = 1860 Width = 1395 End Begin VB.Label lblRatePerPeriod Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate/Period"
frmCheckOut - 6 ForeColor = &H00FF0000& Height = 300 Left = 3600 TabIndex = 30 Top = 1860 Width = 1395 End Begin VB.Label Label17 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Discount" Height = 300 Left = 3600 TabIndex = 29 Top = 3540 Width = 1395 End Begin VB.Label Label18 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Days" Height = 300 Left = 180 TabIndex = 28 Top = 2280 Width = 1395 End Begin VB.Label Label19 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Adults" Height = 300 Left = 180 TabIndex = 27 Top = 2700 Width = 1395 End Begin VB.Label Label20 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Childrens" Height = 300 Left = 180 TabIndex = 26 Top = 3120 Width = 1395 End Begin VB.Label Label22 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 3600 TabIndex = 25 Top = 2280 Width = 1395 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False
frmCheckOut - 7 EndProperty Height = 165 Left = 9450 TabIndex = 24 Top = 3030 Width = 45 End End Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 479 TabIndex = 18 Top = 0 Width = 7185 Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Check Out" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 20 Top = 30 Width = 1470 End Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 19 Top = 360 Width = 3900 End EndEnd
Fill all fields or fields with '*' then click 'Save' button to update.
Check Out
Total Charges
No. of Childrens
No. of Adults
No. of Days
Discount
Rate/PeriodRate Type
Date OutDate In
Room Number
Other Charges
Sub Total
Amount Paid
Balance
Total
Guest Name
%
6
frmCloseShift - 1 Dim RS As New Rec
Private Sub CmdCl Unload MeEnd Sub
Private Sub CmdCl mdiMain.Unloa CurrUser.USER CurrUser.USER
frmCloseShift - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCloseShift BorderStyle = 1 'Fixed Single Caption = "Cashier Report" ClientHeight = 5325 ClientLeft = 45 ClientTop = 330 ClientWidth = 5040 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5325 ScaleWidth = 5040 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton CmdClose Caption = "Close" Height = 405 Left = 3480 TabIndex = 2 Top = 4740 Width = 1335 End Begin VB.CommandButton CmdCloseShift Caption = "Close Shift" Height = 405 Left = 2130 TabIndex = 1 Top = 4740 Width = 1335 End Begin MSComctlLib.ListView lvList Height = 4290 Left = 210 TabIndex = 0 Top = 300 Width = 4665 _ExtentX = 8229 _ExtentY = 7567 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 ForeColor = -2147483640 BackColor = -2147483643 BorderStyle = 1 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 2 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Type" Object.Width = 5362 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} Alignment = 1 SubItemIndex = 1 Text = "Amount" Object.Width = 2540 EndProperty End Begin MSComctlLib.ImageList i16x16 Left = 4020 Top = 120 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643
frmCloseShift - 2 ImageWidth = 16 ImageHeight = 16 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 6 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty EndProperty EndEnd
frmCompany - 1
Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ
frmCompany - 2 Unload Me End IfEnd Sub
Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM Company WHERE CompanyID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False PK = getIndex("Company") Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmCompanyList.RefreshRecords End If End If Set frmCompany = NothingEnd Sub
Private Sub txtEntry_GotFocus(Index As Integer) HLText txtEntry(Index)End Sub
frmCompany - 1 VERSION 5.00Begin VB.Form frmCompany BorderStyle = 1 'Fixed Single Caption = "Company" ClientHeight = 4335 ClientLeft = 45 ClientTop = 330 ClientWidth = 6405 KeyPreview = -1 'True LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 4335 ScaleWidth = 6405 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Index = 0 Left = 1680 MaxLength = 100 TabIndex = 0 Tag = "Company" Top = 180 Width = 2415 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 765 TabIndex = 10 Top = 3690 Width = 1680 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 4605 TabIndex = 9 Top = 3675 Width = 1335 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 3165 TabIndex = 8 Top = 3675 Width = 1335 End Begin VB.TextBox txtEntry Height = 285 Index = 2 Left = 1680 MaxLength = 100 TabIndex = 2 Top = 975 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 1 Left = 1680 MaxLength = 100 TabIndex = 1 Top = 600 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 3 Left = 1680 MaxLength = 100 TabIndex = 3 Top = 1365 Width = 3840 End
frmCompany - 2 Begin VB.TextBox txtEntry Height = 285 Index = 5 Left = 1680 MaxLength = 100 TabIndex = 5 Top = 2115 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 4 Left = 1680 MaxLength = 100 TabIndex = 4 Top = 1740 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 7 Left = 1680 MaxLength = 100 TabIndex = 7 Top = 2835 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 6 Left = 1680 MaxLength = 100 TabIndex = 6 Top = 2460 Width = 2415 End Begin VB.PictureBox b8Line1 Height = 30 Left = 495 ScaleHeight = 30 ScaleWidth = 5415 TabIndex = 11 Top = 3450 Width = 5415 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Company" Height = 240 Index = 7 Left = 480 TabIndex = 19 Top = 180 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Lastname" Height = 240 Index = 1 Left = 480 TabIndex = 18 Top = 600 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Firstname" Height = 240 Index = 0 Left = 480 TabIndex = 17 Top = 975 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify
frmCompany - 3 Caption = "Address" Height = 240 Index = 2 Left = 480 TabIndex = 16 Top = 1365 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Email Address" Height = 240 Index = 3 Left = 480 TabIndex = 15 Top = 1740 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Tel No" Height = 240 Index = 4 Left = 480 TabIndex = 14 Top = 2115 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Mobile No" Height = 240 Index = 5 Left = 480 TabIndex = 13 Top = 2460 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Fax No" Height = 240 Index = 6 Left = 480 TabIndex = 12 Top = 2835 Width = 1140 EndEnd
Fax No
Mobile No
Tel No
Email Address
Address
Firstname
Lastname
Company
frmCompanyList - 1 Option Explicit
Dim CURR_COL As IDim rsCompany As Dim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmCompanyList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsCompany If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmCompanyList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Company,LastName,FirstName,Address,EmailAddress,TelNo,MobileNo,FaxNo,CompanyID" .Tables = "[Company]" .SortOrder = "LastName ASC" .SaveStatement End With rsCompany.CursorLocation = adUseClient rsCompany.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCompany, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCompany, RecordPage.PageStart, RecordPage.PageEnd, 8, 2, False, True, , , , "CompanyID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCompanyList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmCompanyList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmCompanyList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCompanyList Caption = "Company" ClientHeight = 6000 ClientLeft = 60 ClientTop = 345 ClientWidth = 8100 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 6000 ScaleWidth = 8100 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8100 TabIndex = 9 Top = 5610 Width = 8100 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8100 TabIndex = 8 Top = 5595 Width = 8100 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8100 TabIndex = 0 Top = 5625 Width = 8100 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmCompanyList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 510 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 9 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Company" Object.Width = 6288 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Lastname" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmCompanyList - 3 SubItemIndex = 2 Text = "Firstname" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Address" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 4 Text = "Email Add" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 5 Text = "Tel No" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 6 Text = "Mobile No" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 7 Text = "Fax No" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(9) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 8 Text = "Company ID" Object.Width = 0 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Company" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 210 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 210 Width = 6915 EndEnd
Company
Selected Record: 0 0 - 0 of 0
frmCompanyLookup - 1 Option Explicit
Public RefForm
Dim CURR_COL
Dim rsCompany Dim RecordPage Dim SQLParser
frmCompanyLookup - 2
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Company, LastName, FirstName, Address, TelNo, CompanyID" .Tables = "Company" .SortOrder = "Company ASC" .SaveStatement End With If rsCompany.State = 1 Then rsCompany.Close rsCompany.CursorLocation = adUseClient Debug.Print CN rsCompany.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCompany, 75 FillList 1 End With
cboField.ListIndex = 0End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCompany, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "CompanyID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize1() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer)' mdiMain.RemToWin Me.Caption' mdiMain.HideTBButton "", True Set frmCustomerLookup = NothingEnd Sub
Private Sub SetNavigation() With RecordPage
frmCompanyLookup - 3 If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() RefForm.txtCompany.Text = lvList.SelectedItem Unload MeEnd Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)' If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
Private Sub txtSearch_Change() If txtSearch.Text = "" Then RefreshRecords FilterRecord "[" & cboField.Text & "] Like '" & txtSearch.Text & "%'"End Sub
frmCompanyLookup - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCompanyLookup BorderStyle = 1 'Fixed Single Caption = "Company" ClientHeight = 5355 ClientLeft = 45 ClientTop = 330 ClientWidth = 7500 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5355 ScaleWidth = 7500 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 7500 TabIndex = 6 Top = 4980 Width = 7500 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 7 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 11 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 10 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 9 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 8 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 12
frmCompanyLookup - 2 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 13 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 7500 TabIndex = 5 Top = 4950 Width = 7500 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 7500 TabIndex = 4 Top = 4965 Width = 7500 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 375 Left = 6510 TabIndex = 3 Top = 4440 Width = 735 End Begin VB.CommandButton cmdOK Caption = "OK" Height = 375 Left = 5640 TabIndex = 2 Top = 4440 Width = 795 End Begin VB.TextBox txtSearch Height = 315 Left = 3180 TabIndex = 1 Top = 120 Width = 1515 End Begin VB.ComboBox cboField Height = 315 Left = 1560 Style = 2 'Dropdown List TabIndex = 0 Top = 120 Width = 1515 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 30 TabIndex = 14 Top = 900 Width = 7260
frmCompanyLookup - 3 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 6 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Company" Object.Width = 2937 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Last Name" Object.Width = 2240 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 2 Text = "First Name" Object.Width = 3863 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Address" Object.Width = 4762 EndProperty BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 4 Text = "Tel No" Object.Width = 2424 EndProperty BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 5 Text = "Customer ID" Object.Width = 0 EndProperty End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 30 Top = 600 Width = 6915 End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Customers" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210
frmCompanyLookup - 4 Left = 105 TabIndex = 16 Top = 600 Width = 4815 End Begin VB.Label Label1 Caption = "Search" Height = 285 Left = 210 TabIndex = 15 Top = 120 Width = 1185 EndEnd
Search
Customers
Selected Record: 0 0 - 0 of 0
frmCountries - 1 Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ On Error GoTo
frmCountries - 2 "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Countries] WHERE CountryID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmCountriesList.RefreshRecords End If End If Set frmCountries = NothingEnd Sub
frmCountries - 1 VERSION 5.00Begin VB.Form frmCountries BorderStyle = 1 'Fixed Single Caption = "Countries" ClientHeight = 1740 ClientLeft = 45 ClientTop = 330 ClientWidth = 5640 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1740 ScaleWidth = 5640 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 330 TabIndex = 3 Top = 1125 Width = 1680 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3870 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2430 TabIndex = 1 Top = 1125 Width = 1335 End Begin VB.TextBox txtEntry Height = 285 Left = 1770 MaxLength = 100 TabIndex = 0 Tag = "Category" Top = 210 Width = 3030 End Begin VB.PictureBox b8Line1 Height = 30 Left = 150 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 4 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Country" Height = 240 Left = 450 TabIndex = 5 Top = 210 Width = 1215 EndEnd
Country
frmCountriesList - 1 Option Explicit
Dim CURR_COL As IDim rsCountry As Dim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmCountriesList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsCountry If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmCountriesList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Country,CountryID" .Tables = "[Countries]" .SortOrder = "Country ASC" .SaveStatement End With rsCountry.CursorLocation = adUseClient rsCountry.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCountry, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCountry, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "CountryID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCountriesList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmCountriesList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmCountriesList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCountriesList Caption = "Countries" ClientHeight = 5985 ClientLeft = 60 ClientTop = 345 ClientWidth = 8610 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5985 ScaleWidth = 8610 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8610 TabIndex = 9 Top = 5580 Width = 8610 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8610 TabIndex = 8 Top = 5595 Width = 8610 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8610 TabIndex = 0 Top = 5610 Width = 8610 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmCountriesList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 450 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Countries" BeginProperty Font Name = "Tahoma"
frmCountriesList - 3 Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 150 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 150 Width = 6915 EndEnd
Countries
Selected Record: 0 0 - 0 of 0
frmCustomerLookup - 1 Option Explicit
Public RefForm
Dim CURR_COL
Dim rsCustomers Dim RecordPage Dim SQLParser
frmCustomerLookup - 2
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "LastName, FirstName, Address, TelNo, CustomerID" .Tables = "Customers" .SortOrder = "LastName ASC" .SaveStatement End With If rsCustomers.State = 1 Then rsCustomers.Close rsCustomers.CursorLocation = adUseClient Debug.Print CN rsCustomers.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCustomers, 75 FillList 1 End With
cboField.ListIndex = 0End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCustomers, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "CustomerID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize1() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer)' mdiMain.RemToWin Me.Caption' mdiMain.HideTBButton "", True Set frmCustomerLookup = NothingEnd Sub
Private Sub SetNavigation() With RecordPage
frmCustomerLookup - 3 If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() RefForm.txtLastName.Text = lvList.SelectedItem RefForm.txtFirstName.Text = lvList.SelectedItem.SubItems(1) Unload MeEnd Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)' If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
Private Sub txtSearch_Change() If txtSearch.Text = "" Then RefreshRecords FilterRecord "[" & cboField.Text & "] Like '" & txtSearch.Text & "%'"End Sub
frmCustomerLookup - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCustomerLookup BorderStyle = 1 'Fixed Single Caption = "Customers" ClientHeight = 5355 ClientLeft = 45 ClientTop = 330 ClientWidth = 7500 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5355 ScaleWidth = 7500 StartUpPosition = 2 'CenterScreen Begin VB.ComboBox cboField Height = 315 Left = 1560 Style = 2 'Dropdown List TabIndex = 16 Top = 90 Width = 1515 End Begin VB.TextBox txtSearch Height = 315 Left = 3180 TabIndex = 14 Top = 90 Width = 1515 End Begin VB.CommandButton cmdOK Caption = "OK" Height = 375 Left = 5640 TabIndex = 13 Top = 4410 Width = 795 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 375 Left = 6510 TabIndex = 12 Top = 4410 Width = 735 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 7500 TabIndex = 9 Top = 4950 Width = 7500 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 7500 TabIndex = 8 Top = 4965 Width = 7500 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0
frmCustomerLookup - 2 ScaleHeight = 375 ScaleWidth = 7500 TabIndex = 0 Top = 4980 Width = 7500 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 30 TabIndex = 10 Top = 870 Width = 7260
frmCustomerLookup - 3 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 5 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Last Name" Object.Width = 2240 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "First Name" Object.Width = 3863 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 2 Text = "Address" Object.Width = 4762 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Tel No" Object.Width = 2424 EndProperty BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 4 Text = "Customer ID" Object.Width = 0 EndProperty End Begin VB.Label Label1 Caption = "Search" Height = 285 Left = 210 TabIndex = 15 Top = 90 Width = 1185 End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Customers" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 105 TabIndex = 11 Top = 570 Width = 4815 End Begin VB.Shape shpBar
frmCustomerLookup - 4 BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 30 Top = 570 Width = 6915 EndEnd
Customers
Search
Selected Record: 0 0 - 0 of 0
frmCustomers - 1
Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ
frmCustomers - 2 End IfEnd Sub
Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM Customers WHERE CustomerID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False PK = getIndex("Customers") Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmCustomersList.RefreshRecords End If End If Set frmCustomers = NothingEnd Sub
Private Sub txtEntry_GotFocus(Index As Integer) HLText txtEntry(Index)End Sub
frmCustomers - 1 VERSION 5.00Begin VB.Form frmCustomers BorderStyle = 1 'Fixed Single Caption = "Customers" ClientHeight = 4050 ClientLeft = 45 ClientTop = 330 ClientWidth = 6405 KeyPreview = -1 'True LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 4050 ScaleWidth = 6405 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Index = 5 Left = 1605 MaxLength = 100 TabIndex = 5 Top = 2190 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 6 Left = 1605 MaxLength = 100 TabIndex = 6 Top = 2565 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 3 Left = 1605 MaxLength = 100 TabIndex = 3 Top = 1470 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 4 Left = 1605 MaxLength = 100 TabIndex = 4 Top = 1845 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 2 Left = 1605 MaxLength = 100 TabIndex = 2 Top = 1095 Width = 3840 End Begin VB.TextBox txtEntry Height = 285 Index = 0 Left = 1605 MaxLength = 100 TabIndex = 0 Tag = "Lastname" Top = 330 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 1 Left = 1605 MaxLength = 100 TabIndex = 1 Tag = "Firstname"
frmCustomers - 2 Top = 705 Width = 2415 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 3090 TabIndex = 7 Top = 3405 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 4530 TabIndex = 8 Top = 3405 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 690 TabIndex = 9 Top = 3420 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 420 ScaleHeight = 30 ScaleWidth = 5415 TabIndex = 10 Top = 3180 Width = 5415 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Fax No" Height = 240 Index = 6 Left = 405 TabIndex = 17 Top = 2565 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Mobile No" Height = 240 Index = 5 Left = 405 TabIndex = 16 Top = 2190 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Tel No" Height = 240 Index = 4 Left = 405 TabIndex = 15 Top = 1845 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Email Address" Height = 240 Index = 3 Left = 405 TabIndex = 14 Top = 1470 Width = 1140 End
frmCustomers - 3 Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Address" Height = 240 Index = 2 Left = 405 TabIndex = 13 Top = 1095 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Firstname" Height = 240 Index = 0 Left = 405 TabIndex = 12 Top = 705 Width = 1140 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Lastname" Height = 240 Index = 1 Left = 405 TabIndex = 11 Top = 330 Width = 1140 EndEnd
Lastname
Firstname
Address
Email Address
Tel No
Mobile No
Fax No
frmCustomersList - 1 Option Explicit
Dim CURR_COL As IDim rsCustomers ADim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmCustomersList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsCustomers If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmCustomersList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "LastName,FirstName,Address,EmailAddress,TelNo,MobileNo,FaxNo,CustomerID" .Tables = "[Customers]" .SortOrder = "LastName ASC" .SaveStatement End With rsCustomers.CursorLocation = adUseClient rsCustomers.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsCustomers, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsCustomers, RecordPage.PageStart, RecordPage.PageEnd, 8, 2, False, True, , , , "CustomerID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCustomersList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmCustomersList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmCustomersList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmCustomersList Caption = "Customers" ClientHeight = 5940 ClientLeft = 60 ClientTop = 345 ClientWidth = 7515 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5940 ScaleWidth = 7515 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 7515 TabIndex = 2 Top = 5565 Width = 7515 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmCustomersList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 7515 TabIndex = 1 Top = 5550 Width = 7515 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 7515 TabIndex = 0 Top = 5535 Width = 7515 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 510 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 8 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Lastname" Object.Width = 6288 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Firstname" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmCustomersList - 3 SubItemIndex = 2 Text = "Address" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Email Add" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 4 Text = "Tel No" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 5 Text = "Mobile No" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 6 Text = "Fax No" Object.Width = 2540 EndProperty BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 7 Text = "Customer ID" Object.Width = 0 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Customers" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 210 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 210 Width = 6915 EndEnd
Customers
Selected Record: 0 0 - 0 of 0
frmErrMsg - 1 Option Explicit
Dim mModuleName ADim mRoutineName Dim mDetail As String
'Public Sub ShowFring)''
frmErrMsg - 1 VERSION 5.00Begin VB.Form frmErrMsg BorderStyle = 1 'Fixed Single Caption = "3JNet - Unhandled error" ClientHeight = 4245 ClientLeft = 45 ClientTop = 345 ClientWidth = 5730 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 4245 ScaleWidth = 5730 StartUpPosition = 3 'Windows Default Begin VB.CommandButton cmdClose Cancel = -1 'True Caption = "&Close" Default = -1 'True Height = 345 Left = 4470 TabIndex = 0 Top = 3780 Width = 1155 End Begin VB.Image Image1 Height = 4260 Left = 0 Picture = (Bitmap) Top = 0 Width = 5745 End Begin VB.Label lblMsg BackStyle = 0 'Transparent Caption = "Unknown Error!" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000040C0& Height = 3345 Left = 2130 TabIndex = 1 Top = 660 Width = 3315 EndEnd
Unknown Error!
frmIDType - 1 Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ On Error GoTo
frmIDType - 2 "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [ID Type] WHERE IDTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmIDTypeList.RefreshRecords End If End If Set frmIDType = NothingEnd Sub
frmIDType - 1 VERSION 5.00Begin VB.Form frmIDType BorderStyle = 1 'Fixed Single Caption = "Form2" ClientHeight = 1725 ClientLeft = 45 ClientTop = 330 ClientWidth = 5550 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1725 ScaleWidth = 5550 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1710 MaxLength = 100 TabIndex = 3 Tag = "Category" Top = 210 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2370 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3810 TabIndex = 1 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 270 TabIndex = 0 Top = 1125 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 90 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 4 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "ID Type" Height = 240 Left = 390 TabIndex = 5 Top = 210 Width = 1215 EndEnd
ID Type
frmIDTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsIDType As NDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmIDTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsIDType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmIDTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "IDType,IDTypeID" .Tables = "[ID Type]" .SortOrder = "IDType ASC" .SaveStatement End With rsIDType.CursorLocation = adUseClient rsIDType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsIDType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsIDType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "IDTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmIDTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmIDTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmIDTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmIDTypeList BorderStyle = 1 'Fixed Single Caption = "ID Type" ClientHeight = 5565 ClientLeft = 45 ClientTop = 330 ClientWidth = 7710 LinkTopic = "Form2" MaxButton = 0 'False MDIChild = -1 'True MinButton = 0 'False ScaleHeight = 5565 ScaleWidth = 7710 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 7710 TabIndex = 2 Top = 5190 Width = 7710 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8
frmIDTypeList - 2 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 7710 TabIndex = 1 Top = 5175 Width = 7710 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 7710 TabIndex = 0 Top = 5160 Width = 7710 End Begin MSComctlLib.ListView lvList Height = 3435 Left = -30 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent
frmIDTypeList - 3 Caption = "ID Type" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 45 TabIndex = 11 Top = 150 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = -30 Top = 150 Width = 6915 EndEnd
ID Type
Selected Record: 0 0 - 0 of 0
frmInventoryView - 1 Option Explicit
Dim CURR_COL As IDim rsInventory ADim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmInventoryView - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsInventory If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub CmdChange_Click() Call UpdateDate FilterRecord "Format([Date],'m') = " & cbMonth.ListIndex + 1End Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load()
frmInventoryView - 3 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With cbMonth.ListIndex = Month(Date) - 1 txtYear.Text = Year(Date) Call UpdateDate Dim rsRooms As New Recordset With rsRooms .Open "SELECT RoomNumber FROM Rooms", CN, adOpenStatic, adLockOptimistic lvList.ColumnHeaders.Add , , "Date" If .RecordCount > 0 Then Do While Not .EOF lvList.ColumnHeaders.Add , , .Fields("RoomNumber") .MoveNext Loop End If End With With SQLParser '.Fields = "[Date],[201],[202],203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321" .Fields = "*" .Tables = "[qry_Inventory_View]" .wCondition = "Format([Date],'m') = " & cbMonth.ListIndex + 1 .SortOrder = "[Date] ASC" .SaveStatement End With rsInventory.CursorLocation = adUseClient rsInventory.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsInventory, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsInventory, RecordPage.PageStart, RecordPage.PageEnd, 40, 2, False, True, , , , "Date") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195
frmInventoryView - 4 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmInventoryView = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidth
frmInventoryView - 5 End Sub
Private Sub UpdateDate() On Error Resume Next CN.Execute "UPDATE DateTemp SET DateTemp.[Date] = '" & cbMonth.ListIndex + 1 & "' & '/' & Day([Date]) & '/' & '" & txtYear.Text & "'"End Sub
frmInventoryView - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmInventoryView Caption = "Inventory View" ClientHeight = 7170 ClientLeft = 60 ClientTop = 345 ClientWidth = 9375 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 7170 ScaleWidth = 9375 Begin VB.CommandButton CmdChange Caption = "Change" Height = 315 Left = 5070 TabIndex = 16 Top = 90 Width = 1245 End Begin VB.TextBox txtYear Height = 315 Left = 3300 TabIndex = 13 Top = 90 Width = 1515 End Begin VB.ComboBox cbMonth Height = 315 Left = 840 Style = 2 'Dropdown List TabIndex = 12 Top = 90 Width = 1725 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9375 TabIndex = 2 Top = 6795 Width = 9375 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5
frmInventoryView - 2 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9375 TabIndex = 1 Top = 6780 Width = 9375 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9375 TabIndex = 0 Top = 6765 Width = 9375 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 870 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1"
frmInventoryView - 3 ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 0 End Begin VB.Label Label2 AutoSize = -1 'True Caption = "Year" Height = 195 Left = 2850 TabIndex = 15 Top = 120 Width = 330 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Month" Height = 195 Left = 240 TabIndex = 14 Top = 120 Width = 450 End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Inventory View" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 570 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 570 Width = 6915 EndEnd
Inventory View
Month Year
Selected Record: 0 0 - 0 of 0
frmLocate - 1 Option Explicit
Private Sub cmdBr dlgOpen.ShowOpen txtPath.Text = End Sub
Private Sub cmdCa If CN.State = 1 EndEnd Sub
frmLocate - 1 VERSION 5.00Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"Begin VB.Form frmLocate BorderStyle = 1 'Fixed Single Caption = "Locate Database" ClientHeight = 2295 ClientLeft = 45 ClientTop = 345 ClientWidth = 4980 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2295 ScaleWidth = 4980 StartUpPosition = 3 'Windows Default Begin VB.TextBox txtPath Height = 315 Left = 600 TabIndex = 3 Top = 1320 Width = 3615 End Begin VB.CommandButton cmdBrowse Caption = "..." Height = 345 Left = 4260 TabIndex = 2 Top = 1320 Width = 375 End Begin VB.CommandButton cmdOK Caption = "OK" Height = 315 Left = 2490 TabIndex = 1 Top = 1770 Width = 1035 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3600 TabIndex = 0 Top = 1770 Width = 1035 End Begin MSComDlg.CommonDialog dlgOpen Left = 3000 Top = 270 _ExtentX = 847 _ExtentY = 847 _Version = 393216 End Begin VB.Frame Frame1 Caption = "Data Provider" Height = 1005 Left = 90 TabIndex = 4 Top = 150 Width = 4605 Begin VB.OptionButton optJet4 Caption = "Microsoft Jet OLEDB 4.0" Height = 285 Left = 150 TabIndex = 6 Top = 300 Value = -1 'True Width = 2655 End Begin VB.OptionButton Option1 Caption = "ODBC" Enabled = 0 'False Height = 285 Left = 150 TabIndex = 5 Top = 630 Width = 2655
frmLocate - 2 End End Begin VB.Label Label1 Caption = "Path" Height = 285 Left = 90 TabIndex = 7 Top = 1350 Width = 765 EndEnd
Path
frmLogin - 1 Option Explicit
Private Sub cmdCa modMain.Close Unload MeEnd Sub
Private Sub cmdLo 'Verify If dcUser.Tex If txtPass.Te
frmLogin - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Begin VB.Form frmLogin BorderStyle = 4 'Fixed ToolWindow Caption = "User's Login" ClientHeight = 3420 ClientLeft = 45 ClientTop = 315 ClientWidth = 4830 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3420 ScaleWidth = 4830 ShowInTaskbar = 0 'False StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtPass BeginProperty Font Name = "Webdings" Size = 8.25 Charset = 2 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 IMEMode = 3 'DISABLE Left = 1170 MaxLength = 20 PasswordChar = "=" TabIndex = 1 Top = 2280 Width = 3105 End Begin VB.CommandButton cmdCancel Cancel = -1 'True Caption = "&Cancel" Height = 375 Left = 3360 TabIndex = 3 Top = 2970 Width = 1395 End Begin VB.CommandButton cmdLogin Caption = "&Login" Default = -1 'True BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 1800 TabIndex = 2 Top = 2970 Width = 1395 End Begin MSDataListLib.DataCombo dcUser Height = 315 Left = 1170 TabIndex = 0 Top = 1740 Width = 3105 _ExtentX = 5477 _ExtentY = 556 _Version = 393216 Style = 2 BackColor = -2147483643 ForeColor = -2147483640 Text = "" BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma"
frmLogin - 2 Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty End Begin VB.Label Label1 Appearance = 0 'Flat AutoSize = -1 'True BackColor = &H80000005& BackStyle = 0 'Transparent Caption = "&User Name:" ForeColor = &H00004040& Height = 195 Left = 150 TabIndex = 5 Top = 1785 Width = 840 End Begin VB.Label Label2 Appearance = 0 'Flat AutoSize = -1 'True BackColor = &H80000005& BackStyle = 0 'Transparent Caption = "&Password:" ForeColor = &H00004040& Height = 195 Left = 150 TabIndex = 4 Top = 2310 Width = 750 End Begin VB.Image Image1 Height = 1335 Left = 0 Picture = (Bitmap) Top = 0 Width = 4830 EndEnd
Password:
User Name: 6
frmOtherCharges - 1 Public FolioNumbePublic GuestName Public RefForm
Dim OtherCharges Dim cIRowCount
Private Sub btnRe 'Remove selec With Grid 'Update t
frmOtherCharges - 2
Public Sub cmdSave_Click() Dim rsOtherCharges As New Recordset
rsOtherCharges.CursorLocation = adUseClient rsOtherCharges.Open "SELECT * FROM [Other Charges] WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic DeleteItems Dim c As Integer With Grid 'Save the details of the records For c = 1 To cIRowCount .Row = c If .TextMatrix(c, 1) = "" Then rsOtherCharges.AddNew rsOtherCharges![FolioNumber] = FolioNumber Else rsOtherCharges.Filter = "OtherChargesID = " & toNumber(.TextMatrix(c, 1)) If rsOtherCharges.RecordCount = 0 Then rsOtherCharges.AddNew rsOtherCharges![FolioNumber] = FolioNumber End If End If
rsOtherCharges![Date] = .TextMatrix(c, 3) rsOtherCharges![ChargeTypeID] = getValueAt("SELECT * FROM [Charge Type] WHERE ChargeType = '" & .TextMatrix(c, 4) & "'", "ChargeTypeID") rsOtherCharges![Description] = .TextMatrix(c, 5) rsOtherCharges![Amount] = .TextMatrix(c, 6)
rsOtherCharges.Update
OtherCharges = OtherCharges + .TextMatrix(c, 6) Next c End With
'Clear variables c = 0 Set rsOtherCharges = Nothing Unload frmOtherChargesEnd Sub
Private Sub cmdUpdate_Click() With Grid .TextMatrix(.RowSel, 3) = dtpDate.Value .TextMatrix(.RowSel, 4) = dcChargeType.Text .TextMatrix(.RowSel, 5) = txtDescription.Text .TextMatrix(.RowSel, 6) = toMoney(txtAmount.Text) End WithEnd Sub
Private Sub Form_Activate() OtherCharges = 0End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() Call InitGrid bind_dc "SELECT * FROM [Charge Type]", "ChargeType", dcChargeType, "ChargeTypeID", True
txtGuestName.Text = GuestName dtpDate.Value = Date
frmOtherCharges - 3 DisplayForEditingEnd Sub
'Procedure used to initialize the gridPrivate Sub InitGrid() cIRowCount = 0 With Grid .Clear .ClearStructure .Rows = 2 .FixedRows = 1 .FixedCols = 1 .Cols = 7 .ColSel = 6 'Initialize the column size .ColWidth(0) = 315 .ColWidth(1) = 0 .ColWidth(2) = 0 .ColWidth(3) = 1200 .ColWidth(4) = 1500 .ColWidth(5) = 1700 .ColWidth(6) = 1200
'Initialize the column name .TextMatrix(0, 0) = "" .TextMatrix(0, 1) = "Other Charges ID" .TextMatrix(0, 2) = "Folio Number" .TextMatrix(0, 3) = "Date" .TextMatrix(0, 4) = "Charge Type" .TextMatrix(0, 5) = "Description" .TextMatrix(0, 6) = "Amount" End WithEnd Sub
Private Sub Form_Unload(Cancel As Integer) Set frmPayment = NothingEnd Sub
Private Sub Grid_Click() With Grid If .TextMatrix(.RowSel, 3) = "" Then Exit Sub dtpDate.Value = .TextMatrix(.RowSel, 3) dcChargeType.Text = .TextMatrix(.RowSel, 4) txtDescription.Text = .TextMatrix(.RowSel, 5) txtAmount.Text = .TextMatrix(.RowSel, 6) If Grid.Rows = 2 And Grid.TextMatrix(1, 2) = "" Then '1 = Folio Number btnRemove.Visible = False Else btnRemove.Visible = True btnRemove.Top = (Grid.CellTop + Grid.Top) - 20 btnRemove.Left = Grid.Left + 50 End If End WithEnd Sub
Private Sub ResetFields() txtAmount.Text = "" dcChargeType.SetFocusEnd Sub
Private Sub DisplayForEditing() On Error GoTo err 'Display the details Dim rsOtherCharges As New Recordset
cIRowCount = 0 rsOtherCharges.CursorLocation = adUseClient rsOtherCharges.Open "SELECT * FROM qry_Other_Charges WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic If rsOtherCharges.RecordCount > 0 Then
frmOtherCharges - 4 rsOtherCharges.MoveFirst While Not rsOtherCharges.EOF cIRowCount = cIRowCount + 1 'increment With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsOtherCharges!OtherChargesID .TextMatrix(1, 2) = rsOtherCharges!FolioNumber .TextMatrix(1, 3) = rsOtherCharges!Date .TextMatrix(1, 4) = rsOtherCharges!ChargeType .TextMatrix(1, 5) = rsOtherCharges!Description .TextMatrix(1, 6) = toMoney(rsOtherCharges!Amount) Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsOtherCharges!OtherChargesID .TextMatrix(.Rows - 1, 2) = rsOtherCharges!FolioNumber .TextMatrix(.Rows - 1, 3) = rsOtherCharges!Date .TextMatrix(.Rows - 1, 4) = rsOtherCharges!ChargeType .TextMatrix(.Rows - 1, 5) = rsOtherCharges!Description .TextMatrix(.Rows - 1, 6) = toMoney(rsOtherCharges!Amount) End If End With rsOtherCharges.MoveNext Wend Grid.Row = 1 Grid.ColSel = 6 'Set fixed cols If State = adStateEditMode Then Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If End If
rsOtherCharges.Close 'Clear variables Set rsOtherCharges = Nothing
Exit Suberr: If err.Number = 94 Then Resume Next prompt_err err, Name, "DisplayForEditing" Screen.MousePointer = vbDefaultEnd Sub
Private Sub DeleteItems() Dim CurrRow As Integer Dim rsOtherCharges As New Recordset
rsOtherCharges.CursorLocation = adUseClient rsOtherCharges.Open "SELECT * FROM [Other Charges] WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic If rsOtherCharges.RecordCount > 0 Then rsOtherCharges.MoveFirst While Not rsOtherCharges.EOF CurrRow = getFlexPos(Grid, 1, rsOtherCharges!OtherChargesID) 'Add to grid With Grid If CurrRow < 0 Then 'Delete record if doesnt exist in flexgrid DelRecwSQL "[Other Charges]", "OtherChargesID", "", True, rsOtherCharges!OtherChargesID End If End With rsOtherCharges.MoveNext Wend End IfEnd Sub
Private Sub txtAmount_GotFocus() HLText txtAmountEnd Sub
Private Sub txtAmount_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
frmOtherCharges - 5
Private Sub txtAmount_Validate(Cancel As Boolean) txtAmount.Text = toMoney(txtAmount.Text)End Sub
frmOtherCharges - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"Begin VB.Form frmOtherCharges BorderStyle = 1 'Fixed Single Caption = "Other Charges" ClientHeight = 5070 ClientLeft = 45 ClientTop = 330 ClientWidth = 8730 ControlBox = 0 'False KeyPreview = -1 'True LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5070 ScaleWidth = 8730 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton btnRemove Height = 275 Left = 300 Picture = (Icon) Style = 1 'Graphical TabIndex = 20 ToolTipText = "Remove" Top = 2160 Visible = 0 'False Width = 275 End Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 537 TabIndex = 9 Top = 0 Width = 8055 Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 11 Top = 360 Width = 3900 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Other Charges" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747&
frmOtherCharges - 2 Height = 345 Left = 600 TabIndex = 10 Top = 30 Width = 2055 End Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End End Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid Height = 2220 Left = 240 TabIndex = 21 Top = 2010 Width = 8205 _ExtentX = 14473 _ExtentY = 3916 _Version = 393216 Rows = 0 FixedRows = 0 FixedCols = 0 RowHeightMin = 275 ForeColorFixed = -2147483640 BackColorSel = 1091552 ForeColorSel = 16777215 BackColorBkg = -2147483643 GridColor = -2147483633 GridColorFixed = -2147483633 GridColorUnpopulated= -2147483633 AllowBigSelection= 0 'False FocusRect = 0 SelectionMode = 1 AllowUserResizing= 3 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty _NumberOfBands = 1 _Band(0).Cols = 2 _Band(0).GridLinesBand= 1 _Band(0).TextStyleBand= 0 _Band(0).TextStyleHeader= 0 End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 4485 Left = 0 ScaleHeight = 299 ScaleMode = 3 'Pixel ScaleWidth = 579 TabIndex = 12 Top = 570 Width = 8685 Begin VB.TextBox txtDescription Height = 315 Left = 3750 TabIndex = 2 Top = 990 Width = 1485 End Begin VB.CommandButton cmdSave Caption = "Save" Height = 375 Left = 6480
frmOtherCharges - 3 TabIndex = 7 Top = 3930 Visible = 0 'False Width = 885 End Begin VB.CommandButton cmdUpdate Caption = "Update" Height = 375 Left = 7740 TabIndex = 6 Top = 930 Width = 795 End Begin VB.CommandButton cmdClose Caption = "Close" Height = 375 Left = 7470 TabIndex = 8 Top = 3930 Width = 1005 End Begin VB.CommandButton cmdAdd Caption = "Add" Height = 375 Left = 6840 TabIndex = 5 Top = 930 Width = 825 End Begin VB.TextBox txtAmount Alignment = 1 'Right Justify Height = 315 Left = 5310 TabIndex = 4 Text = "0.00" Top = 990 Width = 1455 End Begin VB.TextBox txtGuestName Appearance = 0 'Flat Height = 315 Left = 1080 Locked = -1 'True TabIndex = 0 TabStop = 0 'False Top = 120 Width = 1815 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 13 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 150 ScaleHeight = 30 ScaleWidth = 8355 TabIndex = 14 Top = 3780 Width = 8355 End Begin MSComCtl2.DTPicker dtpDate Height = 315 Left = 240 TabIndex = 3 TabStop = 0 'False Top = 990 Width = 1515 _ExtentX = 2672 _ExtentY = 556 _Version = 393216 Format = 104136705
frmOtherCharges - 4 CurrentDate = 39539 End Begin MSDataListLib.DataCombo dcChargeType Height = 315 Left = 1860 TabIndex = 1 Top = 990 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Description" Height = 195 Left = 3810 TabIndex = 22 Top = 750 Width = 795 End Begin VB.Label Label5 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Date" Height = 195 Left = 270 TabIndex = 19 Top = 750 Width = 345 End Begin VB.Label Label9 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Amount" Height = 195 Left = 5370 TabIndex = 18 Top = 720 Width = 540 End Begin VB.Label Label7 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Charge Type" Height = 195 Left = 1890 TabIndex = 17 Top = 750 Width = 915 End Begin VB.Label Label1 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Guest Name" Height = 195 Left = 90 TabIndex = 16 Top = 150 Width = 885 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False
frmOtherCharges - 5 EndProperty Height = 165 Left = 9450 TabIndex = 15 Top = 3030 Width = 45 End EndEnd
Guest Name
Charge Type AmountDate Description
6
Other ChargesFill all fields or fields with '*' then click 'Save' button to update.
frmPayment - 1 Public FolioNumbePublic GuestName Public Balance Public RefForm
Dim AmountPaid Dim cIRowCount
Private Sub btnRe 'Remove selec With Grid
frmPayment - 2 End Sub
Private Sub CmdClose_Click() Dim c As Integer With Grid 'Save the details of the records For c = 1 To cIRowCount .Row = c AmountPaid = AmountPaid + .TextMatrix(c, 8) Next c End With
'Clear variables c = 0 RefForm.AmountPaid = AmountPaid Me.HideEnd Sub
Public Sub cmdSave_Click() Dim rsPayments As New Recordset
rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM Payments WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic DeleteItems Dim c As Integer With Grid 'Save the details of the records For c = 1 To cIRowCount .Row = c If .TextMatrix(c, 1) = "" Then rsPayments.AddNew rsPayments![FolioNumber] = FolioNumber Else rsPayments.Filter = "PaymentID = " & toNumber(.TextMatrix(c, 1)) If rsPayments.RecordCount = 0 Then rsPayments.AddNew rsPayments![FolioNumber] = FolioNumber End If End If
rsPayments![Date] = .TextMatrix(c, 3) rsPayments![PaymentTypeID] = getValueAt("SELECT * FROM [Payment Type] WHERE PaymentType = '" & .TextMatrix(c, 4) & "'", "PaymentTypeID") rsPayments![CardNumber] = .TextMatrix(c, 5) rsPayments![AuthorityNumber] = .TextMatrix(c, 6) rsPayments![ValidTill] = .TextMatrix(c, 7) rsPayments![Amount] = .TextMatrix(c, 8)
rsPayments.Update
AmountPaid = AmountPaid + .TextMatrix(c, 8) Next c End With
'Clear variables c = 0 Set rsPayments = Nothing Unload frmPaymentEnd Sub
Private Sub cmdUpdate_Click() With Grid .TextMatrix(.RowSel, 3) = dtpDate.Value .TextMatrix(.RowSel, 4) = dcPaymentType.Text .TextMatrix(.RowSel, 5) = txtCardNumber.Text
frmPayment - 3 .TextMatrix(.RowSel, 6) = txtAuthCode.Text .TextMatrix(.RowSel, 7) = txtValidTill.Text .TextMatrix(.RowSel, 8) = toMoney(txtAmountPaid.Text) End WithEnd Sub
Private Sub dcPaymentType_Click(Area As Integer) If dcPaymentType.Text = "Cash Refund" Then If txtAmountPaid.Text > 0 Then txtAmountPaid.Text = toMoney(toNumber(-txtAmountPaid.Text)) End IfEnd Sub
Private Sub Form_Activate() AmountPaid = 0End Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load() Call InitGrid bind_dc "SELECT * FROM [Payment Type] ORDER BY PaymentType", "PaymentType", dcPaymentType, "paymentTypeID", False dcPaymentType.Text = "Cash" dtpDate.Value = Date txtGuestName.Text = GuestName DisplayForEditingEnd Sub
'Procedure used to initialize the gridPrivate Sub InitGrid() cIRowCount = 0 With Grid .Clear .ClearStructure .Rows = 2 .FixedRows = 1 .FixedCols = 1 .Cols = 9 .ColSel = 8 'Initialize the column size .ColWidth(0) = 315 .ColWidth(1) = 0 .ColWidth(2) = 0 .ColWidth(3) = 800 .ColWidth(4) = 1200 .ColWidth(5) = 1200 .ColWidth(6) = 1200 .ColWidth(7) = 1200 .ColWidth(8) = 1200
'Initialize the column name .TextMatrix(0, 0) = "" .TextMatrix(0, 1) = "Payment ID" .TextMatrix(0, 2) = "Folio Number" .TextMatrix(0, 3) = "Date" .TextMatrix(0, 4) = "Payment Type" .TextMatrix(0, 5) = "Card Number" .TextMatrix(0, 6) = "Auth Code" .TextMatrix(0, 7) = "Valid Till" .TextMatrix(0, 8) = "Amount Paid" End WithEnd Sub
Private Sub Form_Unload(Cancel As Integer) Set frmPayment = NothingEnd Sub
Private Sub Grid_Click() With Grid
frmPayment - 4 If .TextMatrix(.RowSel, 3) = "" Then Exit Sub dtpDate.Value = .TextMatrix(.RowSel, 3) dcPaymentType.Text = .TextMatrix(.RowSel, 4) txtCardNumber.Text = .TextMatrix(.RowSel, 5) txtAuthCode.Text = .TextMatrix(.RowSel, 6) txtValidTill.Text = .TextMatrix(.RowSel, 7) txtAmountPaid.Text = .TextMatrix(.RowSel, 8) If Grid.Rows = 2 And Grid.TextMatrix(1, 2) = "" Then btnRemove.Visible = False Else btnRemove.Visible = True btnRemove.Top = (Grid.CellTop + Grid.Top) - 20 btnRemove.Left = Grid.Left + 50 End If End WithEnd Sub
Private Sub ResetFields() txtAmountPaid.Text = "" txtCardNumber.Text = "" txtAuthCode.Text = "" txtAmountPaid.SetFocusEnd Sub
Private Sub DisplayForEditing() On Error GoTo err 'Display the details Dim rsPayments As New Recordset
cIRowCount = 0 rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM qry_Payments WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic If rsPayments.RecordCount > 0 Then rsPayments.MoveFirst While Not rsPayments.EOF cIRowCount = cIRowCount + 1 'increment With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsPayments!PaymentID .TextMatrix(1, 2) = rsPayments!FolioNumber .TextMatrix(1, 3) = rsPayments!Date .TextMatrix(1, 4) = rsPayments!PaymentType .TextMatrix(1, 5) = rsPayments!CardNumber .TextMatrix(1, 6) = rsPayments!AuthorityNumber .TextMatrix(1, 7) = rsPayments!ValidTill .TextMatrix(1, 8) = toMoney(rsPayments!Amount) Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsPayments!PaymentID .TextMatrix(.Rows - 1, 2) = rsPayments!FolioNumber .TextMatrix(.Rows - 1, 3) = rsPayments!Date .TextMatrix(.Rows - 1, 4) = rsPayments!PaymentType .TextMatrix(.Rows - 1, 5) = rsPayments!CardNumber .TextMatrix(.Rows - 1, 6) = rsPayments!AuthorityNumber .TextMatrix(.Rows - 1, 7) = rsPayments!ValidTill .TextMatrix(.Rows - 1, 8) = toMoney(rsPayments!Amount) End If End With ' AmountPaid = rsPayments!Amount rsPayments.MoveNext Wend Grid.Row = 1 Grid.ColSel = 8 'Set fixed cols If State = adStateEditMode Then Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If
frmPayment - 5 End If
rsPayments.Close 'Clear variables Set rsPayments = Nothing
Exit Suberr: If err.Number = 94 Then Resume Next prompt_err err, Name, "DisplayForEditing" Screen.MousePointer = vbDefaultEnd Sub
Private Sub DeleteItems() Dim CurrRow As Integer Dim rsPayments As New Recordset ' If State = adStateAddMode Then Exit Sub rsPayments.CursorLocation = adUseClient rsPayments.Open "SELECT * FROM Payments WHERE FolioNumber='" & FolioNumber & "'", CN, adOpenStatic, adLockOptimistic If rsPayments.RecordCount > 0 Then rsPayments.MoveFirst While Not rsPayments.EOF CurrRow = getFlexPos(Grid, 1, rsPayments!PaymentID) 'Add to grid With Grid If CurrRow < 0 Then 'Delete record if doesnt exist in flexgrid DelRecwSQL "Payments", "PaymentID", "", True, rsPayments!PaymentID End If End With rsPayments.MoveNext Wend End IfEnd Sub
Public Sub RefreshBalance() txtBalance.Text = toMoney(Balance)End Sub
Private Sub txtAmountPaid_GotFocus() HLText txtAmountPaidEnd Sub
Private Sub txtAmountPaid_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtAmountPaid_Validate(Cancel As Boolean) txtAmountPaid.Text = toMoney(txtAmountPaid.Text)End Sub
frmPayment - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"Begin VB.Form frmPayment BorderStyle = 1 'Fixed Single Caption = "Amount Paid Details" ClientHeight = 6000 ClientLeft = 45 ClientTop = 345 ClientWidth = 9000 ControlBox = 0 'False KeyPreview = -1 'True LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 6000 ScaleWidth = 9000 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtValidTill Height = 315 Left = 4950 TabIndex = 7 Top = 2490 Width = 1245 End Begin VB.CommandButton cmdSave Caption = "Save" Height = 375 Left = 6750 TabIndex = 10 Top = 5460 Visible = 0 'False Width = 885 End Begin VB.TextBox txtAuthCode Height = 315 Left = 3660 TabIndex = 6 Top = 2490 Width = 1245 End Begin VB.CommandButton cmdUpdate Caption = "Update" Height = 375 Left = 7260 TabIndex = 9 Top = 2460 Width = 795 End Begin VB.CommandButton cmdClose Caption = "Close" Height = 375 Left = 7740 TabIndex = 11 Top = 5460 Width = 1005 End Begin VB.CommandButton cmdAdd Caption = "Add" Height = 375 Left = 6330 TabIndex = 8 Top = 2460 Width = 825 End Begin VB.TextBox txtAmountPaid Alignment = 1 'Right Justify Height = 315 Left = 4410 TabIndex = 3 Text = "0.00" Top = 1320 Width = 1815 End Begin VB.TextBox txtBalance
frmPayment - 2 Alignment = 1 'Right Justify Appearance = 0 'Flat Height = 315 Left = 1080 Locked = -1 'True TabIndex = 1 TabStop = 0 'False Top = 1290 Width = 1815 End Begin VB.TextBox txtCardNumber Height = 315 Left = 2160 TabIndex = 5 Top = 2490 Width = 1455 End Begin VB.TextBox txtGuestName Appearance = 0 'Flat Height = 315 Left = 1080 Locked = -1 'True TabIndex = 0 TabStop = 0 'False Top = 840 Width = 1815 End Begin VB.CommandButton btnRemove Height = 275 Left = 300 Picture = (Icon) Style = 1 'Graphical TabIndex = 18 ToolTipText = "Remove" Top = 3030 Visible = 0 'False Width = 275 End Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 581 TabIndex = 12 Top = 0 Width = 8715 Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Payments" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 14 Top = 30 Width = 1395
frmPayment - 3 End Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 13 Top = 360 Width = 3900 End End Begin VB.PictureBox b8Line5 Height = 30 Left = 180 ScaleHeight = 30 ScaleWidth = 8625 TabIndex = 19 Top = 5340 Width = 8625 End Begin MSComCtl2.DTPicker dtpDate Height = 375 Left = 4410 TabIndex = 2 TabStop = 0 'False Top = 840 Width = 1515 _ExtentX = 2672 _ExtentY = 661 _Version = 393216 Format = 104136705 CurrentDate = 39539 End Begin VB.PictureBox b8GradLine2 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 180 ScaleHeight = 180 ScaleWidth = 8445 TabIndex = 20 Top = 1830 Width = 8505 End Begin MSDataListLib.DataCombo dcPaymentType Height = 315 Left = 270 TabIndex = 4 Top = 2490 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "Cash" End Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid Height = 2220
frmPayment - 4 Left = 240 TabIndex = 21 Top = 2940 Width = 8565 _ExtentX = 15108 _ExtentY = 3916 _Version = 393216 Rows = 0 FixedRows = 0 FixedCols = 0 RowHeightMin = 275 ForeColorFixed = -2147483640 BackColorSel = 1091552 ForeColorSel = 16777215 BackColorBkg = -2147483643 GridColor = -2147483633 GridColorFixed = -2147483633 GridColorUnpopulated= -2147483633 AllowBigSelection= 0 'False FocusRect = 0 SelectionMode = 1 AllowUserResizing= 3 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty _NumberOfBands = 1 _Band(0).Cols = 2 _Band(0).GridLinesBand= 1 _Band(0).TextStyleBand= 0 _Band(0).TextStyleHeader= 0 End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 5415 Left = 0 ScaleHeight = 361 ScaleMode = 3 'Pixel ScaleWidth = 599 TabIndex = 15 Top = 570 Width = 8985 Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 16 Top = 0 Width = 11595 End Begin VB.Label Label1 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Guest Name" Height = 195 Left = 90 TabIndex = 29 Top = 300 Width = 885 End Begin VB.Label Label7 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Payment Type" Height = 195 Left = 270 TabIndex = 28
frmPayment - 5 Top = 1680 Width = 1020 End Begin VB.Label Label9 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Card Number" Height = 195 Left = 2160 TabIndex = 27 Top = 1650 Width = 930 End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Balance" Height = 195 Left = 120 TabIndex = 26 Top = 810 Width = 585 End Begin VB.Label Label3 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Amount Paid" Height = 195 Left = 3450 TabIndex = 25 Top = 780 Width = 900 End Begin VB.Label Label4 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Auth Code" Height = 195 Left = 3660 TabIndex = 24 Top = 1650 Width = 750 End Begin VB.Label Label5 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Date" Height = 195 Left = 3990 TabIndex = 23 Top = 270 Width = 345 End Begin VB.Label Label6 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Valid Till" Height = 195 Left = 4950 TabIndex = 22 Top = 1650 Width = 585 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165
frmPayment - 6 Left = 9450 TabIndex = 17 Top = 3030 Width = 45 End EndEnd
Valid Till
Date
Auth Code
Amount PaidBalance
Card NumberPayment Type
Guest Name
Cash 6
Fill all fields or fields with '*' then click 'Save' button to update.
Payments
frmPaymentType - 1 Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ On Error GoTo
frmPaymentType - 2 "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Payment Type] WHERE PaymentTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmPaymentTypeList.RefreshRecords End If End If Set frmPaymentType = NothingEnd Sub
frmPaymentType - 1 VERSION 5.00Begin VB.Form frmPaymentType BorderStyle = 1 'Fixed Single Caption = "Payment Type" ClientHeight = 1815 ClientLeft = 45 ClientTop = 330 ClientWidth = 5565 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1815 ScaleWidth = 5565 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1680 MaxLength = 100 TabIndex = 4 Tag = "Category" Top = 210 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2340 TabIndex = 3 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3780 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 240 TabIndex = 1 Top = 1125 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 60 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 0 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Payment Type" Height = 240 Left = 360 TabIndex = 5 Top = 210 Width = 1215 EndEnd
Payment Type
frmPaymentTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsPaymentTypeDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmPaymentTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsPaymentType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmPaymentTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "PaymentType,PaymentTypeID" .Tables = "[Payment Type]" .SortOrder = "PaymentType ASC" .SaveStatement End With rsPaymentType.CursorLocation = adUseClient rsPaymentType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsPaymentType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsPaymentType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "PaymentTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmPaymentTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmPaymentTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmPaymentTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmPaymentTypeList Caption = "Payment Type" ClientHeight = 5835 ClientLeft = 60 ClientTop = 345 ClientWidth = 8730 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5835 ScaleWidth = 8730 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8730 TabIndex = 2 Top = 5460 Width = 8730 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmPaymentTypeList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8730 TabIndex = 1 Top = 5445 Width = 8730 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8730 TabIndex = 0 Top = 5430 Width = 8730 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Payment Type" BeginProperty Font Name = "Tahoma"
frmPaymentTypeList - 3 Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 180 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 180 Width = 6915 EndEnd
Payment Type
Selected Record: 0 0 - 0 of 0
frmRatePerPeriod - 1 Option Explicit
Public FolioNumbeDim cIRowCount
Private Sub CmdCl Unload MeEnd Sub
Private Sub cmdSa Dim rsRatePer
frmRatePerPeriod - 2 Call InitGrid bind_dc "SELECT * FROM [Rate Type]", "RateType", dcRateType, "RateTypeID", False
DisplayForEditing DoEventsEnd Sub
Private Sub DisplayForEditing() On Error GoTo err 'Display the details Dim rsRatePerPeriod As New Recordset
cIRowCount = 0 rsRatePerPeriod.CursorLocation = adUseClient rsRatePerPeriod.Open "SELECT * FROM qry_Rate_Per_Period WHERE FolioNumber='" & FolioNumber & "' ORDER BY [Date]", CN, adOpenStatic, adLockOptimistic If rsRatePerPeriod.RecordCount > 0 Then rsRatePerPeriod.MoveFirst While Not rsRatePerPeriod.EOF cIRowCount = cIRowCount + 1 'increment With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsRatePerPeriod!Date .TextMatrix(1, 2) = rsRatePerPeriod!RoomNumber .TextMatrix(1, 3) = rsRatePerPeriod!RateTypeID .TextMatrix(1, 4) = rsRatePerPeriod!RateType .TextMatrix(1, 5) = toMoney(rsRatePerPeriod!Rate) .TextMatrix(1, 6) = toMoney(rsRatePerPeriod!Adults) .TextMatrix(1, 7) = toMoney(rsRatePerPeriod!Childrens) Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsRatePerPeriod!Date .TextMatrix(.Rows - 1, 2) = rsRatePerPeriod!RoomNumber .TextMatrix(.Rows - 1, 3) = rsRatePerPeriod!RateTypeID .TextMatrix(.Rows - 1, 4) = rsRatePerPeriod!RateType .TextMatrix(.Rows - 1, 5) = toMoney(rsRatePerPeriod!Rate) .TextMatrix(.Rows - 1, 6) = toMoney(rsRatePerPeriod!Adults) .TextMatrix(.Rows - 1, 7) = toMoney(rsRatePerPeriod!Childrens) End If End With rsRatePerPeriod.MoveNext Wend Grid.Row = 1 Grid.ColSel = 7 'Set fixed cols' If State = adStateEditMode Then Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1' End If End If
rsRatePerPeriod.Close 'Clear variables Set rsRatePerPeriod = Nothing
Exit Suberr: If err.Number = 94 Then Resume Next prompt_err err, Name, "DisplayForEditing" Screen.MousePointer = vbDefaultEnd Sub
'Procedure used to initialize the gridPrivate Sub InitGrid() cIRowCount = 0 With Grid .Clear .ClearStructure .Rows = 2 .FixedRows = 1
frmRatePerPeriod - 3 .FixedCols = 1 .Cols = 8 .ColSel = 7 'Initialize the column size .ColWidth(0) = 315 .ColWidth(1) = 1200 .ColWidth(2) = 1200 .ColWidth(3) = 0 .ColWidth(4) = 1200 .ColWidth(5) = 900 .ColWidth(6) = 1200 .ColWidth(7) = 1200 'Initialize the column name .TextMatrix(0, 0) = "" .TextMatrix(0, 1) = "Date" .TextMatrix(0, 2) = "Room Number" .TextMatrix(0, 3) = "Rate Type ID" .TextMatrix(0, 4) = "Rate Type" .TextMatrix(0, 5) = "Rate" .TextMatrix(0, 6) = "Adult's Rate" .TextMatrix(0, 7) = "Children's Rate" 'Set the column alignment' .ColAlignment(0) = vbLeftJustify' .ColAlignment(1) = vbLeftJustify' .ColAlignment(2) = vbLeftJustify' .ColAlignment(3) = flexAlignGeneral' .ColAlignment(4) = flexAlignGeneral' .ColAlignment(5) = vbRightJustify' .ColAlignment(6) = vbRightJustify' .ColAlignment(7) = vbRightJustify' .ColAlignment(8) = vbRightJustify End WithEnd Sub
Private Sub Grid_Click() With Grid dcRateType.BoundText = .TextMatrix(.RowSel, 3) txtRate.Text = .TextMatrix(.RowSel, 5) txtAdults.Text = .TextMatrix(.RowSel, 6) txtChildrens.Text = .TextMatrix(.RowSel, 7) End WithEnd Sub
Private Sub txtAdults_GotFocus() HLText txtAdultsEnd Sub
Private Sub txtAdults_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtAdults_Validate(Cancel As Boolean) txtAdults.Text = toMoney(txtAdults.Text)End Sub
Private Sub txtChildrens_GotFocus() HLText txtChildrensEnd Sub
Private Sub txtChildrens_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtChildrens_Validate(Cancel As Boolean) txtChildrens.Text = toMoney(txtChildrens.Text)End Sub
Private Sub txtRate_GotFocus() HLText txtRateEnd Sub
Private Sub txtRate_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
frmRatePerPeriod - 4 Private Sub txtRate_Validate(Cancel As Boolean) txtRate.Text = toMoney(txtRate.Text)End Sub
frmRatePerPeriod - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"Begin VB.Form frmRatePerPeriod BorderStyle = 1 'Fixed Single Caption = "Rate Per Period" ClientHeight = 5460 ClientLeft = 45 ClientTop = 330 ClientWidth = 8430 ControlBox = 0 'False KeyPreview = -1 'True LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5460 ScaleWidth = 8430 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 439 TabIndex = 11 Top = 0 Width = 6585 Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Rates" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 13 Top = 30 Width = 810 End Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 570 TabIndex = 12 Top = 360
frmRatePerPeriod - 2 Width = 3900 End End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 4875 Left = 0 ScaleHeight = 325 ScaleMode = 3 'Pixel ScaleWidth = 561 TabIndex = 7 Top = 570 Width = 8415 Begin VB.TextBox txtChildrens Alignment = 1 'Right Justify Height = 315 Left = 4770 TabIndex = 3 Text = "0.00" Top = 390 Width = 1275 End Begin VB.TextBox txtAdults Alignment = 1 'Right Justify Height = 315 Left = 3450 TabIndex = 2 Text = "0.00" Top = 390 Width = 1275 End Begin VB.CommandButton cmdSave Caption = "Save" Height = 375 Left = 6150 TabIndex = 5 Top = 4350 Width = 885 End Begin VB.CommandButton cmdUpdate Caption = "Update" Height = 315 Left = 6120 TabIndex = 4 Top = 390 Width = 795 End Begin VB.CommandButton cmdClose Caption = "Close" Height = 375 Left = 7140 TabIndex = 6 Top = 4350 Width = 1005 End Begin VB.TextBox txtRate Alignment = 1 'Right Justify Height = 315 Left = 2100 TabIndex = 1 Text = "0.00" Top = 390 Width = 1275 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 8 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5
frmRatePerPeriod - 3 Height = 30 Left = 210 ScaleHeight = 30 ScaleWidth = 8025 TabIndex = 9 Top = 4200 Width = 8025 End Begin MSDataListLib.DataCombo dcRateType Height = 315 Left = 210 TabIndex = 0 Top = 390 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid Height = 3240 Left = 180 TabIndex = 14 Top = 840 Width = 8085 _ExtentX = 14261 _ExtentY = 5715 _Version = 393216 Rows = 0 FixedRows = 0 FixedCols = 0 RowHeightMin = 275 ForeColorFixed = -2147483640 BackColorSel = 1091552 ForeColorSel = 16777215 BackColorBkg = -2147483643 GridColor = -2147483633 GridColorFixed = -2147483633 GridColorUnpopulated= -2147483633 AllowBigSelection= 0 'False FocusRect = 0 SelectionMode = 1 AllowUserResizing= 3 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty _NumberOfBands = 1 _Band(0).Cols = 2 _Band(0).GridLinesBand= 1 _Band(0).TextStyleBand= 0 _Band(0).TextStyleHeader= 0 End Begin VB.Label Label2 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Children's Rate" Height = 195 Left = 4800 TabIndex = 18 Top = 150 Width = 1065 End Begin VB.Label Label1 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Adult's Rate" Height = 195 Left = 3480
frmRatePerPeriod - 4 TabIndex = 17 Top = 150 Width = 855 End Begin VB.Label Label9 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Rate" Height = 195 Left = 2100 TabIndex = 16 Top = 150 Width = 345 End Begin VB.Label Label7 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Rate Type" Height = 195 Left = 210 TabIndex = 15 Top = 150 Width = 750 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165 Left = 9450 TabIndex = 10 Top = 3030 Width = 45 End EndEnd
Rate Type Rate Adult's Rate Children's Rate
6
Fill all fields or fields with '*' then click 'Save' button to update.
Rates
frmRateType - 1 Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ On Error GoTo
frmRateType - 2 "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Rate Type] WHERE RateTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmRateTypeList.RefreshRecords End If End If Set frmRateType = NothingEnd Sub
frmRateType - 1 VERSION 5.00Begin VB.Form frmRateType BorderStyle = 1 'Fixed Single Caption = "Rate Type" ClientHeight = 1755 ClientLeft = 45 ClientTop = 330 ClientWidth = 5670 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1755 ScaleWidth = 5670 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1740 MaxLength = 100 TabIndex = 0 Tag = "Category" Top = 210 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2400 TabIndex = 1 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3840 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 300 TabIndex = 3 Top = 1125 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 120 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 4 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Rate Type" Height = 240 Left = 420 TabIndex = 5 Top = 210 Width = 1215 EndEnd
Rate Type
frmRateTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsRateType AsDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmRateTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRateType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmRateTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "RateType,RateTypeID" .Tables = "[Rate Type]" .SortOrder = "RateType ASC" .SaveStatement End With rsRateType.CursorLocation = adUseClient rsRateType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRateType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRateType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "RateTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmRateTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmRateTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRateTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRateTypeList BorderStyle = 1 'Fixed Single Caption = "Rate Type" ClientHeight = 5805 ClientLeft = 45 ClientTop = 330 ClientWidth = 8580 LinkTopic = "Form2" MaxButton = 0 'False MDIChild = -1 'True MinButton = 0 'False ScaleHeight = 5805 ScaleWidth = 8580 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8580 TabIndex = 2 Top = 5430 Width = 8580 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8
frmRateTypeList - 2 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8580 TabIndex = 1 Top = 5400 Width = 8580 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8580 TabIndex = 0 Top = 5415 Width = 8580 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 450 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent
frmRateTypeList - 3 Caption = "Rate Type" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 150 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 150 Width = 6915 EndEnd
Rate Type
Selected Record: 0 0 - 0 of 0
frmReports - 1 Option Explicit
Public strReport Public PK Public strYear Public blnPaid Public strWhere
Dim mTest As CRAXDim mReport As CRDim SubReport As
frmReports - 2 mParam.Item(2).AddCurrentValue CurrBiz.BUSINESS_ADDRESS mParam.Item(3).AddCurrentValue CurrBiz.BUSINESS_CONTACT_INFO Case "Due Reservation" Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Due_Reservation.rpt")
mReport.RecordSelectionFormula = strWhere
Set mParam = mReport.ParameterFields mParam.Item(1).AddCurrentValue CurrBiz.BUSINESS_NAME mParam.Item(2).AddCurrentValue CurrBiz.BUSINESS_ADDRESS mParam.Item(3).AddCurrentValue CurrBiz.BUSINESS_CONTACT_INFO Case "Guest List" Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Guest_List.rpt")
Set mParam = mReport.ParameterFields mParam.Item(1).AddCurrentValue CurrBiz.BUSINESS_NAME mParam.Item(2).AddCurrentValue CurrBiz.BUSINESS_ADDRESS mParam.Item(3).AddCurrentValue CurrBiz.BUSINESS_CONTACT_INFO Case "Room History" Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Room_History.rpt")
mReport.RecordSelectionFormula = strWhere
Set mParam = mReport.ParameterFields mParam.Item(1).AddCurrentValue CurrBiz.BUSINESS_NAME mParam.Item(2).AddCurrentValue CurrBiz.BUSINESS_ADDRESS mParam.Item(3).AddCurrentValue CurrBiz.BUSINESS_CONTACT_INFO Case "Reservation" Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Reservation.rpt")
mReport.RecordSelectionFormula = strWhere End Select Screen.MousePointer = vbHourglass CR.ReportSource = mReport CR.ViewReport Screen.MousePointer = vbDefault Exit Sub err_Form_Load: prompt_err err, Name, "Form_Load" Screen.MousePointer = vbDefaultEnd Sub
Private Sub Form_Resize() With CR .Top = 0 .Left = 0 .Height = ScaleHeight .Width = ScaleWidth End WithEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name Set frmReports = NothingEnd Sub
frmReports - 1 VERSION 5.00Begin VB.Form frmReports Caption = "Form2" ClientHeight = 7995 ClientLeft = 60 ClientTop = 345 ClientWidth = 9390 LinkTopic = "Form2" ScaleHeight = 7995 ScaleWidth = 9390 WindowState = 2 'Maximized Begin VB.PictureBox CR Height = 3915 Left = 1470 ScaleHeight = 3855 ScaleWidth = 6345 TabIndex = 0 Top = 1260 Width = 6405 EndEnd
frmReservation - 1 Option Explicit
Public State Public PK Public Shortcut the list
Dim HaveAction Dim RS
Private Sub Displ
frmReservation - 2 End Sub
Private Sub CmdCheckIn_Click()On Error GoTo err Dim intCount As Integer If dcRoomNumber.BoundText = "" Then MsgBox "Please select Room number.", vbCritical Exit Sub End If Call Save_Record If HaveAction = False Then Exit Sub If MsgBox("Are you sure?", vbYesNo + vbInformation) = vbYes Then Dim FolioNumber As String FolioNumber = getIndex("Transactions") FolioNumber = GenerateID(FolioNumber, Format$(Date, "yy") & "-", "00000")
CN.BeginTrans CN.Execute "INSERT INTO Transactions ( FolioNumber, CustomerID, Address, CountryID, CompanyID, IDTypeID, IDNumber, RoomNumber, DateIn, DateOut, RateType, Rate, Days, Adults, Childrens, BusinessSourceID, VehicleID, VehicleModel, PlateNo, Status, Notes, ReservedBy, CheckInBy, AddedByFK ) " & _ "SELECT '" & FolioNumber & "' AS Folio, CustomerID, Address, CountryID, CompanyID, IDTypeID, IDNumber, " & dcRoomNumber.BoundText & ", DateIn, DateOut, RateType, Rate, Days, Adults, Childrens, BusinessSourceID, VehicleID, VehicleModel, PlateNo, 'Check In' AS CheckIn, Notes, ReservedBy, " & CurrUser.USER_PK & ", " & CurrUser.USER_PK & " " & _ "FROM Reservation " & _ "WHERE ReservationNo='" & txtReservationNo.Text & "'" Call AddRatePerPeriod(FolioNumber) ChangeValue CN, "Rooms", "RoomStatusID", 2, True, "WHERE RoomNumber = " & dcRoomNumber.BoundText ChangeValue CN, "Reservation", "Status", "Check In", False, "WHERE ReservationNo = '" & txtReservationNo.Text & "'" CN.Execute "UPDATE [Inventory] SET Status = 'Check In', ID = '" & FolioNumber & "' " & _ "WHERE ID= '" & txtReservationNo.Text & "' AND RoomNumber= " & dcRoomNumber.BoundText & " AND Status='Reservation'"
CN.CommitTrans Unload Me End If Exit Sub err: CN.RollbackTrans prompt_err err, Name, "CmdCheckIn_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub AddRatePerPeriod(FolioNumber As String)On Error GoTo err Dim rsRatePerPeriod As New ADODB.Recordset Dim tmpDate As Date
tmpDate = dtpDateIn.Value If txtAdults.Tag = "" Then Exit Sub Dim intAdults As Integer If txtAdults.Text = hsAdults.Min Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - hsAdults.Min End If
With rsRatePerPeriod
frmReservation - 3 .Open "SELECT * FROM [Rate Per Period] WHERE FolioNumber = '" & FolioNumber & "' ORDER BY [Date]", CN, adOpenStatic, adLockOptimistic
Do Until tmpDate > dtpDateOut.Value - 1' .Filter = "[Date] = #" & tmpDate & "#" ' If .RecordCount = 0 Then .AddNew .Fields("FolioNumber") = FolioNumber .Fields("Date") = tmpDate .Fields("RoomNumber") = dcRoomNumber.BoundText .Fields("RateTypeID") = dcRateType.BoundText .Fields("Rate") = txtRate.Text .Fields("Adults") = txtAdults.Tag * intAdults .Fields("Childrens") = toMoney(txtChildrens.Tag) * toNumber(txtChildrens.Text) .Update' End If tmpDate = tmpDate + 1 Loop End With rsRatePerPeriod.Close
Exit Sub
err: prompt_err err, Name, "AddRatePerPeriod" Screen.MousePointer = vbDefaultEnd Sub
Private Sub CmdClose_Click() Unload MeEnd Sub
Private Sub ResetFields()' clearText Me'' txtEntry(15).Text = "0.00"' txtEntry(1).SetFocusEnd Sub
Private Sub cmdLookupComp_Click() With frmCompanyLookup Set .RefForm = Me .Show vbModal End WithEnd Sub
Private Sub cmdLookupCust_Click() With frmCustomerLookup Set .RefForm = Me .Show vbModal End WithEnd Sub
Private Sub CmdPrint_Click() With frmReports .strReport = "Reservation" .strWhere = "{qry_rpt_Reservation.ReservationNo} = '" & txtReservationNo.Text & "'" frmReports.Show vbModal End WithEnd Sub
Private Sub Save_Record()On Error GoTo err Dim rsCustomers As New Recordset Dim CustomerID As Integer Dim CompanyID As Integer
If Trim(txtLastName.Text) = "" Or Trim(txtFirstName.Text) = "" Then
frmReservation - 4 MsgBox "Please complete the name of a guest.", vbInformation Exit Sub End If CN.BeginTrans
With rsCustomers .Open "SELECT * FROM Customers WHERE LastName = '" & txtLastName.Text & "' AND FirstName = '" & txtFirstName.Text & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtLastName.Tag = .Fields("CustomerID") Else .AddNew CustomerID = getIndex("Customers") txtLastName.Tag = CustomerID .Fields("CustomerID") = CustomerID .Fields("LastName") = txtLastName.Text .Fields("FirstName") = txtFirstName.Text .Update End If .Close If txtCompany.Text = "" Then GoSub ContinueSave .Open "SELECT * FROM Company WHERE Company = '" & txtCompany.Text & "'", CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtCompany.Tag = .Fields("CompanyID") Else .AddNew
CompanyID = getIndex("Company") txtCompany.Tag = CompanyID .Fields("CompanyID") = CompanyID .Fields("Company") = txtCompany.Text .Update End If .Close End With ContinueSave:
If State = adStateAddMode Then RS.AddNew RS.Fields("ReservationNo") = txtReservationNo.Text RS.Fields("ReservedBy") = CurrUser.USER_PK RS.Fields("AddedByFK") = CurrUser.USER_PK Else RS.Fields("DateModified") = Now RS.Fields("LastUserFK") = CurrUser.USER_PK End If With RS .Fields("CustomerID") = txtLastName.Tag .Fields("Address") = txtAddress.Text .Fields("CountryID") = dcCountry.BoundText .Fields("CompanyID") = IIf(txtCompany.Tag = "", Null, txtCompany.Tag) .Fields("IDTypeID") = dcIDType.BoundText .Fields("IDNumber") = txtIDNumber.Text .Fields("RoomNumber") = dcRoomNumber.BoundText .Fields("DateIn") = dtpDateIn.Value .Fields("DateOut") = dtpDateOut.Value .Fields("RateType") = dcRateType.BoundText .Fields("Rate") = txtRate.Text .Fields("OtherCharges") = txtOtherCharges.Text .Fields("Discount") = txtDiscount.Text
frmReservation - 5 .Fields("AmountPaid") = txtAmountPaid.Text .Fields("Days") = txtDays.Text .Fields("Adults") = txtAdults.Text .Fields("Childrens") = txtChildrens.Text .Fields("Total") = txtTotal.Text .Fields("BusinessSourceID") = dcBusSource.BoundText .Fields("VehicleID") = IIf(dcVehicle.BoundText = "", Null, dcVehicle.BoundText) .Fields("VehicleModel") = txtVehicleModel.Text .Fields("PlateNo") = txtPlateNo.Text .Fields("Notes") = txtNotes.Text
.Update End With
'---------------------------- 'Delete record from Inventory and add a new check in/out date CN.Execute "DELETE ID, Status " & _ "From [Inventory] " & _ "WHERE ID='" & txtReservationNo.Text & "' AND Status='Reservation'" Dim dtpStartDate As Date dtpStartDate = dtpDateIn.Value Do Until dtpStartDate = dtpDateOut.Value CN.Execute "INSERT INTO [Inventory] ( ID, RoomNumber, [Date], CustomerID, Status ) " & _ "VALUES ('" & txtReservationNo.Text & "', " & dcRoomNumber.BoundText & ", #" & dtpStartDate & "#, " & txtLastName.Tag & ", 'Reservation')"
dtpStartDate = dtpStartDate + 1 Loop '----------------------------
CN.CommitTrans
HaveAction = True Exit Sub
err: CN.RollbackTrans prompt_err err, Name, "cmdSave_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub cmdSave_Click() Call Save_Record If State = adStateAddMode And HaveAction = True Then MsgBox "New record has been successfully saved.", vbInformation
' Unload frmReservation ElseIf State = adStateEditMode And HaveAction = True Then MsgBox "Changes in record has been successfully saved.", vbInformation ' Unload frmReservation End IfEnd Sub
Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _
frmReservation - 6 "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub dcRateType_Click(Area As Integer)On Error GoTo err
Dim rsRoomRates As New ADODB.Recordset With rsRoomRates .Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & dcRoomNumber.BoundText & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Text = !NoofPerson hsAdults.Min = !NoofPerson hsAdults.Value = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With rsRoomRates.Close Call ComputeRate Exit Sub err: CN.RollbackTrans prompt_err err, Name, "dcRateType_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub dcRoomNumber_Click(Area As Integer) dcRateType_Click 0End Sub
Public Sub dtpDateOut_Change() If dtpDateOut.Value < dtpDateIn.Value Then Exit Sub txtDays.Text = dtpDateOut.Value - dtpDateIn.Value hsDays.Value = txtDays.Text Call ComputeRateEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load()On Error GoTo err
RS.CursorLocation = adUseClient
bind_dc "SELECT * FROM qry_Available_Rooms", "AvailableRoom", dcRoomNumber, "RoomNumber", True bind_dc "SELECT * FROM Countries", "Country", dcCountry, "CountryID", True bind_dc "SELECT * FROM [ID Type]", "IDType", dcIDType, "IDTypeID", True bind_dc "SELECT * FROM [Rate Type]", "RateType", dcRateType, "RateTypeID", True bind_dc "SELECT * FROM [Business Source]", "BusinessSource", dcBusSource, "BusinessSourceID", True bind_dc "SELECT * FROM [Vehicles]", "Vehicle", dcVehicle, "VehicleID", False dcCountry.Text = "Philippines"
Dim rsRoomRates As New ADODB.Recordset
'Check the form state
frmReservation - 7 If State = adStateAddMode Then RS.Open "SELECT * FROM Reservation WHERE ReservationNo = '" & PK & "'", CN, adOpenStatic, adLockOptimistic
cmdUsrHistory.Enabled = False
dtpDateIn.Value = Date dtpDateOut.Value = dtpDateIn.Value + 1
GeneratePK
rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & dcRoomNumber.BoundText & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic
With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) txtAdults.Text = !NoofPerson hsAdults.Min = !NoofPerson hsAdults.Value = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
dcBusSource.BoundText = 2
' Call txtDays_Change
Call ComputeRate Else RS.Open "SELECT * FROM Reservation WHERE ReservationNo = '" & PK & "'", CN, adOpenStatic, adLockOptimistic
rsRoomRates.Open "SELECT * FROM [Room Rates] WHERE RoomNumber = " & RightSplitUF(dcRoomNumber.Tag) & " AND RateTypeID = " & dcRateType.BoundText, CN, adOpenStatic, adLockOptimistic
With rsRoomRates If .RecordCount > 0 Then txtRate.Text = toMoney(!RoomRate) hsAdults.Min = !NoofPerson txtAdults.Tag = !ExtraAdultRate txtChildrens.Tag = !ExtraChildRate End If End With
DisplayForEditing CmdCheckIn.Visible = True CmdPrint.Visible = True CmdCancel.Visible = True Call ComputeRate End If
rsRoomRates.Close
Exit Sub err: prompt_err err, Name, "Form_Load" Screen.MousePointer = vbDefaultEnd Sub
'Procedure used to generate PKPrivate Sub GeneratePK() PK = getIndex("Reservation") txtReservationNo.Text = GenerateID(PK, Format$(Date, "yy") & "-", "00000")End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True And Shortcut = False Then frmReservationList.RefreshRecords End If Set frmReservation = NothingEnd Sub
frmReservation - 8
Private Sub hsAdults_Change() txtAdults.Text = hsAdults.Value ' Call ComputeAdultsRate Call ComputeRateEnd Sub
Private Sub hsChildrens_Change() txtChildrens.Text = hsChildrens.Value ' Call ComputeChildrensRate Call ComputeRateEnd Sub
Private Sub hsDays_Change() dtpDateOut.Value = dtpDateIn.Value + hsDays.Value txtDays.Text = hsDays.Value Call ComputeRateEnd Sub
Private Sub ComputeRate() If txtAdults.Tag = "" Then Exit Sub Dim intAdults As Integer If txtAdults.Text = hsAdults.Min Then intAdults = 0 Else intAdults = CInt(txtAdults.Text) - hsAdults.Min End If txtTotalCharges.Text = (toMoney(txtRate.Text) * toNumber(txtDays.Text)) + (toMoney(txtAdults.Tag) * intAdults) + (toMoney(txtChildrens.Tag) * toNumber(txtChildrens.Text)) txtTotalCharges.Text = toMoney(txtTotalCharges.Text) txtSubTotal.Text = toMoney(toNumber(txtTotalCharges.Text) + toNumber(txtOtherCharges.Text)) txtTotal.Text = toMoney(toNumber(txtSubTotal.Text) - (toNumber(txtSubTotal.Text) * toNumber(txtDiscount.Text) / 100)) txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
Private Sub txtAmountPaid_Change() txtBalance.Text = toMoney(toNumber(txtTotal.Text) - toNumber(txtAmountPaid.Text))End Sub
Private Sub txtDiscount_Change() Call ComputeRateEnd Sub
Private Sub txtDiscount_GotFocus() HLText txtDiscountEnd Sub
Private Sub txtDiscount_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtDiscount_Validate(Cancel As Boolean) txtDiscount.Text = toMoney(txtDiscount.Text)End Sub
Private Sub txtRate_GotFocus() HLText txtRateEnd Sub
Private Sub txtRate_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtRate_Validate(Cancel As Boolean) txtRate.Text = toMoney(txtRate.Text)End Sub
frmReservation - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmReservation BorderStyle = 1 'Fixed Single Caption = "Reservation" ClientHeight = 7845 ClientLeft = 45 ClientTop = 330 ClientWidth = 11265 KeyPreview = -1 'True LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 7845 ScaleWidth = 11265 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 7005 Left = 0 ScaleHeight = 467 ScaleMode = 3 'Pixel ScaleWidth = 775 TabIndex = 4 Top = 540 Width = 11625 Begin VB.CommandButton CmdCheckIn Caption = "Check In" Height = 315 Left = 6780 TabIndex = 79 Top = 6150 Visible = 0 'False Width = 1335 End Begin VB.CommandButton CmdCancel Caption = "Cancel Reservation" Height = 315 Left = 6780 TabIndex = 78 Top = 6540 Visible = 0 'False Width = 2685 End Begin VB.HScrollBar hsAdults Height = 315 Left = 6330 Min = 1 TabIndex = 33 Top = 2340 Value = 1 Width = 495 End Begin VB.HScrollBar hsChildrens Height = 315 Left = 6330 TabIndex = 32 Top = 2760 Width = 495 End Begin VB.HScrollBar hsDays Height = 315 Left = 6330 Min = 1 TabIndex = 31 Top = 1920 Value = 1 Width = 495 End Begin VB.TextBox txtBalance Alignment = 1 'Right Justify Height = 345
frmReservation - 2 Left = 9090 Locked = -1 'True TabIndex = 30 Text = "0.00" Top = 4440 Width = 1815 End Begin VB.TextBox txtAmountPaid Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 29 Text = "0.00" Top = 4050 Width = 1815 End Begin VB.TextBox txtTotalCharges Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 28 Text = "0.00" Top = 1920 Width = 1815 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 420 TabIndex = 27 Top = 6180 Width = 1680 End Begin VB.CommandButton cmdClose Caption = "Close" Height = 315 Left = 9480 TabIndex = 26 Top = 6540 Width = 1335 End Begin VB.TextBox txtChildrens Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 25 Text = "0" Top = 2760 Width = 465 End Begin VB.TextBox txtAdults Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 24 Text = "1" Top = 2340 Width = 465 End Begin VB.TextBox txtDays Alignment = 2 'Center Height = 345 Left = 5760 Locked = -1 'True TabIndex = 23 Text = "1" Top = 1920 Width = 465 End Begin VB.TextBox txtDiscount Alignment = 1 'Right Justify Height = 345 Left = 9090
frmReservation - 3 TabIndex = 22 Text = "0.00" Top = 3180 Width = 1575 End Begin VB.TextBox txtRate Alignment = 1 'Right Justify Height = 345 Left = 9090 TabIndex = 21 Text = "0.00" Top = 1500 Width = 1815 End Begin VB.TextBox txtIDNumber Height = 345 Left = 1680 TabIndex = 20 Top = 4200 Width = 1815 End Begin VB.TextBox txtCompany Height = 345 Left = 1680 TabIndex = 19 Top = 2820 Width = 1815 End Begin VB.TextBox txtAddress Height = 345 Left = 1680 TabIndex = 18 Top = 1950 Width = 1815 End Begin VB.TextBox txtFirstName Height = 345 Left = 1680 TabIndex = 17 Top = 1500 Width = 1815 End Begin VB.TextBox txtLastName Height = 345 Left = 1680 TabIndex = 16 Top = 1050 Width = 1815 End Begin VB.TextBox txtReservationNo Appearance = 0 'Flat Height = 345 Left = 1680 TabIndex = 15 Top = 600 Width = 1815 End Begin VB.CommandButton cmdSave Caption = "Save" Height = 315 Left = 9480 TabIndex = 14 Top = 6150 Width = 1335 End Begin VB.TextBox txtOtherCharges Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 13 Text = "0.00" Top = 2340 Width = 1815 End Begin VB.TextBox txtSubTotal Alignment = 1 'Right Justify
frmReservation - 4 Height = 345 Left = 9090 Locked = -1 'True TabIndex = 12 Text = "0.00" Top = 2760 Width = 1815 End Begin VB.TextBox txtTotal Alignment = 1 'Right Justify Height = 345 Left = 9090 Locked = -1 'True TabIndex = 11 Text = "0.00" Top = 3600 Width = 1815 End Begin VB.TextBox txtVehicleModel Height = 345 Left = 1650 TabIndex = 10 Top = 5340 Width = 1815 End Begin VB.TextBox txtPlateNo Height = 345 Left = 1650 TabIndex = 9 Top = 5760 Width = 1815 End Begin VB.TextBox txtNotes Height = 1485 Left = 4530 TabIndex = 8 Top = 4500 Width = 3045 End Begin VB.CommandButton cmdLookupCust Caption = ">>" Height = 315 Left = 3540 TabIndex = 7 Top = 1050 Width = 375 End Begin VB.CommandButton cmdLookupComp Caption = ">>" Height = 315 Left = 3540 TabIndex = 6 Top = 2820 Width = 375 End Begin VB.CommandButton CmdPrint Caption = "&Print" Height = 315 Left = 8130 TabIndex = 5 Top = 6150 Visible = 0 'False Width = 1335 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595 TabIndex = 34 Top = 0 Width = 11595 End Begin VB.PictureBox b8Line5 Height = 30 Left = 240 ScaleHeight = 30
frmReservation - 5 ScaleWidth = 11595 TabIndex = 35 Top = 6060 Width = 11595 End Begin MSDataListLib.DataCombo dcCountry Height = 315 Left = 1680 TabIndex = 36 Top = 2400 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSComCtl2.DTPicker dtpDateIn Height = 345 Left = 5760 TabIndex = 37 Top = 1080 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin VB.PictureBox b8GradLine1 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 180 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 38 Top = 240 Width = 3495 End Begin VB.PictureBox b8GradLine3 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 210 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 39 Top = 3330 Width = 3495 End Begin VB.PictureBox b8GradLine4 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty
frmReservation - 6 ForeColor = &H00404040& Height = 240 Left = 4050 ScaleHeight = 180 ScaleWidth = 4545 TabIndex = 40 Top = 240 Width = 4605 End Begin MSComCtl2.DTPicker dtpDateOut Height = 345 Left = 9090 TabIndex = 41 Top = 1050 Width = 1815 _ExtentX = 3201 _ExtentY = 609 _Version = 393216 Format = 104136705 CurrentDate = 39536 End Begin MSDataListLib.DataCombo dcIDType Height = 315 Left = 1680 TabIndex = 42 Top = 3780 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcRateType Height = 315 Left = 5760 TabIndex = 43 Top = 1530 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcBusSource Height = 315 Left = 5760 TabIndex = 44 Top = 3210 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.PictureBox b8GradLine2 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 240 ScaleHeight = 180 ScaleWidth = 3435 TabIndex = 45 Top = 4650 Width = 3495 End Begin MSDataListLib.DataCombo dcVehicle
frmReservation - 7 Height = 315 Left = 1650 TabIndex = 46 Top = 4920 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin MSDataListLib.DataCombo dcRoomNumber Height = 315 Left = 5760 TabIndex = 77 Top = 660 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165 Left = 9450 TabIndex = 76 Top = 3030 Width = 45 End Begin VB.Label Label22 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 75 Top = 1950 Width = 1395 End Begin VB.Label Label21 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Business Source" Height = 300 Left = 4320 TabIndex = 74 Top = 3210 Width = 1395 End Begin VB.Label Label20 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Childrens" Height = 300 Left = 4320 TabIndex = 73
frmReservation - 8 Top = 2790 Width = 1395 End Begin VB.Label Label19 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Adults" Height = 300 Left = 4320 TabIndex = 72 Top = 2370 Width = 1395 End Begin VB.Label Label18 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "No. of Days" Height = 300 Left = 4320 TabIndex = 71 Top = 1950 Width = 1395 End Begin VB.Label Label17 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Discount" Height = 300 Left = 7650 TabIndex = 70 Top = 3210 Width = 1395 End Begin VB.Label lblRatePerPeriod Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate/Period" ForeColor = &H00000000& Height = 300 Left = 7650 TabIndex = 69 Top = 1500 Width = 1395 End Begin VB.Label Label15 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Rate Type" Height = 300 Left = 4320 TabIndex = 68 Top = 1530 Width = 1395 End Begin VB.Label Label14 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date Out" Height = 300 Left = 7650 TabIndex = 67 Top = 1080 Width = 1395 End Begin VB.Label Label13 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Date In" Height = 300 Left = 4320 TabIndex = 66 Top = 1110 Width = 1395 End Begin VB.Label Label12 Alignment = 1 'Right Justify BackStyle = 0 'Transparent
frmReservation - 9 Caption = "Room Number" Height = 300 Left = 4320 TabIndex = 65 Top = 660 Width = 1395 End Begin VB.Label Label11 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "ID Type" Height = 300 Left = 240 TabIndex = 64 Top = 3780 Width = 1395 End Begin VB.Label Label10 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "ID Number" Height = 300 Left = 240 TabIndex = 63 Top = 4200 Width = 1395 End Begin VB.Label Label6 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Country" Height = 300 Left = 240 TabIndex = 62 Top = 2400 Width = 1395 End Begin VB.Label Label5 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Company" Height = 300 Left = 240 TabIndex = 61 Top = 2850 Width = 1395 End Begin VB.Label Label4 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Address" Height = 300 Left = 240 TabIndex = 60 Top = 1980 Width = 1395 End Begin VB.Label Label3 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "First name" Height = 300 Left = 240 TabIndex = 59 Top = 1530 Width = 1395 End Begin VB.Label Label2 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Last name" Height = 300 Left = 240 TabIndex = 58 Top = 1080 Width = 1395 End
frmReservation - 10 Begin VB.Label Label1 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Reservation No" Height = 300 Left = 240 TabIndex = 57 Top = 630 Width = 1395 End Begin VB.Label Label25 BackStyle = 0 'Transparent Caption = "%" Height = 315 Left = 10680 TabIndex = 56 Top = 3180 Width = 165 End Begin VB.Line Line1 BorderStyle = 3 'Dot X1 = 516 X2 = 516 Y1 = 44 Y2 = 274 End Begin VB.Label lblOtherCharges Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Other Charges" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 300 Left = 7650 TabIndex = 55 Top = 2370 Width = 1395 End Begin VB.Label Label8 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Sub Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 54 Top = 2790 Width = 1395 End Begin VB.Label lblAmountPaid Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Amount Paid" ForeColor = &H00000000& Height = 300 Left = 7650 TabIndex = 53 Top = 4080 Width = 1395 End Begin VB.Label Label24
frmReservation - 11 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Balance" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 52 Top = 4470 Width = 1395 End Begin VB.Label Label9 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Total" BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 300 Left = 7650 TabIndex = 51 Top = 3630 Width = 1395 End Begin VB.Label Label23 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Model" Height = 300 Left = 210 TabIndex = 50 Top = 5340 Width = 1395 End Begin VB.Label Label28 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Vehicle Make" Height = 300 Left = 210 TabIndex = 49 Top = 4920 Width = 1395 End Begin VB.Label Label29 Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "Plate No." Height = 300 Left = 210 TabIndex = 48 Top = 5760 Width = 1395 End Begin VB.Label Label16 BackStyle = 0 'Transparent Caption = "Notes" Height = 285 Left = 4530 TabIndex = 47 Top = 4230 Width = 585 End End
frmReservation - 12 Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 30 ScaleHeight = 37 ScaleMode = 3 'Pixel ScaleWidth = 687 TabIndex = 1 Top = 0 Width = 10305 Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Reservation" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 3 Top = 30 Width = 1710 End Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 2 Top = 360 Width = 3900 End End Begin MSComctlLib.StatusBar StatusBar1 Align = 2 'Align Bottom Height = 375 Left = 0 TabIndex = 0 Top = 7470 Width = 11265 _ExtentX = 19870 _ExtentY = 661 _Version = 393216 BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} NumPanels = 3 BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} AutoSize = 1 Object.Width = 6588 Text = "Reserved By:"
frmReservation - 13 TextSave = "Reserved By:" EndProperty BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} AutoSize = 1 Object.Width = 6588 Text = "Cancelled By:" TextSave = "Cancelled By:" EndProperty BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} AutoSize = 1 Object.Width = 6588 Text = "Business Source:" TextSave = "Business Source:" EndProperty EndProperty EndEnd
Fill all fields or fields with '*' then click 'Save' button to update.
Reservation
Notes
Plate No.
Vehicle Make
Model
Total
Balance
Amount Paid
Sub Total
Other Charges
%
Reservation No
Last name
First name
Address
Company
Country
ID Number
ID Type
Room Number
Date In Date Out
Rate Type Rate/Period
Discount
No. of Days
No. of Adults
No. of Childrens
Business Source
Total Charges
6
6
6
6
6
6
frmReservationList - 1 Dim CURR_COL As I
Dim rsRooms As NeDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub Filter SQLParser.Res SQLParser.wCo
frmReservationList - 2 Exit Sub 'Trap the errorerr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Else MsgBox err.Number & " " & err.Description End If Me.MousePointer = vbDefaultEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRooms If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "ttfftttt", False Call lvList_ClickEnd Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load()
frmReservationList - 3 ' mdiMain.AddToWin Me.Caption, Name 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "ReservationNo, Customer, Company, Address, DateIn, ReservationNo" .Tables = "qry_Reservation" .wCondition = "Status = 'Reserved'" .SortOrder = "ReservationNo ASC" .SaveStatement End With If rsRooms.State = 1 Then rsRooms.Close rsRooms.CursorLocation = adUseClient Debug.Print CN rsRooms.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRooms, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRooms, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "ReservationNo") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmReservationList = NothingEnd Sub
Private Sub SetNavigation()
frmReservationList - 4 With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) If lvList.SelectedItem.SubItems(2) = "Occupied" Then mdiMain.tbMenu.Buttons(2).Visible = False Else mdiMain.tbMenu.Buttons(2).Visible = True End If Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)' MsgBox lvList.SelectedItem.SubItems(2) DoEvents' lvList.ToolTipText = lvList.SelectedItem.SubItems(2)End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)' If Button = 2 Then PopupMenu mnuActionEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmReservationList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmReservationList Caption = "Reservation" ClientHeight = 7095 ClientLeft = 60 ClientTop = 345 ClientWidth = 9495 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 7095 ScaleWidth = 9495 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9495 TabIndex = 9 Top = 6705 Width = 9495 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9495 TabIndex = 8 Top = 6690 Width = 9495 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9495 TabIndex = 0 Top = 6720 Width = 9495 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmReservationList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = -30 TabIndex = 10 Top = 450 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 5 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Reservation No" Object.Width = 4701 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Customer" Object.Width = 4004 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmReservationList - 3 SubItemIndex = 2 Text = "Company" Object.Width = 4304 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Address" Object.Width = 3863 EndProperty BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 4 Text = "Date Reserved" Object.Width = 0 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Reservation" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 45 TabIndex = 11 Top = 150 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = -30 Top = 150 Width = 6915 EndEnd
Reservation
Selected Record: 0 0 - 0 of 0
frmRooms - 1 Public State Public PK
Dim RS Dim cIRowCount
Private Sub btnRe 'Remove selec With Grid 'Update t cIRowCoun
frmRooms - 2
rsRoomRates.Update End If Next c End With
'Save last rate entry to rate templates If State = adStateAddMode Then CN.Execute "DELETE RoomTypeID " & _ "From [Rate Templates] " & _ "WHERE RoomTypeID=" & dcRoomType.BoundText CN.Execute "INSERT INTO [Rate Templates] ( RoomTypeID, RateTypeID, RoomRate, NoofPerson, ExtraAdultRate ) " & _ "SELECT Rooms.RoomTypeID, [Room Rates].RateTypeID, [Room Rates].RoomRate, [Room Rates].NoofPerson, [Room Rates].ExtraAdultRate " & _ "FROM [Room Rates] INNER JOIN Rooms ON [Room Rates].RoomNumber = Rooms.RoomNumber " & _ "WHERE [Room Rates].RoomNumber=" & txtRoomNumber.Text End If
'Clear variables c = 0 Set rsRoomRates = Nothing CN.CommitTrans Unload frmRooms
Exit Sub err: CN.RollbackTrans prompt_err err, Name, "cmdSave_Click" Screen.MousePointer = vbDefaultEnd Sub
Private Sub cmdUpdate_Click() With Grid .TextMatrix(.RowSel, 1) = dcRateType.BoundText .TextMatrix(.RowSel, 2) = dcRateType.Text .TextMatrix(.RowSel, 3) = toMoney(txtRoomRate.Text) .TextMatrix(.RowSel, 4) = txtNoofPerson.Text .TextMatrix(.RowSel, 5) = toMoney(txtAdults.Text) .TextMatrix(.RowSel, 6) = toMoney(txtChildrens.Text) End WithEnd Sub
Private Sub AddRoomRates()On Error GoTo err
CN.BeginTrans If State = adStateAddMode Then CN.Execute "INSERT INTO [Room Rates] ( RoomNumber, RateTypeID ) " & _ "SELECT " & txtRoomNumber.Text & ", [Rate Type].RateTypeID " & _ "FROM [Rate Type]" Else Dim rsRateType As New Recordset With rsRateType .Open "SELECT RateTypeID FROM [Rate Type]", CN, adOpenStatic, adLockOptimistic Do While Not .EOF If .Fields("RateTypeID") <> getValueAt("SELECT RateTypeID FROM [Room Rates] WHERE RoomNumber = " & txtRoomNumber.Text & " AND RateTypeID = " & .Fields("RateTypeID"), "RateTypeID") Then CN.Execute "INSERT INTO [Room Rates] ( RoomNumber, RateTypeID ) " & _ "SELECT " & txtRoomNumber.Text & ", " & .Fields("RateTypeID") .Update End If .MoveNext Loop .Close End With
frmRooms - 3 End If CN.CommitTrans Exit Sub err: CN.RollbackTrans prompt_err err, Name, "AddRoomRates" Screen.MousePointer = vbDefaultEnd Sub
Private Sub dcRoomType_Click(Area As Integer) AddFromRateTemplates' Call AddRoomRates' Call DisplayForEditingEnd Sub
Private Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then SendKeys "{TAB}" End IfEnd Sub
Private Sub Form_Load()On Error GoTo err
Call InitGrid bind_dc "SELECT * FROM [Room Type]", "RoomType", dcRoomType, "RoomTypeID", True bind_dc "SELECT * FROM [Rate Type]", "RateType", dcRateType, "RateTypeID", True bind_dc "SELECT * FROM [Room Status]", "Status", dcRoomStatus, "StatusID", True
RS.Open "SELECT * FROM Rooms WHERE RoomNumber = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then AddFromRateTemplates
cmdUsrHistory.Enabled = False Else With RS txtRoomNumber.Text = PK dcRoomType.BoundText = .Fields("RoomTypeID") dcRoomStatus.BoundText = .Fields("RoomStatusID") End With Call AddRoomRates DisplayForEditing End If Exit Sub err: CN.RollbackTrans prompt_err err, Name, "cmdSave_Click" Screen.MousePointer = vbDefaultEnd Sub
'Procedure used to initialize the gridPrivate Sub InitGrid() cIRowCount = 0 With Grid .Clear .ClearStructure .Rows = 2 .FixedRows = 1 .FixedCols = 1 .Cols = 7 .ColSel = 6 'Initialize the column size .ColWidth(0) = 315 .ColWidth(1) = 0 .ColWidth(2) = 1200 .ColWidth(3) = 1200 .ColWidth(4) = 1200
frmRooms - 4 .ColWidth(5) = 1200 .ColWidth(6) = 1200
'Initialize the column name .TextMatrix(0, 0) = "" .TextMatrix(0, 1) = "Rate Type ID" .TextMatrix(0, 2) = "Rate Type" .TextMatrix(0, 3) = "Room Rate" .TextMatrix(0, 4) = "No. of Person" .TextMatrix(0, 5) = "Extra Adult's Rate" .TextMatrix(0, 6) = "Extra Children's Rate" End WithEnd Sub
Private Sub Form_Unload(Cancel As Integer) frmRoomsList.RefreshRecords Set frmRooms = NothingEnd Sub
Private Sub Grid_Click() With Grid dcRateType.BoundText = .TextMatrix(.RowSel, 1) txtRoomRate.Text = .TextMatrix(.RowSel, 3) txtNoofPerson.Text = .TextMatrix(.RowSel, 4) txtAdults.Text = .TextMatrix(.RowSel, 5) txtChildrens.Text = .TextMatrix(.RowSel, 6) If Grid.Rows = 2 And Grid.TextMatrix(1, 2) = "" Then btnRemove.Visible = False Else btnRemove.Visible = True btnRemove.Top = (Grid.CellTop + Grid.Top) - 20 btnRemove.Left = Grid.Left + 50 End If End WithEnd Sub
Private Sub ResetFields() txtRoomNumber.Text = "" txtRoomNumber.SetFocusEnd Sub
Private Sub DisplayForEditing()On Error GoTo err 'Display the details Dim rsRoomRates As New Recordset
cIRowCount = 0 rsRoomRates.CursorLocation = adUseClient rsRoomRates.Open "SELECT * FROM qry_Room_Rates WHERE RoomNumber=" & PK, CN, adOpenStatic, adLockOptimistic If rsRoomRates.RecordCount > 0 Then rsRoomRates.MoveFirst While Not rsRoomRates.EOF cIRowCount = cIRowCount + 1 'increment With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsRoomRates!RateTypeID .TextMatrix(1, 2) = rsRoomRates!RateType .TextMatrix(1, 3) = toMoney(rsRoomRates!RoomRate) .TextMatrix(1, 4) = rsRoomRates!NoofPerson .TextMatrix(1, 5) = toMoney(rsRoomRates!ExtraAdultRate) .TextMatrix(1, 6) = toMoney(rsRoomRates!ExtraChildRate) Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsRoomRates!RateTypeID .TextMatrix(.Rows - 1, 2) = rsRoomRates!RateType .TextMatrix(.Rows - 1, 3) = toMoney(rsRoomRates!RoomRate) .TextMatrix(.Rows - 1, 4) = rsRoomRates!NoofPerson .TextMatrix(.Rows - 1, 5) = toMoney(rsRoomRates!ExtraAdultRate) .TextMatrix(.Rows - 1, 6) = toMoney(rsRoomRates!ExtraChildRate) End If
frmRooms - 5 End With rsRoomRates.MoveNext Wend Grid.Row = 1 Grid.ColSel = 6 'Set fixed cols If State = adStateEditMode Then Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If End If
rsRoomRates.Close 'Clear variables Set rsRoomRates = Nothing
Exit Suberr: If err.Number = 94 Then Resume Next prompt_err err, Name, "DisplayForEditing" Screen.MousePointer = vbDefaultEnd Sub
Private Sub AddFromRateTemplates() Dim rsRateType As New Recordset Dim rsRateTemplates As New Recordset
Grid.Clear InitGrid cIRowCount = 0 rsRateTemplates.CursorLocation = adUseClient rsRateTemplates.Open "SELECT [Rate Templates].RoomTypeID, [Rate Templates].RateTypeID, [Rate Templates].RoomRate, [Rate Templates].NoofPerson, [Rate Templates].ExtraAdultRate " & _ "From [Rate Templates] " & _ "WHERE RoomTypeID= " & dcRoomType.BoundText, CN, adOpenStatic, adLockOptimistic rsRateType.CursorLocation = adUseClient rsRateType.Open "SELECT RateTypeID, RateType FROM [Rate Type]", CN, adOpenStatic, adLockOptimistic If rsRateType.RecordCount > 0 Then rsRateType.MoveFirst While Not rsRateType.EOF cIRowCount = cIRowCount + 1 'increment rsRateTemplates.Filter = "[RateTypeID]=" & rsRateType!RateTypeID With Grid If .Rows = 2 And .TextMatrix(1, 1) = "" Then .TextMatrix(1, 1) = rsRateType!RateTypeID .TextMatrix(1, 2) = rsRateType!RateType If rsRateTemplates.RecordCount > 0 Then .TextMatrix(1, 3) = toMoney(rsRateTemplates!RoomRate) .TextMatrix(1, 4) = rsRateTemplates!NoofPerson .TextMatrix(1, 5) = toMoney(rsRateTemplates!ExtraAdultRate) End If .TextMatrix(1, 6) = 0 Else .Rows = .Rows + 1 .TextMatrix(.Rows - 1, 1) = rsRateType!RateTypeID .TextMatrix(.Rows - 1, 2) = rsRateType!RateType If rsRateTemplates.RecordCount > 0 Then .TextMatrix(.Rows - 1, 3) = toMoney(rsRateTemplates!RoomRate) .TextMatrix(.Rows - 1, 4) = rsRateTemplates!NoofPerson .TextMatrix(.Rows - 1, 5) = toMoney(rsRateTemplates!ExtraAdultRate) End If .TextMatrix(.Rows - 1, 6) = 0 End If End With rsRateType.MoveNext Wend Grid.Row = 1 Grid.ColSel = 6 'Set fixed cols
frmRooms - 6 If State = adStateEditMode Then Grid.FixedRows = Grid.Row: 'Grid.SelectionMode = flexSelectionFree Grid.FixedCols = 1 End If End If rsRateType.Close rsRateTemplates.Close Set rsRateType = Nothing Set rsRateTemplates = NothingEnd Sub
Private Sub txtAdults_GotFocus() HLText txtAdultsEnd Sub
Private Sub txtAdults_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtAdults_Validate(Cancel As Boolean) txtAdults.Text = toMoney(txtAdults.Text)End Sub
Private Sub txtChildrens_GotFocus() HLText txtChildrensEnd Sub
Private Sub txtChildrens_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtChildrens_Validate(Cancel As Boolean) txtChildrens.Text = toMoney(txtChildrens.Text)End Sub
Private Sub txtNoofPerson_GotFocus() HLText txtNoofPersonEnd Sub
Private Sub txtNoofPerson_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtNoofPerson_Validate(Cancel As Boolean) txtNoofPerson.Text = toNumber(txtNoofPerson.Text)End Sub
Private Sub txtRoomRate_GotFocus() HLText txtRoomRateEnd Sub
Private Sub txtRoomRate_KeyPress(KeyAscii As Integer) KeyAscii = isNumber(KeyAscii)End Sub
Private Sub txtRoomRate_Validate(Cancel As Boolean) txtRoomRate.Text = toMoney(txtRoomRate.Text)End Sub
frmRooms - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"Begin VB.Form frmRooms BorderStyle = 1 'Fixed Single Caption = "Rooms" ClientHeight = 6120 ClientLeft = 105 ClientTop = 405 ClientWidth = 8910 ControlBox = 0 'False KeyPreview = -1 'True LinkTopic = "Form1" LockControls = -1 'True MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 6120 ScaleWidth = 8910 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton btnRemove Height = 275 Left = 210 Picture = (Icon) Style = 1 'Graphical TabIndex = 14 ToolTipText = "Remove" Top = 3180 Visible = 0 'False Width = 275 End Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid Height = 2220 Left = 150 TabIndex = 15 Top = 3000 Width = 8565 _ExtentX = 15108 _ExtentY = 3916 _Version = 393216 Rows = 0 FixedRows = 0 FixedCols = 0 RowHeightMin = 275 ForeColorFixed = -2147483640 BackColorSel = 1091552 ForeColorSel = 16777215 BackColorBkg = -2147483643 GridColor = -2147483633 GridColorFixed = -2147483633 GridColorUnpopulated= -2147483633 AllowBigSelection= 0 'False FocusRect = 0 SelectionMode = 1 AllowUserResizing= 3 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty _NumberOfBands = 1 _Band(0).Cols = 2 _Band(0).GridLinesBand= 1 _Band(0).TextStyleBand= 0 _Band(0).TextStyleHeader= 0 End Begin VB.PictureBox bgHeader Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 555 Left = 0 ScaleHeight = 37
frmRooms - 2 ScaleMode = 3 'Pixel ScaleWidth = 581 TabIndex = 11 Top = 0 Width = 8715 Begin VB.Label Label27 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Fill all fields or fields with '*' then click 'Save' button to update." BeginProperty Font Name = "Arial" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = -1 'True Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 180 Left = 600 TabIndex = 13 Top = 360 Width = 3900 End Begin VB.Label Label26 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Rooms" BeginProperty Font Name = "Tahoma" Size = 14.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00926747& Height = 345 Left = 600 TabIndex = 12 Top = 30 Width = 990 End Begin VB.Image Image1 Height = 480 Left = 30 Picture = (Icon) Top = 30 Width = 480 End End Begin VB.PictureBox bgMain Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H00E3F9FB& Height = 5535 Left = 0 ScaleHeight = 369 ScaleMode = 3 'Pixel ScaleWidth = 593 TabIndex = 16 Top = 570 Width = 8895 Begin VB.PictureBox b8Line5 Height = 30 Left = 180 ScaleHeight = 30 ScaleWidth = 8535 TabIndex = 18 Top = 4800 Width = 8535 End Begin VB.TextBox txtRoomNumber DataField = "RoomNumber"
frmRooms - 3 DataMember = "Rooms" DataSource = "deHotel" Height = 285 Left = 1650 TabIndex = 0 Top = 150 Width = 960 End Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 375 Left = 7800 TabIndex = 10 Top = 4950 Width = 885 End Begin VB.TextBox txtRoomRate Alignment = 1 'Right Justify Height = 315 Left = 2040 TabIndex = 4 Top = 2040 Width = 1455 End Begin VB.CommandButton cmdUpdate Caption = "Update" Height = 375 Left = 7710 TabIndex = 8 Top = 2010 Width = 795 End Begin VB.TextBox txtAdults Alignment = 1 'Right Justify Height = 315 Left = 5100 TabIndex = 6 Top = 2040 Width = 1245 End Begin VB.CommandButton cmdSave Caption = "Save" Height = 375 Left = 6630 TabIndex = 9 Top = 4950 Width = 885 End Begin VB.TextBox txtChildrens Alignment = 1 'Right Justify Height = 315 Left = 6420 TabIndex = 7 Top = 2040 Width = 1245 End Begin VB.TextBox txtNoofPerson Alignment = 1 'Right Justify Height = 315 Left = 3570 TabIndex = 5 Top = 2040 Width = 1455 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 240 TabIndex = 20 Top = 4950 Width = 1680 End Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 11595
frmRooms - 4 TabIndex = 17 Top = 0 Width = 11595 End Begin MSDataListLib.DataCombo dcRoomType Height = 315 Left = 1650 TabIndex = 1 Top = 510 Width = 1725 _ExtentX = 3043 _ExtentY = 556 _Version = 393216 ListField = "" BoundColumn = "RoomTypeID" Text = "" Object.DataMember = "" End Begin MSDataListLib.DataCombo dcRoomStatus DataField = "RoomStatusID" Height = 315 Left = 1650 TabIndex = 2 Top = 915 Width = 2430 _ExtentX = 4286 _ExtentY = 556 _Version = 393216 Text = "" End Begin VB.PictureBox b8GradLine2 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00404040& Height = 240 Left = 150 ScaleHeight = 180 ScaleWidth = 8445 TabIndex = 21 Top = 1380 Width = 8505 End Begin MSDataListLib.DataCombo dcRateType Height = 315 Left = 150 TabIndex = 3 Top = 2040 Width = 1815 _ExtentX = 3201 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.Label lblFieldLabel Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Room Number" Height = 195 Index = 1 Left = 585 TabIndex = 29 Top = 165 Width = 1020 End Begin VB.Label lblFieldLabel Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent
frmRooms - 5 Caption = "Room Type" Height = 195 Index = 2 Left = 780 TabIndex = 28 Top = 555 Width = 825 End Begin VB.Label lblFieldLabel Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Room Status" Height = 195 Index = 3 Left = 690 TabIndex = 27 Top = 960 Width = 915 End Begin VB.Label Label7 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Rate Type" Height = 195 Left = 420 TabIndex = 26 Top = 1800 Width = 750 End Begin VB.Label Label9 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Room Rate" Height = 195 Left = 2160 TabIndex = 25 Top = 1770 Width = 810 End Begin VB.Label Label4 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Adult's Rate" Height = 195 Left = 5100 TabIndex = 24 Top = 1770 Width = 855 End Begin VB.Label Label6 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Children's Rate" Height = 195 Left = 6390 TabIndex = 23 Top = 1770 Width = 1065 End Begin VB.Label Label1 Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "No. of Person" Height = 195 Left = 3600 TabIndex = 22 Top = 1770 Width = 975 End Begin VB.Label lblRM AutoSize = -1 'True BackStyle = 0 'Transparent BeginProperty Font
frmRooms - 6 Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 165 Left = 9450 TabIndex = 19 Top = 3030 Width = 45 End EndEnd
No. of Person Children's RateAdult's RateRoom RateRate Type
Room Status
Room Type
Room Number
6
6
6
RoomsFill all fields or fields with '*' then click 'Save' button to update.
frmRoomsList - 1 Dim CURR_COL As I
Dim rsRooms As NeDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub Filter SQLParser.Res SQLParser.wCo
frmRoomsList - 2 Exit Sub 'Trap the errorerr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Else MsgBox err.Number & " " & err.Description End If Me.MousePointer = vbDefaultEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRooms If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub btnRecOp_Click() frmCustomerRecOp.Show vbModalEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttttt", False Call lvList_ClickEnd Sub
Private Sub Form_Deactivate()
frmRoomsList - 3 mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load()' mdiMain.AddToWin Me.Caption, Name 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "RoomNumber, RoomType, Status, RoomNumber" .Tables = "qry_Rooms_Window" .SortOrder = "RoomNumber ASC" .SaveStatement End With If rsRooms.State = 1 Then rsRooms.Close rsRooms.CursorLocation = adUseClient Debug.Print CN rsRooms.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRooms, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRooms, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "RoomNumber") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCheckInList = NothingEnd Sub
frmRoomsList - 4
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) ' If lvList.SelectedItem.SubItems(2) = "Occupied" Then' mdiMain.tbMenu.Buttons(2).Visible = False' Else' mdiMain.tbMenu.Buttons(2).Visible = True' End If Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)' MsgBox lvList.SelectedItem.SubItems(2) DoEvents lvList.ToolTipText = lvList.SelectedItem.SubItems(2)End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)' If Button = 2 Then PopupMenu mnuActionEnd Sub
Private Sub mnuCheckOut_Click() With frmCheckOut .RoomNumber = CLng(LeftSplitUF(lvList.SelectedItem.Tag)) .AutoCheckOut = True
frmRoomsList - 5 .Show vbModal End WithEnd Sub
Private Sub mnuRoomRate_Click() With frmRooms .PK = CLng(LeftSplitUF(lvList.SelectedItem.Tag)) .Show vbModal End WithEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRoomsList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRoomsList Caption = "Rooms" ClientHeight = 7140 ClientLeft = 60 ClientTop = 345 ClientWidth = 10005 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 7140 ScaleWidth = 10005 Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 10005 TabIndex = 9 Top = 6750 Width = 10005 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 10005 TabIndex = 8 Top = 6735 Width = 10005 End Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 10005 TabIndex = 0 Top = 6765 Width = 10005 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 1 Top = 0 Width = 4150 Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315
frmRoomsList - 2 Left = 3075 Style = 1 'Graphical TabIndex = 3 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 2 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 6 Top = 60 Width = 2535 End End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 7 Top = 60 Width = 1365 End End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 420 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 4 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Room Number" Object.Width = 4701 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Room Type" Object.Width = 2240 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmRoomsList - 3 SubItemIndex = 2 Text = "Status" Object.Width = 3863 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Room Number" Object.Width = 0 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Rooms" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 120 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 120 Width = 6915 EndEnd
Rooms
Selected Record: 0 0 - 0 of 0
frmRoomStatus - 1 Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ On Error GoTo
frmRoomStatus - 2 "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Room Status] WHERE StatusID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmRoomStatusList.RefreshRecords End If End If Set frmRoomStatus = NothingEnd Sub
frmRoomStatus - 1 VERSION 5.00Begin VB.Form frmRoomStatus BorderStyle = 1 'Fixed Single Caption = "Room Status" ClientHeight = 1800 ClientLeft = 45 ClientTop = 330 ClientWidth = 5640 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1800 ScaleWidth = 5640 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1830 MaxLength = 100 TabIndex = 4 Tag = "Category" Top = 180 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2490 TabIndex = 3 Top = 1095 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3930 TabIndex = 2 Top = 1095 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 390 TabIndex = 1 Top = 1095 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 210 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 0 Top = 810 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Room Status" Height = 240 Left = 510 TabIndex = 5 Top = 180 Width = 1215 EndEnd
Room Status
frmRoomStatusList - 1 Option Explicit
Dim CURR_COL As IDim rsStatus As NDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmRoomStatusList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsStatus If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmRoomStatusList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Status,StatusID" .Tables = "[Room Status]" .SortOrder = "Status ASC" .SaveStatement End With rsStatus.CursorLocation = adUseClient rsStatus.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsStatus, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsStatus, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "StatusID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmRoomStatusList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmRoomStatusList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRoomStatusList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRoomStatusList Caption = "Room Status" ClientHeight = 5880 ClientLeft = 60 ClientTop = 345 ClientWidth = 8940 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5880 ScaleWidth = 8940 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8940 TabIndex = 2 Top = 5505 Width = 8940 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmRoomStatusList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8940 TabIndex = 1 Top = 5475 Width = 8940 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8940 TabIndex = 0 Top = 5490 Width = 8940 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 450 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Room Status" BeginProperty Font Name = "Tahoma"
frmRoomStatusList - 3 Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 150 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 150 Width = 6915 EndEnd
Room Status
Selected Record: 0 0 - 0 of 0
frmRoomsWindow - 1 Dim CURR_COL As I
Dim rsRooms As NeDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub Filter SQLParser.Res SQLParser.wCo
frmRoomsWindow - 2 Else MsgBox "No record to delete.", vbExclamation End If Case "Refresh" RefreshRecords Case "Print" Case "Close" Unload Me End Select Exit Sub 'Trap the errorerr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Else MsgBox err.Number & " " & err.Description End If Me.MousePointer = vbDefaultEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRooms If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub btnRecOp_Click() frmCustomerRecOp.Show vbModal
frmRoomsWindow - 3 End Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "ttfftttt", False Call lvList_ClickEnd Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load()' mdiMain.AddToWin Me.Caption, Name 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "RoomNumber, RoomType, Status, RoomNumber" .Tables = "qry_Rooms_Window" .SortOrder = "RoomNumber ASC" .SaveStatement End With If rsRooms.State = 1 Then rsRooms.Close rsRooms.CursorLocation = adUseClient Debug.Print CN rsRooms.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRooms, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRooms, RecordPage.PageStart, RecordPage.PageEnd, 15, 2, False, True, , , , "RoomNumber") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top
frmRoomsWindow - 4 End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmCheckInList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) If lvList.SelectedItem.SubItems(2) = "Occupied" Then mdiMain.tbMenu.Buttons(2).Visible = False Else mdiMain.tbMenu.Buttons(2).Visible = True End If Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub lvList_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)' MsgBox lvList.SelectedItem.SubItems(2) DoEvents lvList.ToolTipText = lvList.SelectedItem.SubItems(2)
frmRoomsWindow - 5 End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mnuActionEnd Sub
Private Sub mnuCheckOut_Click() With frmCheckOut .RoomNumber = CLng(LeftSplitUF(lvList.SelectedItem.Tag)) .AutoCheckOut = True .Show vbModal End WithEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRoomsWindow - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRoomsWindow Caption = "Rooms" ClientHeight = 7110 ClientLeft = 120 ClientTop = 420 ClientWidth = 9750 LinkTopic = "Form1" MDIChild = -1 'True ScaleHeight = 7110 ScaleWidth = 9750 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 9750 TabIndex = 2 Top = 6735 Width = 9750 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmRoomsWindow - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 9750 TabIndex = 1 Top = 6705 Width = 9750 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 9750 TabIndex = 0 Top = 6720 Width = 9750 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 420 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 4 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Room Number" Object.Width = 4701 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Rate Type" Object.Width = 2240 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
frmRoomsWindow - 3 SubItemIndex = 2 Text = "Status" Object.Width = 3863 EndProperty BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 3 Text = "Room Number" Object.Width = 0 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Rooms" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 120 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 120 Width = 6915 End Begin VB.Menu mnuAction Caption = "Action" Visible = 0 'False Begin VB.Menu mnuCheckOut Caption = "Check Out" End EndEnd
Rooms
Selected Record: 0 0 - 0 of 0
frmRoomType - 1 Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ On Error GoTo
frmRoomType - 2 "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Room Type] WHERE RoomTypeID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmRoomTypeList.RefreshRecords End If End If Set frmRoomType = NothingEnd Sub
frmRoomType - 1 VERSION 5.00Begin VB.Form frmRoomType BorderStyle = 1 'Fixed Single Caption = "Room Type" ClientHeight = 1740 ClientLeft = 45 ClientTop = 330 ClientWidth = 5505 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 1740 ScaleWidth = 5505 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1740 MaxLength = 100 TabIndex = 4 Tag = "Category" Top = 210 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2400 TabIndex = 3 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3840 TabIndex = 2 Top = 1125 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 300 TabIndex = 1 Top = 1125 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 120 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 0 Top = 840 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Business Source" Height = 240 Left = 420 TabIndex = 5 Top = 210 Width = 1215 EndEnd
Business
Source
frmRoomTypeList - 1 Option Explicit
Dim CURR_COL As IDim rsRoomType AsDim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmRoomTypeList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsRoomType If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmRoomTypeList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "RoomType,RoomTypeID" .Tables = "[Room Type]" .SortOrder = "RoomType ASC" .SaveStatement End With rsRoomType.CursorLocation = adUseClient rsRoomType.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsRoomType, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsRoomType, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "RoomTypeID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmRoomTypeList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmRoomTypeList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmRoomTypeList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmRoomTypeList Caption = "Room Type" ClientHeight = 5805 ClientLeft = 60 ClientTop = 345 ClientWidth = 8940 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5805 ScaleWidth = 8940 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8940 TabIndex = 2 Top = 5430 Width = 8940 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmRoomTypeList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8940 TabIndex = 1 Top = 5400 Width = 8940 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8940 TabIndex = 0 Top = 5415 Width = 8940 End Begin MSComctlLib.ListView lvList Height = 3435 Left = 0 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Room Type" BeginProperty Font Name = "Tahoma"
frmRoomTypeList - 3 Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 75 TabIndex = 11 Top = 180 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = 0 Top = 180 Width = 6915 EndEnd
Room Type
Selected Record: 0 0 - 0 of 0
frmRPTAccRec - 1 Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor frmReport End With
frmRPTAccRec - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Begin VB.Form frmRPTAccRec BorderStyle = 1 'Fixed Single Caption = "Account Receivable" ClientHeight = 2190 ClientLeft = 45 ClientTop = 330 ClientWidth = 4680 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2190 ScaleWidth = 4680 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3450 TabIndex = 2 Top = 1500 Width = 945 End Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2340 TabIndex = 1 Top = 1500 Width = 945 End Begin VB.PictureBox b8Line1 Height = 30 Left = 240 ScaleHeight = 30 ScaleWidth = 4185 TabIndex = 4 Top = 1260 Width = 4185 End Begin MSDataListLib.DataCombo dcCompany Height = 315 Left = 1590 TabIndex = 0 Top = 540 Width = 2295 _ExtentX = 4048 _ExtentY = 556 _Version = 393216 Style = 2 Text = "" End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Company" Height = 195 Left = 840 TabIndex = 3 Top = 600 Width = 660 EndEnd
Company 6
frmRPTCheckOut - 1 Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor .strWhere
frmReport
frmRPTCheckOut - 1 VERSION 5.00Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmRPTCheckOut BorderStyle = 1 'Fixed Single Caption = "Check Out Report" ClientHeight = 2175 ClientLeft = 45 ClientTop = 330 ClientWidth = 4680 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2175 ScaleWidth = 4680 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2280 TabIndex = 3 Top = 1560 Width = 945 End Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3390 TabIndex = 2 Top = 1560 Width = 945 End Begin MSComCtl2.DTPicker dtpCheckOut Height = 375 Left = 1920 TabIndex = 0 Top = 360 Width = 1875 _ExtentX = 3307 _ExtentY = 661 _Version = 393216 Format = 104136705 CurrentDate = 39592 End Begin VB.PictureBox b8Line1 Height = 30 Left = 180 ScaleHeight = 30 ScaleWidth = 4185 TabIndex = 4 Top = 1320 Width = 4185 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Check Out Date" Height = 195 Left = 630 TabIndex = 1 Top = 390 Width = 1155 EndEnd
Check Out Date
frmRPTDueReservat Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor .strWhere
frmReport
frmRPTDueReservation - 1 VERSION 5.00Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmRPTDueReservation BorderStyle = 1 'Fixed Single Caption = "Due Reservation" ClientHeight = 2175 ClientLeft = 45 ClientTop = 330 ClientWidth = 4680 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2175 ScaleWidth = 4680 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3360 TabIndex = 1 Top = 1560 Width = 945 End Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2250 TabIndex = 0 Top = 1560 Width = 945 End Begin MSComCtl2.DTPicker dtpCheckIn Height = 375 Left = 1890 TabIndex = 2 Top = 360 Width = 1875 _ExtentX = 3307 _ExtentY = 661 _Version = 393216 Format = 104136705 CurrentDate = 39592 End Begin VB.PictureBox b8Line1 Height = 30 Left = 150 ScaleHeight = 30 ScaleWidth = 4185 TabIndex = 3 Top = 1320 Width = 4185 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Check Out Date" Height = 195 Left = 600 TabIndex = 4 Top = 390 Width = 1155 EndEnd
Check Out Date
frmRPTOtherCharges - 1 Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor If dcChar .strWrpt_Other_Charges
frmRPTOtherCharges - 1 VERSION 5.00Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmRPTOtherCharges BorderStyle = 1 'Fixed Single Caption = "Other Charges" ClientHeight = 2895 ClientLeft = 45 ClientTop = 330 ClientWidth = 5220 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2895 ScaleWidth = 5220 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2460 TabIndex = 1 Top = 2250 Width = 945 End Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3570 TabIndex = 0 Top = 2250 Width = 945 End Begin VB.PictureBox b8Line1 Height = 30 Left = 360 ScaleHeight = 30 ScaleWidth = 4395 TabIndex = 2 Top = 1890 Width = 4395 End Begin MSComCtl2.DTPicker dtpBegDate Height = 375 Left = 1230 TabIndex = 3 Top = 1170 Width = 1605 _ExtentX = 2831 _ExtentY = 661 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 39156 End Begin MSComCtl2.DTPicker dtpEndDate Height = 375 Left = 2910 TabIndex = 4 Top = 1170 Width = 1605 _ExtentX = 2831 _ExtentY = 661 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 39156 End Begin MSDataListLib.DataCombo dcChargeType Height = 315 Left = 2010 TabIndex = 8 Top = 330 Width = 2085 _ExtentX = 3678 _ExtentY = 556 _Version = 393216
frmRPTOtherCharges - 2 Style = 2 Text = "" End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Other Charges" Height = 195 Left = 960 TabIndex = 9 Top = 360 Width = 1020 End Begin VB.Label Label4 Caption = "To" Height = 255 Left = 2940 TabIndex = 7 Top = 900 Width = 825 End Begin VB.Label Label3 Alignment = 1 'Right Justify Caption = "Date" Height = 315 Left = 630 TabIndex = 6 Top = 1200 Width = 525 End Begin VB.Label Label2 Caption = "From" Height = 255 Left = 1230 TabIndex = 5 Top = 930 Width = 825 EndEnd
From
Date
To
Other Charges6
frmRPTRoomHistory - 1 Private Sub cmdCa Unload MeEnd Sub
Private Sub cmdOk With frmReports .strRepor If cboRoo .strWDate.Value & "# O
frmRPTRoomHistory - 1 VERSION 5.00Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmRPTRoomHistory BorderStyle = 1 'Fixed Single Caption = "Room History" ClientHeight = 2820 ClientLeft = 45 ClientTop = 330 ClientWidth = 4680 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2820 ScaleWidth = 4680 StartUpPosition = 2 'CenterScreen Begin VB.ComboBox cboRoomNumber Height = 315 Left = 1770 Style = 2 'Dropdown List TabIndex = 9 Top = 270 Width = 1815 End Begin VB.CommandButton CmdCancel Caption = "Cancel" Height = 405 Left = 3240 TabIndex = 1 Top = 2160 Width = 945 End Begin VB.CommandButton CmdOK Caption = "OK" Default = -1 'True Height = 405 Left = 2130 TabIndex = 0 Top = 2160 Width = 945 End Begin VB.PictureBox b8Line1 Height = 30 Left = 30 ScaleHeight = 30 ScaleWidth = 4395 TabIndex = 2 Top = 1800 Width = 4395 End Begin MSComCtl2.DTPicker dtpBegDate Height = 375 Left = 900 TabIndex = 3 Top = 1080 Width = 1605 _ExtentX = 2831 _ExtentY = 661 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 39156 End Begin MSComCtl2.DTPicker dtpEndDate Height = 375 Left = 2580 TabIndex = 4 Top = 1080 Width = 1605 _ExtentX = 2831 _ExtentY = 661 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 39156 End Begin VB.Label Label2 Caption = "From"
frmRPTRoomHistory - 2 Height = 255 Left = 900 TabIndex = 8 Top = 840 Width = 825 End Begin VB.Label Label3 Alignment = 1 'Right Justify Caption = "Date" Height = 315 Left = 300 TabIndex = 7 Top = 1110 Width = 525 End Begin VB.Label Label4 Caption = "To" Height = 255 Left = 2610 TabIndex = 6 Top = 810 Width = 825 End Begin VB.Label Label1 AutoSize = -1 'True Caption = "Room" Height = 195 Left = 1200 TabIndex = 5 Top = 270 Width = 420 EndEnd
Room
To
Date
From
frmSearch - 1 ''***************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Ph'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE,''***************
frmSearch - 2 End If Select Case cmbOperation(1).ListIndex Case 0: strFilter = strFilter & " LIKE '%" & txtFilter(1).Text & "%'" Case 1: strFilter = strFilter & " = '" & txtFilter(1).Text & "'" Case 2: strFilter = strFilter & " <> '" & txtFilter(1).Text & "'" Case 3: strFilter = strFilter & " > '" & txtFilter(1).Text & "'" Case 4: strFilter = strFilter & " >= '" & txtFilter(1).Text & "'" Case 5: strFilter = strFilter & " < '" & txtFilter(1).Text & "'" Case 6: strFilter = strFilter & " <= '" & txtFilter(1).Text & "'" Case 7: strFilter = strFilter & " BETWEEN #" & dtpDate(2).Value & "# AND #" & dtpDate(3).Value & "#" End Select End If 'InputBox "", , strFilter 'Pass the condition to filtered records srcForm.FilterRecord strFilter 'Clear used variables strFilter = vbNullString Unload Me Exit Suberr: If err.Number = -2147352571 Then MsgBox "Invalid search operation.", vbExclamation Unload Me ElseIf err.Number = 3001 Then Resume Next Else prompt_err err, "frmFilter", "cmdOk_Click" End IfEnd Sub
Private Sub Form_Load() 'Initialize values dtpDate(0).Value = Date dtpDate(1).Value = Date dtpDate(2).Value = Date dtpDate(3).Value = Date 'Set the images for the controls With mdiMain Image1.Picture = .i16x16.ListImages(7).Picture Image2.Picture = .i16x16.ListImages(7).Picture End With Dim i As Integer If srcNoOfCol = 0 Then srcNoOfCol = srcColumnHeaders.Count For i = 1 To srcNoOfCol If srcColumnHeaders(i).Text <> "" Then cmbFields.AddItem srcColumnHeaders(i).Text Next i i = 0 cmbFields.ListIndex = 0 cmbOperation(0).ListIndex = 0 End Sub
Private Sub Form_Unload(Cancel As Integer) Set frmSearch = NothingEnd Sub
Private Sub txtFilter_GotFocus(Index As Integer) HLText txtFilter(Index)End Sub
frmSearch - 1 VERSION 5.00Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"Begin VB.Form frmSearch BorderStyle = 1 'Fixed Single Caption = "Search Records" ClientHeight = 3015 ClientLeft = 45 ClientTop = 435 ClientWidth = 6870 BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Icon = (Icon) LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3015 ScaleWidth = 6870 StartUpPosition = 2 'CenterScreen Begin VB.ComboBox cmbFields Height = 315 Left = 1800 Style = 2 'Dropdown List TabIndex = 0 Top = 120 Width = 4995 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 5520 TabIndex = 13 Top = 2520 Width = 1215 End Begin VB.CommandButton cmdOk Caption = "OK" Default = -1 'True Height = 315 Left = 4200 TabIndex = 12 Top = 2520 Width = 1215 End Begin VB.Frame Frame1 Caption = " Condition " Height = 1695 Left = 120 TabIndex = 1 Top = 600 Width = 6615 Begin VB.TextBox txtFilter Height = 285 Index = 0 Left = 3120 TabIndex = 3 Top = 360 Width = 3255 End Begin VB.TextBox txtFilter Height = 285 Index = 1 Left = 3120 TabIndex = 9 Top = 1080 Width = 3255 End Begin MSComCtl2.DTPicker dtpDate Height = 285 Index = 0 Left = 3120
frmSearch - 2 TabIndex = 4 Top = 360 Visible = 0 'False Width = 1335 _ExtentX = 2355 _ExtentY = 503 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 38207 End Begin VB.OptionButton Option2 Caption = "Or" Height = 255 Left = 1560 TabIndex = 7 Top = 720 Width = 735 End Begin VB.OptionButton Option1 Caption = "And" Height = 255 Left = 840 TabIndex = 6 Top = 720 Value = -1 'True Width = 615 End Begin VB.ComboBox cmbOperation Height = 315 Index = 1 Left = 240 Style = 2 'Dropdown List TabIndex = 8 Top = 1080 Width = 2470 End Begin VB.ComboBox cmbOperation Height = 315 Index = 0 Left = 240 Style = 2 'Dropdown List TabIndex = 2 Top = 360 Width = 2470 End Begin MSComCtl2.DTPicker dtpDate Height = 285 Index = 1 Left = 5040 TabIndex = 5 Top = 360 Visible = 0 'False Width = 1335 _ExtentX = 2355 _ExtentY = 503 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 38207 End Begin MSComCtl2.DTPicker dtpDate Height = 285 Index = 2 Left = 3120 TabIndex = 10 Top = 1080 Visible = 0 'False Width = 1335 _ExtentX = 2355 _ExtentY = 503 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 38207 End Begin MSComCtl2.DTPicker dtpDate
frmSearch - 3 Height = 285 Index = 3 Left = 5040 TabIndex = 11 Top = 1080 Visible = 0 'False Width = 1335 _ExtentX = 2355 _ExtentY = 503 _Version = 393216 CustomFormat = "MMM-dd-yyyy" Format = 104136707 CurrentDate = 38207 End Begin VB.Label Label3 Alignment = 2 'Center Caption = "And" Height = 255 Left = 4560 TabIndex = 16 Top = 1110 Width = 375 End Begin VB.Label Label2 Alignment = 2 'Center Caption = "And" Height = 255 Left = 4560 TabIndex = 15 Top = 390 Width = 375 End Begin VB.Image Image2 Height = 240 Left = 2760 Stretch = -1 'True Top = 1080 Width = 240 End Begin VB.Image Image1 Height = 240 Left = 2760 Stretch = -1 'True Top = 360 Width = 240 End End Begin VB.Label Label1 BackStyle = 0 'Transparent Caption = "Show Records Where?" Height = 255 Index = 0 Left = 120 TabIndex = 14 Top = 120 Width = 1935 EndEnd
Show Records Where?
And
And
frmSplash - 1 Option Explicit
'API for Top Most formPrivate Declare F (ByVal hWnd A ByVal X As Lo ByVal cy As LPrivate Const HWNPrivate Const SWPPrivate Const SWPPrivate Const FLA
frmSplash - 1 VERSION 5.00Begin VB.Form frmSplash BorderStyle = 0 'None Caption = "Form1" ClientHeight = 4440 ClientLeft = 0 ClientTop = 0 ClientWidth = 7380 LinkTopic = "Form1" ScaleHeight = 4440 ScaleWidth = 7380 ShowInTaskbar = 0 'False StartUpPosition = 2 'CenterScreen Begin VB.Image Image1 Height = 3465 Left = 30 Picture = (Bitmap) Top = 210 Width = 4635 End Begin VB.Label Label1 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "This programmed is licensed to:" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00C0C0C0& Height = 195 Left = 5010 TabIndex = 3 Top = 15 Width = 2880 End Begin VB.Shape Shape2 BorderColor = &H00C0C0C0& BorderWidth = 2 Height = 4425 Left = 15 Top = 0 Width = 7365 End Begin VB.Label Label2 BackStyle = 0 'Transparent Caption = "ABC" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00808080& Height = 615 Left = 5640 TabIndex = 2 Top = 255 Width = 1515 End Begin VB.Image Image4 Height = 150 Left = 6270 Picture = (Bitmap) Top = 3915 Width = 1005 End Begin VB.Image Image3 Height = 270 Left = 2970
frmSplash - 2 Picture = (Bitmap) Top = 3660 Width = 4245 End Begin VB.Label Label3 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "COPYRIGHT © 3JNet 2008 | Developed by: Jomar I. Pabuaya" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00808080& Height = 195 Left = 2190 TabIndex = 1 Top = 4125 Width = 4590 End Begin VB.Label lblStat Alignment = 1 'Right Justify AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Loading..." BeginProperty Font Name = "Tahoma" Size = 9.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 240 Left = 6420 TabIndex = 0 Top = 3105 Width = 840 End Begin VB.Shape Shape1 BackStyle = 1 'Opaque BorderColor = &H00FFFFFF& Height = 975 Left = 0 Top = 3645 Width = 7695 End Begin VB.Image Image2 Height = 300 Left = 3810 Picture = (Bitmap) Stretch = -1 'True Top = 3360 Width = 16110 EndEnd
Loading...
COPYRIGHT © 3JNet 2008 | Developed by: Jomar I. Pabuaya
ABC
This programmed is licensed to:
frmUserPermission - 1 Public strUser As
Private Sub cboAl If KeyAscii = listProdP listProdP End IfEnd Sub
Private Sub CmdCl Unload Me
frmUserPermission - 2
Private Sub listProdPack_RequestUpdate(Row As Long, Col As Long, NewValue As String, Cancel As Boolean) 'default Cancel = True 'validate' If (NewValue <> "True" Or NewValue <> "False") Then' MsgBox "Please enter valid value. It must True or False", vbExclamation' Exit Sub' End If ' NewValue = FormatNumber(GetTxtVal(NewValue), 2) NewValue = cboAllowOpen.Text If ChangePermission(listProdPack.CellText(Row, 1), NewValue) Then listProdPack.CellText(Row, Col) = NewValue listProdPack.Refresh Else 'WriteErrorLog Me.Name, "listProdPack_RequestUpdate", "Failed on: 'modRSSup.SetSupBegAP(GetTxtVal(listProdPack.celltext(Row, 1)), GetTxtVal(NewValue)) = True'" 'refresh list RefreshProdPack strUser End If Cancel = FalseEnd Sub
frmUserPermission - 1 VERSION 5.00Begin VB.Form frmUserPermission BorderStyle = 1 'Fixed Single Caption = "User Permission" ClientHeight = 6510 ClientLeft = 45 ClientTop = 330 ClientWidth = 6270 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 6510 ScaleWidth = 6270 StartUpPosition = 2 'CenterScreen Begin VB.CommandButton cmdClose Caption = "&Close" Height = 465 Left = 4590 TabIndex = 1 Top = 5940 Width = 1245 End Begin VB.ComboBox cboAllowOpen Height = 315 Left = 1410 Style = 2 'Dropdown List TabIndex = 0 Top = 1890 Visible = 0 'False Width = 1455 End Begin VB.PictureBox listProdPack BorderStyle = 0 'None BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 5565 Left = 330 ScaleHeight = 5565 ScaleWidth = 5445 TabIndex = 2 Top = 240 Width = 5445 End Begin VB.Shape Shape2 BorderColor = &H00C0C0C0& FillColor = &H00808080& Height = 4905 Left = 330 Top = 210 Width = 5475 EndEnd
frmUsers - 1
Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ
frmUsers - 2 Private Sub cmdUsrHistory_Click() On Error Resume Next Dim tDate1 As String Dim tDate2 As String Dim tUser1 As String Dim tUser2 As String tDate1 = Format$(RS.Fields("DateAdded"), "MMM-dd-yyyy HH:MM AMPM") tDate2 = Format$(RS.Fields("DateModified"), "MMM-dd-yyyy HH:MM AMPM") tUser1 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("AddedByFK"), "CompleteName") tUser2 = getValueAt("SELECT PK,CompleteName FROM tbl_SM_Users WHERE PK = " & RS.Fields("LastUserFK"), "CompleteName") MsgBox "Date Added: " & tDate1 & vbCrLf & _ "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM Users WHERE PK = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False PK = getIndex("Users") Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmUsersList.CommandPass 5 End If End If Set frmUsers = NothingEnd Sub
Private Sub txtEntry_GotFocus(Index As Integer) HLText txtEntry(Index)End Sub
Public Sub AddPermission() Dim vRS As New ADODB.Recordset Dim sSQL As String sSQL = "INSERT INTO [User Permission] ( UserID, FormID ) " _ & "SELECT '" & Me.txtEntry(0).Text & "', Form.FormID " _ & "FROM Form"
CN.Execute sSQL Exit Sub RAE: Set vRS = NothingEnd Sub
frmUsers - 1 VERSION 5.00Begin VB.Form frmUsers BorderStyle = 1 'Fixed Single Caption = "Users" ClientHeight = 2550 ClientLeft = 45 ClientTop = 330 ClientWidth = 5610 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 2550 ScaleWidth = 5610 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox b8Line1 Height = 30 Left = 90 ScaleHeight = 30 ScaleWidth = 5415 TabIndex = 10 Top = 1770 Width = 5415 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 210 TabIndex = 6 Top = 1995 Width = 1680 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 4200 TabIndex = 5 Top = 1995 Width = 1335 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2760 TabIndex = 4 Top = 1995 Width = 1335 End Begin VB.TextBox txtEntry Height = 285 Index = 1 Left = 1335 MaxLength = 100 TabIndex = 3 Tag = "Password" Top = 495 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 0 Left = 1335 MaxLength = 100 TabIndex = 2 Tag = "Username" Top = 120 Width = 2415 End Begin VB.TextBox txtEntry Height = 285 Index = 2 Left = 1335 MaxLength = 100 TabIndex = 1 Tag = "Complete Name" Top = 945 Width = 3840
frmUsers - 2 End Begin VB.CheckBox Check1 Caption = "Admin" Height = 240 Left = 1335 TabIndex = 0 Top = 1320 Width = 990 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Username" Height = 240 Index = 1 Left = 285 TabIndex = 9 Top = 120 Width = 990 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Password" Height = 240 Index = 0 Left = 360 TabIndex = 8 Top = 495 Width = 915 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Complete Name" Height = 240 Index = 2 Left = 135 TabIndex = 7 Top = 945 Width = 1140 EndEnd
Complete Name
Password
Username
frmUsersList - 1 Option Explicit
Dim RS As New Rec
Private Sub Form_ 'Set the grap 'Set the grap With mdiMain 'For listview Set lvLis Set lvLis
frmUsersList - 2 Case 4 If CLng(lvList.SelectedItem.Tag) = CurrUser.USER_PK Then MsgBox "You cannot remove your own record because you currently using it.", vbExclamation Exit Sub Else If lvList.ListItems.Count > 0 Then If isRecordExist("Users", "PK", CLng(lvList.SelectedItem.Tag)) = False Then MsgBox "This record has been removed by other user.Click 'OK' button to refresh the records.", vbExclamation RefreshRecords Exit Sub Else Dim ANS As Integer ANS = MsgBox("Are you sure you want to delete the selected record?" & vbCrLf & vbCrLf & "WARNING: You cannot undo this operation.", vbCritical + vbYesNo, "Confirm Record Delete") Me.MousePointer = vbHourglass If ANS = vbYes Then DelRecwSQL "Users", "PK", "", True, CLng(lvList.SelectedItem.Tag) RefreshRecords MsgBox "Record has been successfully deleted.", vbInformation, "Confirm" End If ANS = 0 Me.MousePointer = vbDefault End If Else MsgBox "No record to delete.", vbExclamation End If End If 'Reload Case 5: RefreshRecords Case 6: With frmUserPermission .strUser = Me.lvList.SelectedItem.Text .Show 1 End With 'Close Case 7: Unload Me End Select Exit Suberr: If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault End IfEnd Sub
frmUsersList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmUsersList BorderStyle = 1 'Fixed Single Caption = "Users" ClientHeight = 5790 ClientLeft = 45 ClientTop = 330 ClientWidth = 8835 LinkTopic = "Form2" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 5790 ScaleWidth = 8835 StartUpPosition = 2 'CenterScreen Begin VB.PictureBox b8Line1 Height = 30 Left = 30 ScaleHeight = 30 ScaleWidth = 8745 TabIndex = 2 Top = 420 Width = 8745 End Begin MSComctlLib.Toolbar tbMenu Align = 1 'Align Top Height = 360 Left = 0 TabIndex = 0 Top = 0 Width = 8835 _ExtentX = 15584 _ExtentY = 635 ButtonWidth = 2037 ButtonHeight = 582 AllowCustomize = 0 'False Wrappable = 0 'False Appearance = 1 Style = 1 TextAlignment = 1 ImageList = "i16x16" DisabledImageList= "i16x16" HotImageList = "i16x16" _Version = 393216 BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} NumButtons = 13 BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Find" Object.ToolTipText = "F1" ImageIndex = 1 EndProperty BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} Style = 3 EndProperty BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "New" Object.ToolTipText = "F2" ImageIndex = 2 EndProperty BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} Object.ToolTipText = "F3" Style = 3 EndProperty BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Edit" Object.ToolTipText = "F4" ImageIndex = 3 EndProperty BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} Style = 3 EndProperty BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Delete" Object.ToolTipText = "F5" ImageIndex = 4 EndProperty BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
frmUsersList - 2 Style = 3 EndProperty BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Refresh" Object.ToolTipText = "F6" ImageIndex = 5 EndProperty BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} Style = 3 EndProperty BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Permission" Object.ToolTipText = "F7" ImageIndex = 6 EndProperty BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} Style = 3 EndProperty BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Close" EndProperty EndProperty End Begin MSComctlLib.ImageList i16x16 Left = 5520 Top = 3645 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 16 ImageHeight = 16 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 6 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty EndProperty End Begin MSComctlLib.ListView lvList Height = 4860 Left = 60 TabIndex = 1 Top = 540 Width = 8685 _ExtentX = 15319 _ExtentY = 8573 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 ForeColor = -2147483640
frmUsersList - 3 BackColor = -2147483643 BorderStyle = 1 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 3 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "User Name" Object.Width = 3598 EndProperty BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 1 Text = "Complete Name" Object.Width = 6068 EndProperty BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} SubItemIndex = 2 Text = "Admin" Object.Width = 2540 EndProperty EndEnd
frmVehicles - 1 Option Explicit
Public State Public PK Public srcText
Dim HaveAction Dim RS
Private Sub Displ On Error GoTo
frmVehicles - 2 "Added By: " & tUser1 & vbCrLf & _ "" & vbCrLf & _ "Last Modified: " & tDate2 & vbCrLf & _ "Modified By: " & tUser2, vbInformation, "Modification History" tDate1 = vbNullString tDate2 = vbNullString tUser1 = vbNullString tUser2 = vbNullStringEnd Sub
Private Sub Form_Load() RS.CursorLocation = adUseClient RS.Open "SELECT * FROM [Vehicles] WHERE VehicleID = " & PK, CN, adOpenStatic, adLockOptimistic 'Check the form state If State = adStateAddMode Then Caption = "Create New Entry" cmdUsrHistory.Enabled = False Else Caption = "Edit Entry" DisplayForEditing End If End Sub
Private Sub Form_Unload(Cancel As Integer) If HaveAction = True Then If State = adStateAddMode Or adStateEditMode Then frmVehiclesList.RefreshRecords End If End If Set frmVehicles = NothingEnd Sub
frmVehicles - 1 VERSION 5.00Begin VB.Form frmVehicles Caption = "Vehicles" ClientHeight = 1620 ClientLeft = 60 ClientTop = 345 ClientWidth = 5610 LinkTopic = "Form2" ScaleHeight = 1620 ScaleWidth = 5610 StartUpPosition = 2 'CenterScreen Begin VB.TextBox txtEntry Height = 285 Left = 1710 MaxLength = 100 TabIndex = 3 Tag = "Category" Top = 150 Width = 3030 End Begin VB.CommandButton cmdSave Caption = "Save" Default = -1 'True Height = 315 Left = 2370 TabIndex = 2 Top = 1065 Width = 1335 End Begin VB.CommandButton cmdCancel Caption = "Cancel" Height = 315 Left = 3810 TabIndex = 1 Top = 1065 Width = 1335 End Begin VB.CommandButton cmdUsrHistory Caption = "Modification History" Height = 315 Left = 270 TabIndex = 0 Top = 1065 Width = 1680 End Begin VB.PictureBox b8Line1 Height = 30 Left = 90 ScaleHeight = 30 ScaleWidth = 5205 TabIndex = 4 Top = 780 Width = 5205 End Begin VB.Label Labels Alignment = 1 'Right Justify Caption = "Vehicle" Height = 240 Left = 390 TabIndex = 5 Top = 150 Width = 1215 EndEnd
Vehicle
frmVehiclesList - 1 Option Explicit
Dim CURR_COL As IDim rsVehicle As Dim RecordPage AsDim SQLParser As
'Procedure used tPublic Sub FilterSQLParser.RestoreSQLParser.wCondit
frmVehiclesList - 2 If err.Number = -2147467259 Then MsgBox "You cannot delete this record because it was used by other records! If you want to delete this record" & vbCrLf & _ "you will first have to delete or change the records that currenly used this record as shown bellow." & vbCrLf & vbCrLf & _ err.Description, , "Delete Operation Failed!" Me.MousePointer = vbDefault Else MsgBox err.Description End IfEnd Sub
Public Sub RefreshRecords() SQLParser.RestoreStatement ReloadRecords SQLParser.SQLStatementEnd Sub
'Procedure for reloadingrecordsPublic Sub ReloadRecords(ByVal srcSQL As String) '-In this case I used SQL because it is faster than Filter function of VB '-when hundling millions of records. On Error GoTo err With rsVehicle If .State = adStateOpen Then .Close .Open srcSQL End With RecordPage.Refresh FillList 1 Exit Suberr: If err.Number = -2147217913 Then srcSQL = Replace(srcSQL, "'", "", , , vbTextCompare) Resume ElseIf err.Number = -2147217900 Then MsgBox "Invalid search operation.", vbExclamation SQLParser.RestoreStatement srcSQL = SQLParser.SQLStatement Resume Else prompt_err err, Name, "ReloadRecords" End IfEnd Sub
Private Sub btnClose_Click() Unload MeEnd Sub
Private Sub btnFirst_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList 1End Sub
Private Sub btnLast_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_TOTALEnd Sub
Private Sub btnNext_Click() If RecordPage.PAGE_CURRENT <> RecordPage.PAGE_TOTAL Then FillList RecordPage.PAGE_NEXTEnd Sub
Private Sub btnPrev_Click() If RecordPage.PAGE_CURRENT <> 1 Then FillList RecordPage.PAGE_PREVIOUSEnd Sub
Private Sub Form_Activate() HighlightInWin Me.Name: mdiMain.ShowTBButton "tttttft"End Sub
Private Sub Form_Deactivate() mdiMain.HideTBButton "", TrueEnd Sub
Private Sub Form_Load() 'Set the graphics for the controls With mdiMain 'For listview Set lvList.SmallIcons = .i16x16 Set lvList.Icons = .i16x16
frmVehiclesList - 3 btnFirst.Picture = .i16x16.ListImages(3).Picture btnPrev.Picture = .i16x16.ListImages(4).Picture btnNext.Picture = .i16x16.ListImages(5).Picture btnLast.Picture = .i16x16.ListImages(6).Picture btnFirst.DisabledPicture = .i16x16g.ListImages(3).Picture btnPrev.DisabledPicture = .i16x16g.ListImages(4).Picture btnNext.DisabledPicture = .i16x16g.ListImages(5).Picture btnLast.DisabledPicture = .i16x16g.ListImages(6).Picture End With With SQLParser .Fields = "Vehicle,VehicleID" .Tables = "[Vehicles]" .SortOrder = "Vehicle ASC" .SaveStatement End With rsVehicle.CursorLocation = adUseClient rsVehicle.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly With RecordPage .Start rsVehicle, 75 FillList 1 End With
End Sub
Private Sub FillList(ByVal whichPage As Long) RecordPage.CurrentPosition = whichPage Screen.MousePointer = vbHourglass Me.Enabled = False Call pageFillListView(lvList, rsVehicle, RecordPage.PageStart, RecordPage.PageEnd, 2, 2, False, True, , , , "VehicleID") Me.Enabled = True Screen.MousePointer = vbDefault SetNavigation 'Display the page information lblPageInfo.Caption = "Record " & RecordPage.PageInfo 'Display the selected record lvList_ClickEnd Sub
Private Sub Form_Resize() On Error Resume Next If WindowState <> vbMinimized Then If Me.Width < 9195 Then Me.Width = 9195 If Me.Height < 4500 Then Me.Height = 4500 shpBar.Width = ScaleWidth lvList.Width = Me.ScaleWidth lvList.Height = (Me.ScaleHeight - Picture1.Height) - lvList.Top End IfEnd Sub
Private Sub Form_Unload(Cancel As Integer) mdiMain.RemoveChild Me.Name mdiMain.HideTBButton "", True Set frmVehiclesList = NothingEnd Sub
Private Sub SetNavigation() With RecordPage If .PAGE_TOTAL = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = False btnLast.Enabled = False ElseIf .PAGE_CURRENT = 1 Then btnFirst.Enabled = False btnPrev.Enabled = False btnNext.Enabled = True btnLast.Enabled = True
frmVehiclesList - 4 ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = False btnLast.Enabled = False Else btnFirst.Enabled = True btnPrev.Enabled = True btnNext.Enabled = True btnLast.Enabled = True End If End WithEnd Sub
Private Sub lvList_Click() On Error GoTo err lblCurrentRecord.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag) Exit Suberr: lblCurrentRecord.Caption = "Selected Record: NONE"End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu mdiMain.mnuRecAEnd Sub
Private Sub lvList_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) 'Sort the listview If ColumnHeader.Index - 1 <> CURR_COL Then lvList.SortOrder = 0 Else lvList.SortOrder = Abs(lvList.SortOrder - 1) End If lvList.SortKey = ColumnHeader.Index - 1 lvList.Sorted = True CURR_COL = ColumnHeader.Index - 1End Sub
Private Sub lvList_DblClick() CommandPass "Edit"End Sub
Private Sub lvList_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 38 Or KeyCode = 40 Or KeyCode = 33 Or KeyCode = 34 Then lvList_ClickEnd Sub
Private Sub Picture1_Resize() Picture2.Left = Picture1.ScaleWidth - Picture2.ScaleWidthEnd Sub
frmVehiclesList - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.Form frmVehiclesList Caption = "Vehicles" ClientHeight = 5445 ClientLeft = 60 ClientTop = 345 ClientWidth = 8100 LinkTopic = "Form2" MDIChild = -1 'True ScaleHeight = 5445 ScaleWidth = 8100 Begin VB.PictureBox Picture1 Align = 2 'Align Bottom BorderStyle = 0 'None Height = 375 Left = 0 ScaleHeight = 375 ScaleWidth = 8100 TabIndex = 2 Top = 5070 Width = 8100 Begin VB.PictureBox Picture2 BorderStyle = 0 'None Height = 345 Left = 3000 ScaleHeight = 345 ScaleWidth = 4155 TabIndex = 3 Top = 0 Width = 4150 Begin VB.CommandButton btnFirst Height = 315 Left = 2760 Style = 1 'Graphical TabIndex = 7 ToolTipText = "First 250" Top = 10 Width = 315 End Begin VB.CommandButton btnPrev Height = 315 Left = 3075 Style = 1 'Graphical TabIndex = 6 ToolTipText = "Previous 250" Top = 10 Width = 315 End Begin VB.CommandButton btnLast Height = 315 Left = 3705 Style = 1 'Graphical TabIndex = 5 ToolTipText = "Last 250" Top = 10 Width = 315 End Begin VB.CommandButton btnNext Height = 315 Left = 3390 Style = 1 'Graphical TabIndex = 4 ToolTipText = "Next 250" Top = 10 Width = 315 End Begin VB.Label lblPageInfo Alignment = 1 'Right Justify BackStyle = 0 'Transparent Caption = "0 - 0 of 0" Height = 255 Left = 120 TabIndex = 8 Top = 60 Width = 2535 End
frmVehiclesList - 2 End Begin VB.Label lblCurrentRecord AutoSize = -1 'True Caption = "Selected Record: 0" Height = 195 Left = 120 TabIndex = 9 Top = 60 Width = 1365 End End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000014& BorderStyle = 0 'None Height = 15 Index = 0 Left = 0 ScaleHeight = 15 ScaleWidth = 8100 TabIndex = 1 Top = 5055 Width = 8100 End Begin VB.PictureBox picLine Align = 2 'Align Bottom BackColor = &H80000010& BorderStyle = 0 'None Height = 15 Index = 1 Left = 0 ScaleHeight = 15 ScaleWidth = 8100 TabIndex = 0 Top = 5040 Width = 8100 End Begin MSComctlLib.ListView lvList Height = 3435 Left = -30 TabIndex = 10 Top = 480 Width = 7260 _ExtentX = 12806 _ExtentY = 6059 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False FullRowSelect = -1 'True GridLines = -1 'True _Version = 393217 Icons = "ImageList1" SmallIcons = "ImageList1" ForeColor = -2147483640 BackColor = -2147483643 Appearance = 1 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty NumItems = 1 BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} Text = "Category" Object.Width = 6288 EndProperty End Begin VB.Label lblTitle BackStyle = 0 'Transparent Caption = "Vehicles" BeginProperty Font Name = "Tahoma"
frmVehiclesList - 3 Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H80000014& Height = 210 Left = 45 TabIndex = 11 Top = 180 Width = 4815 End Begin VB.Shape shpBar BackColor = &H80000010& BackStyle = 1 'Opaque BorderColor = &H80000010& Height = 240 Left = -30 Top = 180 Width = 6915 EndEnd
Vehicles
Selected Record: 0 0 - 0 of 0
frmWelcome - 1 Option Explicit
Public Sub ShowForm() mdiMain.AddChEnd Sub
Private Sub Form_ Active mdiMain.ActivEnd Sub
frmWelcome - 1 VERSION 5.00Begin VB.Form frmWelcome BorderStyle = 0 'None Caption = "Welcome" ClientHeight = 5565 ClientLeft = 0 ClientTop = 0 ClientWidth = 12780 LinkTopic = "Form1" MDIChild = -1 'True ScaleHeight = 5565 ScaleWidth = 12780 ShowInTaskbar = 0 'False Begin VB.Image Image1 Height = 3465 Left = 0 Picture = (Bitmap) Top = 990 Width = 4635 End Begin VB.Image Image2 Height = 300 Left = 4620 Picture = (Bitmap) Stretch = -1 'True Top = 4140 Width = 15360 End Begin VB.Image Image3 Height = 270 Left = 4350 Picture = (Bitmap) Top = 4410 Width = 4245 End Begin VB.Shape Shape1 BackStyle = 1 'Opaque BorderColor = &H00FFFFFF& Height = 12000 Left = 0 Top = 4380 Width = 15360 EndEnd
mdiMain - 1 Option Explicit
Private Const m_TPrivate Const m_TPrivate Const m_T
'Flag for User logPublic bUserLogge
'Control Procedures'----------------
mdiMain - 2 Select Case Index Case m_TabSearch 'search 'resize txtSearchWhat.Move 150, txtSearchWhat.Top, b8ST(Index).Width - 300 cmbLookIn.Move 150, cmbLookIn.Top, txtSearchWhat.Width cmdSearch.Move b8ST(Index).Width - cmdSearch.Width - 150 Case m_TabFilterDate 'filter date b8DateP.Move 150, b8DateP.Top, b8ST(Index).Width - 300 Case m_TabShowQuickLaunch listQL.Move 150, listQL.Top, b8ST(Index).Width - 300
End Select
End Sub
Private Sub b8ST_CompleteExpand(Index As Integer) Dim i As Integer For i = 0 To b8ST.UBound If Index <> i Then If b8ST(i).AutoContract = True Then b8ST(i).Expanded = False End If End If NextEnd Sub
Private Sub b8ST_Resize(Index As Integer) Dim i As Integer For i = 1 To b8ST.UBound b8ST(i).Move b8ST(i).Left, (b8ST(i - 1).Top + b8ST(i - 1).Height) - 15 Next If b8ST(Index).Expanded = True Then Select Case Index Case m_TabSearch 'search 'resize txtSearchWhat.Move 150, txtSearchWhat.Top, b8ST(Index).Width - 300 cmbLookIn.Move 150, cmbLookIn.Top, txtSearchWhat.Width cmdSearch.Move b8ST(Index).Width - cmdSearch.Width - 150 Case m_TabFilterDate 'filter date b8DateP.Move 150, b8DateP.Top, b8ST(Index).Width - 300 Case m_TabShowQuickLaunch listQL.Move 150, listQL.Top, b8ST(Index).Width - 300 End Select End If
End Sub
Private Sub listQL_DblClick()
Dim selItem As ListItem On Error GoTo RAE Set selItem = listQL.SelectedItem Select Case selItem.Key Case "reservation" 'Manage Products" If allowOpen("frmReservation", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If With frmReservation .Shortcut = True .Show vbModal End With
mdiMain - 3 Case "rooms_windows" 'Manage Supliers" If allowOpen("frmRoomsWindow", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
LoadForm frmRoomsWindow Case "cust" 'Manage Customers" If allowOpen("frmAllCustomer", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
' frmAllCustomer.ShowForm Case "poad" 'New P.O." If allowOpen("frmPOEntry", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
' frmPOEntry.ShowAdd Case "sale" 'New Sales Entry" If allowOpen("frmSIEntry", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
' frmSIEntry.ShowAdd Case "ppm" 'Purchases/Payments Mon." If allowOpen("frmAllPPM", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
' frmAllPPM.ShowForm Case "sicpm" 'Sales/Cust.Payments Mon." If allowOpen("frmAllSICPM", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmAllSICPM.ShowForm Case "void" 'Void Products Mon." If allowOpen("frmAllVoid", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmAllVoid.ShowForm Case "stock" 'Stock Inventory" If allowOpen("frmAllStockInv", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmAllStockInv.ShowForm Case "checkcust" 'Manage Due Checks (Cust.)" If allowOpen("frmAllCustPayDueCheck", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation
mdiMain - 4 Exit Sub End If ' frmAllCustPayDueCheck.ShowForm Case "checksupp" 'Manage Due Checks (Supp.)" If allowOpen("frmAllPTSDueCheck", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmAllPTSDueCheck.ShowForm End Select
RAE: Set selItem = NothingEnd Sub
Private Sub MDIForm_Load() 'show weclome frmWelcome.ShowForm 'set menus' Set b8Menus(0).Menu = Me.mnuSystem' Set b8Menus(1).Menu = Me.mnuRecords' Set b8Menus(2).Menu = Me.mnuMonitoring' Set b8Menus(3).Menu = Me.mnuTools' Set b8Menus(4).Menu = Me.mnuRecA' Set b8Menus(5).Menu = Me.mnuReports' Set b8Menus(6).Menu = Me.mnuHelp 'add quick launch items listQL.ListItems.Add , "reservation", "New Reservation", 1, 1 listQL.ListItems.Add , "rooms_windows", "Rooms", 1, 1
DisplayUserInfo
HideTBButton "", True frmWelcome.ActiveEnd Sub
Private Sub mnuAccountReceivables_Click() If allowOpen("frmAccountReceivableList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmAccountReceivableListEnd Sub
Private Sub mnuBackupDatabase_Click() If allowOpen("frmDBBackup", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If ' frmDBBackup.ShowFormEnd Sub
Private Sub mnuBusinessSource_Click() If allowOpen("frmBusinessSourceList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmBusinessSourceListEnd Sub
Private Sub mnuChangeDeskClerk_Click()
mdiMain - 5 frmCloseShift.Show 1End Sub
Private Sub mnuChargeType_Click() If allowOpen("frmChargeTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmChargeTypeListEnd Sub
Private Sub mnuCheckInHistory_Click() If allowOpen("frmCheckInList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmCheckInListEnd Sub
Private Sub mnuCompany_Click() If allowOpen("frmCompanyList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmCompanyListEnd Sub
Private Sub mnuCountries_Click() If allowOpen("frmCountriesList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmCountriesListEnd Sub
Private Sub mnuCustomers_Click() If allowOpen("frmCustomersList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmCustomersListEnd Sub
Private Sub mnuDatabaseRestore_Click()' If allowOpen("frmRestore", CurrUser.USER_NAME) = False Then' MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _' "Please ask permission from your administrator.", vbInformation'' Exit Sub' End If'' frmRestore.ShowFormEnd Sub
Private Sub mnuDueReservation_Click() If allowOpen("frmRPTDueReservation", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
mdiMain - 6 frmRPTDueReservation.Show vbModalEnd Sub
Private Sub mnuExit_Click() Unload MeEnd Sub
Private Sub mnuIDType_Click() If allowOpen("frmIDTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmIDTypeListEnd Sub
Private Sub mnuLogOff_Click() If MsgBox("Are you sure you want to log out?", vbQuestion + vbYesNo) = vbNo Then Exit Sub
'SendMessage frmShortcuts.hwnd, WM_CLOSE, 0, 0 UnloadChilds' SendMessage frmShortcuts.hWnd, WM_ACTIVATE, 0, 0 'ClearInfoMsg' StatusBar1.Panels(3).Text = ""' StatusBar1.Panels(4).Text = "" CurrUser.USER_NAME = "" CurrUser.USER_PK = 0 frmLogin.Show vbModal: If CloseMe = True Then Unload Me: Exit Sub: Exit Sub' DisplayUserInfoEnd Sub
Private Sub mnuManageUser_Click() frmUsersList.Show vbModalEnd Sub
Private Sub mnuNewReservation_Click() If allowOpen("frmReservation", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmReservation.Show vbModalEnd Sub
Private Sub mnuPaymentType_Click() If allowOpen("frmPaymentTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmPaymentTypeListEnd Sub
Private Sub mnuPreferences_Click()' If allowOpen("frmPref", CurrUser.USER_NAME) = False Then' MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _' "Please ask permission from your administrator.", vbInformation'' Exit Sub' End If'' frmPref.ShowForm 0End Sub
Private Sub mnuRateType_Click() If allowOpen("frmRateTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _
mdiMain - 7 "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmRateTypeListEnd Sub
Private Sub mnuReservations_Click() If allowOpen("frmReservationList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmReservationListEnd Sub
Private Sub mnuRooms_Click() If allowOpen("frmRoomsList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If
LoadForm frmRoomsListEnd Sub
Private Sub mnuRoomStatus_Click() If allowOpen("frmRoomStatusList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmRoomStatusListEnd Sub
Private Sub mnuRoomType_Click() If allowOpen("frmRoomTypeList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmRoomTypeListEnd Sub
Private Sub mnuRPTAccRec_Click() If allowOpen("frmRPTAccRec", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmRPTAccRec.Show vbModalEnd Sub
Private Sub mnuRPTCheckedInGuest_Click() If allowOpen("rpt_CheckIn_Guest", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If With frmReports .strReport = "CheckIn Guest"
frmReports.Show vbModal End WithEnd Sub
mdiMain - 8
Private Sub mnuRPTCheckOut_Click() If allowOpen("frmRPTCheckOut", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmRPTCheckOut.Show vbModalEnd Sub
Private Sub mnuRPTGuestList_Click() If allowOpen("rpt_Guest_List", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If With frmReports .strReport = "Guest List"
frmReports.Show vbModal End WithEnd Sub
Private Sub mnuRPTOtherCharges_Click() If allowOpen("frmRPTOtherCharges", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmRPTOtherCharges.Show vbModalEnd Sub
Private Sub mnuInventoryView_Click() If allowOpen("frmInventoryView", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmInventoryViewEnd Sub
Private Sub mnuRPTRoomHistory_Click() If allowOpen("frmRPTRoomHistory", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If frmRPTRoomHistory.Show 1End Sub
Private Sub mnuVehicles_Click() If allowOpen("frmVehiclesList", CurrUser.USER_NAME) = False Then MsgBox "You're not allowed to open this form." & vbCrLf & vbCrLf & _ "Please ask permission from your administrator.", vbInformation Exit Sub End If LoadForm frmVehiclesListEnd Sub
Private Sub tbMenu_ButtonClick(ByVal Button As MSComctlLib.Button) ActiveForm.CommandPass Button.KeyEnd Sub
Private Sub timeUpdateDate_Timer() lblDate.Caption = FormatDateTime(Now, vbGeneralDate)
mdiMain - 9 End Sub
'Private Sub txtSearchWhat_KeyPress(KeyAscii As Integer)' If KeyAscii = vbKeyReturn Then' Call cmdSearch_Click' End If'End Sub
'Private Sub cmdSearch_Click()' Form_Search'End Sub
'-----------------------------------------------------------' end Control Procedures
' MDI Form procedures'-----------------------------------------------------------Private Sub MDIForm_Resize() Dim frm As Form On Error Resume Next 'resize header menus bg 'bgHeaderMenu.Left = b8SBC.Width / Screen.TwipsPerPixelX 'resize bg Record Opt bgRecOpt.Move b8SBC.Width / Screen.TwipsPerPixelX 'resize childs If GetActiveChildCount > 0 Then For Each frm In Forms If frm.Name <> Me.Name Then If frm.MDIChild = True Then If frm.Name = Me.ActiveForm.Name Then ResizeMdiChildForm frm Else frm.Visible = False End If End If End If Next End If Set frm = NothingEnd Sub
Private Sub MDIForm_Unload(Cancel As Integer) EndEnd Sub'Get Opened MDI Child Forms CountPublic Function GetActiveChildCount() As Integer Dim frm As Form Dim iCount As Integer iCount = 0 For Each frm In Forms If frm.Name <> Me.Name Then If frm.MDIChild = True Then iCount = iCount + 1 End If End If Next GetActiveChildCount = iCount Set frm = Nothing End Function
'-----------------------------------------------------------' >> End MDI Form procedures'------------------------------------------------------------
mdiMain - 10
'------------------------------------------------------------' Parent To Child procedures'------------------------------------------------------------
Public Sub AddChild(ByRef CFrm As Form)
'load form modFuncChild.LoadForm CFrm End Sub
Public Sub ActivateChild(ByRef CFrm As Form)
'activate form Me.b8CW.SetActiveWindow CFrm.Name 'refresh record operation buttons' Form_CanAdd' Form_CanEdit' Form_CanDelete' Form_CanRefresh' Form_CanPrint' Form_CanSearch' Form_SetSearch
End Sub
Public Sub RemoveChild(ByVal sFormName As String) 'remove form Me.b8CW.RemoveChildWindow sFormName End Sub
'Record Operation
'Public Function Form_CanAdd() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanAdd'' b8RecOpt(0).Enabled = bReturn'' Form_CanAdd = bReturn'' err.Clear''End Function
'Public Function Form_CanEdit() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanEdit'' b8RecOpt(1).Enabled = bReturn'' Form_CanEdit = bReturn'' err.Clear''End Function
'Public Function Form_Edit()'' If Form_CanEdit Then' Me.ActiveForm.Form_Edit' End If
mdiMain - 11 ''End Function
'Public Function Form_CanDelete() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanDelete'' b8RecOpt(2).Enabled = bReturn'' Form_CanDelete = bReturn'' err.Clear''End Function
'Public Function Form_Delete()'' If Form_CanDelete Then' Me.ActiveForm.Form_Delete' End If''End Function
'Public Function Form_CanRefresh() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanRefresh'' b8RecOpt(3).Enabled = bReturn'' Form_CanRefresh = bReturn'' err.Clear''End Function
'Public Function Form_Refresh()'' If Form_CanRefresh Then' Me.ActiveForm.Form_Refresh' End If''End Function
'Public Function Form_CanPrint() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanPrint'' b8RecOpt(4).Enabled = bReturn'' Form_CanPrint = bReturn'' err.Clear''End Function
'Public Function Form_Print()
mdiMain - 12 ' If Form_CanPrint Then' Me.ActiveForm.Form_Print' End If'End Function
'Public Function Form_CanSearch() As Boolean'' Dim bReturn As Boolean'' On Error Resume Next'' bReturn = False' bReturn = Me.ActiveForm.Form_CanSearch'' Form_CanSearch = bReturn'' err.Clear''End Function
Public Function Form_ShowQuickLaunch()
'expand side bar If b8SBT.SizeState <> ssContracted Then b8SBT.SizeState = ssContracted End If
'expand search tab If b8ST(m_TabShowQuickLaunch).Expanded = False Then b8ST(m_TabShowQuickLaunch).Expanded = True End If On Error Resume Next b8ST(m_TabShowQuickLaunch).SetFocus 'HLTxt txtSearchWhat err.Clear End Function
'Public Function Form_ShowSearch()'' 'expand side bar' If b8SBT.SizeState <> ssContracted Then' b8SBT.SizeState = ssContracted' End If'' 'expand search tab' If b8ST(m_TabSearch).Expanded = False Then' b8ST(m_TabSearch).Expanded = True' End If'' On Error Resume Next' b8ST(m_TabSearch).SetFocus' HLTxt txtSearchWhat' err.Clear''End Function
Public Function Form_ShowDateFilter()
'expand side bar If b8SBT.SizeState <> ssContracted Then b8SBT.SizeState = ssContracted End If
'expand search tab If b8ST(m_TabFilterDate).Expanded = False Then b8ST(m_TabFilterDate).Expanded = True End If On Error Resume Next b8ST(m_TabFilterDate).SetFocus b8DateP.SetFocus
mdiMain - 13 err.Clear End Function
Public Function Form_SetSearch() Dim bReturn As Boolean Dim sFields() As String Dim i As Integer 'clear txtSearchWhat.Text = "" cmbLookIn.Clear On Error Resume Next bReturn = False bReturn = Me.ActiveForm.Form_SetSearch(sFields)
txtSearchWhat.Enabled = bReturn cmbLookIn.Enabled = bReturn cmdSearch.Enabled = bReturn If bReturn = True Then cmbLookIn.AddItem "All Fields" cmbLookIn.ListIndex = 0 If UBound(sFields) >= 0 Then For i = 0 To UBound(sFields) cmbLookIn.AddItem sFields(i) Next End If Else 'contract search tab if it was expanded If b8ST(m_TabSearch).Expanded = True Then b8ST(m_TabSearch).Expanded = False End If End If Form_SetSearch = bReturn err.ClearEnd Function
'Public Function Form_Search()'' Dim bResult As Boolean'' 'default' bResult = False''' On Error GoTo errh'' If txtSearchWhat.Text = "Enter text here" Then' txtSearchWhat.Text = ""' End If'' If Len(Trim(txtSearchWhat.Text)) <= 0 Then' MsgBox "Please enter text to search.", vbExclamation' txtSearchWhat.Text = "Enter text here"' HLTxt txtSearchWhat' GoTo errh' End If'' If Len(Trim(cmbLookIn.Text)) <= 0 Then' MsgBox "Please enter valid field.", vbExclamation' cmbLookIn.SetFocus' GoTo errh' End If''' bResult = Me.ActiveForm.Form_Search(Trim(txtSearchWhat.Text), Trim(cmbLookIn.Text))'' If bResult = False Then' MsgBox "Cannot find '" & txtSearchWhat.Text & "'", vbExclamation
mdiMain - 14 ' HLTxt txtSearchWhat' End If''errh:' err.Clear''End Function
Public Sub Form_DateChange()
On Error GoTo errh Me.ActiveForm.Form_DateChangeerrh:End Sub
Public Function Form_StartBussy() Me.MousePointer = vbHourglassEnd Function
Public Function Form_EndBussy() Me.MousePointer = vbDefaultEnd Function
Public Sub AFForm_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 83 And Shift = 4 Then b8Menus(0).ShowPopUp ElseIf KeyCode = 82 And Shift = 4 Then b8Menus(1).ShowPopUp ElseIf KeyCode = 77 And Shift = 4 Then b8Menus(2).ShowPopUp ElseIf KeyCode = 84 And Shift = 4 Then b8Menus(3).ShowPopUp ElseIf KeyCode = 72 And Shift = 4 Then b8Menus(4).ShowPopUp ElseIf KeyCode = 81 And Shift = 2 Then 'Ctrl + Q Me.Form_ShowQuickLaunch ElseIf KeyCode = 68 And Shift = 2 Then 'Ctrl + D Me.Form_ShowDateFilter End If 'MsgBox KeyCode & " - " & ShiftEnd Sub'------------------------------------------------------------' >>> Parent To Child procedures
'Member variables propertyPublic Property Get TabSearchIndex() As Integer TabSearchIndex = m_TabSearchEnd Property
Public Sub HideTBButton(ByVal srcPatern As String, Optional srcAllButton As Boolean) If srcAllButton = True Then srcPatern = "ttttttt" If Mid$(srcPatern, 1, 1) = "t" Then tbMenu.Buttons(2).Visible = False: mnuRACN.Visible = False If Mid$(srcPatern, 2, 1) = "t" Then tbMenu.Buttons(3).Visible = False: mnuRAES.Visible = False If Mid$(srcPatern, 3, 1) = "t" Then tbMenu.Buttons(4).Visible = False: mnuRAS.Visible = False If Mid$(srcPatern, 4, 1) = "t" Then tbMenu.Buttons(5).Visible = False: mnuRADS.Visible = False If Mid$(srcPatern, 5, 1) = "t" Then tbMenu.Buttons(6).Visible = False: mnuRARR.Visible = False If Mid$(srcPatern, 6, 1) = "t" Then tbMenu.Buttons(7).Visible = False: mnuRAP.Visible = False If Mid$(srcPatern, 7, 1) = "t" Then tbMenu.Buttons(8).Visible = False: mnuRAC.Visible = False' If mnuRAC.Visible = False Then mnuRASep2.Visible = FalseEnd Sub
Public Sub ShowTBButton(ByVal srcPatern As String, Optional srcAllButton As Boolean) 'Highligh active form in opened form list If srcAllButton = True Then srcPatern = "ttttttt" If Mid$(srcPatern, 1, 1) = "t" Then tbMenu.Buttons(2).Visible = True: mnuRACN.Visible = True If Mid$(srcPatern, 2, 1) = "t" Then tbMenu.Buttons(3).Visible = True: mnuRAES.Visible = True If Mid$(srcPatern, 3, 1) = "t" Then tbMenu.Buttons(4).Visible = True: mnuRAS.Visible = True If Mid$(srcPatern, 4, 1) = "t" Then tbMenu.Buttons(5).Visible = True: mnuRADS.Visible = True If Mid$(srcPatern, 5, 1) = "t" Then tbMenu.Buttons(6).Visible = True: mnuRARR.Visible = True If Mid$(srcPatern, 6, 1) = "t" Then tbMenu.Buttons(7).Visible = True: mnuRAP.Visible = True If Mid$(srcPatern, 7, 1) = "t" Then tbMenu.Buttons(8).Visible = True: mnuRAC.Visible = True
mdiMain - 15 ' If mnuRAC.Visible = True Then mnuRASep2.Visible = TrueEnd Sub
Public Sub UnloadChilds()''Unload all active forms Dim Form As Form For Each Form In Forms ''Unload all active childs If Form.Name <> Me.Name And Form.Name <> "frmShortcuts" Then Unload Form Next Form Set Form = NothingEnd Sub
Private Sub DisplayUserInfo() 'Display the current user info' If CurrUser.USER_ISADMIN = True Then' StatusBar1.Panels(4).Text = "Admin"' Else' StatusBar1.Panels(4).Text = "Operator"' End If' StatusBar1.Panels(3).Text = CurrUser.USER_NAME Dim RS As New Recordset RS.Open "SELECT * FROM [Business Info]", CN, adOpenStatic, adLockReadOnly CurrBiz.BUSINESS_NAME = RS.Fields(0) CurrBiz.BUSINESS_ADDRESS = RS.Fields(1) CurrBiz.BUSINESS_CONTACT_INFO = RS.Fields(2) Set RS = NothingEnd Sub
mdiMain - 1 VERSION 5.00Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"Begin VB.MDIForm mdiMain BackColor = &H8000000C& Caption = "3JNet Hotel Management System" ClientHeight = 8085 ClientLeft = 225 ClientTop = 855 ClientWidth = 13485 LinkTopic = "MDIForm1" ScrollBars = 0 'False StartUpPosition = 3 'Windows Default WindowState = 2 'Maximized Begin VB.PictureBox bgHeader Align = 1 'Align Top Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H80000008& Height = 1080 Left = 0 ScaleHeight = 72 ScaleMode = 3 'Pixel ScaleWidth = 899 TabIndex = 18 Top = 0 Width = 13485 Begin VB.PictureBox bgRecOpt Appearance = 0 'Flat BackColor = &H00F5F5F5& BorderStyle = 0 'None ForeColor = &H80000008& Height = 765 Left = 3510 ScaleHeight = 51 ScaleMode = 3 'Pixel ScaleWidth = 950 TabIndex = 29 Top = 330 Width = 14250 Begin VB.PictureBox b8Line2 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 15720 TabIndex = 30 Top = 720 Width = 15720 End Begin MSComctlLib.Toolbar tbMenu Height = 810 Left = 0 TabIndex = 31 Top = 0 Width = 11580 _ExtentX = 20426 _ExtentY = 1429 ButtonWidth = 1217 ButtonHeight = 1429 AllowCustomize = 0 'False Wrappable = 0 'False Style = 1 ImageList = "itb32x32" _Version = 393216 BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} NumButtons = 8 BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} Style = 3 EndProperty BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "New" Key = "New" Object.ToolTipText = "Ctrl+F2" ImageIndex = 1 EndProperty BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Edit"
mdiMain - 2 Key = "Edit" Object.ToolTipText = "Ctrl+F3" ImageIndex = 2 EndProperty BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Search" Key = "Search" Object.ToolTipText = "Ctrl+F4" ImageIndex = 3 EndProperty BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Delete" Key = "Delete" Object.ToolTipText = "Ctrl+F5" ImageIndex = 4 EndProperty BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Refresh" Key = "Refresh" Object.ToolTipText = "Ctrl+F6" ImageIndex = 5 EndProperty BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Print" Key = "Print" Object.ToolTipText = "Ctrl+F7" ImageIndex = 6 EndProperty BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} Caption = "Close" Key = "Close" Object.ToolTipText = "Ctrl+F8" ImageIndex = 7 EndProperty EndProperty End End Begin VB.PictureBox bgHeaderMenu BackColor = &H00EDEBE9& BorderStyle = 0 'None Height = 330 Left = 0 ScaleHeight = 22 ScaleMode = 3 'Pixel ScaleWidth = 1024 TabIndex = 19 Top = 0 Width = 15360 Begin VB.PictureBox b8Menus BackColor = &H00EDEBE9& BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 285 Index = 0 Left = 60 ScaleHeight = 225 ScaleWidth = 675 TabIndex = 20 Top = 15 Width = 735 End Begin VB.PictureBox b8Menus BackColor = &H00EDEBE9& BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False
mdiMain - 3 Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 285 Index = 1 Left = 840 ScaleHeight = 225 ScaleWidth = 825 TabIndex = 21 Top = 15 Width = 885 End Begin VB.PictureBox b8Menus BackColor = &H00EDEBE9& BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 285 Index = 2 Left = 1740 ScaleHeight = 225 ScaleWidth = 885 TabIndex = 22 Top = 15 Width = 945 End Begin VB.PictureBox b8Menus BackColor = &H00EDEBE9& BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 285 Index = 3 Left = 2730 ScaleHeight = 225 ScaleWidth = 555 TabIndex = 23 Top = 15 Width = 615 End Begin VB.PictureBox b8Menus BackColor = &H00EDEBE9& BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 285 Index = 6 Left = 4680 ScaleHeight = 225 ScaleWidth = 585 TabIndex = 24 Top = 15 Width = 645 End Begin VB.PictureBox b8Line1
mdiMain - 4 Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 15720 TabIndex = 25 Top = 300 Width = 15720 End Begin VB.PictureBox b8Menus BackColor = &H00EDEBE9& BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 285 Index = 5 Left = 4050 ScaleHeight = 225 ScaleWidth = 585 TabIndex = 26 Top = 15 Width = 645 End Begin VB.PictureBox b8Menus BackColor = &H00EDEBE9& BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00000000& Height = 285 Index = 4 Left = 3360 ScaleHeight = 225 ScaleWidth = 555 TabIndex = 32 Top = 15 Width = 615 End End Begin VB.PictureBox b8LLogoB Height = 30 Left = 0 ScaleHeight = 30 ScaleWidth = 15720 TabIndex = 27 Top = 1050 Visible = 0 'False Width = 15720 End Begin VB.PictureBox b8SBT Height = 945 Left = 0 ScaleHeight = 885 ScaleWidth = 3465 TabIndex = 28 Top = 330 Width = 3525 Begin VB.Image Image2 Height = 540 Left = 690 Picture = (Bitmap) Top = 150 Width = 1710 End Begin VB.Image Image1
mdiMain - 5 Height = 480 Left = 150 Picture = (Icon) Top = 150 Width = 480 End End End Begin VB.Timer timeUpdateDate Interval = 1000 Left = 5040 Top = 1860 End Begin VB.PictureBox b8CW Align = 2 'Align Bottom Height = 375 Left = 0 ScaleHeight = 315 ScaleWidth = 13425 TabIndex = 0 Top = 7710 Width = 13485 Begin VB.PictureBox bgSystemBot Appearance = 0 'Flat BackColor = &H80000005& BorderStyle = 0 'None ForeColor = &H80000008& Height = 405 Left = 0 ScaleHeight = 405 ScaleWidth = 3495 TabIndex = 1 Top = 0 Width = 3495 Begin VB.Image Image3 Height = 360 Left = 0 Picture = (Bitmap) Stretch = -1 'True Top = 0 Width = 19995 End Begin VB.Label Label4 BackStyle = 0 'Transparent Caption = "Programmed by: jaYPee" Height = 285 Left = 120 TabIndex = 2 Top = 60 Width = 2385 End End End Begin VB.PictureBox b8SBC Align = 3 'Align Left Height = 6630 Left = 0 ScaleHeight = 6570 ScaleWidth = 3465 TabIndex = 3 Top = 1080 Width = 3525 Begin VB.PictureBox b8ST BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00808080& Height = 345 Index = 0 Left = 60 ScaleHeight = 285
mdiMain - 6 ScaleWidth = 3345 TabIndex = 4 Top = 510 Width = 3405 Begin MSComctlLib.ListView listQL Height = 3075 Left = 30 TabIndex = 5 Top = 360 Width = 3345 _ExtentX = 5900 _ExtentY = 5424 View = 2 Arrange = 1 LabelEdit = 1 LabelWrap = 0 'False HideSelection = -1 'True OLEDropMode = 1 _Version = 393217 Icons = "ilQL" SmallIcons = "ilQL" ForeColor = -2147483640 BackColor = 16777215 Appearance = 0 BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty OLEDropMode = 1 NumItems = 0 End Begin MSComctlLib.ImageList ilQL Left = 1080 Top = 660 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 16 ImageHeight = 16 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 1 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty EndProperty End End Begin VB.PictureBox b8ST BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00808080& Height = 345 Index = 1 Left = 60 ScaleHeight = 285 ScaleWidth = 3345 TabIndex = 6 Top = 840 Width = 3405 Begin VB.CommandButton cmdSearch Caption = "Search" BeginProperty Font
mdiMain - 7 Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 2040 TabIndex = 9 Top = 1950 Width = 1215 End Begin VB.ComboBox cmbLookIn BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 315 Left = 120 Style = 2 'Dropdown List TabIndex = 8 Top = 1470 Width = 3135 End Begin VB.TextBox txtSearchWhat BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 345 Left = 120 TabIndex = 7 Top = 690 Width = 3165 End Begin VB.Label Label2 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "&Look In:" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 150 TabIndex = 11 Top = 1260 Width = 585 End Begin VB.Label Label1 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "&Search What:" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False
mdiMain - 8 Strikethrough = 0 'False EndProperty Height = 195 Left = 120 TabIndex = 10 Top = 450 Width = 990 End End Begin VB.PictureBox b8ST BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00808080& Height = 345 Index = 2 Left = 60 ScaleHeight = 285 ScaleWidth = 3345 TabIndex = 12 Top = 1170 Width = 3405 Begin VB.PictureBox b8DateP BackColor = &H00FFFFFF& Height = 2415 Left = 120 ScaleHeight = 2355 ScaleWidth = 3075 TabIndex = 13 Top = 420 Width = 3135 End End Begin VB.Label lblCurrentUser AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "---" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 195 Left = 840 TabIndex = 17 Top = 45 Width = 180 End Begin VB.Label Label3 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Welcome," BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00808080& Height = 165 Left = 150 TabIndex = 16 Top = 60 Width = 600
mdiMain - 9 End Begin VB.Label lblDate AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "---" BeginProperty Font Name = "Tahoma" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00808080& Height = 195 Left = 780 TabIndex = 15 Top = 255 Width = 180 End Begin VB.Label Label5 AutoSize = -1 'True BackStyle = 0 'Transparent Caption = "Today is " BeginProperty Font Name = "Tahoma" Size = 6.75 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00808080& Height = 165 Left = 150 TabIndex = 14 Top = 270 Width = 585 End End Begin MSComctlLib.ImageList i16x16g Left = 4260 Top = 2310 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 16 ImageHeight = 16 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 6 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = ""
mdiMain - 10 EndProperty EndProperty End Begin MSComctlLib.ImageList ig24x24 Left = 5745 Top = 2010 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 10 ImageHeight = 13 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 1 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty EndProperty End Begin MSComctlLib.ImageList i16x16 Left = 4005 Top = 1290 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 16 ImageHeight = 16 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 15 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty
mdiMain - 11 BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty EndProperty End Begin MSComctlLib.ImageList itb32x32 Left = 6480 Top = 1290 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 32 ImageHeight = 32 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 17 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = ""
mdiMain - 12 EndProperty BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty EndProperty End Begin MSComctlLib.ImageList ImageList1 Left = 1140 Top = 330 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 16 ImageHeight = 16 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 6 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty EndProperty End Begin MSComctlLib.ImageList ImageList2 Left = 540 Top = 1530 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 10 ImageHeight = 13 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 1 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty
mdiMain - 13 EndProperty End Begin MSComctlLib.ImageList ImageList3 Left = 540 Top = 330 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 16 ImageHeight = 16 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 15 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty EndProperty End Begin MSComctlLib.ImageList ImageList4
mdiMain - 14 Left = 3015 Top = 360 _ExtentX = 1005 _ExtentY = 1005 BackColor = -2147483643 ImageWidth = 32 ImageHeight = 32 MaskColor = 12632256 _Version = 393216 BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} NumListImages = 17 BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary} Key = "" EndProperty BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628} Picture = {Binary}
mdiMain - 15 Key = "" EndProperty EndProperty End Begin VB.Menu mnuSystem Caption = "&System" Begin VB.Menu mnuManageUser Caption = "&Manage Users" End Begin VB.Menu mnuChangeDeskClerk Caption = "Change Desk Clerk" End Begin VB.Menu mnuS01 Caption = "-" End Begin VB.Menu mnuLogOff Caption = "&Log Off" Visible = 0 'False End Begin VB.Menu mnuExit Caption = "E&xit" End End Begin VB.Menu mnuRecords Caption = "&Records" Begin VB.Menu mnuNewReservation Caption = "&New Reservation" End Begin VB.Menu mnuCheckInHistory Caption = "Check &In History" End Begin VB.Menu mnuS02 Caption = "-" End Begin VB.Menu mnuCustomers Caption = "&Customers" End Begin VB.Menu mnuCompany Caption = "Com&pany" End Begin VB.Menu mnuAccountReceivables Caption = "Account Receivables" End End Begin VB.Menu mnuMonitoring Caption = "&Monitoring" Begin VB.Menu mnuRoomS Caption = "Rooms" End Begin VB.Menu mnuReservations Caption = "Reservations" End Begin VB.Menu mnuInventoryView Caption = "Inventory View" End Begin VB.Menu mnuBusinessSource Caption = "Business Source" End Begin VB.Menu mnuChargeType Caption = "Charge Type" End Begin VB.Menu mnuCountries Caption = "Countries" End Begin VB.Menu mnuIDType Caption = "ID Type" End Begin VB.Menu mnuPaymentType Caption = "Payment Type" End Begin VB.Menu mnuRateType Caption = "Rate Type" End Begin VB.Menu mnuRoomStatus Caption = "Room Status" End Begin VB.Menu mnuRoomType
mdiMain - 16 Caption = "Room Type" End Begin VB.Menu mnuVehicles Caption = "Vehicles" End End Begin VB.Menu mnuTools Caption = "&Tools" Begin VB.Menu mnuPreferences Caption = "&Preferences" End Begin VB.Menu mnuDatabaseUtilities Caption = "&Database Utilities" Begin VB.Menu mnuBackupDatabase Caption = "&Backup Database" End Begin VB.Menu mnuDatabaseRestore Caption = "Database &Restore" End End End Begin VB.Menu mnuRecA Caption = "&Action" Begin VB.Menu mnuRACN Caption = "Create &New" End Begin VB.Menu mnuRAES Caption = "&Edit Selected" End Begin VB.Menu mnuRAS Caption = "&Search" End Begin VB.Menu mnuRADS Caption = "&Delete Selected" End Begin VB.Menu mnuRARR Caption = "&Refresh" End Begin VB.Menu mnuRAP Caption = "&Print" End Begin VB.Menu mnuRASep2 Caption = "-" End Begin VB.Menu mnuRAC Caption = "&Close" End End Begin VB.Menu mnuReports Caption = "&Reports" Begin VB.Menu mnuRPTAccRec Caption = "Accounts Receivable" End Begin VB.Menu mnuRPTOtherCharges Caption = "Other Charges" End Begin VB.Menu mnuRPTCheckedInGuest Caption = "Checked In Guest" End Begin VB.Menu mnuRPTCheckOut Caption = "Check Out Report" End Begin VB.Menu mnuDueReservation Caption = "Due Reservation" End Begin VB.Menu mnuRPTGuestList Caption = "Guest List Report" End Begin VB.Menu mnuRPTRoomHistory Caption = "Room History Report" End End Begin VB.Menu mnuHelp Caption = "&Help" EndEnd
Today is ---
Welcome, ---
Programmed by: jaYPee
modADO - 1 ''***************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Ph'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE,''***************
modADO - 2 'Function used to get the sum of fieldsPublic Function getSumOfFields(ByVal sTable As String, ByVal sField As String, ByRef sCN As ADODB.Connection, Optional inclField As String, Optional sCondition As String) As Double On Error GoTo err Dim RS As New ADODB.Recordset
RS.CursorLocation = adUseClient If sCondition <> "" Then sCondition = " GROUP BY " & inclField & " HAVING(" & sCondition & ")" If inclField <> "" Then inclField = "," & inclField RS.Open "SELECT Sum(" & sTable & "." & sField & ") AS fTotal" & inclField & " FROM " & sTable & sCondition, sCN, adOpenStatic, adLockOptimistic If RS.RecordCount > 0 Then RS.MoveFirst Do While Not RS.EOF getSumOfFields = getSumOfFields + RS.Fields("fTotal") RS.MoveNext Loop Else getSumOfFields = 0 End If Set RS = Nothing Exit Functionerr: 'Error when incounter a null value If err.Number = 94 Then getSumOfFields = 0: Resume NextEnd Function
'Procedure used to generate DSNPublic Sub GenerateDSN()Open App.Path & "\rptCN.dsn" For Output As #1 Print #1, "[ODBC]" Print #1, "DRIVER=Microsoft Access Driver (*.mdb)" Print #1, "UID=admin" Print #1, "UserCommitSync=Yes" Print #1, "Threads=3" Print #1, "SafeTransactions=0" Print #1, "PageTimeout=5" Print #1, "MaxScanRows=8" Print #1, "MaxBufferSize=2048" Print #1, "FIL=MS Access" Print #1, "DriverId=25" Print #1, "DefaultDir=" & App.Path & "\Data" Print #1, "DBQ=" & App.Path & "\Data\Data.mdb"Close #1End Sub
'Procedure used to remove DSNPublic Sub RemoveDSN()On Error Resume NextKill App.Path & "\rptCN.dsn"End Sub
modApp - 1 Option Explicit
Private Const sAS_AutoBackup As String = "AutoBackup"
'Public Function WriteErrorLog(sModuleName As String, sRoutineName As String, sDetail As String)' frmErrMsg.ShowForm sModuleName, sRoutineName, sDetail'End Function
Public Function SetAutoBackup(ByVal NewValue As Boolean)
Dim sValue As String SaveSetting App.Title, "AppSetting", sAS_AutoBackup, IIf(NewValue, "T", "F")
End Function
Public Function GetAutoBackup() As Boolean Dim sValue As String 'default GetAutoBackup = -1 sValue = GetSetting(App.Title, "AppSetting", sAS_AutoBackup, "T")
GetAutoBackup = IIf(sValue = "T", True, False)
End Function
modDSN - 1 Private Const ODBC_ADD_SYS_DSN = 4 ' Add data sourcePrivate Const ODBC_CONFIG_DSN = 2 ' Configure (edit) data SourcePrivate Const ODBC_REMOVE_DSN = 3 ' Remove data sourcePrivate Const vbAPINull As Long = vbNull ' NULL Pointer
'Function DeclarePrivate Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" _ (ByVal hwndParent As Long, ByVal fRequest As Long, _ ByVal lpszDriver As String, ByVal lpszAttributes As String) _ As Long
Public Sub createDSN() 'Creating the DSN
#If Win32 Then Dim intRet As Long #Else Dim intRet As Integer #End If
Dim strDriver As String Dim strAttributes As String
strDriver = "Microsoft Access Driver (*.mdb)"
strAttributes = strAttributes & "DESCRIPTION=" & "Hotel DSN " & Chr$(0) strAttributes = strAttributes & "DSN=" & "Hotel" & Chr$(0) strAttributes = strAttributes & "PWD=" & "jaypee" & Chr$(0) strAttributes = strAttributes & "UID=" & "admin" & Chr$(0) strAttributes = strAttributes & "DBQ=" & DBPath & Chr$(0)
intRet = SQLConfigDataSource(vbAPINull, ODBC_ADD_SYS_DSN, _ strDriver, strAttributes)
' DSN createdEnd Sub
modFuncChild - 1 Option Explicit
Private Declare Function GetClientRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
' RectanglePrivate Type RECT Left As Long ' Left of the rectangle Top As Long ' Top of the rectangle Right As Long ' Right of the rectangle Bottom As Long ' Bottom of the rectangleEnd Type
Public Sub LoadForm(ByRef CFrm As Form) Dim R As RECT CFrm.Visible = False CFrm.WindowState = vbNormal
GetClientRect mdiMain.hWnd, R 'set client size 'right If mdiMain.b8SBC.Visible = True Then R.Right = R.Right - (mdiMain.b8SBC.Width / Screen.TwipsPerPixelX) End If 'bottom R.Bottom = R.Bottom - ((mdiMain.b8CW.Height / Screen.TwipsPerPixelY) + (mdiMain.bgHeader.Height / Screen.TwipsPerPixelY)) - R.Top mdiMain.b8CW.LoadChildWindow mdiMain.hWnd, CFrm.hWnd, CFrm.Name, CFrm.Caption, R.Top, R.Left, R.Right, R.Bottom
CFrm.Visible = True CFrm.Show CFrm.SetFocus ResizeMdiChildForm CFrmEnd Sub
Public Sub ResizeMdiChildForm(ByRef CFrm As Form)
Dim R As RECT GetClientRect mdiMain.hWnd, R 'set client size 'right If mdiMain.b8SBC.Visible = True Then R.Right = R.Right - (mdiMain.b8SBC.Width / Screen.TwipsPerPixelX) End If 'bottom R.Bottom = R.Bottom - ((mdiMain.b8CW.Height / Screen.TwipsPerPixelY) + (mdiMain.bgHeader.Height / Screen.TwipsPerPixelY)) - R.Top
mdiMain.b8CW.ResizeClientWin CFrm.hWnd, R.Top, R.Left, R.Right, R.Bottom
End Sub
Public Sub ActivateMDIChildForm(ByVal sFormName As String) Dim frm As Form For Each frm In Forms If frm.Name = sFormName Then 'activate form ResizeMdiChildForm frm frm.Visible = True frm.Show frm.SetFocus 'set tab active window mdiMain.b8CW.SetActiveWindow sFormName Exit For End If Next
modFuncChild - 2 Set frm = NothingEnd Sub
modFunction - 1 ''*****************************************************************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
'Function used to format recordsetPublic Function FormatRS(ByVal srcField As Field, Optional AllowNewLine As Boolean) As String Dim strRet As String With srcField If AllowNewLine = True Then strRet = srcField Else strRet = Replace(srcField, vbCrLf, " ", , , vbTextCompare) End If 'If srcField.Type = adCurrency Or srcField.Type = adDouble Then If srcField.Type = adCurrency Then strRet = Format$(srcField, "#,##0.00") ElseIf srcField.Type = adDate Then strRet = Format$(srcField, "MMM-dd-yyyy") Else strRet = srcField End If End With FormatRS = strRet strRet = vbNullStringEnd Function
'Function that will format return a generated idPublic Function GenerateID(ByVal srcNo As String, ByVal src1stStr As String, ByVal src2ndStr As String) As String If Len(src2ndStr) <= Len(srcNo) Then GenerateID = src1stStr & srcNo Else GenerateID = src1stStr & Left$(src2ndStr, Len(src2ndStr) - Len(srcNo)) & srcNo End IfEnd Function
'Function used to check if the record exit or not.Public Function isRecordExist(ByVal sTable As String, ByVal sField As String, ByVal sStr As String, Optional isString As Boolean) As Boolean Dim RS As New Recordset
RS.CursorLocation = adUseClient If isString = False Then RS.Open "Select * From " & sTable & " Where " & sField & " = " & sStr, CN, adOpenStatic, adLockOptimistic Else RS.Open "Select * From " & sTable & " Where " & sField & " = '" & sStr & "'", CN, adOpenStatic, adLockOptimistic End If If RS.RecordCount < 1 Then isRecordExist = False Else isRecordExist = True End If Set RS = NothingEnd Function
'Function used to check if the Ascii is a number or not (return 0 if number)Public Function isNumber(ByVal sKeyAscii) As Integer
modFunction - 2 If Not ((sKeyAscii >= 48 And sKeyAscii <= 57) Or sKeyAscii = 8 Or sKeyAscii = 46) Then isNumber = 0 Else isNumber = sKeyAscii End IfEnd Function
'Function used to check if the record exist in Flex gridPublic Function isRecExistInFlex(ByVal srcFlexGrd As MSHFlexGrid, ByVal srcWhatCol As Integer, ByVal srcFindWhat As String) As Boolean isRecExistInFlex = False Dim i As Long For i = 1 To srcFlexGrd.Rows - 1 If srcFlexGrd.TextMatrix(i, srcWhatCol) = srcFindWhat Then isRecExistInFlex = True: Exit For Next i i = 0End Function
'Function used to check if the record exist in Flex gridPublic Function getFlexPos(ByVal srcFlexGrd As MSHFlexGrid, ByVal srcWhatCol As Integer, ByVal srcFindWhat As String) As Integer Dim R As Long, ret As Integer ret = -1 'Means not found For R = 0 To srcFlexGrd.Rows - 1 If srcFlexGrd.TextMatrix(R, srcWhatCol) = srcFindWhat Then ret = R: Exit For Next R getFlexPos = ret R = 0: ret = 0End Function
'Function used to left split user fieldsPublic Function LeftSplitUF(ByVal srcUF As String) As String If srcUF = "*~~~~~*" Then LeftSplitUF = "": Exit Function Dim i As Integer Dim t As String For i = 1 To Len(srcUF) If Mid$(srcUF, i, 7) = "*~~~~~*" Then Exit For Else t = t & Mid$(srcUF, i, 1) End If Next i LeftSplitUF = t i = 0 t = ""End Function
'Function used to right split user fieldsPublic Function RightSplitUF(ByVal srcUF As String) As String If srcUF = "*~~~~~*" Then RightSplitUF = "": Exit Function Dim i As Integer Dim t As String For i = (InStr(1, srcUF, "*~~~~~*", vbTextCompare) + 7) To Len(srcUF) t = t & Mid$(srcUF, i, 1) Next i RightSplitUF = t i = 0 t = ""End Function
'Function that return true if the control is emptyPublic Function is_empty(ByRef sText As Variant, Optional UseTagValue As Boolean) As Boolean On Error Resume Next If sText.Text = "" Then is_empty = True If UseTagValue = True Then MsgBox "The field '" & sText.Tag & "' is required.Please check it!", vbExclamation Else MsgBox "The field is required.Please check it!", vbExclamation End If sText.SetFocus Else is_empty = False End If
modFunction - 3 End Function
'Function used to change the yes/no valuePublic Function changeYNValue(ByVal srcStr As String) As String Select Case srcStr Case "Y": changeYNValue = "1" Case "N": changeYNValue = "0" Case "1": changeYNValue = "Y" Case "0": changeYNValue = "N" End SelectEnd Function
'Function used to change the true/false valuePublic Function changeTFValue(ByVal srcStr As String) As String Select Case srcStr Case "True": changeTFValue = "1" Case "False": changeTFValue = "0" Case "1": changeTFValue = "True" Case "0": changeTFValue = "False" End SelectEnd Function
'Function that return true if the control is numericPublic Function is_numeric(ByRef sText As String) As Boolean If IsNumeric(sText) = False Then is_numeric = False MsgBox "The field required a numeric input.Please check it!", vbExclamation Else is_numeric = True End IfEnd Function
'Function that return the value of a certain fieldPublic Function getValueAt(ByVal srcSQL As String, ByVal whichField As String) As String Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockReadOnly If RS.RecordCount > 0 Then getValueAt = RS.Fields(whichField) Set RS = NothingEnd Function
'Convert string to number'I create this istead of val() co'z val return incorrect value'ex. Try to see the output of val("3,800")'It did not support characters like , and etc.Public Function toNumber(ByVal srcCurrency As String, Optional RetZeroIfNegative As Boolean) As Double If srcCurrency = "" Then toNumber = 0 Else Dim retValue As Double If InStr(1, srcCurrency, ",") > 0 Then retValue = Val(Replace(srcCurrency, ",", "", , , vbTextCompare)) Else retValue = Val(srcCurrency) End If If RetZeroIfNegative = True Then If retValue < 1 Then retValue = 0 End If toNumber = retValue retValue = 0 End IfEnd Function
'Function that return the count of the rows in the tablePublic Function getRecordCount(ByVal srcTable As String, Optional srcCondition As String, Optional isFormatted As Boolean) As String If srcCondition <> "" Then srcCondition = " " & srcCondition Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open "SELECT COUNT(PK) as TCount FROM " & srcTable & srcCondition, CN, adOpenStatic, adLockReadOnly If isFormatted = True Then getRecordCount = Format$(RS![TCount], "#,##0")
modFunction - 4 Else getRecordCount = RS![TCount] End If Set RS = NothingEnd Function
'Function that will return a currenct formatPublic Function toMoney(ByVal srcCurr As String) As String toMoney = Format$(IIf(Trim(srcCurr) = "", 0, srcCurr), "#,##0.00")End Function
'Function used to determine if the object has been setPublic Function isObjectSet(srcObject As Object) As Boolean On Error GoTo err 'I use tag because almost all controls have this srcObject.Tag = srcObject.Tag isObjectSet = True Exit Functionerr: isObjectSet = FalseEnd Function
'Function used to get the end day number of a cetain monthPublic Function getEndDay(ByVal srcDate As Date) As Byte Dim h1 As String h1 = Format(srcDate, "mm") On Error GoTo err Select Case h1 Case Is = "01": getEndDay = 31 Case Is = "02": getEndDay = Day(h1 & "/29/" & Format(srcDate, "yy")) Case Is = "03": getEndDay = 31 Case Is = "04": getEndDay = 30 Case Is = "05": getEndDay = 31 Case Is = "06": getEndDay = 30 Case Is = "07": getEndDay = 31 Case Is = "08": getEndDay = 31 Case Is = "09": getEndDay = 30 Case Is = "10": getEndDay = 31 Case Is = "11": getEndDay = 30 Case Is = "12": getEndDay = 31 End Select h1 = "" Exit Functionerr: If err.Number = 13 Then getEndDay = 28: h1 = "" 'Day if encounter not a left-yearEnd Function
Public Function getUnitID(ByVal sUnit As String) As Long Dim RS As New ADODB.Recordset Dim sql As String sql = "SELECT UnitID From Unit WHERE (((Unit)='" & Replace(sUnit, "'", "''") & "'))" RS.Open sql, CN, adOpenDynamic, adLockOptimistic If Not RS.EOF Then getUnitID = RS!UnitID Else getUnitID = 0 End If RS.Close Set RS = NothingEnd Function
Function GetINI(strMain As String, strSub As String) As String Dim strBuffer As String Dim lngLen As Long Dim lngRet As Long strBuffer = Space(100) lngLen = Len(strBuffer) lngRet = GetPrivateProfileString(strMain, strSub, vbNullString, strBuffer, lngLen, App.Path & "\config.txt") GetINI = Left(strBuffer, lngRet)End Function
modFunction - 5 'Function to determine user's permissionPublic Function allowOpen(frmForm As String, ByRef User As String) As Boolean Dim RS As New Recordset Dim srcSQL As String srcSQL = "SELECT * FROM qry_User WHERE Form = '" & frmForm & "' AND UserID = '" & User & "'" RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockReadOnly If RS.RecordCount > 0 Then allowOpen = True Set RS = NothingEnd Function
Public Function ChangePermission(ByVal UserPermID As Long, ByVal bNewPermission As Boolean) As Boolean Dim vRS As New ADODB.Recordset Dim sSQL As String 'default ChangePermission = False sSQL = "SELECT *" & _ " From [User Permission]" & _ " WHERE UserPermissionID=" & UserPermID vRS.Open sSQL, CN, adOpenStatic, adLockOptimistic On Error GoTo RAE vRS.MoveFirst vRS.Fields("AllowOpen").Value = bNewPermission vRS.Update ChangePermission = True RAE: Set vRS = NothingEnd Function
modMain - 1 Option Explicit
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
'api declarationsPublic Declare Function InitCommonControls Lib "comctl32.dll" () As LongPrivate Declare Function GetTickCount Lib "kernel32" () As Long
Public CloseMe As Boolean
Public Sub Main() 'use system appearance style InitCommonControls frmSplash.Show frmSplash.Refresh
DBPath = GetINI("Configuration", "Path") 'get path from file If Trim(DBPath) = "" Or IsNull(DBPath) ThenJumpHere: frmLocate.Show 1 'browse database End If If OpenDB = vbRetry Then GoTo JumpHere 'create DSN for reports createDSN
' Load mdiMain Delay 2
frmLogin.Show 1 If CloseMe = True Then End
mdiMain.Show Unload frmSplash Set frmSplash = NothingEnd Sub
'Public Sub Main_AfterSD()''' 'Open Database File' If OpenDB = False Then' Exit Sub' End If''' 'TestUnit' mdiMain.ShowForm'End Sub
Public Sub SetINI(strMain As String, strSub As String, strvalue As String) WritePrivateProfileString strMain, strSub, strvalue, App.Path & "\config.txt"End Sub
Public Sub Delay(PauseTime) Dim Start, Finish, TotalTime
Start = Timer ' Set start time. Do While Timer < Start + PauseTime DoEvents ' Yield to other processes. LoopEnd Sub
modProcedure - 1 ''*****************************************************************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
'Public Sub LoadForm(ByRef srcForm As Form)'On Error Resume Next' srcForm.Show' srcForm.WindowState = vbMaximized' srcForm.SetFocus'End Sub
'Used to locate the key in opened formPublic Sub HighlightInWin(ByVal srcKey As String)' With mdiMain.lvWin' If .ListItems.Count > 0 Then' If .SelectedItem.Key <> srcKey Then' Dim c As Integer' For c = 1 To .ListItems.Count' If .ListItems(c).Key = srcKey Then' .ListItems(c).Selected = True' .ListItems(c).EnsureVisible' Exit For' End If' Next c' End If' End If' End WithEnd Sub
'Procedure used to custom move the recordset cursorPublic Sub customMove(ByRef sRS As Recordset, ByVal isNum As Boolean, ByVal findStr As String, ByVal sField As String) If sRS.RecordCount < 1 Then Exit Sub Dim old_pos As Long sRS.MoveFirst old_pos = sRS.AbsolutePosition If isNum = True Then sRS.Find sField & " = " & findStr Else sRS.Find sField & " = '" & findStr & "'" End If If sRS.EOF Then sRS.AbsolutePosition = old_pos old_pos = 0End Sub'This code is also available in .NET version with ADO.NET'Procedure used to fill list viewPublic Sub FillListView(ByRef sListView As ListView, ByRef sRecordSource As Recordset, ByVal sNumOfFields As Byte, ByVal sNumIco As Byte, ByVal with_num As Boolean, ByVal show_first_rec As Boolean, Optional srcHiddenField As String) Dim X As Variant Dim i As Byte On Error Resume Next sListView.ListItems.Clear If sRecordSource.RecordCount < 1 Then Exit Sub sRecordSource.MoveFirst Do While Not sRecordSource.EOF If with_num = True Then Set X = sListView.ListItems.Add(, , sRecordSource.AbsolutePosition, sNumIco, sNumIco) Else Set X = sListView.ListItems.Add(, , "" & sRecordSource.Fields(0), sNumIco, sNumIco) End If If srcHiddenField <> "" Then X.Tag = sRecordSource.Fields(srcHiddenField) For i = 1 To sNumOfFields - 1
modProcedure - 2 If show_first_rec = True Then If with_num = True Then If sRecordSource.Fields(CInt(i) - 1).Type = adDouble Then X.SubItems(i) = FormatRS(sRecordSource.Fields(CInt(i) - 1)) Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i) - 1)) End If Else If sRecordSource.Fields(CInt(i)).Type = adDouble Then X.SubItems(i) = FormatRS(sRecordSource.Fields(CInt(i))) Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i))) End If End If Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i) + 1)) End If Next i sRecordSource.MoveNext Loop i = 0 Set X = NothingEnd Sub
'Procedure used to promp unexpected errorsPublic Sub prompt_err(ByVal sError As ErrObject, ByVal ModuleName As String, ByVal OccurIn As String) MsgBox "Error From: " & ModuleName & vbNewLine & _ "Occur In: " & OccurIn & vbNewLine & _ "Error Number: " & sError.Number & vbNewLine & _ "Description: " & sError.Description, vbCritical, "Application Error" 'Save the error log (The save error log will be display later on in the program) Open App.Path & "\Error.log" For Append As #1 Print #1, Format(Date, "MMM-dd-yyyy") & "~~~~~" & Time & "~~~~~" & sError.Number & "~~~~~" & sError.Description & "~~~~~" & ModuleName & "~~~~~" & OccurIn Close #1End Sub
'Procedure used to delete record with SQLPublic Sub DelRecwSQL(ByVal sTable As String, ByVal sField As String, ByVal sString As String, ByVal isNumber As Boolean, ByVal snum As Long) If isNumber = True Then CN.Execute "DELETE FROM " & sTable & " WHERE " & sField & " =" & snum Else CN.Execute "DELETE FROM " & sTable & " WHERE " & sField & " ='" & sString & "'" End IfEnd Sub
'Procedure used to fill the listview in paging methodPublic Sub pageFillListView(ByRef sListView As ListView, ByRef sRecordSource As Recordset, ByVal pos_start As Long, ByVal pos_end As Long, ByVal sNumOfFields As Byte, ByVal sNumIco As Byte, ByVal with_num As Boolean, ByVal show_first_rec As Boolean, Optional match_field As String, Optional match_str As String, Optional match_ico As Byte, Optional srcHiddenField As String)
Dim X As ListItem Dim i As Byte, c As Long, old_pt As Long sListView.ListItems.Clear If sRecordSource.RecordCount < 1 Then Exit Sub sRecordSource.AbsolutePosition = pos_start On Error Resume Next old_pt = Screen.MousePointer Screen.MousePointer = vbHourglass DoEvents Do If match_field = "" Then If with_num = True Then Set X = sListView.ListItems.Add(, , "" & sRecordSource.AbsolutePosition, sNumIco, sNumIco) Else Set X = sListView.ListItems.Add(, , "" & FormatRS(sRecordSource.Fields(0)), sNumIco, sNumIco) End If Else If sRecordSource.Fields(match_field) = match_str Then If with_num = True Then Set X = sListView.ListItems.Add(, , "" & sRecordSource.AbsolutePosition, match_ico, match_ico)
modProcedure - 3 Else Set X = sListView.ListItems.Add(, , "" & FormatRS(sRecordSource.Fields(0)), match_ico, match_ico) End If Else If with_num = True Then Set X = sListView.ListItems.Add(, , "" & sRecordSource.AbsolutePosition, sNumIco, sNumIco) Else Set X = sListView.ListItems.Add(, , "" & FormatRS(sRecordSource.Fields(0)), sNumIco, sNumIco) End If End If End If If srcHiddenField <> "" Then X.Tag = sRecordSource.Fields(srcHiddenField) & "*~~~~~*" & c + pos_start Else X.Tag = c + pos_start End If For i = 1 To sNumOfFields - 1 If show_first_rec = True Then If with_num = True Then X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i) - 1)) Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i))) End If Else X.SubItems(i) = "" & FormatRS(sRecordSource.Fields(CInt(i) + 1)) End If Next i If sRecordSource.AbsolutePosition >= pos_end Then Exit Do Else sRecordSource.MoveNext c = c + 1 End If Loop Screen.MousePointer = old_pt i = 0: c = 0: old_pt = 0 Set X = NothingEnd Sub
'Procedure used to highlight text when focusPublic Sub HLText(ByRef sText) On Error Resume Next With sText .SelStart = 0 .SelLength = Len(sText.Text) End WithEnd Sub
'Procedure used to bind data comboPublic Sub bind_dc(ByVal srcSQL As String, ByVal srcBindField As String, ByRef srcDC As DataCombo, Optional srcColBound As String, Optional ShowFirstRec As Boolean) Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockOptimistic With srcDC .ListField = srcBindField .BoundColumn = srcColBound Set .RowSource = RS 'Display the first record If ShowFirstRec = True Then If Not RS.RecordCount < 1 Then .BoundText = RS.Fields(srcColBound) .Tag = RS.RecordCount & "*~~~~~*" & RS.Fields(srcColBound) Else .Tag = "0*~~~~~*0" End If End If End With Set RS = NothingEnd Sub
modProcedure - 4 'Procedure used to bind data listPublic Sub bind_dl(ByVal srcSQL As String, ByVal srcBindField As String, ByRef srcDL As DataList, Optional srcColBound As String, Optional ShowFirstRec As Boolean) Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockOptimistic With srcDL .ListField = srcBindField .BoundColumn = srcColBound Set .RowSource = RS 'Display the first record If ShowFirstRec = True Then If Not RS.RecordCount < 1 Then .BoundText = RS.Fields(srcColBound) .Tag = RS.RecordCount & "*~~~~~*" & RS.Fields(srcColBound) Else .Tag = "0*~~~~~*0" End If End If End With Set RS = NothingEnd Sub
'Procedure used to clear the text contentPublic Sub clearText(ByRef sForm As Form) Dim Control As Control For Each Control In sForm.Controls If (TypeOf Control Is TextBox) Then Control = vbNullString Next Control Set Control = NothingEnd Sub
'Procedure used to clear the text contentPublic Sub LockInput(ByRef sForm As Form, ByVal bolLock As Boolean, Optional bolTabStop As Boolean) On Error Resume Next Dim Control As Control For Each Control In sForm.Controls Control.Locked = bolLock Next Control Set Control = NothingEnd Sub
'Procedure that will change the value at oncePublic Sub ChangeValue(ByRef srcCN As Connection, ByVal srcTable As String, ByVal srcField As String, ByVal srcValue As String, Optional isNumber As Boolean, Optional srcCondition As String) If srcCondition <> vbNullString Then srcCondition = " " & srcCondition If isNumber = True Then srcCN.Execute "UPDATE " & srcTable & " SET " & srcField & " =" & srcValue & " " & srcCondition Else srcCN.Execute "UPDATE " & srcTable & " SET " & srcField & " ='" & srcValue & "'" & srcCondition End IfEnd Sub
Public Sub FillFlex(ByRef srcFlex As MSHFlexGrid, ByVal srcSQL As String, ByVal srcNoOfCol As Integer) Dim RS As New Recordset RS.CursorLocation = adUseClient RS.Open srcSQL, CN, adOpenStatic, adLockReadOnly If RS.RecordCount < 1 Then Exit Sub RS.MoveFirst Dim i As Long, c As Long srcFlex.Rows = (srcFlex.Rows + RS.RecordCount) - 1 For i = 1 To RS.RecordCount For c = 0 To srcNoOfCol - 1 srcFlex.TextMatrix(i, c) = RS.Fields(c) Next c RS.MoveNext Next i i = 0 c = 0 Set RS = NothingEnd Sub
modProcedure - 5 'Procedure used to search in listviewPublic Sub search_in_listview(ByRef sListView As ListView, ByVal sFindText As String) Dim tmp_listtview As ListItem Set tmp_listtview = sListView.FindItem(sFindText, lvwSubItem) If Not tmp_listtview Is Nothing Then tmp_listtview.EnsureVisible tmp_listtview.Selected = True End IfEnd Sub
'Procedure used to center formPublic Sub centerForm(ByRef sForm As Form, ByVal sHeight As Integer, ByVal sWidth As Integer) sForm.Move (sWidth - sForm.Width) / 2, (sHeight - sForm.Height) / 2End Sub'Procedure used to center object horizontalPublic Sub center_obj_horizontal(ByVal sParentObj As Variant, ByRef sMoveObj As Variant) sMoveObj.Left = (sParentObj - sMoveObj.Width) / 2End Sub'Procedure used to center verticalPublic Sub center_obj_vertical(ByVal sParentObj As Variant, ByRef sMoveObj As Variant) sMoveObj.Top = (sParentObj.Height - sMoveObj.Height) / 2End Sub
'Public Sub SetINI(strMain As String, strSub As String, strvalue As String)' WritePrivateProfileString strMain, strSub, strvalue, App.Path & "\VTM.txt"'End Sub
Public Sub SetHandCur(Hand As Boolean) If Hand = True Then SetCursor LoadCursor(0, IDC_HAND) Else SetCursor LoadCursor(0, IDC_ARROW) End IfEnd Sub
modPublicVar - 1 ''*****************************************************************'' File Name:'' Purpose:'' Required Files:'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created:'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
Public CurrUser As USER_INFOPublic DBPath As StringPublic Enc As New clsBlowfishPublic CurrBiz As BUSINESS_INFO
Public CN As New Connection
Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Long) As Long
Public Declare Function SetCursor Lib "user32" (ByVal hCursor As Long) As Long Public Const IDC_HAND = 32649& Public Const IDC_ARROW = 32512&
modVarType - 1
'Variable structure for userPublic Type USER_INFO USER_PK As Long USER_NAME As String USER_ISADMIN As BooleanEnd Type
'Enumerator for form statePublic Enum FormState adStateAddMode = 0 adStateEditMode = 1 adStatePopupMode = 2 adStateViewMode = 3End Enum
Public Type BUSINESS_INFO BUSINESS_NAME As String BUSINESS_ADDRESS As String BUSINESS_CONTACT_INFO As StringEnd Type
clsBlowfish - 1 Option Explicit
' Visual Basic Blowfish Implementation' Algorithm Author: Bruce Schneier' VB Implementation: David Midkiff ([email protected])'' Standard Blowfish implementation with file support, Base64 conversion,' and overall optimisations for Visual Basic. Blowfish is considered one' of the strongest encryption algorithms on the market and is much faster' than the IDEA cipher. It supports variable length keys up to 448-bits. I' would recommend this cipher for high security risk related solutions since' it is unpatented and free for use.'' Information on the Blowfish algorithm can be found at:' http://www.counterpane.com/blowfish.html
Private Declare Sub CopyMem Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Event Progress(Percent As Long)
Private Const Rounds = 16
Private m_pBox(0 To Rounds + 1) As LongPrivate m_sBox(0 To 3, 0 To 255) As LongPrivate m_KeyValue As StringPrivate m_RunningCompiled As BooleanPrivate m_bytIndex(0 To 63) As BytePrivate m_bytReverseIndex(0 To 255) As Byte
Private Const k_bytEqualSign As Byte = 61Private Const k_bytMask1 As Byte = 3Private Const k_bytMask2 As Byte = 15Private Const k_bytMask3 As Byte = 63Private Const k_bytMask4 As Byte = 192Private Const k_bytMask5 As Byte = 240Private Const k_bytMask6 As Byte = 252Private Const k_bytShift2 As Byte = 4Private Const k_bytShift4 As Byte = 16Private Const k_bytShift6 As Byte = 64Private Const k_lMaxBytesPerLine As Long = 152Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As Long, ByVal Source As Long, ByVal Length As Long)
Private Sub Initialize64() m_bytIndex(0) = 65 'Asc("A") m_bytIndex(1) = 66 'Asc("B") m_bytIndex(2) = 67 'Asc("C") m_bytIndex(3) = 68 'Asc("D") m_bytIndex(4) = 69 'Asc("E") m_bytIndex(5) = 70 'Asc("F") m_bytIndex(6) = 71 'Asc("G") m_bytIndex(7) = 72 'Asc("H") m_bytIndex(8) = 73 'Asc("I") m_bytIndex(9) = 74 'Asc("J") m_bytIndex(10) = 75 'Asc("K") m_bytIndex(11) = 76 'Asc("L") m_bytIndex(12) = 77 'Asc("M") m_bytIndex(13) = 78 'Asc("N") m_bytIndex(14) = 79 'Asc("O") m_bytIndex(15) = 80 'Asc("P") m_bytIndex(16) = 81 'Asc("Q") m_bytIndex(17) = 82 'Asc("R") m_bytIndex(18) = 83 'Asc("S") m_bytIndex(19) = 84 'Asc("T") m_bytIndex(20) = 85 'Asc("U") m_bytIndex(21) = 86 'Asc("V") m_bytIndex(22) = 87 'Asc("W") m_bytIndex(23) = 88 'Asc("X") m_bytIndex(24) = 89 'Asc("Y") m_bytIndex(25) = 90 'Asc("Z") m_bytIndex(26) = 97 'Asc("a") m_bytIndex(27) = 98 'Asc("b") m_bytIndex(28) = 99 'Asc("c") m_bytIndex(29) = 100 'Asc("d") m_bytIndex(30) = 101 'Asc("e") m_bytIndex(31) = 102 'Asc("f")
clsBlowfish - 2 m_bytIndex(32) = 103 'Asc("g") m_bytIndex(33) = 104 'Asc("h") m_bytIndex(34) = 105 'Asc("i") m_bytIndex(35) = 106 'Asc("j") m_bytIndex(36) = 107 'Asc("k") m_bytIndex(37) = 108 'Asc("l") m_bytIndex(38) = 109 'Asc("m") m_bytIndex(39) = 110 'Asc("n") m_bytIndex(40) = 111 'Asc("o") m_bytIndex(41) = 112 'Asc("p") m_bytIndex(42) = 113 'Asc("q") m_bytIndex(43) = 114 'Asc("r") m_bytIndex(44) = 115 'Asc("s") m_bytIndex(45) = 116 'Asc("t") m_bytIndex(46) = 117 'Asc("u") m_bytIndex(47) = 118 'Asc("v") m_bytIndex(48) = 119 'Asc("w") m_bytIndex(49) = 120 'Asc("x") m_bytIndex(50) = 121 'Asc("y") m_bytIndex(51) = 122 'Asc("z") m_bytIndex(52) = 48 'Asc("0") m_bytIndex(53) = 49 'Asc("1") m_bytIndex(54) = 50 'Asc("2") m_bytIndex(55) = 51 'Asc("3") m_bytIndex(56) = 52 'Asc("4") m_bytIndex(57) = 53 'Asc("5") m_bytIndex(58) = 54 'Asc("6") m_bytIndex(59) = 55 'Asc("7") m_bytIndex(60) = 56 'Asc("8") m_bytIndex(61) = 57 'Asc("9") m_bytIndex(62) = 43 'Asc("+") m_bytIndex(63) = 47 'Asc("/") m_bytReverseIndex(65) = 0 'Asc("A") m_bytReverseIndex(66) = 1 'Asc("B") m_bytReverseIndex(67) = 2 'Asc("C") m_bytReverseIndex(68) = 3 'Asc("D") m_bytReverseIndex(69) = 4 'Asc("E") m_bytReverseIndex(70) = 5 'Asc("F") m_bytReverseIndex(71) = 6 'Asc("G") m_bytReverseIndex(72) = 7 'Asc("H") m_bytReverseIndex(73) = 8 'Asc("I") m_bytReverseIndex(74) = 9 'Asc("J") m_bytReverseIndex(75) = 10 'Asc("K") m_bytReverseIndex(76) = 11 'Asc("L") m_bytReverseIndex(77) = 12 'Asc("M") m_bytReverseIndex(78) = 13 'Asc("N") m_bytReverseIndex(79) = 14 'Asc("O") m_bytReverseIndex(80) = 15 'Asc("P") m_bytReverseIndex(81) = 16 'Asc("Q") m_bytReverseIndex(82) = 17 'Asc("R") m_bytReverseIndex(83) = 18 'Asc("S") m_bytReverseIndex(84) = 19 'Asc("T") m_bytReverseIndex(85) = 20 'Asc("U") m_bytReverseIndex(86) = 21 'Asc("V") m_bytReverseIndex(87) = 22 'Asc("W") m_bytReverseIndex(88) = 23 'Asc("X") m_bytReverseIndex(89) = 24 'Asc("Y") m_bytReverseIndex(90) = 25 'Asc("Z") m_bytReverseIndex(97) = 26 'Asc("a") m_bytReverseIndex(98) = 27 'Asc("b") m_bytReverseIndex(99) = 28 'Asc("c") m_bytReverseIndex(100) = 29 'Asc("d") m_bytReverseIndex(101) = 30 'Asc("e") m_bytReverseIndex(102) = 31 'Asc("f") m_bytReverseIndex(103) = 32 'Asc("g") m_bytReverseIndex(104) = 33 'Asc("h") m_bytReverseIndex(105) = 34 'Asc("i") m_bytReverseIndex(106) = 35 'Asc("j") m_bytReverseIndex(107) = 36 'Asc("k") m_bytReverseIndex(108) = 37 'Asc("l") m_bytReverseIndex(109) = 38 'Asc("m") m_bytReverseIndex(110) = 39 'Asc("n") m_bytReverseIndex(111) = 40 'Asc("o") m_bytReverseIndex(112) = 41 'Asc("p") m_bytReverseIndex(113) = 42 'Asc("q") m_bytReverseIndex(114) = 43 'Asc("r") m_bytReverseIndex(115) = 44 'Asc("s")
clsBlowfish - 3 m_bytReverseIndex(116) = 45 'Asc("t") m_bytReverseIndex(117) = 46 'Asc("u") m_bytReverseIndex(118) = 47 'Asc("v") m_bytReverseIndex(119) = 48 'Asc("w") m_bytReverseIndex(120) = 49 'Asc("x") m_bytReverseIndex(121) = 50 'Asc("y") m_bytReverseIndex(122) = 51 'Asc("z") m_bytReverseIndex(48) = 52 'Asc("0") m_bytReverseIndex(49) = 53 'Asc("1") m_bytReverseIndex(50) = 54 'Asc("2") m_bytReverseIndex(51) = 55 'Asc("3") m_bytReverseIndex(52) = 56 'Asc("4") m_bytReverseIndex(53) = 57 'Asc("5") m_bytReverseIndex(54) = 58 'Asc("6") m_bytReverseIndex(55) = 59 'Asc("7") m_bytReverseIndex(56) = 60 'Asc("8") m_bytReverseIndex(57) = 61 'Asc("9") m_bytReverseIndex(43) = 62 'Asc("+") m_bytReverseIndex(47) = 63 'Asc("/")End Sub
Public Function Decode64(sInput As String) As String If sInput = "" Then Exit Function Decode64 = StrConv(DecodeArray64(sInput), vbUnicode)End Function
Public Function DecodeArray64(sInput As String) As Byte() If m_bytReverseIndex(47) <> 63 Then Initialize64 Dim bytInput() As Byte Dim bytWorkspace() As Byte Dim bytResult() As Byte Dim lInputCounter As Long Dim lWorkspaceCounter As Long bytInput = Replace(Replace(sInput, vbCrLf, ""), "=", "") ReDim bytWorkspace(LBound(bytInput) To (UBound(bytInput) * 2)) As Byte lWorkspaceCounter = LBound(bytWorkspace) For lInputCounter = LBound(bytInput) To UBound(bytInput) bytInput(lInputCounter) = m_bytReverseIndex(bytInput(lInputCounter)) Next lInputCounter For lInputCounter = LBound(bytInput) To (UBound(bytInput) - ((UBound(bytInput) Mod 8) + 8)) Step 8 bytWorkspace(lWorkspaceCounter) = (bytInput(lInputCounter) * k_bytShift2) + (bytInput(lInputCounter + 2) \ k_bytShift4) bytWorkspace(lWorkspaceCounter + 1) = ((bytInput(lInputCounter + 2) And k_bytMask2) * k_bytShift4) + (bytInput(lInputCounter + 4) \ k_bytShift2) bytWorkspace(lWorkspaceCounter + 2) = ((bytInput(lInputCounter + 4) And k_bytMask1) * k_bytShift6) + bytInput(lInputCounter + 6) lWorkspaceCounter = lWorkspaceCounter + 3 Next lInputCounter Select Case (UBound(bytInput) Mod 8): Case 3: bytWorkspace(lWorkspaceCounter) = (bytInput(lInputCounter) * k_bytShift2) + (bytInput(lInputCounter + 2) \ k_bytShift4) Case 5: bytWorkspace(lWorkspaceCounter) = (bytInput(lInputCounter) * k_bytShift2) + (bytInput(lInputCounter + 2) \ k_bytShift4) bytWorkspace(lWorkspaceCounter + 1) = ((bytInput(lInputCounter + 2) And k_bytMask2) * k_bytShift4) + (bytInput(lInputCounter + 4) \ k_bytShift2) lWorkspaceCounter = lWorkspaceCounter + 1 Case 7: bytWorkspace(lWorkspaceCounter) = (bytInput(lInputCounter) * k_bytShift2) + (bytInput(lInputCounter + 2) \ k_bytShift4) bytWorkspace(lWorkspaceCounter + 1) = ((bytInput(lInputCounter + 2) And k_bytMask2) * k_bytShift4) + (bytInput(lInputCounter + 4) \ k_bytShift2) bytWorkspace(lWorkspaceCounter + 2) = ((bytInput(lInputCounter + 4) And k_bytMask1) * k_bytShift6) + bytInput(lInputCounter + 6) lWorkspaceCounter = lWorkspaceCounter + 2 End Select ReDim bytResult(LBound(bytWorkspace) To lWorkspaceCounter) As Byte If LBound(bytWorkspace) = 0 Then lWorkspaceCounter = lWorkspaceCounter + 1 CopyMemory VarPtr(bytResult(LBound(bytResult))), VarPtr(bytWorkspace(LBound(bytWorkspace))), lWorkspaceCounter DecodeArray64 = bytResult
clsBlowfish - 4 End Function
Public Function Encode64(ByRef sInput As String) As String If sInput = "" Then Exit Function Dim bytTemp() As Byte bytTemp = StrConv(sInput, vbFromUnicode) Encode64 = EncodeArray64(bytTemp)End Function
Public Function EncodeArray64(ByRef bytInput() As Byte) As String On Error GoTo ErrorHandler If m_bytReverseIndex(47) <> 63 Then Initialize64 Dim bytWorkspace() As Byte, bytResult() As Byte Dim bytCrLf(0 To 3) As Byte, lCounter As Long Dim lWorkspaceCounter As Long, lLineCounter As Long Dim lCompleteLines As Long, lBytesRemaining As Long Dim lpWorkSpace As Long, lpResult As Long Dim lpCrLf As Long
If UBound(bytInput) < 1024 Then ReDim bytWorkspace(LBound(bytInput) To (LBound(bytInput) + 4096)) As Byte Else ReDim bytWorkspace(LBound(bytInput) To (UBound(bytInput) * 4)) As Byte End If
lWorkspaceCounter = LBound(bytWorkspace)
For lCounter = LBound(bytInput) To (UBound(bytInput) - ((UBound(bytInput) Mod 3) + 3)) Step 3 bytWorkspace(lWorkspaceCounter) = m_bytIndex((bytInput(lCounter) \ k_bytShift2)) bytWorkspace(lWorkspaceCounter + 2) = m_bytIndex(((bytInput(lCounter) And k_bytMask1) * k_bytShift4) + ((bytInput(lCounter + 1)) \ k_bytShift4)) bytWorkspace(lWorkspaceCounter + 4) = m_bytIndex(((bytInput(lCounter + 1) And k_bytMask2) * k_bytShift2) + (bytInput(lCounter + 2) \ k_bytShift6)) bytWorkspace(lWorkspaceCounter + 6) = m_bytIndex(bytInput(lCounter + 2) And k_bytMask3) lWorkspaceCounter = lWorkspaceCounter + 8 Next lCounter
Select Case (UBound(bytInput) Mod 3): Case 0: bytWorkspace(lWorkspaceCounter) = m_bytIndex((bytInput(lCounter) \ k_bytShift2)) bytWorkspace(lWorkspaceCounter + 2) = m_bytIndex((bytInput(lCounter) And k_bytMask1) * k_bytShift4) bytWorkspace(lWorkspaceCounter + 4) = k_bytEqualSign bytWorkspace(lWorkspaceCounter + 6) = k_bytEqualSign Case 1: bytWorkspace(lWorkspaceCounter) = m_bytIndex((bytInput(lCounter) \ k_bytShift2)) bytWorkspace(lWorkspaceCounter + 2) = m_bytIndex(((bytInput(lCounter) And k_bytMask1) * k_bytShift4) + ((bytInput(lCounter + 1)) \ k_bytShift4)) bytWorkspace(lWorkspaceCounter + 4) = m_bytIndex((bytInput(lCounter + 1) And k_bytMask2) * k_bytShift2) bytWorkspace(lWorkspaceCounter + 6) = k_bytEqualSign Case 2: bytWorkspace(lWorkspaceCounter) = m_bytIndex((bytInput(lCounter) \ k_bytShift2)) bytWorkspace(lWorkspaceCounter + 2) = m_bytIndex(((bytInput(lCounter) And k_bytMask1) * k_bytShift4) + ((bytInput(lCounter + 1)) \ k_bytShift4)) bytWorkspace(lWorkspaceCounter + 4) = m_bytIndex(((bytInput(lCounter + 1) And k_bytMask2) * k_bytShift2) + ((bytInput(lCounter + 2)) \ k_bytShift6)) bytWorkspace(lWorkspaceCounter + 6) = m_bytIndex(bytInput(lCounter + 2) And k_bytMask3) End Select
lWorkspaceCounter = lWorkspaceCounter + 8
If lWorkspaceCounter <= k_lMaxBytesPerLine Then EncodeArray64 = Left$(bytWorkspace, InStr(1, bytWorkspace, Chr$(0)) - 1) Else bytCrLf(0) = 13 bytCrLf(1) = 0 bytCrLf(2) = 10 bytCrLf(3) = 0 ReDim bytResult(LBound(bytWorkspace) To UBound(bytWorkspace)) lpWorkSpace = VarPtr(bytWorkspace(LBound(bytWorkspace))) lpResult = VarPtr(bytResult(LBound(bytResult))) lpCrLf = VarPtr(bytCrLf(LBound(bytCrLf))) lCompleteLines = Fix(lWorkspaceCounter / k_lMaxBytesPerLine) For lLineCounter = 0 To lCompleteLines
clsBlowfish - 5 CopyMemory lpResult, lpWorkSpace, k_lMaxBytesPerLine lpWorkSpace = lpWorkSpace + k_lMaxBytesPerLine lpResult = lpResult + k_lMaxBytesPerLine CopyMemory lpResult, lpCrLf, 4& lpResult = lpResult + 4& Next lLineCounter lBytesRemaining = lWorkspaceCounter - (lCompleteLines * k_lMaxBytesPerLine) If lBytesRemaining > 0 Then CopyMemory lpResult, lpWorkSpace, lBytesRemaining EncodeArray64 = Left$(bytResult, InStr(1, bytResult, Chr$(0)) - 1) End If Exit Function
ErrorHandler: Erase bytResult EncodeArray64 = bytResultEnd Function
Private Static Sub DecryptBlock(Xl As Long, Xr As Long) Dim i As Long, j As Long, K As Long K = Xr Xr = Xl Xor m_pBox(Rounds + 1) Xl = K Xor m_pBox(Rounds) j = Rounds - 2 For i = 0 To (Rounds \ 2 - 1) Xl = Xl Xor f(Xr) Xr = Xr Xor m_pBox(j + 1) Xr = Xr Xor f(Xl) Xl = Xl Xor m_pBox(j) j = j - 2 NextEnd SubPrivate Static Sub EncryptBlock(Xl As Long, Xr As Long) Dim i As Long, j As Long, Temp As Long j = 0 For i = 0 To (Rounds \ 2 - 1) Xl = Xl Xor m_pBox(j) Xr = Xr Xor f(Xl) Xr = Xr Xor m_pBox(j + 1) Xl = Xl Xor f(Xr) j = j + 2 Next Temp = Xr Xr = Xl Xor m_pBox(Rounds) Xl = Temp Xor m_pBox(Rounds + 1)End SubPublic Sub EncryptByte(byteArray() As Byte, Optional Key As String) Dim Offset As Long, OrigLen As Long, LeftWord As Long, RightWord As Long, CipherLen As Long, CipherLeft As Long, CipherRight As Long, CurrPercent As Long, NextPercent As Long If (Len(Key) > 0) Then Me.Key = Key OrigLen = UBound(byteArray) + 1 CipherLen = OrigLen + 12 If (CipherLen Mod 8 <> 0) Then CipherLen = CipherLen + 8 - (CipherLen Mod 8) ReDim Preserve byteArray(CipherLen - 1) Call CopyMem(byteArray(12), byteArray(0), OrigLen) Call CopyMem(byteArray(8), OrigLen, 4) Call Randomize Call CopyMem(byteArray(0), CLng(2147483647 * Rnd), 4) Call CopyMem(byteArray(4), CLng(2147483647 * Rnd), 4) For Offset = 0 To (CipherLen - 1) Step 8 Call GetWord(LeftWord, byteArray(), Offset) Call GetWord(RightWord, byteArray(), Offset + 4) LeftWord = LeftWord Xor CipherLeft RightWord = RightWord Xor CipherRight Call EncryptBlock(LeftWord, RightWord) Call PutWord(LeftWord, byteArray(), Offset) Call PutWord(RightWord, byteArray(), Offset + 4) CipherLeft = LeftWord CipherRight = RightWord If (Offset >= NextPercent) Then CurrPercent = Int((Offset / CipherLen) * 100) NextPercent = (CipherLen * ((CurrPercent + 1) / 100)) + 1 RaiseEvent Progress(CurrPercent) End If Next If (CurrPercent <> 100) Then RaiseEvent Progress(100)End Sub
clsBlowfish - 6 Public Function EncryptString(Text As String, Optional Key As String, Optional OutputIn64 As Boolean) As String Dim byteArray() As Byte byteArray() = StrConv(Text, vbFromUnicode) Call EncryptByte(byteArray(), Key) EncryptString = StrConv(byteArray(), vbUnicode) If OutputIn64 = True Then EncryptString = Encode64(EncryptString) Erase byteArray(): Key = "": Text = ""End FunctionPublic Function DecryptString(Text As String, Optional Key As String, Optional IsTextIn64 As Boolean) As String Dim byteArray() As Byte If IsTextIn64 = True Then Text = Decode64(Text) byteArray() = StrConv(Text, vbFromUnicode) Call DecryptByte(byteArray(), Key) DecryptString = StrConv(byteArray(), vbUnicode) Erase byteArray(): Key = "": Text = ""End FunctionPublic Sub DecryptByte(byteArray() As Byte, Optional Key As String) On Error GoTo ErrorHandler Dim Offset As Long, OrigLen As Long, LeftWord As Long, RightWord As Long, CipherLen As Long, CipherLeft As Long, CipherRight As Long, CurrPercent As Long, NextPercent As Long If (Len(Key) > 0) Then Me.Key = Key CipherLen = UBound(byteArray) + 1 For Offset = 0 To (CipherLen - 1) Step 8 Call GetWord(LeftWord, byteArray(), Offset) Call GetWord(RightWord, byteArray(), Offset + 4) Call DecryptBlock(LeftWord, RightWord) LeftWord = LeftWord Xor CipherLeft RightWord = RightWord Xor CipherRight Call GetWord(CipherLeft, byteArray(), Offset) Call GetWord(CipherRight, byteArray(), Offset + 4) Call PutWord(LeftWord, byteArray(), Offset) Call PutWord(RightWord, byteArray(), Offset + 4) If Offset >= NextPercent Then CurrPercent = Int((Offset / CipherLen) * 100) NextPercent = (CipherLen * ((CurrPercent + 1) / 100)) + 1 RaiseEvent Progress(CurrPercent) End If Next Call CopyMem(OrigLen, byteArray(8), 4) If (CipherLen - OrigLen > 19) Or (CipherLen - OrigLen < 12) Then Call err.Raise(vbObjectError, , "Incorrect size descriptor in Blowfish decryption") Call CopyMem(byteArray(0), byteArray(12), OrigLen) ReDim Preserve byteArray(OrigLen - 1) If CurrPercent <> 100 Then RaiseEvent Progress(100)
ErrorHandler:End SubPrivate Static Function f(ByVal X As Long) As Long Dim xb(0 To 3) As Byte Call CopyMem(xb(0), X, 4) If (m_RunningCompiled) Then f = (((m_sBox(0, xb(3)) + m_sBox(1, xb(2))) Xor m_sBox(2, xb(1))) + m_sBox(3, xb(0))) Else f = UnsignedAdd((UnsignedAdd(m_sBox(0, xb(3)), m_sBox(1, xb(2))) Xor m_sBox(2, xb(1))), m_sBox(3, xb(0)))End FunctionPrivate Static Sub GetWord(LongValue As Long, CryptBuffer() As Byte, Offset As Long) Dim bb(0 To 3) As Byte bb(3) = CryptBuffer(Offset) bb(2) = CryptBuffer(Offset + 1) bb(1) = CryptBuffer(Offset + 2) bb(0) = CryptBuffer(Offset + 3) Call CopyMem(LongValue, bb(0), 4)End SubPrivate Static Sub PutWord(LongValue As Long, CryptBuffer() As Byte, Offset As Long) Dim bb(0 To 3) As Byte Call CopyMem(bb(0), LongValue, 4) CryptBuffer(Offset) = bb(3) CryptBuffer(Offset + 1) = bb(2) CryptBuffer(Offset + 2) = bb(1) CryptBuffer(Offset + 3) = bb(0)End SubPrivate Static Function UnsignedAdd(ByVal Data1 As Long, Data2 As Long) As Long Dim x1(0 To 3) As Byte, x2(0 To 3) As Byte, xx(0 To 3) As Byte, Rest As Long, Value As Long, a As Long Call CopyMem(x1(0), Data1, 4) Call CopyMem(x2(0), Data2, 4)
clsBlowfish - 7 Rest = 0 For a = 0 To 3 Value = CLng(x1(a)) + CLng(x2(a)) + Rest xx(a) = Value And 255 Rest = Value \ 256 Next Call CopyMem(UnsignedAdd, xx(0), 4)End FunctionPrivate Function UnsignedDel(Data1 As Long, Data2 As Long) As Long Dim x1(0 To 3) As Byte, x2(0 To 3) As Byte, xx(0 To 3) As Byte, Rest As Long, Value As Long, a As Long Call CopyMem(x1(0), Data1, 4) Call CopyMem(x2(0), Data2, 4) Call CopyMem(xx(0), UnsignedDel, 4) For a = 0 To 3 Value = CLng(x1(a)) - CLng(x2(a)) - Rest If (Value < 0) Then Value = Value + 256 Rest = 1 Else Rest = 0 End If xx(a) = Value Next Call CopyMem(UnsignedDel, xx(0), 4)End FunctionPublic Property Let Key(New_Value As String) Dim i As Long, j As Long, K As Long, dataX As Long, datal As Long, datar As Long, Key() As Byte, KeyLength As Long Class_Initialize If (m_KeyValue = New_Value) Then Exit Property m_KeyValue = New_Value KeyLength = Len(New_Value) Key() = StrConv(New_Value, vbFromUnicode) j = 0 For i = 0 To (Rounds + 1) dataX = 0 For K = 0 To 3 Call CopyMem(ByVal VarPtr(dataX) + 1, dataX, 3) dataX = (dataX Or Key(j)) j = j + 1 If (j >= KeyLength) Then j = 0 Next m_pBox(i) = m_pBox(i) Xor dataX Next datal = 0: datar = 0 For i = 0 To (Rounds + 1) Step 2 Call EncryptBlock(datal, datar) m_pBox(i) = datal m_pBox(i + 1) = datar Next For i = 0 To 3 For j = 0 To 255 Step 2 Call EncryptBlock(datal, datar) m_sBox(i, j) = datal m_sBox(i, j + 1) = datar Next NextEnd PropertyPrivate Sub Class_Initialize()On Local Error Resume Next m_RunningCompiled = ((2147483647 + 1) < 0) m_pBox(0) = &H243F6A88 m_pBox(1) = &H85A308D3 m_pBox(2) = &H13198A2E m_pBox(3) = &H3707344 m_pBox(4) = &HA4093822 m_pBox(5) = &H299F31D0 m_pBox(6) = &H82EFA98 m_pBox(7) = &HEC4E6C89 m_pBox(8) = &H452821E6 m_pBox(9) = &H38D01377 m_pBox(10) = &HBE5466CF m_pBox(11) = &H34E90C6C m_pBox(12) = &HC0AC29B7 m_pBox(13) = &HC97C50DD
clsBlowfish - 8 m_pBox(14) = &H3F84D5B5 m_pBox(15) = &HB5470917 m_pBox(16) = &H9216D5D9 m_pBox(17) = &H8979FB1B m_sBox(0, 0) = &HD1310BA6 m_sBox(1, 0) = &H98DFB5AC m_sBox(2, 0) = &H2FFD72DB m_sBox(3, 0) = &HD01ADFB7 m_sBox(0, 1) = &HB8E1AFED m_sBox(1, 1) = &H6A267E96 m_sBox(2, 1) = &HBA7C9045 m_sBox(3, 1) = &HF12C7F99 m_sBox(0, 2) = &H24A19947 m_sBox(1, 2) = &HB3916CF7 m_sBox(2, 2) = &H801F2E2 m_sBox(3, 2) = &H858EFC16 m_sBox(0, 3) = &H636920D8 m_sBox(1, 3) = &H71574E69 m_sBox(2, 3) = &HA458FEA3 m_sBox(3, 3) = &HF4933D7E m_sBox(0, 4) = &HD95748F m_sBox(1, 4) = &H728EB658 m_sBox(2, 4) = &H718BCD58 m_sBox(3, 4) = &H82154AEE m_sBox(0, 5) = &H7B54A41D m_sBox(1, 5) = &HC25A59B5 m_sBox(2, 5) = &H9C30D539 m_sBox(3, 5) = &H2AF26013 m_sBox(0, 6) = &HC5D1B023 m_sBox(1, 6) = &H286085F0 m_sBox(2, 6) = &HCA417918 m_sBox(3, 6) = &HB8DB38EF m_sBox(0, 7) = &H8E79DCB0 m_sBox(1, 7) = &H603A180E m_sBox(2, 7) = &H6C9E0E8B m_sBox(3, 7) = &HB01E8A3E m_sBox(0, 8) = &HD71577C1 m_sBox(1, 8) = &HBD314B27 m_sBox(2, 8) = &H78AF2FDA m_sBox(3, 8) = &H55605C60 m_sBox(0, 9) = &HE65525F3 m_sBox(1, 9) = &HAA55AB94 m_sBox(2, 9) = &H57489862 m_sBox(3, 9) = &H63E81440 m_sBox(0, 10) = &H55CA396A m_sBox(1, 10) = &H2AAB10B6 m_sBox(2, 10) = &HB4CC5C34 m_sBox(3, 10) = &H1141E8CE m_sBox(0, 11) = &HA15486AF m_sBox(1, 11) = &H7C72E993 m_sBox(2, 11) = &HB3EE1411 m_sBox(3, 11) = &H636FBC2A m_sBox(0, 12) = &H2BA9C55D m_sBox(1, 12) = &H741831F6 m_sBox(2, 12) = &HCE5C3E16 m_sBox(3, 12) = &H9B87931E m_sBox(0, 13) = &HAFD6BA33 m_sBox(1, 13) = &H6C24CF5C m_sBox(2, 13) = &H7A325381 m_sBox(3, 13) = &H28958677 m_sBox(0, 14) = &H3B8F4898 m_sBox(1, 14) = &H6B4BB9AF m_sBox(2, 14) = &HC4BFE81B m_sBox(3, 14) = &H66282193 m_sBox(0, 15) = &H61D809CC m_sBox(1, 15) = &HFB21A991 m_sBox(2, 15) = &H487CAC60 m_sBox(3, 15) = &H5DEC8032 m_sBox(0, 16) = &HEF845D5D m_sBox(1, 16) = &HE98575B1 m_sBox(2, 16) = &HDC262302 m_sBox(3, 16) = &HEB651B88 m_sBox(0, 17) = &H23893E81 m_sBox(1, 17) = &HD396ACC5 m_sBox(2, 17) = &HF6D6FF3 m_sBox(3, 17) = &H83F44239 m_sBox(0, 18) = &H2E0B4482
clsBlowfish - 9 m_sBox(1, 18) = &HA4842004 m_sBox(2, 18) = &H69C8F04A m_sBox(3, 18) = &H9E1F9B5E m_sBox(0, 19) = &H21C66842 m_sBox(1, 19) = &HF6E96C9A m_sBox(2, 19) = &H670C9C61 m_sBox(3, 19) = &HABD388F0 m_sBox(0, 20) = &H6A51A0D2 m_sBox(1, 20) = &HD8542F68 m_sBox(2, 20) = &H960FA728 m_sBox(3, 20) = &HAB5133A3 m_sBox(0, 21) = &H6EEF0B6C m_sBox(1, 21) = &H137A3BE4 m_sBox(2, 21) = &HBA3BF050 m_sBox(3, 21) = &H7EFB2A98 m_sBox(0, 22) = &HA1F1651D m_sBox(1, 22) = &H39AF0176 m_sBox(2, 22) = &H66CA593E m_sBox(3, 22) = &H82430E88 m_sBox(0, 23) = &H8CEE8619 m_sBox(1, 23) = &H456F9FB4 m_sBox(2, 23) = &H7D84A5C3 m_sBox(3, 23) = &H3B8B5EBE m_sBox(0, 24) = &HE06F75D8 m_sBox(1, 24) = &H85C12073 m_sBox(2, 24) = &H401A449F m_sBox(3, 24) = &H56C16AA6 m_sBox(0, 25) = &H4ED3AA62 m_sBox(1, 25) = &H363F7706 m_sBox(2, 25) = &H1BFEDF72 m_sBox(3, 25) = &H429B023D m_sBox(0, 26) = &H37D0D724 m_sBox(1, 26) = &HD00A1248 m_sBox(2, 26) = &HDB0FEAD3 m_sBox(3, 26) = &H49F1C09B m_sBox(0, 27) = &H75372C9 m_sBox(1, 27) = &H80991B7B m_sBox(2, 27) = &H25D479D8 m_sBox(3, 27) = &HF6E8DEF7 m_sBox(0, 28) = &HE3FE501A m_sBox(1, 28) = &HB6794C3B m_sBox(2, 28) = &H976CE0BD m_sBox(3, 28) = &H4C006BA m_sBox(0, 29) = &HC1A94FB6 m_sBox(1, 29) = &H409F60C4 m_sBox(2, 29) = &H5E5C9EC2 m_sBox(3, 29) = &H196A2463 m_sBox(0, 30) = &H68FB6FAF m_sBox(1, 30) = &H3E6C53B5 m_sBox(2, 30) = &H1339B2EB m_sBox(3, 30) = &H3B52EC6F m_sBox(0, 31) = &H6DFC511F m_sBox(1, 31) = &H9B30952C m_sBox(2, 31) = &HCC814544 m_sBox(3, 31) = &HAF5EBD09 m_sBox(0, 32) = &HBEE3D004 m_sBox(1, 32) = &HDE334AFD m_sBox(2, 32) = &H660F2807 m_sBox(3, 32) = &H192E4BB3 m_sBox(0, 33) = &HC0CBA857 m_sBox(1, 33) = &H45C8740F m_sBox(2, 33) = &HD20B5F39 m_sBox(3, 33) = &HB9D3FBDB m_sBox(0, 34) = &H5579C0BD m_sBox(1, 34) = &H1A60320A m_sBox(2, 34) = &HD6A100C6 m_sBox(3, 34) = &H402C7279 m_sBox(0, 35) = &H679F25FE m_sBox(1, 35) = &HFB1FA3CC m_sBox(2, 35) = &H8EA5E9F8 m_sBox(3, 35) = &HDB3222F8 m_sBox(0, 36) = &H3C7516DF m_sBox(1, 36) = &HFD616B15 m_sBox(2, 36) = &H2F501EC8 m_sBox(3, 36) = &HAD0552AB m_sBox(0, 37) = &H323DB5FA m_sBox(1, 37) = &HFD238760
clsBlowfish - 10 m_sBox(2, 37) = &H53317B48 m_sBox(3, 37) = &H3E00DF82 m_sBox(0, 38) = &H9E5C57BB m_sBox(1, 38) = &HCA6F8CA0 m_sBox(2, 38) = &H1A87562E m_sBox(3, 38) = &HDF1769DB m_sBox(0, 39) = &HD542A8F6 m_sBox(1, 39) = &H287EFFC3 m_sBox(2, 39) = &HAC6732C6 m_sBox(3, 39) = &H8C4F5573 m_sBox(0, 40) = &H695B27B0 m_sBox(1, 40) = &HBBCA58C8 m_sBox(2, 40) = &HE1FFA35D m_sBox(3, 40) = &HB8F011A0 m_sBox(0, 41) = &H10FA3D98 m_sBox(1, 41) = &HFD2183B8 m_sBox(2, 41) = &H4AFCB56C m_sBox(3, 41) = &H2DD1D35B m_sBox(0, 42) = &H9A53E479 m_sBox(1, 42) = &HB6F84565 m_sBox(2, 42) = &HD28E49BC m_sBox(3, 42) = &H4BFB9790 m_sBox(0, 43) = &HE1DDF2DA m_sBox(1, 43) = &HA4CB7E33 m_sBox(2, 43) = &H62FB1341 m_sBox(3, 43) = &HCEE4C6E8 m_sBox(0, 44) = &HEF20CADA m_sBox(1, 44) = &H36774C01 m_sBox(2, 44) = &HD07E9EFE m_sBox(3, 44) = &H2BF11FB4 m_sBox(0, 45) = &H95DBDA4D m_sBox(1, 45) = &HAE909198 m_sBox(2, 45) = &HEAAD8E71 m_sBox(3, 45) = &H6B93D5A0 m_sBox(0, 46) = &HD08ED1D0 m_sBox(1, 46) = &HAFC725E0 m_sBox(2, 46) = &H8E3C5B2F m_sBox(3, 46) = &H8E7594B7 m_sBox(0, 47) = &H8FF6E2FB m_sBox(1, 47) = &HF2122B64 m_sBox(2, 47) = &H8888B812 m_sBox(3, 47) = &H900DF01C m_sBox(0, 48) = &H4FAD5EA0 m_sBox(1, 48) = &H688FC31C m_sBox(2, 48) = &HD1CFF191 m_sBox(3, 48) = &HB3A8C1AD m_sBox(0, 49) = &H2F2F2218 m_sBox(1, 49) = &HBE0E1777 m_sBox(2, 49) = &HEA752DFE m_sBox(3, 49) = &H8B021FA1 m_sBox(0, 50) = &HE5A0CC0F m_sBox(1, 50) = &HB56F74E8 m_sBox(2, 50) = &H18ACF3D6 m_sBox(3, 50) = &HCE89E299 m_sBox(0, 51) = &HB4A84FE0 m_sBox(1, 51) = &HFD13E0B7 m_sBox(2, 51) = &H7CC43B81 m_sBox(3, 51) = &HD2ADA8D9 m_sBox(0, 52) = &H165FA266 m_sBox(1, 52) = &H80957705 m_sBox(2, 52) = &H93CC7314 m_sBox(3, 52) = &H211A1477 m_sBox(0, 53) = &HE6AD2065 m_sBox(1, 53) = &H77B5FA86 m_sBox(2, 53) = &HC75442F5 m_sBox(3, 53) = &HFB9D35CF m_sBox(0, 54) = &HEBCDAF0C m_sBox(1, 54) = &H7B3E89A0 m_sBox(2, 54) = &HD6411BD3 m_sBox(3, 54) = &HAE1E7E49 m_sBox(0, 55) = &H250E2D m_sBox(1, 55) = &H2071B35E m_sBox(2, 55) = &H226800BB m_sBox(3, 55) = &H57B8E0AF m_sBox(0, 56) = &H2464369B m_sBox(1, 56) = &HF009B91E m_sBox(2, 56) = &H5563911D
clsBlowfish - 11 m_sBox(3, 56) = &H59DFA6AA m_sBox(0, 57) = &H78C14389 m_sBox(1, 57) = &HD95A537F m_sBox(2, 57) = &H207D5BA2 m_sBox(3, 57) = &H2E5B9C5 m_sBox(0, 58) = &H83260376 m_sBox(1, 58) = &H6295CFA9 m_sBox(2, 58) = &H11C81968 m_sBox(3, 58) = &H4E734A41 m_sBox(0, 59) = &HB3472DCA m_sBox(1, 59) = &H7B14A94A m_sBox(2, 59) = &H1B510052 m_sBox(3, 59) = &H9A532915 m_sBox(0, 60) = &HD60F573F m_sBox(1, 60) = &HBC9BC6E4 m_sBox(2, 60) = &H2B60A476 m_sBox(3, 60) = &H81E67400 m_sBox(0, 61) = &H8BA6FB5 m_sBox(1, 61) = &H571BE91F m_sBox(2, 61) = &HF296EC6B m_sBox(3, 61) = &H2A0DD915 m_sBox(0, 62) = &HB6636521 m_sBox(1, 62) = &HE7B9F9B6 m_sBox(2, 62) = &HFF34052E m_sBox(3, 62) = &HC5855664 m_sBox(0, 63) = &H53B02D5D m_sBox(1, 63) = &HA99F8FA1 m_sBox(2, 63) = &H8BA4799 m_sBox(3, 63) = &H6E85076A m_sBox(0, 64) = &H4B7A70E9 m_sBox(1, 64) = &HB5B32944 m_sBox(2, 64) = &HDB75092E m_sBox(3, 64) = &HC4192623 m_sBox(0, 65) = &HAD6EA6B0 m_sBox(1, 65) = &H49A7DF7D m_sBox(2, 65) = &H9CEE60B8 m_sBox(3, 65) = &H8FEDB266 m_sBox(0, 66) = &HECAA8C71 m_sBox(1, 66) = &H699A17FF m_sBox(2, 66) = &H5664526C m_sBox(3, 66) = &HC2B19EE1 m_sBox(0, 67) = &H193602A5 m_sBox(1, 67) = &H75094C29 m_sBox(2, 67) = &HA0591340 m_sBox(3, 67) = &HE4183A3E m_sBox(0, 68) = &H3F54989A m_sBox(1, 68) = &H5B429D65 m_sBox(2, 68) = &H6B8FE4D6 m_sBox(3, 68) = &H99F73FD6 m_sBox(0, 69) = &HA1D29C07 m_sBox(1, 69) = &HEFE830F5 m_sBox(2, 69) = &H4D2D38E6 m_sBox(3, 69) = &HF0255DC1 m_sBox(0, 70) = &H4CDD2086 m_sBox(1, 70) = &H8470EB26 m_sBox(2, 70) = &H6382E9C6 m_sBox(3, 70) = &H21ECC5E m_sBox(0, 71) = &H9686B3F m_sBox(1, 71) = &H3EBAEFC9 m_sBox(2, 71) = &H3C971814 m_sBox(3, 71) = &H6B6A70A1 m_sBox(0, 72) = &H687F3584 m_sBox(1, 72) = &H52A0E286 m_sBox(2, 72) = &HB79C5305 m_sBox(3, 72) = &HAA500737 m_sBox(0, 73) = &H3E07841C m_sBox(1, 73) = &H7FDEAE5C m_sBox(2, 73) = &H8E7D44EC m_sBox(3, 73) = &H5716F2B8 m_sBox(0, 74) = &HB03ADA37 m_sBox(1, 74) = &HF0500C0D m_sBox(2, 74) = &HF01C1F04 m_sBox(3, 74) = &H200B3FF m_sBox(0, 75) = &HAE0CF51A m_sBox(1, 75) = &H3CB574B2 m_sBox(2, 75) = &H25837A58 m_sBox(3, 75) = &HDC0921BD
clsBlowfish - 12 m_sBox(0, 76) = &HD19113F9 m_sBox(1, 76) = &H7CA92FF6 m_sBox(2, 76) = &H94324773 m_sBox(3, 76) = &H22F54701 m_sBox(0, 77) = &H3AE5E581 m_sBox(1, 77) = &H37C2DADC m_sBox(2, 77) = &HC8B57634 m_sBox(3, 77) = &H9AF3DDA7 m_sBox(0, 78) = &HA9446146 m_sBox(1, 78) = &HFD0030E m_sBox(2, 78) = &HECC8C73E m_sBox(3, 78) = &HA4751E41 m_sBox(0, 79) = &HE238CD99 m_sBox(1, 79) = &H3BEA0E2F m_sBox(2, 79) = &H3280BBA1 m_sBox(3, 79) = &H183EB331 m_sBox(0, 80) = &H4E548B38 m_sBox(1, 80) = &H4F6DB908 m_sBox(2, 80) = &H6F420D03 m_sBox(3, 80) = &HF60A04BF m_sBox(0, 81) = &H2CB81290 m_sBox(1, 81) = &H24977C79 m_sBox(2, 81) = &H5679B072 m_sBox(3, 81) = &HBCAF89AF m_sBox(0, 82) = &HDE9A771F m_sBox(1, 82) = &HD9930810 m_sBox(2, 82) = &HB38BAE12 m_sBox(3, 82) = &HDCCF3F2E m_sBox(0, 83) = &H5512721F m_sBox(1, 83) = &H2E6B7124 m_sBox(2, 83) = &H501ADDE6 m_sBox(3, 83) = &H9F84CD87 m_sBox(0, 84) = &H7A584718 m_sBox(1, 84) = &H7408DA17 m_sBox(2, 84) = &HBC9F9ABC m_sBox(3, 84) = &HE94B7D8C m_sBox(0, 85) = &HEC7AEC3A m_sBox(1, 85) = &HDB851DFA m_sBox(2, 85) = &H63094366 m_sBox(3, 85) = &HC464C3D2 m_sBox(0, 86) = &HEF1C1847 m_sBox(1, 86) = &H3215D908 m_sBox(2, 86) = &HDD433B37 m_sBox(3, 86) = &H24C2BA16 m_sBox(0, 87) = &H12A14D43 m_sBox(1, 87) = &H2A65C451 m_sBox(2, 87) = &H50940002 m_sBox(3, 87) = &H133AE4DD m_sBox(0, 88) = &H71DFF89E m_sBox(1, 88) = &H10314E55 m_sBox(2, 88) = &H81AC77D6 m_sBox(3, 88) = &H5F11199B m_sBox(0, 89) = &H43556F1 m_sBox(1, 89) = &HD7A3C76B m_sBox(2, 89) = &H3C11183B m_sBox(3, 89) = &H5924A509 m_sBox(0, 90) = &HF28FE6ED m_sBox(1, 90) = &H97F1FBFA m_sBox(2, 90) = &H9EBABF2C m_sBox(3, 90) = &H1E153C6E m_sBox(0, 91) = &H86E34570 m_sBox(1, 91) = &HEAE96FB1 m_sBox(2, 91) = &H860E5E0A m_sBox(3, 91) = &H5A3E2AB3 m_sBox(0, 92) = &H771FE71C m_sBox(1, 92) = &H4E3D06FA m_sBox(2, 92) = &H2965DCB9 m_sBox(3, 92) = &H99E71D0F m_sBox(0, 93) = &H803E89D6 m_sBox(1, 93) = &H5266C825 m_sBox(2, 93) = &H2E4CC978 m_sBox(3, 93) = &H9C10B36A m_sBox(0, 94) = &HC6150EBA m_sBox(1, 94) = &H94E2EA78 m_sBox(2, 94) = &HA5FC3C53 m_sBox(3, 94) = &H1E0A2DF4 m_sBox(0, 95) = &HF2F74EA7
clsBlowfish - 13 m_sBox(1, 95) = &H361D2B3D m_sBox(2, 95) = &H1939260F m_sBox(3, 95) = &H19C27960 m_sBox(0, 96) = &H5223A708 m_sBox(1, 96) = &HF71312B6 m_sBox(2, 96) = &HEBADFE6E m_sBox(3, 96) = &HEAC31F66 m_sBox(0, 97) = &HE3BC4595 m_sBox(1, 97) = &HA67BC883 m_sBox(2, 97) = &HB17F37D1 m_sBox(3, 97) = &H18CFF28 m_sBox(0, 98) = &HC332DDEF m_sBox(1, 98) = &HBE6C5AA5 m_sBox(2, 98) = &H65582185 m_sBox(3, 98) = &H68AB9802 m_sBox(0, 99) = &HEECEA50F m_sBox(1, 99) = &HDB2F953B m_sBox(2, 99) = &H2AEF7DAD m_sBox(3, 99) = &H5B6E2F84 m_sBox(0, 100) = &H1521B628 m_sBox(1, 100) = &H29076170 m_sBox(2, 100) = &HECDD4775 m_sBox(3, 100) = &H619F1510 m_sBox(0, 101) = &H13CCA830 m_sBox(1, 101) = &HEB61BD96 m_sBox(2, 101) = &H334FE1E m_sBox(3, 101) = &HAA0363CF m_sBox(0, 102) = &HB5735C90 m_sBox(1, 102) = &H4C70A239 m_sBox(2, 102) = &HD59E9E0B m_sBox(3, 102) = &HCBAADE14 m_sBox(0, 103) = &HEECC86BC m_sBox(1, 103) = &H60622CA7 m_sBox(2, 103) = &H9CAB5CAB m_sBox(3, 103) = &HB2F3846E m_sBox(0, 104) = &H648B1EAF m_sBox(1, 104) = &H19BDF0CA m_sBox(2, 104) = &HA02369B9 m_sBox(3, 104) = &H655ABB50 m_sBox(0, 105) = &H40685A32 m_sBox(1, 105) = &H3C2AB4B3 m_sBox(2, 105) = &H319EE9D5 m_sBox(3, 105) = &HC021B8F7 m_sBox(0, 106) = &H9B540B19 m_sBox(1, 106) = &H875FA099 m_sBox(2, 106) = &H95F7997E m_sBox(3, 106) = &H623D7DA8 m_sBox(0, 107) = &HF837889A m_sBox(1, 107) = &H97E32D77 m_sBox(2, 107) = &H11ED935F m_sBox(3, 107) = &H16681281 m_sBox(0, 108) = &HE358829 m_sBox(1, 108) = &HC7E61FD6 m_sBox(2, 108) = &H96DEDFA1 m_sBox(3, 108) = &H7858BA99 m_sBox(0, 109) = &H57F584A5 m_sBox(1, 109) = &H1B227263 m_sBox(2, 109) = &H9B83C3FF m_sBox(3, 109) = &H1AC24696 m_sBox(0, 110) = &HCDB30AEB m_sBox(1, 110) = &H532E3054 m_sBox(2, 110) = &H8FD948E4 m_sBox(3, 110) = &H6DBC3128 m_sBox(0, 111) = &H58EBF2EF m_sBox(1, 111) = &H34C6FFEA m_sBox(2, 111) = &HFE28ED61 m_sBox(3, 111) = &HEE7C3C73 m_sBox(0, 112) = &H5D4A14D9 m_sBox(1, 112) = &HE864B7E3 m_sBox(2, 112) = &H42105D14 m_sBox(3, 112) = &H203E13E0 m_sBox(0, 113) = &H45EEE2B6 m_sBox(1, 113) = &HA3AAABEA m_sBox(2, 113) = &HDB6C4F15 m_sBox(3, 113) = &HFACB4FD0 m_sBox(0, 114) = &HC742F442 m_sBox(1, 114) = &HEF6ABBB5
clsBlowfish - 14 m_sBox(2, 114) = &H654F3B1D m_sBox(3, 114) = &H41CD2105 m_sBox(0, 115) = &HD81E799E m_sBox(1, 115) = &H86854DC7 m_sBox(2, 115) = &HE44B476A m_sBox(3, 115) = &H3D816250 m_sBox(0, 116) = &HCF62A1F2 m_sBox(1, 116) = &H5B8D2646 m_sBox(2, 116) = &HFC8883A0 m_sBox(3, 116) = &HC1C7B6A3 m_sBox(0, 117) = &H7F1524C3 m_sBox(1, 117) = &H69CB7492 m_sBox(2, 117) = &H47848A0B m_sBox(3, 117) = &H5692B285 m_sBox(0, 118) = &H95BBF00 m_sBox(1, 118) = &HAD19489D m_sBox(2, 118) = &H1462B174 m_sBox(3, 118) = &H23820E00 m_sBox(0, 119) = &H58428D2A m_sBox(1, 119) = &HC55F5EA m_sBox(2, 119) = &H1DADF43E m_sBox(3, 119) = &H233F7061 m_sBox(0, 120) = &H3372F092 m_sBox(1, 120) = &H8D937E41 m_sBox(2, 120) = &HD65FECF1 m_sBox(3, 120) = &H6C223BDB m_sBox(0, 121) = &H7CDE3759 m_sBox(1, 121) = &HCBEE7460 m_sBox(2, 121) = &H4085F2A7 m_sBox(3, 121) = &HCE77326E m_sBox(0, 122) = &HA6078084 m_sBox(1, 122) = &H19F8509E m_sBox(2, 122) = &HE8EFD855 m_sBox(3, 122) = &H61D99735 m_sBox(0, 123) = &HA969A7AA m_sBox(1, 123) = &HC50C06C2 m_sBox(2, 123) = &H5A04ABFC m_sBox(3, 123) = &H800BCADC m_sBox(0, 124) = &H9E447A2E m_sBox(1, 124) = &HC3453484 m_sBox(2, 124) = &HFDD56705 m_sBox(3, 124) = &HE1E9EC9 m_sBox(0, 125) = &HDB73DBD3 m_sBox(1, 125) = &H105588CD m_sBox(2, 125) = &H675FDA79 m_sBox(3, 125) = &HE3674340 m_sBox(0, 126) = &HC5C43465 m_sBox(1, 126) = &H713E38D8 m_sBox(2, 126) = &H3D28F89E m_sBox(3, 126) = &HF16DFF20 m_sBox(0, 127) = &H153E21E7 m_sBox(1, 127) = &H8FB03D4A m_sBox(2, 127) = &HE6E39F2B m_sBox(3, 127) = &HDB83ADF7 m_sBox(0, 128) = &HE93D5A68 m_sBox(1, 128) = &H948140F7 m_sBox(2, 128) = &HF64C261C m_sBox(3, 128) = &H94692934 m_sBox(0, 129) = &H411520F7 m_sBox(1, 129) = &H7602D4F7 m_sBox(2, 129) = &HBCF46B2E m_sBox(3, 129) = &HD4A20068 m_sBox(0, 130) = &HD4082471 m_sBox(1, 130) = &H3320F46A m_sBox(2, 130) = &H43B7D4B7 m_sBox(3, 130) = &H500061AF m_sBox(0, 131) = &H1E39F62E m_sBox(1, 131) = &H97244546 m_sBox(2, 131) = &H14214F74 m_sBox(3, 131) = &HBF8B8840 m_sBox(0, 132) = &H4D95FC1D m_sBox(1, 132) = &H96B591AF m_sBox(2, 132) = &H70F4DDD3 m_sBox(3, 132) = &H66A02F45 m_sBox(0, 133) = &HBFBC09EC m_sBox(1, 133) = &H3BD9785 m_sBox(2, 133) = &H7FAC6DD0
clsBlowfish - 15 m_sBox(3, 133) = &H31CB8504 m_sBox(0, 134) = &H96EB27B3 m_sBox(1, 134) = &H55FD3941 m_sBox(2, 134) = &HDA2547E6 m_sBox(3, 134) = &HABCA0A9A m_sBox(0, 135) = &H28507825 m_sBox(1, 135) = &H530429F4 m_sBox(2, 135) = &HA2C86DA m_sBox(3, 135) = &HE9B66DFB m_sBox(0, 136) = &H68DC1462 m_sBox(1, 136) = &HD7486900 m_sBox(2, 136) = &H680EC0A4 m_sBox(3, 136) = &H27A18DEE m_sBox(0, 137) = &H4F3FFEA2 m_sBox(1, 137) = &HE887AD8C m_sBox(2, 137) = &HB58CE006 m_sBox(3, 137) = &H7AF4D6B6 m_sBox(0, 138) = &HAACE1E7C m_sBox(1, 138) = &HD3375FEC m_sBox(2, 138) = &HCE78A399 m_sBox(3, 138) = &H406B2A42 m_sBox(0, 139) = &H20FE9E35 m_sBox(1, 139) = &HD9F385B9 m_sBox(2, 139) = &HEE39D7AB m_sBox(3, 139) = &H3B124E8B m_sBox(0, 140) = &H1DC9FAF7 m_sBox(1, 140) = &H4B6D1856 m_sBox(2, 140) = &H26A36631 m_sBox(3, 140) = &HEAE397B2 m_sBox(0, 141) = &H3A6EFA74 m_sBox(1, 141) = &HDD5B4332 m_sBox(2, 141) = &H6841E7F7 m_sBox(3, 141) = &HCA7820FB m_sBox(0, 142) = &HFB0AF54E m_sBox(1, 142) = &HD8FEB397 m_sBox(2, 142) = &H454056AC m_sBox(3, 142) = &HBA489527 m_sBox(0, 143) = &H55533A3A m_sBox(1, 143) = &H20838D87 m_sBox(2, 143) = &HFE6BA9B7 m_sBox(3, 143) = &HD096954B m_sBox(0, 144) = &H55A867BC m_sBox(1, 144) = &HA1159A58 m_sBox(2, 144) = &HCCA92963 m_sBox(3, 144) = &H99E1DB33 m_sBox(0, 145) = &HA62A4A56 m_sBox(1, 145) = &H3F3125F9 m_sBox(2, 145) = &H5EF47E1C m_sBox(3, 145) = &H9029317C m_sBox(0, 146) = &HFDF8E802 m_sBox(1, 146) = &H4272F70 m_sBox(2, 146) = &H80BB155C m_sBox(3, 146) = &H5282CE3 m_sBox(0, 147) = &H95C11548 m_sBox(1, 147) = &HE4C66D22 m_sBox(2, 147) = &H48C1133F m_sBox(3, 147) = &HC70F86DC m_sBox(0, 148) = &H7F9C9EE m_sBox(1, 148) = &H41041F0F m_sBox(2, 148) = &H404779A4 m_sBox(3, 148) = &H5D886E17 m_sBox(0, 149) = &H325F51EB m_sBox(1, 149) = &HD59BC0D1 m_sBox(2, 149) = &HF2BCC18F m_sBox(3, 149) = &H41113564 m_sBox(0, 150) = &H257B7834 m_sBox(1, 150) = &H602A9C60 m_sBox(2, 150) = &HDFF8E8A3 m_sBox(3, 150) = &H1F636C1B m_sBox(0, 151) = &HE12B4C2 m_sBox(1, 151) = &H2E1329E m_sBox(2, 151) = &HAF664FD1 m_sBox(3, 151) = &HCAD18115 m_sBox(0, 152) = &H6B2395E0 m_sBox(1, 152) = &H333E92E1 m_sBox(2, 152) = &H3B240B62 m_sBox(3, 152) = &HEEBEB922
clsBlowfish - 16 m_sBox(0, 153) = &H85B2A20E m_sBox(1, 153) = &HE6BA0D99 m_sBox(2, 153) = &HDE720C8C m_sBox(3, 153) = &H2DA2F728 m_sBox(0, 154) = &HD0127845 m_sBox(1, 154) = &H95B794FD m_sBox(2, 154) = &H647D0862 m_sBox(3, 154) = &HE7CCF5F0 m_sBox(0, 155) = &H5449A36F m_sBox(1, 155) = &H877D48FA m_sBox(2, 155) = &HC39DFD27 m_sBox(3, 155) = &HF33E8D1E m_sBox(0, 156) = &HA476341 m_sBox(1, 156) = &H992EFF74 m_sBox(2, 156) = &H3A6F6EAB m_sBox(3, 156) = &HF4F8FD37 m_sBox(0, 157) = &HA812DC60 m_sBox(1, 157) = &HA1EBDDF8 m_sBox(2, 157) = &H991BE14C m_sBox(3, 157) = &HDB6E6B0D m_sBox(0, 158) = &HC67B5510 m_sBox(1, 158) = &H6D672C37 m_sBox(2, 158) = &H2765D43B m_sBox(3, 158) = &HDCD0E804 m_sBox(0, 159) = &HF1290DC7 m_sBox(1, 159) = &HCC00FFA3 m_sBox(2, 159) = &HB5390F92 m_sBox(3, 159) = &H690FED0B m_sBox(0, 160) = &H667B9FFB m_sBox(1, 160) = &HCEDB7D9C m_sBox(2, 160) = &HA091CF0B m_sBox(3, 160) = &HD9155EA3 m_sBox(0, 161) = &HBB132F88 m_sBox(1, 161) = &H515BAD24 m_sBox(2, 161) = &H7B9479BF m_sBox(3, 161) = &H763BD6EB m_sBox(0, 162) = &H37392EB3 m_sBox(1, 162) = &HCC115979 m_sBox(2, 162) = &H8026E297 m_sBox(3, 162) = &HF42E312D m_sBox(0, 163) = &H6842ADA7 m_sBox(1, 163) = &HC66A2B3B m_sBox(2, 163) = &H12754CCC m_sBox(3, 163) = &H782EF11C m_sBox(0, 164) = &H6A124237 m_sBox(1, 164) = &HB79251E7 m_sBox(2, 164) = &H6A1BBE6 m_sBox(3, 164) = &H4BFB6350 m_sBox(0, 165) = &H1A6B1018 m_sBox(1, 165) = &H11CAEDFA m_sBox(2, 165) = &H3D25BDD8 m_sBox(3, 165) = &HE2E1C3C9 m_sBox(0, 166) = &H44421659 m_sBox(1, 166) = &HA121386 m_sBox(2, 166) = &HD90CEC6E m_sBox(3, 166) = &HD5ABEA2A m_sBox(0, 167) = &H64AF674E m_sBox(1, 167) = &HDA86A85F m_sBox(2, 167) = &HBEBFE988 m_sBox(3, 167) = &H64E4C3FE m_sBox(0, 168) = &H9DBC8057 m_sBox(1, 168) = &HF0F7C086 m_sBox(2, 168) = &H60787BF8 m_sBox(3, 168) = &H6003604D m_sBox(0, 169) = &HD1FD8346 m_sBox(1, 169) = &HF6381FB0 m_sBox(2, 169) = &H7745AE04 m_sBox(3, 169) = &HD736FCCC m_sBox(0, 170) = &H83426B33 m_sBox(1, 170) = &HF01EAB71 m_sBox(2, 170) = &HB0804187 m_sBox(3, 170) = &H3C005E5F m_sBox(0, 171) = &H77A057BE m_sBox(1, 171) = &HBDE8AE24 m_sBox(2, 171) = &H55464299 m_sBox(3, 171) = &HBF582E61 m_sBox(0, 172) = &H4E58F48F
clsBlowfish - 17 m_sBox(1, 172) = &HF2DDFDA2 m_sBox(2, 172) = &HF474EF38 m_sBox(3, 172) = &H8789BDC2 m_sBox(0, 173) = &H5366F9C3 m_sBox(1, 173) = &HC8B38E74 m_sBox(2, 173) = &HB475F255 m_sBox(3, 173) = &H46FCD9B9 m_sBox(0, 174) = &H7AEB2661 m_sBox(1, 174) = &H8B1DDF84 m_sBox(2, 174) = &H846A0E79 m_sBox(3, 174) = &H915F95E2 m_sBox(0, 175) = &H466E598E m_sBox(1, 175) = &H20B45770 m_sBox(2, 175) = &H8CD55591 m_sBox(3, 175) = &HC902DE4C m_sBox(0, 176) = &HB90BACE1 m_sBox(1, 176) = &HBB8205D0 m_sBox(2, 176) = &H11A86248 m_sBox(3, 176) = &H7574A99E m_sBox(0, 177) = &HB77F19B6 m_sBox(1, 177) = &HE0A9DC09 m_sBox(2, 177) = &H662D09A1 m_sBox(3, 177) = &HC4324633 m_sBox(0, 178) = &HE85A1F02 m_sBox(1, 178) = &H9F0BE8C m_sBox(2, 178) = &H4A99A025 m_sBox(3, 178) = &H1D6EFE10 m_sBox(0, 179) = &H1AB93D1D m_sBox(1, 179) = &HBA5A4DF m_sBox(2, 179) = &HA186F20F m_sBox(3, 179) = &H2868F169 m_sBox(0, 180) = &HDCB7DA83 m_sBox(1, 180) = &H573906FE m_sBox(2, 180) = &HA1E2CE9B m_sBox(3, 180) = &H4FCD7F52 m_sBox(0, 181) = &H50115E01 m_sBox(1, 181) = &HA70683FA m_sBox(2, 181) = &HA002B5C4 m_sBox(3, 181) = &HDE6D027 m_sBox(0, 182) = &H9AF88C27 m_sBox(1, 182) = &H773F8641 m_sBox(2, 182) = &HC3604C06 m_sBox(3, 182) = &H61A806B5 m_sBox(0, 183) = &HF0177A28 m_sBox(1, 183) = &HC0F586E0 m_sBox(2, 183) = &H6058AA m_sBox(3, 183) = &H30DC7D62 m_sBox(0, 184) = &H11E69ED7 m_sBox(1, 184) = &H2338EA63 m_sBox(2, 184) = &H53C2DD94 m_sBox(3, 184) = &HC2C21634 m_sBox(0, 185) = &HBBCBEE56 m_sBox(1, 185) = &H90BCB6DE m_sBox(2, 185) = &HEBFC7DA1 m_sBox(3, 185) = &HCE591D76 m_sBox(0, 186) = &H6F05E409 m_sBox(1, 186) = &H4B7C0188 m_sBox(2, 186) = &H39720A3D m_sBox(3, 186) = &H7C927C24 m_sBox(0, 187) = &H86E3725F m_sBox(1, 187) = &H724D9DB9 m_sBox(2, 187) = &H1AC15BB4 m_sBox(3, 187) = &HD39EB8FC m_sBox(0, 188) = &HED545578 m_sBox(1, 188) = &H8FCA5B5 m_sBox(2, 188) = &HD83D7CD3 m_sBox(3, 188) = &H4DAD0FC4 m_sBox(0, 189) = &H1E50EF5E m_sBox(1, 189) = &HB161E6F8 m_sBox(2, 189) = &HA28514D9 m_sBox(3, 189) = &H6C51133C m_sBox(0, 190) = &H6FD5C7E7 m_sBox(1, 190) = &H56E14EC4 m_sBox(2, 190) = &H362ABFCE m_sBox(3, 190) = &HDDC6C837 m_sBox(0, 191) = &HD79A3234 m_sBox(1, 191) = &H92638212
clsBlowfish - 18 m_sBox(2, 191) = &H670EFA8E m_sBox(3, 191) = &H406000E0 m_sBox(0, 192) = &H3A39CE37 m_sBox(1, 192) = &HD3FAF5CF m_sBox(2, 192) = &HABC27737 m_sBox(3, 192) = &H5AC52D1B m_sBox(0, 193) = &H5CB0679E m_sBox(1, 193) = &H4FA33742 m_sBox(2, 193) = &HD3822740 m_sBox(3, 193) = &H99BC9BBE m_sBox(0, 194) = &HD5118E9D m_sBox(1, 194) = &HBF0F7315 m_sBox(2, 194) = &HD62D1C7E m_sBox(3, 194) = &HC700C47B m_sBox(0, 195) = &HB78C1B6B m_sBox(1, 195) = &H21A19045 m_sBox(2, 195) = &HB26EB1BE m_sBox(3, 195) = &H6A366EB4 m_sBox(0, 196) = &H5748AB2F m_sBox(1, 196) = &HBC946E79 m_sBox(2, 196) = &HC6A376D2 m_sBox(3, 196) = &H6549C2C8 m_sBox(0, 197) = &H530FF8EE m_sBox(1, 197) = &H468DDE7D m_sBox(2, 197) = &HD5730A1D m_sBox(3, 197) = &H4CD04DC6 m_sBox(0, 198) = &H2939BBDB m_sBox(1, 198) = &HA9BA4650 m_sBox(2, 198) = &HAC9526E8 m_sBox(3, 198) = &HBE5EE304 m_sBox(0, 199) = &HA1FAD5F0 m_sBox(1, 199) = &H6A2D519A m_sBox(2, 199) = &H63EF8CE2 m_sBox(3, 199) = &H9A86EE22 m_sBox(0, 200) = &HC089C2B8 m_sBox(1, 200) = &H43242EF6 m_sBox(2, 200) = &HA51E03AA m_sBox(3, 200) = &H9CF2D0A4 m_sBox(0, 201) = &H83C061BA m_sBox(1, 201) = &H9BE96A4D m_sBox(2, 201) = &H8FE51550 m_sBox(3, 201) = &HBA645BD6 m_sBox(0, 202) = &H2826A2F9 m_sBox(1, 202) = &HA73A3AE1 m_sBox(2, 202) = &H4BA99586 m_sBox(3, 202) = &HEF5562E9 m_sBox(0, 203) = &HC72FEFD3 m_sBox(1, 203) = &HF752F7DA m_sBox(2, 203) = &H3F046F69 m_sBox(3, 203) = &H77FA0A59 m_sBox(0, 204) = &H80E4A915 m_sBox(1, 204) = &H87B08601 m_sBox(2, 204) = &H9B09E6AD m_sBox(3, 204) = &H3B3EE593 m_sBox(0, 205) = &HE990FD5A m_sBox(1, 205) = &H9E34D797 m_sBox(2, 205) = &H2CF0B7D9 m_sBox(3, 205) = &H22B8B51 m_sBox(0, 206) = &H96D5AC3A m_sBox(1, 206) = &H17DA67D m_sBox(2, 206) = &HD1CF3ED6 m_sBox(3, 206) = &H7C7D2D28 m_sBox(0, 207) = &H1F9F25CF m_sBox(1, 207) = &HADF2B89B m_sBox(2, 207) = &H5AD6B472 m_sBox(3, 207) = &H5A88F54C m_sBox(0, 208) = &HE029AC71 m_sBox(1, 208) = &HE019A5E6 m_sBox(2, 208) = &H47B0ACFD m_sBox(3, 208) = &HED93FA9B m_sBox(0, 209) = &HE8D3C48D m_sBox(1, 209) = &H283B57CC m_sBox(2, 209) = &HF8D56629 m_sBox(3, 209) = &H79132E28 m_sBox(0, 210) = &H785F0191 m_sBox(1, 210) = &HED756055 m_sBox(2, 210) = &HF7960E44
clsBlowfish - 19 m_sBox(3, 210) = &HE3D35E8C m_sBox(0, 211) = &H15056DD4 m_sBox(1, 211) = &H88F46DBA m_sBox(2, 211) = &H3A16125 m_sBox(3, 211) = &H564F0BD m_sBox(0, 212) = &HC3EB9E15 m_sBox(1, 212) = &H3C9057A2 m_sBox(2, 212) = &H97271AEC m_sBox(3, 212) = &HA93A072A m_sBox(0, 213) = &H1B3F6D9B m_sBox(1, 213) = &H1E6321F5 m_sBox(2, 213) = &HF59C66FB m_sBox(3, 213) = &H26DCF319 m_sBox(0, 214) = &H7533D928 m_sBox(1, 214) = &HB155FDF5 m_sBox(2, 214) = &H3563482 m_sBox(3, 214) = &H8ABA3CBB m_sBox(0, 215) = &H28517711 m_sBox(1, 215) = &HC20AD9F8 m_sBox(2, 215) = &HABCC5167 m_sBox(3, 215) = &HCCAD925F m_sBox(0, 216) = &H4DE81751 m_sBox(1, 216) = &H3830DC8E m_sBox(2, 216) = &H379D5862 m_sBox(3, 216) = &H9320F991 m_sBox(0, 217) = &HEA7A90C2 m_sBox(1, 217) = &HFB3E7BCE m_sBox(2, 217) = &H5121CE64 m_sBox(3, 217) = &H774FBE32 m_sBox(0, 218) = &HA8B6E37E m_sBox(1, 218) = &HC3293D46 m_sBox(2, 218) = &H48DE5369 m_sBox(3, 218) = &H6413E680 m_sBox(0, 219) = &HA2AE0810 m_sBox(1, 219) = &HDD6DB224 m_sBox(2, 219) = &H69852DFD m_sBox(3, 219) = &H9072166 m_sBox(0, 220) = &HB39A460A m_sBox(1, 220) = &H6445C0DD m_sBox(2, 220) = &H586CDECF m_sBox(3, 220) = &H1C20C8AE m_sBox(0, 221) = &H5BBEF7DD m_sBox(1, 221) = &H1B588D40 m_sBox(2, 221) = &HCCD2017F m_sBox(3, 221) = &H6BB4E3BB m_sBox(0, 222) = &HDDA26A7E m_sBox(1, 222) = &H3A59FF45 m_sBox(2, 222) = &H3E350A44 m_sBox(3, 222) = &HBCB4CDD5 m_sBox(0, 223) = &H72EACEA8 m_sBox(1, 223) = &HFA6484BB m_sBox(2, 223) = &H8D6612AE m_sBox(3, 223) = &HBF3C6F47 m_sBox(0, 224) = &HD29BE463 m_sBox(1, 224) = &H542F5D9E m_sBox(2, 224) = &HAEC2771B m_sBox(3, 224) = &HF64E6370 m_sBox(0, 225) = &H740E0D8D m_sBox(1, 225) = &HE75B1357 m_sBox(2, 225) = &HF8721671 m_sBox(3, 225) = &HAF537D5D m_sBox(0, 226) = &H4040CB08 m_sBox(1, 226) = &H4EB4E2CC m_sBox(2, 226) = &H34D2466A m_sBox(3, 226) = &H115AF84 m_sBox(0, 227) = &HE1B00428 m_sBox(1, 227) = &H95983A1D m_sBox(2, 227) = &H6B89FB4 m_sBox(3, 227) = &HCE6EA048 m_sBox(0, 228) = &H6F3F3B82 m_sBox(1, 228) = &H3520AB82 m_sBox(2, 228) = &H11A1D4B m_sBox(3, 228) = &H277227F8 m_sBox(0, 229) = &H611560B1 m_sBox(1, 229) = &HE7933FDC m_sBox(2, 229) = &HBB3A792B m_sBox(3, 229) = &H344525BD
clsBlowfish - 20 m_sBox(0, 230) = &HA08839E1 m_sBox(1, 230) = &H51CE794B m_sBox(2, 230) = &H2F32C9B7 m_sBox(3, 230) = &HA01FBAC9 m_sBox(0, 231) = &HE01CC87E m_sBox(1, 231) = &HBCC7D1F6 m_sBox(2, 231) = &HCF0111C3 m_sBox(3, 231) = &HA1E8AAC7 m_sBox(0, 232) = &H1A908749 m_sBox(1, 232) = &HD44FBD9A m_sBox(2, 232) = &HD0DADECB m_sBox(3, 232) = &HD50ADA38 m_sBox(0, 233) = &H339C32A m_sBox(1, 233) = &HC6913667 m_sBox(2, 233) = &H8DF9317C m_sBox(3, 233) = &HE0B12B4F m_sBox(0, 234) = &HF79E59B7 m_sBox(1, 234) = &H43F5BB3A m_sBox(2, 234) = &HF2D519FF m_sBox(3, 234) = &H27D9459C m_sBox(0, 235) = &HBF97222C m_sBox(1, 235) = &H15E6FC2A m_sBox(2, 235) = &HF91FC71 m_sBox(3, 235) = &H9B941525 m_sBox(0, 236) = &HFAE59361 m_sBox(1, 236) = &HCEB69CEB m_sBox(2, 236) = &HC2A86459 m_sBox(3, 236) = &H12BAA8D1 m_sBox(0, 237) = &HB6C1075E m_sBox(1, 237) = &HE3056A0C m_sBox(2, 237) = &H10D25065 m_sBox(3, 237) = &HCB03A442 m_sBox(0, 238) = &HE0EC6E0E m_sBox(1, 238) = &H1698DB3B m_sBox(2, 238) = &H4C98A0BE m_sBox(3, 238) = &H3278E964 m_sBox(0, 239) = &H9F1F9532 m_sBox(1, 239) = &HE0D392DF m_sBox(2, 239) = &HD3A0342B m_sBox(3, 239) = &H8971F21E m_sBox(0, 240) = &H1B0A7441 m_sBox(1, 240) = &H4BA3348C m_sBox(2, 240) = &HC5BE7120 m_sBox(3, 240) = &HC37632D8 m_sBox(0, 241) = &HDF359F8D m_sBox(1, 241) = &H9B992F2E m_sBox(2, 241) = &HE60B6F47 m_sBox(3, 241) = &HFE3F11D m_sBox(0, 242) = &HE54CDA54 m_sBox(1, 242) = &H1EDAD891 m_sBox(2, 242) = &HCE6279CF m_sBox(3, 242) = &HCD3E7E6F m_sBox(0, 243) = &H1618B166 m_sBox(1, 243) = &HFD2C1D05 m_sBox(2, 243) = &H848FD2C5 m_sBox(3, 243) = &HF6FB2299 m_sBox(0, 244) = &HF523F357 m_sBox(1, 244) = &HA6327623 m_sBox(2, 244) = &H93A83531 m_sBox(3, 244) = &H56CCCD02 m_sBox(0, 245) = &HACF08162 m_sBox(1, 245) = &H5A75EBB5 m_sBox(2, 245) = &H6E163697 m_sBox(3, 245) = &H88D273CC m_sBox(0, 246) = &HDE966292 m_sBox(1, 246) = &H81B949D0 m_sBox(2, 246) = &H4C50901B m_sBox(3, 246) = &H71C65614 m_sBox(0, 247) = &HE6C6C7BD m_sBox(1, 247) = &H327A140A m_sBox(2, 247) = &H45E1D006 m_sBox(3, 247) = &HC3F27B9A m_sBox(0, 248) = &HC9AA53FD m_sBox(1, 248) = &H62A80F00 m_sBox(2, 248) = &HBB25BFE2 m_sBox(3, 248) = &H35BDD2F6 m_sBox(0, 249) = &H71126905
clsBlowfish - 21 m_sBox(1, 249) = &HB2040222 m_sBox(2, 249) = &HB6CBCF7C m_sBox(3, 249) = &HCD769C2B m_sBox(0, 250) = &H53113EC0 m_sBox(1, 250) = &H1640E3D3 m_sBox(2, 250) = &H38ABBD60 m_sBox(3, 250) = &H2547ADF0 m_sBox(0, 251) = &HBA38209C m_sBox(1, 251) = &HF746CE76 m_sBox(2, 251) = &H77AFA1C5 m_sBox(3, 251) = &H20756060 m_sBox(0, 252) = &H85CBFE4E m_sBox(1, 252) = &H8AE88DD8 m_sBox(2, 252) = &H7AAAF9B0 m_sBox(3, 252) = &H4CF9AA7E m_sBox(0, 253) = &H1948C25C m_sBox(1, 253) = &H2FB8A8C m_sBox(2, 253) = &H1C36AE4 m_sBox(3, 253) = &HD6EBE1F9 m_sBox(0, 254) = &H90D4F869 m_sBox(1, 254) = &HA65CDEA0 m_sBox(2, 254) = &H3F09252D m_sBox(3, 254) = &HC208E69F m_sBox(0, 255) = &HB74E6132 m_sBox(1, 255) = &HCE77E25B m_sBox(2, 255) = &H578FDFE3 m_sBox(3, 255) = &H3AC372E6End Sub
Public Function EncryptFile(InFile As String, OutFile As String, Overwrite As Boolean, Optional Key As String, Optional OutputIn64 As Boolean) As Boolean Class_Initialize If FileExist(InFile) = False Then EncryptFile = False Exit Function End If If FileExist(OutFile) = True And Overwrite = False Then EncryptFile = False Exit Function End If Dim Buffer() As Byte, FileO As Integer FileO = FreeFile Open InFile For Binary As #FileO ReDim Buffer(0 To LOF(FileO) - 1) Get #FileO, , Buffer() Close #FileO Call EncryptByte(Buffer(), Key) If FileExist(OutFile) = True Then Kill OutFile FileO = FreeFile Open OutFile For Binary As #FileO If OutputIn64 = True Then Put #FileO, , EncodeArray64(Buffer()) Else Put #FileO, , Buffer() End If Close #FileO EncryptFile = True Erase Buffer(): Key = "": InFile = "": OutFile = "" Exit Function
ErrorHandler: Erase Buffer(): Key = "": InFile = "": OutFile = "" EncryptFile = FalseEnd FunctionPublic Function DecryptFile(InFile As String, OutFile As String, Overwrite As Boolean, Optional Key As String, Optional IsFileIn64 As Boolean) As Boolean On Error GoTo ErrorHandler If FileExist(InFile) = False Then DecryptFile = False Exit Function End If If FileExist(OutFile) = True And Overwrite = False Then DecryptFile = False Exit Function End If
clsBlowfish - 22 Dim Buffer() As Byte, FileO As Integer FileO = FreeFile Open InFile For Binary As #FileO ReDim Buffer(0 To LOF(FileO) - 1) Get #FileO, , Buffer() Close #FileO If IsFileIn64 = True Then Buffer() = DecodeArray64(StrConv(Buffer(), vbUnicode)) Call DecryptByte(Buffer(), Key) If FileExist(OutFile) = True Then Kill OutFile Open OutFile For Binary As #FileO Put #FileO, , Buffer() Close #FileO DecryptFile = True Erase Buffer(): Key = "": InFile = "": OutFile = "" Exit Function
ErrorHandler: Erase Buffer(): Key = "": InFile = "": OutFile = "" DecryptFile = FalseEnd FunctionPrivate Function FileExist(FilePath As String) As Boolean On Error GoTo ErrorHandler Call FileLen(FilePath) FileExist = True Exit Function
ErrorHandler: FileExist = FalseEnd Function
clsPaging - 1 ''*****************************************************************'' File Name: clsPaging.cls'' Purpose: Class used for paging recordset'' Required Files: NONE'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created: Dec-20-04 10:55 AM'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
Private m_PAGE_CURRENT As Long 'Store current pagePrivate m_PAGE_PREV As Long 'Store the previous pagePrivate m_PAGE_NEXT As Long 'Store the next pagePrivate m_PAGE_TOTAL As Long 'Store the total page count
Private m_Recordset As Recordset 'Reference recordset where we will perform the paging
Private m_PageBy As Long 'Store the how many record display per pagePrivate m_PageStart As Long 'Store the starting record positionPrivate m_PageEnd As Long 'Store the ending record position
Private PageInformation As String 'Store the page information
'Return the current positionPublic Property Get CurrentPosition() As Long MsgBox m_PAGE_CURRENT CurrentPosition = m_PAGE_CURRENTEnd Property'Set the current positionPublic Property Let CurrentPosition(ByVal whichPage As Long) m_PAGE_CURRENT = whichPage PageRecordsetEnd Property
'Procedure used to refresh pagesPublic Sub Refresh() PageRecordsetEnd Sub
'Start the class and get all the input neededPublic Sub Start(ByRef srcRecordset, ByVal srcPageBy As Long)Set m_Recordset = srcRecordset m_Recordset.CacheSize = srcPageBy m_PageBy = srcPageByEnd Sub
Private Sub Class_Terminate() 'Clear all variables m_PAGE_CURRENT = 0 m_PAGE_NEXT = 0 m_PAGE_PREV = 0 m_PAGE_TOTAL = 0 m_PageBy = 0 m_PageStart = 0 m_PageEnd = 0 PageInformation = vbNullString Set m_Recordset = NothingEnd Sub
'Procedure for paging the recordsetPrivate Sub PageRecordset() If m_Recordset.RecordCount < 1 Then m_PAGE_NEXT = 0 m_PAGE_PREV = 0 m_PAGE_TOTAL = 1 m_PageStart = 0 m_PageEnd = 0
clsPaging - 2 PageInformation = "0 - 0 of 0" Exit Sub End If 'Initialize the paging variables m_PAGE_TOTAL = Fix(m_Recordset.RecordCount / m_PageBy) If InStr(1, (m_Recordset.RecordCount / m_PageBy), ".") > 0 Then m_PAGE_TOTAL = m_PAGE_TOTAL + 1 End If If m_PAGE_TOTAL = 0 Then m_PAGE_TOTAL = m_PAGE_TOTAL + 1 'Page the records m_PAGE_NEXT = m_PAGE_CURRENT + 1 m_PAGE_PREV = m_PAGE_CURRENT - 1 If m_PAGE_TOTAL = 1 Then m_PageStart = 1 m_PageEnd = m_Recordset.RecordCount ElseIf m_PAGE_CURRENT = 1 And m_PAGE_TOTAL > 1 Then m_PageStart = 1 m_PageEnd = m_PageBy ElseIf m_PAGE_CURRENT = m_PAGE_TOTAL And m_PAGE_CURRENT > 1 Then m_PageStart = ((m_PAGE_CURRENT - 1) * m_PageBy) + 1 m_PageEnd = m_Recordset.RecordCount Else m_PageStart = ((m_PAGE_CURRENT - 1) * m_PageBy) + 1 m_PageEnd = (m_PAGE_NEXT - 1) * m_PageBy End If 'Set the page information PageInformation = m_PageStart & " - " & m_PageEnd & " of " & m_Recordset.RecordCountEnd Sub
'Return the current pagePublic Function PAGE_CURRENT() As Long PAGE_CURRENT = m_PAGE_CURRENTEnd Function'Return the previous pagePublic Function PAGE_PREVIOUS() As Long PAGE_PREVIOUS = m_PAGE_PREVEnd Function'Return the next pagePublic Function PAGE_NEXT() As Long PAGE_NEXT = m_PAGE_NEXTEnd Function'Return the page totalPublic Function PAGE_TOTAL() As Long PAGE_TOTAL = m_PAGE_TOTALEnd Function
'Return the starting record positionPublic Function PageStart() As Long PageStart = m_PageStartEnd Function'Return the ending record positionPublic Function PageEnd() As Long PageEnd = m_PageEndEnd Function'Return the page informationPublic Function PageInfo() As String PageInfo = PageInformationEnd Function
clsSQLSelectParser - 1 ''*****************************************************************'' File Name: clsSQLSelectParser.cls'' Purpose: Class used to parse SELECT SQL statement'' Required Files: NONE'''' Programmer: Philip V. Naparan E-mail: [email protected]'' Date Created: Dec-20-04 1:55 AM'' Last Modified:'' Modified By:'' Credits: NONE, ALL CODES ARE CODED BY Philip V. Naparan''*****************************************************************
Option Explicit
'Variables for SQL statementPrivate m_Fields As StringPrivate m_Tables As StringPrivate m_wCondition As StringPrivate m_GroupOrder As StringPrivate m_hCondition As StringPrivate m_SortOrder As String
'Variables for storing saved statementPrivate def_Fields As StringPrivate def_Tables As StringPrivate def_wCondition As StringPrivate def_GroupOrder As StringPrivate def_hCondition As StringPrivate def_SortOrder As String
'Return the fieldsPublic Property Get Fields() As String Fields = m_FieldsEnd Property
'Set the fieldsPublic Property Let Fields(ByVal srcFields As String) m_Fields = srcFieldsEnd Property
'Return the tablesPublic Property Get Tables() As String Tables = m_TablesEnd Property
'Set the tablesPublic Property Let Tables(ByVal srcTables As String) m_Tables = srcTablesEnd Property
'Return the where conditionPublic Property Get wCondition() As String wCondition = m_wConditionEnd Property
'Set the where conditionPublic Property Let wCondition(ByVal srcwCondition As String) m_wCondition = srcwConditionEnd Property
'Return the group orderPublic Property Get GroupOrder() As String GroupOrder = m_GroupOrderEnd Property
'Set the group orderPublic Property Let GroupOrder(ByVal srcGroupOrder As String) m_GroupOrder = srcGroupOrderEnd Property
'Return the having conditionPublic Property Get hCondition() As String hCondition = m_hConditionEnd Property
'Set the having conditionPublic Property Let hCondition(ByVal srchCondition As String)
clsSQLSelectParser - 2 m_hCondition = srchConditionEnd Property
'Return the sort orderPublic Property Get SortOrder() As String SortOrder = m_SortOrderEnd Property
'Set the sort orderPublic Property Let SortOrder(ByVal srcSortOrder As String) m_SortOrder = srcSortOrderEnd Property
'Return the SQL statementPublic Property Get SQLStatement() As String 'Required statement SQLStatement = "SELECT " & m_Fields & " FROM " & m_Tables 'Optional statement If m_wCondition <> "" Then SQLStatement = SQLStatement & " WHERE " & m_wCondition If m_GroupOrder <> "" Then SQLStatement = SQLStatement & " GROUP BY " & m_GroupOrder If m_hCondition <> "" Then SQLStatement = SQLStatement & " HAVING " & m_hCondition If m_SortOrder <> "" Then SQLStatement = SQLStatement & " ORDER BY " & m_SortOrder Debug.Print SQLStatementEnd Property
'Save the statementPublic Sub SaveStatement() def_Fields = m_Fields def_Tables = m_Tables def_wCondition = m_wCondition def_GroupOrder = m_GroupOrder def_hCondition = m_hCondition def_SortOrder = m_SortOrderEnd Sub
'Restore the statementPublic Sub RestoreStatement() m_Fields = def_Fields m_Tables = def_Tables m_wCondition = def_wCondition m_GroupOrder = def_GroupOrder m_hCondition = def_hCondition m_SortOrder = def_SortOrderEnd Sub
Private Sub Class_Terminate() 'Clear used variables m_Fields = vbNullString m_Tables = vbNullString m_wCondition = vbNullString m_GroupOrder = vbNullString m_hCondition = vbNullString m_SortOrder = vbNullString def_Fields = vbNullString def_Tables = vbNullString def_wCondition = vbNullString def_GroupOrder = vbNullString def_hCondition = vbNullString def_SortOrder = vbNullStringEnd Sub