<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://htyp.org/mw/index.php?action=history&amp;feed=atom&amp;title=VbzCart%2Farchive%2Fcode%2FVBA%2FclsPackage</id>
	<title>VbzCart/archive/code/VBA/clsPackage - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://htyp.org/mw/index.php?action=history&amp;feed=atom&amp;title=VbzCart%2Farchive%2Fcode%2FVBA%2FclsPackage"/>
	<link rel="alternate" type="text/html" href="https://htyp.org/mw/index.php?title=VbzCart/archive/code/VBA/clsPackage&amp;action=history"/>
	<updated>2026-06-25T13:29:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://htyp.org/mw/index.php?title=VbzCart/archive/code/VBA/clsPackage&amp;diff=28616&amp;oldid=prev</id>
		<title>Woozle at 12:45, 14 October 2022</title>
		<link rel="alternate" type="text/html" href="https://htyp.org/mw/index.php?title=VbzCart/archive/code/VBA/clsPackage&amp;diff=28616&amp;oldid=prev"/>
		<updated>2022-10-14T12:45:57Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:45, 14 October 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;VB&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight lang=&lt;/ins&gt;VB&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039; CLASS: clsPackage&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039; CLASS: clsPackage&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l432&quot;&gt;Line 432:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 432:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     End With&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     End With&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;End Function&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;End Function&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;VB&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;syntaxhighlight&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Woozle</name></author>
	</entry>
	<entry>
		<id>https://htyp.org/mw/index.php?title=VbzCart/archive/code/VBA/clsPackage&amp;diff=20366&amp;oldid=prev</id>
		<title>Woozle: Woozle moved page VbzCart/code/VBA/clsPackage to VbzCart/archive/code/VBA/clsPackage</title>
		<link rel="alternate" type="text/html" href="https://htyp.org/mw/index.php?title=VbzCart/archive/code/VBA/clsPackage&amp;diff=20366&amp;oldid=prev"/>
		<updated>2014-12-19T02:08:57Z</updated>

		<summary type="html">&lt;p&gt;Woozle moved page &lt;a href=&quot;/mw/index.php?title=VbzCart/code/VBA/clsPackage&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;VbzCart/code/VBA/clsPackage (page does not exist)&quot;&gt;VbzCart/code/VBA/clsPackage&lt;/a&gt; to &lt;a href=&quot;/VbzCart/archive/code/VBA/clsPackage&quot; title=&quot;VbzCart/archive/code/VBA/clsPackage&quot;&gt;VbzCart/archive/code/VBA/clsPackage&lt;/a&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:08, 19 December 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Woozle</name></author>
	</entry>
	<entry>
		<id>https://htyp.org/mw/index.php?title=VbzCart/archive/code/VBA/clsPackage&amp;diff=19993&amp;oldid=prev</id>
		<title>Woozle: Created page with &quot;&lt;VB&gt; &#039; CLASS: clsPackage  Option Compare Database Option Explicit  Private vID As Long Private vSeq As Long Private vOrder As Long Private vShpmt As Long Private vWhenStarted ...&quot;</title>
		<link rel="alternate" type="text/html" href="https://htyp.org/mw/index.php?title=VbzCart/archive/code/VBA/clsPackage&amp;diff=19993&amp;oldid=prev"/>
		<updated>2014-05-08T00:45:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;VB&amp;gt; &amp;#039; CLASS: clsPackage  Option Compare Database Option Explicit  Private vID As Long Private vSeq As Long Private vOrder As Long Private vShpmt As Long Private vWhenStarted ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;VB&amp;gt;&lt;br /&gt;
