VbzCart/docs/archive/code/VBA/Form sfrmPackageItems
Jump to navigation
Jump to search
File:Vbzcart-MSAccess-sfrmPackages.png
Option Explicit
Public Property Get PkgItem() As clsPackageItem
If IsNull(Me.ID) Then
Set PkgItem = Nothing
Else
Set PkgItem = clsPackageItems.Item(Me.ID)
End If
End Property
Public Function QtyNotPackedEver() As Variant
' ACTION: returns the quantity of the current item which hasn't yet been packed at all (before or after this package)
Dim objPkgItm As clsPackageItem
Dim objOrdItm As clsOrderItem
If ItemExists Then
Set objPkgItm = Me.PkgItem
If objPkgItm Is Nothing Then
QtyNotPackedEver = "new"
Else
If objPkgItm.WasOrdered Then
Set objOrdItm = objPkgItm.OrderItem
If objOrdItm Is Nothing Then
QtyNotPackedEver = "n/a"
Else
With objOrdItm
QtyNotPackedEver = .QtyOrd - .QtyDone
End With
End If
Else
QtyNotPackedEver = "n/a"
End If
End If
Else
QtyNotPackedEver = Null
End If
End Function
Public Function QtyNotYetPacked() As Variant
' ACTION: returns the quantity of the current item which had not been packed as of this package's timestamp
Dim objItem As clsPackageItem ' package item
If IsNull(Me.ID) Then
QtyNotYetPacked = Null
Else
Set objItem = Me.PkgItem
If objItem Is Nothing Then
QtyNotYetPacked = "n/a"
Else
With objItem
If .WasOrdered Then
QtyNotYetPacked = .QtyYetToPack
Else
QtyNotYetPacked = "sub"
End If
End With
End If
End If
End Function
Private Property Get ItemExists() As Boolean
ItemExists = Not IsNull(Me.ID)
End Property
Private Property Let Status(iText As String)
With Me.lblStatus
If iText = "" Then
.Visible = False
Else
.Caption = iText
.Visible = True
End If
End With
DoEvents
End Property
Private Sub btnPullItem_Click()
' ACTION: Allow user to select quantity to pull and location to pull from.
Dim objPLine As clsPackageItem
Set objPLine = clsPackageItems.Item(Me.ID)
With clsForms.Dlg_SelectLocation_andQty
.Item_ID = Me.ID_Item
Do
If .doFetch("select location and quantity") Then
objPLine.FetchFromLocation .Location, .Qty
Status = .Qty & " items fetched; " & objPLine.QtyShipped & " items in pkg to ship"
Me.Requery
End If
Loop Until .isDone
End With
Status = ""
End Sub
Private Sub cbxItem_DblClick(Cancel As Integer)
clsForms.ItemView.Locate Me.cbxItem
End Sub
Private Sub Form_Resize()
Dim glWd As Single
With Me.editNotes
glWd = Me.InsideWidth - .Left - 300
If glWd > 0 Then
.Width = glWd
Me.Width = .Width
End If
End With
End Sub