Difference between revisions of "VbzCart/archive/code/VBA/Form sfrmPackageItems"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< VbzCart‎ | archive‎ | code‎ | VBA
Jump to navigation Jump to search
(form image)
(No difference)

Revision as of 02:08, 19 December 2014

vbzcart-MSAccess-sfrmPackages.png <VB> 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 </VB>