&amp;#039; CLASS: clsPackage&lt;br /&gt;
&lt;br /&gt;
Option Compare Database&lt;br /&gt;
Option Explicit&lt;br /&gt;
&lt;br /&gt;
Private vID As Long&lt;br /&gt;
Private vSeq As Long&lt;br /&gt;
Private vOrder As Long&lt;br /&gt;
Private vShpmt As Long&lt;br /&gt;
Private vWhenStarted As Variant&lt;br /&gt;
Private vWhenFinished As Variant&lt;br /&gt;
Private vNotes_StoreToBuyer As String&lt;br /&gt;
Private vNotes_StoreToRecip As String&lt;br /&gt;
Private vNotes_Internal As String&lt;br /&gt;
&amp;#039;Private vAddr As String&lt;br /&gt;
Private vWhenChecked As Variant&lt;br /&gt;
Public Sub Init(iFields As Fields)&lt;br /&gt;
    With iFields&lt;br /&gt;
        vID = !ID&lt;br /&gt;
        vSeq = !Seq&lt;br /&gt;
        vOrder = !ID_Order&lt;br /&gt;
        vShpmt = Nz(!ID_Shipment)&lt;br /&gt;
        vWhenStarted = !WhenStarted&lt;br /&gt;
        vWhenFinished = !WhenFinished&lt;br /&gt;
        vNotes_StoreToBuyer = Nz(!Notes_StoreToBuyer)&lt;br /&gt;
        vNotes_StoreToRecip = Nz(!Notes_StoreToRecip)&lt;br /&gt;
        vNotes_Internal = Nz(!Notes_Internal)&lt;br /&gt;
        vWhenChecked = !WhenChecked&lt;br /&gt;
    End With&lt;br /&gt;
End Sub&lt;br /&gt;
Public Sub Save()&lt;br /&gt;
&amp;#039; ACTION: save the object&amp;#039;s data back to the database&lt;br /&gt;
    With clsPackages&lt;br /&gt;
        .DataOpen&lt;br /&gt;
        If Located Then&lt;br /&gt;
            With .Data&lt;br /&gt;
                .Edit&lt;br /&gt;
                !Seq = vSeq&lt;br /&gt;
                !ID_Order = vOrder&lt;br /&gt;
                !ID_Shipment = IIf(vShpmt = 0, Null, vShpmt)&lt;br /&gt;
                !WhenStarted = vWhenStarted&lt;br /&gt;
                !WhenFinished = vWhenFinished&lt;br /&gt;
                !WhenChecked = vWhenChecked&lt;br /&gt;
                .Update&lt;br /&gt;
            End With&lt;br /&gt;
        End If&lt;br /&gt;
        .DataShut&lt;br /&gt;
    End With&lt;br /&gt;
End Sub&lt;br /&gt;
Public Property Get ID() As Long&lt;br /&gt;
    ID = vID&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get Seq() As Long&lt;br /&gt;
    Seq = vSeq&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get Code() As String&lt;br /&gt;
    Code = Me.Order.Code &amp;amp; &amp;quot;-&amp;quot; &amp;amp; Me.Seq&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get Order_ID() As Long&lt;br /&gt;
    Order_ID = vOrder&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get Order() As clsOrder&lt;br /&gt;
    Set Order = clsOrders.Item(vOrder)&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get IsPacked() As Boolean&lt;br /&gt;
&amp;#039; ACTION: Returns TRUE iff the package has been finished (and placed into a shipment).&lt;br /&gt;
    IsPacked = Not IsNull(vWhenFinished)&lt;br /&gt;
End Property&lt;br /&gt;
Public Sub AddCharges(iIncludeShipping As Boolean)&lt;br /&gt;
&amp;#039; ACTION: create charge transactions for this package&lt;br /&gt;
&amp;#039;   1. 2002-08-24 THIS STEP IS NOT NEEDED: create a shipment if there isn&amp;#039;t one assigned&lt;br /&gt;
&amp;#039;   2. for each item in the package, increment the qtyDone for the corresponding order item&lt;br /&gt;
&amp;#039;   3. create a transaction entry for this package in the order&amp;#039;s transactions (ITEM)&lt;br /&gt;
&amp;#039;   4. set the package&amp;#039;s &amp;quot;finished&amp;quot; timestamp (do this last)&lt;br /&gt;
&amp;#039;    Dim objShip As clsShipment&lt;br /&gt;
    Dim objItem As clsPackageItem&lt;br /&gt;
    Dim objList As Scripting.Dictionary&lt;br /&gt;
    Dim objTrx As clsTrxactn&lt;br /&gt;
    Dim curTotal As Currency&lt;br /&gt;
    Dim curShItm As Currency&lt;br /&gt;
    Dim curShPkg As Currency&lt;br /&gt;
    Dim curShPkgMax As Currency&lt;br /&gt;
    &lt;br /&gt;
    DBEngine.BeginTrans&lt;br /&gt;
    &lt;br /&gt;
&amp;#039;&amp;#039; STEP 1 - get/create shipment object/record&lt;br /&gt;
&amp;#039;    If Me.ShipmentExists Then&lt;br /&gt;
&amp;#039;        Set objShip = Me.Shipment&lt;br /&gt;
&amp;#039;    Else&lt;br /&gt;
&amp;#039;        If MsgBox(&amp;quot;No shipment has been assigned. Ok to create a new one?&amp;quot;, vbOKCancel, &amp;quot;Confirm&amp;quot;) = vbOK Then&lt;br /&gt;
&amp;#039;            Set objShip = objShipments.Create&lt;br /&gt;
&amp;#039;            vShpmt = objShip.ID&lt;br /&gt;
&amp;#039;        Else&lt;br /&gt;
&amp;#039;            DBEngine.Rollback&lt;br /&gt;
&amp;#039;            Exit Sub&lt;br /&gt;
&amp;#039;        End If&lt;br /&gt;
&amp;#039;    End If&lt;br /&gt;
&lt;br /&gt;
&amp;#039; STEP 2 - increment order item&amp;#039;s qtyDone &amp;amp; add the costs&lt;br /&gt;
    Set objList = Me.Items&lt;br /&gt;
    For Each objItem In objList&lt;br /&gt;
        With objItem&lt;br /&gt;
            If .QtyShipped &amp;lt;&amp;gt; 0 Then    &amp;#039; negative = returned items&lt;br /&gt;
                .Ship&lt;br /&gt;
                curTotal = curTotal + .PriceTotal&lt;br /&gt;
                curShItm = curShItm + .ShipItemTotal&lt;br /&gt;
                curShPkg = .ShipPkgEffective&lt;br /&gt;
                GoSub CheckCancel&lt;br /&gt;
            End If&lt;br /&gt;
        End With&lt;br /&gt;
        If curShPkg &amp;gt; curShPkgMax Then curShPkgMax = curShPkg&lt;br /&gt;
    Next objItem&lt;br /&gt;
    &lt;br /&gt;
&amp;#039; STEP 3 - create transaction(s)&lt;br /&gt;
    Set objTrx = New clsTrxactn&lt;br /&gt;
    With objTrx&lt;br /&gt;
        .Descr = &amp;quot;total for items being shipped&amp;quot;&lt;br /&gt;
        .Type_ID = kiTrxType_ItemShipped&lt;br /&gt;
        .Order_ID = Me.Order_ID&lt;br /&gt;
        .Package_ID = Me.ID&lt;br /&gt;
        .Amount = curTotal&lt;br /&gt;
        .SaveNew&lt;br /&gt;
        If iIncludeShipping Then&lt;br /&gt;
        &amp;#039; create transactions for shipping charges&lt;br /&gt;
        &amp;#039; - itemized shipping total&lt;br /&gt;
            .Descr = &amp;quot;itemized shipping total&amp;quot;&lt;br /&gt;
            .Type_ID = kiTrxType_ShippingItemized&lt;br /&gt;
            .Amount = curShItm&lt;br /&gt;
            .SaveNew&lt;br /&gt;
        &amp;#039; - package charge&lt;br /&gt;
            .Descr = &amp;quot;shipping package&amp;quot;&lt;br /&gt;
            .Type_ID = kiTrxType_ShippingPackage&lt;br /&gt;
            .Amount = curShPkgMax&lt;br /&gt;
            .SaveNew&lt;br /&gt;
        End If&lt;br /&gt;
    End With&lt;br /&gt;
    GoSub CheckCancel&lt;br /&gt;
    &lt;br /&gt;
