VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "DPC_Option"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private Const SEP = "®©"
Private Const C_SEP As String = "@@"
Private Const SEP1 As String = "®"
Private Const SEP2 As String = "©"

Public POP_Id As String
Public SYS_Id  As Long
Public OPT_Id As String
Public Language_Code As String
Public OPT_Code As String
Public OPT_Name As String
Public OPT_Desc As String

Public POP_QMin As Double
Public POP_QMax As Double
Public POP_Qty As Double
Public POP_Cost As Double
Public UM_CodeC As String
Public CURR_Code As String

Public Idx As String
Public RowStatus As eDPCRowStatus

Private mo_Tools As DPC_Tools

Public OfferPrice As New Collection

Public Property Set Tools(ByRef ao_Tools As Object)
On Error GoTo ErrorHandler

  Set mo_Tools = ao_Tools
  Exit Property
ErrorHandler:
  Call ErrorHandler("Tools.Set")
End Property

Public Sub CopyFrom(ByVal ao_Option As DPC_Option)
On Error GoTo ErrHandler

  POP_Id = ao_Option.POP_Id
  SYS_Id = ao_Option.SYS_Id
  OPT_Id = ao_Option.OPT_Id
  OPT_Code = ao_Option.OPT_Code
  OPT_Name = ao_Option.OPT_Name
  OPT_Desc = ao_Option.OPT_Desc

  POP_QMin = ao_Option.POP_QMin
  POP_QMax = ao_Option.POP_QMax
  POP_Qty = ao_Option.POP_Qty
  POP_Cost = ao_Option.POP_Cost
  UM_CodeC = ao_Option.UM_CodeC
  CURR_Code = ao_Option.CURR_Code
  Exit Sub
ErrHandler:
  Call ErrorHandler("CopyFrom")
End Sub

Public Function GetOfferPos(ByVal al_DOF_Id As Long) As DPC_OfferPos
On Error GoTo ErrHandler

Dim lo_Offer As DPC_OfferPos

  Set GetOfferPos = Nothing
  For Each lo_Offer In OfferPrice
    If lo_Offer.DOF_Id = al_DOF_Id Then
      Set GetOfferPos = lo_Offer
      Exit Function
    End If
  Next
  Exit Function
ErrHandler:
  Call ErrorHandler("GetOfferPos")
End Function

Public Function ReplaceValuePlaceholder(ByVal as_Text As String) As String
On Error GoTo ErrHandler

  as_Text = Replace(as_Text, "$POP_Id", POP_Id, , , vbTextCompare)
  ReplaceValuePlaceholder = as_Text
  Exit Function
ErrHandler:
  Call ErrorHandler("ReplaceValuePlaceholder")
End Function

' Standard error handler
Private Sub ErrorHandler(ByVal as_Fct As String)
  
    Call Err.Raise(Err.Number, as_Fct & SEP1 & Err.Source, Err.Description)
End Sub





