Difference between revisions of "VbzCart/archive/code/VBA/clsPackageQueueItem"

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
m
 
Line 1: Line 1:
<VB>
+
<syntaxhighlight lang=VB>
 
' CLASS: clsPackageQueueItem
 
' CLASS: clsPackageQueueItem
  
Line 70: Line 70:
 
     End If
 
     End If
 
End Property
 
End Property
</VB>
+
</syntaxhighlight>

Latest revision as of 12:50, 14 October 2022

' CLASS: clsPackageQueueItem

Option Compare Database
Option Explicit
Private vID As Long
Private vPackage As Long
Private vReport As String
Private vWhenPrinted As Variant
Public Sub Init(iFields As Fields)
    With iFields
        vID = !ID
        vPackage = !ID_Package
        vReport = !ReportName
        vWhenPrinted = !WhenPrinted
    End With
End Sub
Public Sub Create(iPackage As Long, iReport As String)
    With clsPackageQueue
        .DataOpen
        With .Data
            .AddNew
            vID = !ID
            !ID_Package = iPackage
            !ReportName = iReport
            .Update
        End With
        .DataShut
    End With
End Sub
Public Property Get Package_ID() As Long
    Package_ID = vPackage
End Property
Public Property Get Report() As String
    Report = vReport
End Property
Public Property Get WhenPrinted() As Date
    WhenPrinted = vWhenPrinted
End Property
Public Property Get Printed() As Boolean
    Printed = Not IsNull(vWhenPrinted)
End Property
Private Function Located() As Boolean
    With clsPackageQueue
        .DataOpen
        With .Data
            .FindFirst "ID=" & vID
            Located = Not .NoMatch
        End With
        .DataShut
    End With
End Function
Public Property Let Printed(iDone As Boolean)
    If iDone <> Me.Printed Then
        With clsPackageQueue
            .DataOpen
            If Located Then
                With .Data
                    .Edit
                    If iDone Then
                    ' set the timestamp
                        !WhenPrinted = Now
                    Else
                        !WhenPrinted = Null
                    End If
                    .Update
                End With
            End If
        End With
    End If
End Property