&amp;#039; STEP 4 - package&amp;#039;s &amp;quot;finished&amp;quot; timestamp&lt;br /&gt;
    vWhenFinished = Now&lt;br /&gt;
    &lt;br /&gt;
&amp;#039; CLEANUP&lt;br /&gt;
    Me.Save&lt;br /&gt;
    DBEngine.CommitTrans&lt;br /&gt;
    Exit Sub&lt;br /&gt;
&lt;br /&gt;
CheckCancel:&lt;br /&gt;
    If doCancel Then&lt;br /&gt;
        DBEngine.Rollback&lt;br /&gt;
        Exit Sub&lt;br /&gt;
    End If&lt;br /&gt;
    Return&lt;br /&gt;
End Sub&lt;br /&gt;
&amp;#039;Public Function StockIsPulled() As Boolean&lt;br /&gt;
&amp;#039;&amp;#039; ACTION: checks to see if at least one line item has been pulled from stock&lt;br /&gt;
&amp;#039;End Function&lt;br /&gt;
Public Function FindItem(iItem As Long, iStartPkgItem As Long) As clsPackageItem&lt;br /&gt;
&amp;#039; ACTION: Returns the package item object for the given item; Nothing if not found.&lt;br /&gt;
&amp;#039;   iStart is the ID of the package-item to start from (i.e. skip)&lt;br /&gt;
    Dim sqlFilt As String&lt;br /&gt;
    Dim objItem As clsPackageItem&lt;br /&gt;
    Dim rs As Recordset&lt;br /&gt;
&lt;br /&gt;
    Set rs = clsPackageItems.Data_Items&lt;br /&gt;
    With rs&lt;br /&gt;
        sqlFilt = &amp;quot;(ID_Package=&amp;quot; &amp;amp; Me.ID &amp;amp; &amp;quot;) AND (ID_Item=&amp;quot; &amp;amp; iItem &amp;amp; &amp;quot;)&amp;quot;&lt;br /&gt;
        If iStartPkgItem = 0 Then&lt;br /&gt;
            .FindFirst sqlFilt&lt;br /&gt;
        Else&lt;br /&gt;
            .FindFirst &amp;quot;ID=&amp;quot; &amp;amp; iStartPkgItem&lt;br /&gt;
            .FindNext sqlFilt&lt;br /&gt;
        End If&lt;br /&gt;
        If .NoMatch Then&lt;br /&gt;
            Set objItem = Nothing&lt;br /&gt;
        Else&lt;br /&gt;
        &amp;#039; there should be only one entry per package for each item, so the first one is it.&lt;br /&gt;
            Set objItem = New clsPackageItem&lt;br /&gt;
            objItem.Init .Fields&lt;br /&gt;
        End If&lt;br /&gt;
    End With&lt;br /&gt;
    Set FindItem = objItem&lt;br /&gt;
End Function&lt;br /&gt;
Public Sub PullItem(iStockItem As Long, iQty As Long)&lt;br /&gt;
&amp;#039; ACTION: removes the given quantity of the given item from stock and adds it to the package&lt;br /&gt;
&amp;#039; NOTE: Only use this method when there is no specific package line.&lt;br /&gt;
    Dim objLine As clsStockItem&lt;br /&gt;
&lt;br /&gt;
    Set objLine = clsStockItems.Item(iStockItem)&lt;br /&gt;
    objLine.FetchToPkgLine iQty, Me.ID&lt;br /&gt;
