📄 frmsalesreceiptsbatch.frm
字号:
Private Sub Form_Activate()
HighlightInWin Me.Name: MAIN.ShowTBButton "tttttft"
Active
End Sub
Private Sub Form_Deactivate()
MAIN.HideTBButton "", True
Deactive
End Sub
Private Sub Active()
With MAIN
.tbMenu.Buttons(4).Caption = "View"
.tbMenu.Buttons(6).Caption = "Void"
.tbMenu.Buttons(4).Image = 13
.tbMenu.Buttons(6).Image = 14
.mnuRAES.Caption = "View Selected"
.mnuRADS.Caption = "Void Selected"
End With
End Sub
Private Sub Deactive()
With MAIN
.tbMenu.Buttons(4).Caption = "Edit"
.tbMenu.Buttons(6).Caption = "Delete"
.tbMenu.Buttons(4).Image = 2
.tbMenu.Buttons(6).Image = 4
.mnuRAES.Caption = "Edit Selected"
.mnuRADS.Caption = "Delete Selected"
End With
End Sub
Private Sub Form_Load()
MAIN.AddToWin Me.Caption, Name
'Set the graphics for the controls
With MAIN
'For listview
Set lvList.SmallIcons = .i16x16
Set lvList.Icons = .i16x16
Set lvList2.SmallIcons = .i16x16
Set lvList2.Icons = .i16x16
btnFirst1.Picture = .i16x16.ListImages(3).Picture
btnPrev1.Picture = .i16x16.ListImages(4).Picture
btnNext1.Picture = .i16x16.ListImages(5).Picture
btnLast1.Picture = .i16x16.ListImages(6).Picture
btnFirst2.Picture = .i16x16.ListImages(3).Picture
btnPrev2.Picture = .i16x16.ListImages(4).Picture
btnNext2.Picture = .i16x16.ListImages(5).Picture
btnLast2.Picture = .i16x16.ListImages(6).Picture
btnFirst1.DisabledPicture = .i16x16g.ListImages(3).Picture
btnPrev1.DisabledPicture = .i16x16g.ListImages(4).Picture
btnNext1.DisabledPicture = .i16x16g.ListImages(5).Picture
btnLast1.DisabledPicture = .i16x16g.ListImages(6).Picture
btnFirst2.DisabledPicture = .i16x16g.ListImages(3).Picture
btnPrev2.DisabledPicture = .i16x16g.ListImages(4).Picture
btnNext2.DisabledPicture = .i16x16g.ListImages(5).Picture
btnLast2.DisabledPicture = .i16x16g.ListImages(6).Picture
End With
With SQLParser
.Fields = "Company, City, RefNo, AgentName, DateIssued, Status_Alias, Deducted, Printed_Alias, ReceiptID"
.Tables = "qry_Receipts"
.SortOrder = "DateIssued DESC"
.SaveStatement
End With
RSReceipts.CursorLocation = adUseClient
RSReceipts.Open SQLParser.SQLStatement, CN, adOpenStatic, adLockReadOnly
' With RecordPage
' .Start RSReceipts, 75
' FillList2 1
' End With
With SQLParserBatch
.Fields = "Desc, TruckNo, Booking, Collection, DeliveryDate, Status_Alias, ReceiptBatchID"
.Tables = "qry_Receipts_Batch"
.SortOrder = "DeliveryDate DESC"
.SaveStatement
End With
RSReceiptsBatch.CursorLocation = adUseClient
RSReceiptsBatch.Open SQLParserBatch.SQLStatement, CN, adOpenStatic, adLockReadOnly
With RecordPageBatch
.Start RSReceiptsBatch, 75
FillList1 1
End With
End Sub
Private Sub FillList1(ByVal whichPage As Long)
RecordPageBatch.CurrentPosition = whichPage
Screen.MousePointer = vbHourglass
Me.Enabled = False
Call pageFillListView(lvList, RSReceiptsBatch, RecordPageBatch.PageStart, RecordPageBatch.PageEnd, 16, 2, False, True, , , , "ReceiptBatchID")
Me.Enabled = True
Screen.MousePointer = vbDefault
SetNavigation1
'Display the page information
lblPageInfo1.Caption = "Record " & RecordPageBatch.PageInfo
'Display the selected record
lvList_Click
End Sub
Private Sub FillList2(ByVal whichPage As Long)
RecordPage.CurrentPosition = whichPage
Screen.MousePointer = vbHourglass
Me.Enabled = False
Call pageFillListView(lvList2, RSReceipts, RecordPage.PageStart, RecordPage.PageEnd, 16, 2, False, True, , , , "ReceiptID")
Me.Enabled = True
Screen.MousePointer = vbDefault
SetNavigation2
'Display the page information
lblPageInfo2.Caption = "Record " & RecordPage.PageInfo
'Display the selected record
lvList2_Click
End 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.Height / 2 - 1500
Picture1.Top = lvList.Height - lvList.Top + 1000
lvList2.Top = lvList.Height - lvList.Top + 1500
lvList2.Width = Me.ScaleWidth
lvList2.Height = Me.Height / 2 - 600
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
MAIN.RemToWin Me.Caption
MAIN.HideTBButton "", True
Set frmSalesReceiptsBatch = Nothing
End Sub
Private Sub SetNavigation1()
With RecordPageBatch
If .PAGE_TOTAL = 1 Then
btnFirst1.Enabled = False
btnPrev1.Enabled = False
btnNext1.Enabled = False
btnLast1.Enabled = False
ElseIf .PAGE_CURRENT = 1 Then
btnFirst1.Enabled = False
btnPrev1.Enabled = False
btnNext1.Enabled = True
btnLast1.Enabled = True
ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then
btnFirst1.Enabled = True
btnPrev1.Enabled = True
btnNext1.Enabled = False
btnLast1.Enabled = False
Else
btnFirst1.Enabled = True
btnPrev1.Enabled = True
btnNext1.Enabled = True
btnLast1.Enabled = True
End If
End With
End Sub
Private Sub SetNavigation2()
With RecordPage
If .PAGE_TOTAL = 1 Then
btnFirst2.Enabled = False
btnPrev2.Enabled = False
btnNext2.Enabled = False
btnLast2.Enabled = False
ElseIf .PAGE_CURRENT = 1 Then
btnFirst2.Enabled = False
btnPrev2.Enabled = False
btnNext2.Enabled = True
btnLast2.Enabled = True
ElseIf .PAGE_CURRENT = .PAGE_TOTAL And .PAGE_CURRENT > 1 Then
btnFirst2.Enabled = True
btnPrev2.Enabled = True
btnNext2.Enabled = False
btnLast2.Enabled = False
Else
btnFirst2.Enabled = True
btnPrev2.Enabled = True
btnNext2.Enabled = True
btnLast2.Enabled = True
End If
End With
End Sub
Private Sub lvList_Click()
On Error GoTo err
lblCurrentRecord1.Caption = "Selected Record: " & RightSplitUF(lvList.SelectedItem.Tag)
SQLParser.RestoreStatement
'SQLParser.wCondition = "DateofDelivery = #" & Format(lvList.ListItems(lvList.SelectedItem.Index), "Short Date") & "# AND Route = " & lvList.ListItems(1).SubItems(1) & ""
SQLParser.wCondition = "ReceiptBatchID = " & LeftSplitUF(lvList.SelectedItem.Tag)
With RecordPage
.Start RSReceipts, 75
FillList2 1
End With
frmSalesReceiptsAE.strRouteDesc = lvList.SelectedItem.Text
ReloadRecords2 SQLParser.SQLStatement
Exit Sub
err:
lblCurrentRecord1.Caption = "Selected Record: NONE"
End Sub
Private Sub lvList_DblClick()
CommandPass "Edit"
End Sub
Private Sub lvList_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then PopupMenu MAIN.mnuRecA
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 - 1
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_Click
End Sub
Private Sub lvList2_Click()
On Error GoTo err
lblCurrentRecord2.Caption = "Selected Record: " & RightSplitUF(lvList2.SelectedItem.Tag)
Exit Sub
err:
lblCurrentRecord2.Caption = "Selected Record: NONE"
End Sub
Private Sub lvList2_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
'Sort the listview
If ColumnHeader.Index - 1 <> CURR_COL Then
lvList2.SortOrder = 0
Else
lvList2.SortOrder = Abs(lvList2.SortOrder - 1)
End If
lvList2.SortKey = ColumnHeader.Index - 1
lvList2.Sorted = True
CURR_COL = ColumnHeader.Index - 1
End Sub
Private Sub lvList2_DblClick()
If lvList2.ListItems.Count > 0 Then
If isRecordExist("Receipts", "ReceiptID", CLng(LeftSplitUF(lvList2.SelectedItem.Tag))) = False Then
MsgBox "This record has been removed by other user. Click 'OK' button to refresh the records.", vbExclamation
RefreshRecords2
Exit Sub
Else
With frmSalesReceiptsAE
Dim blnStatus As Boolean
blnStatus = getValueAt("SELECT ReceiptID,Status FROM Receipts WHERE ReceiptID=" & CLng(LeftSplitUF(lvList2.SelectedItem.Tag)), "Status")
If blnStatus Then 'true
.State = adStateViewMode
Else
.State = adStateEditMode
End If
.PK = CLng(LeftSplitUF(lvList2.SelectedItem.Tag))
.ReceiptBatchPK = LeftSplitUF(lvList.SelectedItem.Tag)
.show vbModal
RefreshRecords1
' .State = adStateEditMode
' .PK = CLng(LeftSplitUF(lvList2.SelectedItem.Tag))
' .show vbModal
' RefreshRecords1
End With
End If
End If
End Sub
Private Sub Picture3_Resize()
Picture2.Left = Picture3.ScaleWidth - Picture4.ScaleWidth
Picture4.Left = Picture3.ScaleWidth - Picture4.ScaleWidth
Picture1.Width = Picture3.Width
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -