Option Compare Database
Option Compare Database
Option Explicit
New_CustomerOrder = 0
Invoiced_CustomerOrder = 1
Shipped_CustomerOrder = 2
Closed_CustomerOrder = 3
End Enum
If rsw.OpenRecordset("Invoices") Then
With rsw.Recordset
If rsw.Update Then
.Bookmark = .LastModified
CreateInvoice = True
End If
End With
End If
End Function
End Function
End Function
With rsw.Recordset
.Edit
SetStatus = rsw.Update
End If
End With
End If
End Function
Function Delete(OrderID As Long) As Boolean
Delete = rsw.Delete
End If
End Function
Option Explicit
DLookup_Wrapper
DCount_Wrapper
DSum_Wrapper
DMax_Wrapper
DMin_Wrapper
DAvg_Wrapper
End Enum
Expr As String, _
Domain As String, _
Case DLookup_Wrapper
Case DCount_Wrapper
Case DSum_Wrapper
Case DMax_Wrapper
Case DMin_Wrapper
Case DSum_Wrapper
Case DAvg_Wrapper
Case Else
Debug.Assert False
End Select
Done:
Exit Function
ErrorHandler:
If eh.LogError("DomainFunctionWrapper", _
End Function
'--------------------------------------------------------
'--------------------------------------------------------
End Function
'--------------------------------------------------------
'--------------------------------------------------------
'--------------------------------------------------------
'--------------------------------------------------------
End Function
'--------------------------------------------------------
'--------------------------------------------------------
Public Function DCountWrapper(Expr As String, Domain As String, Optional Criteria As String) As Long
End Function
'--------------------------------------------------------
'--------------------------------------------------------
Public Function DMaxWrapper(Expr As String, Domain As String, Optional Criteria As String) As Long
'--------------------------------------------------------
'--------------------------------------------------------
Public Function DMinWrapper(Expr As String, Domain As String, Optional Criteria As String) As Long
End Function
'--------------------------------------------------------
'--------------------------------------------------------
Public Function DSumWrapper(Expr As String, Domain As String, Optional Criteria As String) As Long
End Function
'--------------------------------------------------------
'--------------------------------------------------------
Public Function DAvgWrapper(Expr As String, Domain As String, Optional Criteria As String) As Long
End Function
Option Compare Database
Option Explicit
Purchase_TransactionType = 1
Sold_TransactionType = 2
Hold_TransactionType = 3
End Enum
Type InventoryTransaction
Comments As String
End Type
None_OrderItemStatus = 0
OnHold_OrderItemStatus = 1
Invoiced_OrderItemStatus = 2
Shipped_OrderItemStatus = 3
OnOrder_OrderItemStatus = 4
NoStock_OrderItemStatus = 5
End Enum
NewInventoryID = m_cNew_InventoryID
End Property
Dim IT As InventoryTransaction
IT.TransactionType = Purchase_TransactionType
IT.ProductID = ProductID
IT.Quantity = Qty
IT.InventoryID = m_cNew_InventoryID
AddPurchase = True
InventoryID = IT.InventoryID
End If
End Function
Function RemovePurchase(lInventoryID As Long)
MsgBoxOKOnly CannotRemovePostedInventory
End Function
End Function
End Function
End Function
End Function
Private Function GetInventoryQuantity(FieldName As String, ProductID As Long) As Long
End Function
IT.TransactionType = Hold_TransactionType
Else
RequestHold = ModifyHold(IT)
End If
End Function
QtyRequested = IT.Quantity
QtyToHold = 0
QtyToHold = QtyAvailable
End If
Else
QtyToHold = QtyRequested
End If
IT.TransactionType = Hold_TransactionType
IT.Quantity = QtyToHold
IT.Quantity = QtyRequested
Else
IT.QuantityGranted = 0
End If
End Function
Function ModifyHold(IT As InventoryTransaction) As Boolean
IT_Existing.InventoryID = IT.InventoryID
If GetTransaction(IT_Existing) Then
IT.Quantity = IT.Quantity
If EditTransaction(IT) Then
IT.QuantityGranted = IT.Quantity
ModifyHold = True
Else
IT.QuantityGranted = IT_Existing.Quantity
End If
End If
End If
End Function
Function HoldToSold(InventoryID As Long) As Boolean
Dim IT As InventoryTransaction
IT.InventoryID = InventoryID
If GetTransaction(IT) Then
IT.TransactionType = Sold_TransactionType
If EditTransaction(IT) Then
HoldToSold = True
End If
End If
End Function
RemoveHold = DeleteTransaction(InventoryID)
End Function
With rsw.Recordset
IT.Quantity = ![Quantity]
IT.TransactionType = ![Transaction Type]
IT.Comments = Nz(![Comments])
GetTransaction = True
End If
End With
End If
End Function
With rsw.Recordset
Exit Function
rsw.AddNew
Exit Function
Else
rsw.Edit
End If
![Quantity] = IT.Quantity
![Transaction Type] = IT.TransactionType
EditTransaction = rsw.Update
rsw.Recordset.Bookmark = rsw.Recordset.LastModified
End If
End With
End If
End Function
DeleteTransaction = rsw.Delete
End If
End Function
QtyToOrder = GetQtyToReorder(ProductID)
SupplierID = FindProductSupplier(ProductID)
If PurchaseOrderID = 0 Then
Exit Function
End If
End If
Exit Function
End If
Else
' Suggested Enhancement: Handle case where product does not have a supplier
End If
End If
RestockProduct = True
End Function
End Function
End Function
If rsw.OpenRecordset("Order Details", "[Product ID] =" & ProductID & " AND [Status ID] = " &
OnOrder_OrderItemStatus) Then
With rsw.Recordset
Dim IT As InventoryTransaction
' Back Order Products should not be associated with any Inventory at this point
IT.Quantity = ![Quantity]
IT.InventoryID = m_cNew_InventoryID
.Edit
.Update
End If
End If
rsw.MoveNext
Wend
End With
FillBackOrders = True
End If
End Function
Function FillBackOrder(OrderID As Long, IT As InventoryTransaction) As Boolean
IT.TransactionType = Hold_TransactionType
FillBackOrder = EditTransaction(IT)
End If
End Function