End Sub&lt;br /&gt;
Public Sub DelCharges()&lt;br /&gt;
&amp;#039; ACTION:  remove the charge transactions for this package&lt;br /&gt;
&amp;#039;   1. (ok to leave shipment assigned; no action needed)&lt;br /&gt;
&amp;#039;   2. for each item in the package, DECrement the qtyDone for the corresponding order item&lt;br /&gt;
&amp;#039;   3. REMOVE the transaction entry for this package in the order&amp;#039;s transactions (ITEM)&lt;br /&gt;
&amp;#039;   4. CLEAR the package&amp;#039;s &amp;quot;finished&amp;quot; timestamp&lt;br /&gt;
    Dim objItem As clsPackageItem&lt;br /&gt;
    Dim objList As Scripting.Dictionary&lt;br /&gt;
    Dim objTrx As clsTrxactn&lt;br /&gt;
    Dim ok As Boolean&lt;br /&gt;
    Dim sqlFilt As String&lt;br /&gt;
    &lt;br /&gt;
    DBEngine.BeginTrans&lt;br /&gt;
&lt;br /&gt;
&amp;#039; STEP 2 - DECrement order item&amp;#039;s qtyDone&lt;br /&gt;
    Set objList = Me.Items&lt;br /&gt;
    For Each objItem In objList&lt;br /&gt;
        objItem.UnShip&lt;br /&gt;
    Next objItem&lt;br /&gt;
&lt;br /&gt;
&amp;#039; STEP 3 - DELETE transactions&lt;br /&gt;
    sqlFilt = &amp;quot;ID_Package=&amp;quot; &amp;amp; Me.ID&lt;br /&gt;
    With clsTrxactns&lt;br /&gt;
        .DataOpen&lt;br /&gt;
        With .Data&lt;br /&gt;
            .FindFirst sqlFilt&lt;br /&gt;
            Do Until .NoMatch&lt;br /&gt;
                .Delete&lt;br /&gt;
                .FindNext sqlFilt&lt;br /&gt;
            Loop&lt;br /&gt;
        End With&lt;br /&gt;
        .DataShut&lt;br /&gt;
    End With&lt;br /&gt;
        &lt;br /&gt;
    &lt;br /&gt;
&amp;#039; STEP 4 - CLEAR package&amp;#039;s &amp;quot;finished&amp;quot; timestamp&lt;br /&gt;
    vWhenFinished = Null&lt;br /&gt;
&lt;br /&gt;
&amp;#039; CLEANUP&lt;br /&gt;
    Me.Save&lt;br /&gt;
    DBEngine.CommitTrans&lt;br /&gt;
End Sub&lt;br /&gt;
Public Property Get Shipment_ID() As Long&lt;br /&gt;
    Shipment_ID = vShpmt&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get Shipment() As clsShipment&lt;br /&gt;
    If vShpmt = 0 Then&lt;br /&gt;
        Set Shipment = Nothing&lt;br /&gt;
    Else&lt;br /&gt;
        Set Shipment = clsShipments.Item(vShpmt)&lt;br /&gt;
    End If&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get ShipmentExists() As Boolean&lt;br /&gt;
    ShipmentExists = (vShpmt &amp;lt;&amp;gt; 0)&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get WhenStarted() As Date&lt;br /&gt;
    WhenStarted = vWhenStarted&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get WhenFinished() As Date&lt;br /&gt;
    WhenFinished = vWhenFinished&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get HasBeenFinished() As Boolean&lt;br /&gt;
    HasBeenFinished = Not IsNull(vWhenFinished)&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get Checked() As Boolean&lt;br /&gt;
    Checked = Not IsNull(vWhenChecked)&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Let Checked(iDone As Boolean)&lt;br /&gt;
    If iDone &amp;lt;&amp;gt; Me.Checked Then&lt;br /&gt;
        If iDone Then&lt;br /&gt;
            vWhenChecked = Now&lt;br /&gt;
        Else&lt;br /&gt;
            vWhenChecked = Null&lt;br /&gt;
        End If&lt;br /&gt;
        Save&lt;br /&gt;
    End If&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get Items() As Scripting.Dictionary&lt;br /&gt;
&amp;#039; ACTION: returns a list of objects, one for each Package Item in the current Package&lt;br /&gt;
    Dim strFilt As String&lt;br /&gt;
    Dim objList As Scripting.Dictionary&lt;br /&gt;
    Dim objItem As clsPackageItem&lt;br /&gt;
&lt;br /&gt;
    strFilt = &amp;quot;ID_Package=&amp;quot; &amp;amp; Me.ID&lt;br /&gt;
    Set objList = New Scripting.Dictionary&lt;br /&gt;
    With clsPackageItems&lt;br /&gt;
        .DataOpen&lt;br /&gt;
        With .Data&lt;br /&gt;
            .FindFirst strFilt&lt;br /&gt;
            Do Until .NoMatch&lt;br /&gt;
                Set objItem = New clsPackageItem&lt;br /&gt;
                objItem.Init .Fields&lt;br /&gt;
                objList.Add objItem, objItem.ID&lt;br /&gt;
                .FindNext strFilt&lt;br /&gt;
            Loop&lt;br /&gt;
        End With&lt;br /&gt;
        .DataShut&lt;br /&gt;
    End With&lt;br /&gt;
    Set Items = objList&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get QtyShipped()&lt;br /&gt;
    Dim objItem As clsPackageItem&lt;br /&gt;
    Dim qtyShp As Long&lt;br /&gt;
    &lt;br /&gt;
    For Each objItem In Me.Items&lt;br /&gt;
        qtyShp = qtyShp + objItem.QtyShipped&lt;br /&gt;
    Next objItem&lt;br /&gt;
    QtyShipped = qtyShp&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get Messages(iMedia As Long, iPrefix As String) As String&lt;br /&gt;
    Dim sqlFilt As String&lt;br /&gt;
    Dim strOut As String&lt;br /&gt;
&lt;br /&gt;
    sqlFilt = &amp;quot;(ID_Media=&amp;quot; &amp;amp; iMedia &amp;amp; &amp;quot;) AND ((ID_Package=&amp;quot; &amp;amp; Me.ID &amp;amp; &amp;quot;) OR ((ID_Order =&amp;quot; &amp;amp; Me.Order_ID &amp;amp; &amp;quot;) AND (ID_Package IS NULL)))&amp;quot;&lt;br /&gt;
    With clsOrderMsgs&lt;br /&gt;
        .DataOpen&lt;br /&gt;
        With .Data&lt;br /&gt;
            .FindFirst sqlFilt&lt;br /&gt;
            Do Until .NoMatch&lt;br /&gt;
                If Not IsNull(!Message) Then&lt;br /&gt;
                    If strOut &amp;lt;&amp;gt; &amp;quot;&amp;quot; Then&lt;br /&gt;
                        strOut = strOut &amp;amp; vbCrLf&lt;br /&gt;
                    End If&lt;br /&gt;
                    strOut = strOut &amp;amp; iPrefix &amp;amp; !Message&lt;br /&gt;
                End If&lt;br /&gt;
                .FindNext sqlFilt&lt;br /&gt;
            Loop&lt;br /&gt;
        End With&lt;br /&gt;
        .DataShut&lt;br /&gt;
    End With&lt;br /&gt;
    Messages = strOut&lt;br /&gt;
End Property&lt;br /&gt;
Public Property Get NotesSummary(iBuyer As Boolean, iRecip As Boolean, iStore As Boolean) As String&lt;br /&gt;
&amp;#039; ACTION: returns a string containing all notes intended for the given targets, as indicated&lt;br /&gt;
&amp;#039; NOTE: It is assumed that if only one note-set is flagged on, then no header &amp;quot;-- Message from...&amp;quot; should be included.&lt;br /&gt;
&amp;#039; NOTE ALSO: This method of tracking messages is deprecated, and will be replaced eventually.&lt;br /&gt;
    Dim strNotes As String&lt;br /&gt;
    Dim isPlural As Boolean&lt;br /&gt;
    &lt;br /&gt;
    isPlural = (CLng(iBuyer) + CLng(iRecip) + CLng(iStore) &amp;lt; -1)&lt;br /&gt;
&lt;br /&gt;
    With Me.Order&lt;br /&gt;
        If iRecip Then AppendNote strNotes, .Notes_BuyerToRecip, &amp;quot;-- Message from customer to recipient:&amp;quot;, isPlural&lt;br /&gt;
        If iStore Or iBuyer Then&lt;br /&gt;
            AppendNote strNotes, .Notes_BuyerToStore, &amp;quot;-- Message from customer to us:&amp;quot;, isPlural&lt;br /&gt;
        End If&lt;br /&gt;
        If iStore Then&lt;br /&gt;
            AppendNote strNotes, .Notes_Internal, &amp;quot;-- Message to ourselves (for this order):&amp;quot;, isPlural&lt;br /&gt;
        End If&lt;br /&gt;
    End With&lt;br /&gt;
    If iBuyer Then AppendNote strNotes, vNotes_StoreToBuyer, &amp;quot;-- Message from us to the customer:&amp;quot;, isPlural&lt;br /&gt;
    If iRecip Then AppendNote strNotes, vNotes_StoreToRecip, &amp;quot;-- Message from us to the recipient:&amp;quot;, isPlural&lt;br /&gt;
    If iStore Then AppendNote strNotes, vNotes_Internal, &amp;quot;-- Message to ourselves (for this package):&amp;quot;, isPlural&lt;br /&gt;
    NotesSummary = strNotes&lt;br /&gt;
End Property&lt;br /&gt;
Private Sub AppendNote(ioConcat As String, iNote As String, iDescr As String, Optional iUseDescr As Boolean = True)&lt;br /&gt;
    If iNote &amp;lt;&amp;gt; &amp;quot;&amp;quot; Then&lt;br /&gt;
        If ioConcat &amp;lt;&amp;gt; &amp;quot;&amp;quot; Then ioConcat = ioConcat &amp;amp; vbCrLf &amp;amp; vbCrLf&lt;br /&gt;
        If iUseDescr Then&lt;br /&gt;
            ioConcat = ioConcat &amp;amp; iDescr &amp;amp; vbCrLf&lt;br /&gt;
        End If&lt;br /&gt;
        ioConcat = ioConcat &amp;amp; iNote&lt;br /&gt;
    End If&lt;br /&gt;
End Sub&lt;br /&gt;
Public Sub Delete(iMoveToStock As Boolean)&lt;br /&gt;
&amp;#039; ACTIONS:&lt;br /&gt;
&amp;#039;   - move all this package&amp;#039;s items to the location set by policy (if any)&lt;br /&gt;
&amp;#039;   - delete the package record and all its item records&lt;br /&gt;
    Dim strFilt As String&lt;br /&gt;
    Dim idLoc As Long&lt;br /&gt;
    Dim uResp As Integer&lt;br /&gt;
    Dim rs As Recordset&lt;br /&gt;
    Dim objItem As clsPackageItem&lt;br /&gt;
&amp;#039;    Dim objOrdItm As clsOrderItem&lt;br /&gt;
    &lt;br /&gt;
    idLoc = LocForDeletedPkgs&lt;br /&gt;
    If idLoc = 0 Then&lt;br /&gt;
        If iMoveToStock Then&lt;br /&gt;
            uResp = MsgBox(&amp;quot;No location for deleted package items has been set. Delete anyway?&amp;quot;, vbQuestion Or vbOKCancel, &amp;quot;Are you sure?&amp;quot;)&lt;br /&gt;
            If uResp = vbCancel Then Exit Sub&lt;br /&gt;
        End If&lt;br /&gt;
    End If&lt;br /&gt;
    &lt;br /&gt;
&amp;#039; 1. Delete package items&lt;br /&gt;
    strFilt = &amp;quot;ID_Package=&amp;quot; &amp;amp; Me.ID&lt;br /&gt;
    With clsPackageItems&lt;br /&gt;
        Set rs = .Data_Items&lt;br /&gt;
        rs.FindLast strFilt&lt;br /&gt;
        Do Until rs.NoMatch&lt;br /&gt;
            Set objItem = .Item(rs!ID)&lt;br /&gt;
            If iMoveToStock And (idLoc &amp;lt;&amp;gt; 0) And (Nz(rs!QtyShipped) &amp;lt;&amp;gt; 0) Then&lt;br /&gt;
                If objItem Is Nothing Then&lt;br /&gt;
                    uResp = MsgBox(&amp;quot;Could not find package item ID=&amp;quot; &amp;amp; !ID, vbExclamation, &amp;quot;Record not found&amp;quot;)&lt;br /&gt;
                    Exit Sub&lt;br /&gt;
                End If&lt;br /&gt;
                &amp;#039; move the item to stock&lt;br /&gt;
    &amp;#039;                Set objOrdItm = clsOrderItems.Item(rs!ID_OrderItem)&lt;br /&gt;
    &amp;#039;                clsStockItems.Add idLoc, rs!QtyShipped, rs!ID_Item, objOrdItm.ID&lt;br /&gt;
                clsStockItems.AddFromPkgItem objItem, idLoc&lt;br /&gt;
            End If&lt;br /&gt;
            &amp;#039; delete the item record from the package&lt;br /&gt;
            If objItem Is Nothing Then&lt;br /&gt;
                uResp = MsgBox(&amp;quot;Package line &amp;quot; &amp;amp; Me.Seq &amp;amp; &amp;quot; has no item set. Deleting package item record anyway.&amp;quot;, vbExclamation Or vbOKCancel, &amp;quot;Item not found&amp;quot;)&lt;br /&gt;
                If uResp = vbCancel Then Exit Sub&lt;br /&gt;
            Else&lt;br /&gt;
                If Not objItem.Delete Then&lt;br /&gt;
                    uResp = MsgBox(&amp;quot;Could not delete package item ID=&amp;quot; &amp;amp; !ID, vbExclamation Or vbOKCancel, &amp;quot;Record not found&amp;quot;)&lt;br /&gt;
                    If uResp = vbCancel Then Exit Sub&lt;br /&gt;
                End If&lt;br /&gt;
            End If&lt;br /&gt;
            &amp;#039; move to the next item&lt;br /&gt;
            rs.FindPrevious strFilt&lt;br /&gt;
        Loop&lt;br /&gt;
    End With&lt;br /&gt;
&amp;#039; 2. Delete the package&lt;br /&gt;
    With clsPackages&lt;br /&gt;
        .DataOpen&lt;br /&gt;
        If Located Then&lt;br /&gt;
            With .Data&lt;br /&gt;
                .Delete&lt;br /&gt;
            End With&lt;br /&gt;
        End If&lt;br /&gt;
        .DataShut&lt;br /&gt;
    End With&lt;br /&gt;
End Sub&lt;br /&gt;
Public Sub Edit()&lt;br /&gt;
&amp;#039; ACTION: opens the form for editing a package, and loads the current package record into it&lt;br /&gt;
    Dim frmPkg As Form_frmPackage&lt;br /&gt;
&lt;br /&gt;
    Set frmPkg = clsForms.PackageForm_GotoPkg(Me.ID)&lt;br /&gt;
&amp;#039;    clsForms.PackageForm.Locate Me.ID&lt;br /&gt;
End Sub&lt;br /&gt;
Private Function Located() As Boolean&lt;br /&gt;
    With clsPackages.Data&lt;br /&gt;
        If !ID &amp;lt;&amp;gt; Me.ID Then&lt;br /&gt;
            .FindFirst &amp;quot;ID=&amp;quot; &amp;amp; Me.ID&lt;br /&gt;
            Located = Not .NoMatch&lt;br /&gt;
        Else&lt;br /&gt;
            Located = True&lt;br /&gt;
        End If&lt;br /&gt;
    End With&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/VB&amp;gt;&lt;/div&gt;</summary>
		<author><name>Woozle</name></author>
	</entry>
</feed>