VERSION 5.00
Begin VB.Form prnChoice 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "#Print detail"
   ClientHeight    =   3435
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   3420
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3435
   ScaleWidth      =   3420
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Tag             =   "frm_title"
   Begin Project1.ArmCombobox cbo_Language 
      Height          =   345
      Left            =   1260
      TabIndex        =   7
      Tag             =   "cbo_Language"
      Top             =   960
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   609
   End
   Begin VB.CheckBox chk_List 
      Caption         =   "#"
      Height          =   375
      Index           =   0
      Left            =   240
      TabIndex        =   4
      Top             =   1440
      Width           =   3015
   End
   Begin VB.CheckBox chk_List 
      Caption         =   "#"
      Height          =   375
      Index           =   1
      Left            =   240
      TabIndex        =   3
      Top             =   1920
      Width           =   3015
   End
   Begin VB.CheckBox chk_List 
      Caption         =   "#"
      Height          =   375
      Index           =   2
      Left            =   240
      TabIndex        =   2
      Top             =   2400
      Width           =   3015
   End
   Begin VB.CheckBox chk_List 
      Caption         =   "#"
      Height          =   375
      Index           =   3
      Left            =   240
      TabIndex        =   1
      Top             =   2880
      Width           =   3015
   End
   Begin Project1.ToolBr toolbar 
      Align           =   1  'Align Top
      Height          =   435
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   3420
      _ExtentX        =   6033
      _ExtentY        =   767
   End
   Begin VB.Label lbl_Language 
      Caption         =   "#Language"
      Height          =   375
      Left            =   120
      TabIndex        =   6
      Tag             =   "lbl_Language"
      Top             =   960
      Width           =   1095
   End
   Begin VB.Label lbl_Component 
      Caption         =   "#Customer"
      Height          =   375
      Left            =   0
      TabIndex        =   5
      Top             =   480
      Width           =   3255
   End
End
Attribute VB_Name = "prnChoice"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'Curseur & données
Private mo_ArmDb As Object
Private mb_Created As Boolean
Private mb_use_framework_connection As Boolean
Private ms_ConnectString As String
Private ms_UID As String

Private m_Language As String

Private me_ComponentType As DataTypeEnum
Private ma_Choices As Variant

Private mb_Valid As Boolean

Public Property Set ArmDb(ByRef ao_local_connection As Object)
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:ArmDb_Set"
    #End If
    CapMouseOff
    
    
    If Not (ao_local_connection Is Nothing) Then
        Set mo_ArmDb = ao_local_connection
        mb_use_framework_connection = True
        Set ToolBar.ArmDb = mo_ArmDb
        Set cbo_Language.ArmDb = mo_ArmDb
    End If
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:ArmDb_Set"
    #End If
    CapMouseOn
End Property

Property Let ConnectString(as_ConnectString As String)
    
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:ConnectString_Let", "as_ConnectString=" & as_ConnectString
    #End If
    CapMouseOff
    
    ms_UID = ConnectionStringValidation(as_ConnectString)
    If ms_UID = "" Then GoTo Trace_End
    
    ms_ConnectString = as_ConnectString
    
    ToolBar.ConnectString = ms_ConnectString
    cbo_Language.ConnectString = ms_ConnectString
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:ConnectString_Let"
    #End If
    CapMouseOn
End Property

Property Let Language(ALng As String)
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:Language_Let", "ALng=" & ALng
    #End If
    CapMouseOff
    
    m_Language = ALng
    
    ToolBar.Language = m_Language
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:Language_Let"
    #End If
    CapMouseOn
End Property


Public Sub Load_A_COM()
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:Load_A_Com"
    #End If
    
    VerifyInitialization mo_ArmDb, ms_ConnectString, m_Language, Me
    
    mb_Valid = False
    
    ToolBar.Load_A_COM
    ToolBar.DrivenByCapture = True
    ToolBar.ClearAllIcons
    ToolBar.PictureDisplayed = "P_Valid=1 P_Quit=-1"
    
    
    cbo_Language.Load_A_COM
    cbo_Language.FirstBlankItem = False
    cbo_Language.Request = "EXEC Language_lst"
    cbo_Language.Load
    cbo_Language.SearchItem m_Language, 0
    
    Call StaticInit
    
    LoadLabels mo_ArmDb, Me.Controls, "Cap_Print_List_Select", m_Language

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:Load_A_Com"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrnChoice:Load_A_Com"
    CapMouseOn
End Sub


Public Sub Unload_A_COM()
    
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:Unload_A_COM"
    #End If
        
    ToolBar.Unload_A_COM
    cbo_Language.Unload_A_COM

    ASC_DisconnectFromDB mo_ArmDb, ms_UID, mb_Created

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:Unload_A_COM"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrnChoice:Unload_A_COM"
    CapMouseOn
    
End Sub



Public Property Let ComponentType(ByVal ae_CptTag As DataTypeEnum)
        
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:ComponentType"
    #End If
    
    me_ComponentType = ae_CptTag
        
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:ComponentType"
    #End If
    CapMouseOn
    Exit Property
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrnChoice:ComponentType"
    CapMouseOn
            

End Property



Private Sub StaticInit()
        
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:StaticInit"
    #End If
    
    Select Case me_ComponentType
    
        Case Customer
            lbl_Component.Caption = "#Customer"
            lbl_Component.Tag = "lbl_mastercustomer"
            chk_List(0).Caption = "#Contact"
            chk_List(0).Tag = "lbl_Contact"
            chk_List(1).Caption = "#Action"
            chk_List(1).Tag = "lbl_Action"
            chk_List(2).Caption = "#Project"
            chk_List(2).Tag = "lbl_Project"
            chk_List(3).Visible = False
            ma_Choices = Array(False, False, False)
            
        Case project
            lbl_Component.Caption = "#Project"
            lbl_Component.Tag = "lbl_masterproject"
            chk_List(0).Caption = "#Contact"
            chk_List(0).Tag = "lbl_Contact"
            chk_List(1).Caption = "#Spec"
            chk_List(1).Tag = "lbl_Spec"
            chk_List(2).Caption = "#Action"
            chk_List(2).Tag = "lbl_Action"
            chk_List(3).Caption = "#Company"
            chk_List(3).Tag = "lbl_Company"
            chk_List(3).Visible = True
            ma_Choices = Array(False, False, False, False)
            
    End Select
        
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:StaticInit"
    #End If
    CapMouseOn
    Exit Sub
    
Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrnChoice:StaticInit"
    CapMouseOn
            
End Sub


Public Function Execute() As Boolean

    On Error GoTo Trace_Err
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:Execute"
    #End If
    
    CapMouseOn (True)
    
    mb_Valid = False
    show (vbModal)
    
    
    If mb_Valid Then
        Dim li_Idx As Long, li_Count As Long
        li_Count = UBound(ma_Choices)
        For li_Idx = 0 To li_Count
            ma_Choices(li_Idx) = chk_List(li_Idx).value = 1
        Next
    End If
    
    Execute = mb_Valid
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:Execute"
    #End If
    CapMouseOff (True)
    Exit Function
    
Trace_Err:
    CapMouseOff (True)
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrnChoice:Execute"
    
End Function


Private Sub toolbar_action(ByVal as_ActionType As String)
    

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:toolbar_action", "as_ActionType=" & as_ActionType
    #End If
    
    Select Case as_ActionType
    
        Case "Valid"
            mb_Valid = True
            Me.Hide
            
        Case "Quit"
            mb_Valid = False
            Me.Hide
    End Select

Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:toolbar_action"
    #End If
    CapMouseOn
    Exit Sub

Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrnChoice:toolbar_action"
    CapMouseOn
    
End Sub


Public Property Get DataChoice() As Variant

    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:DataChoice"
    #End If

    DataChoice = ma_Choices
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:DataChoice"
    #End If
    CapMouseOn
    Exit Property

Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrnChoice:DataChoice"
    CapMouseOn


End Property


Public Property Get SelectedLanguage() As String
    
    On Error GoTo Trace_Err
    CapMouseOff
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc True, "PrnChoice:SelectedLanguage_Get"
    #End If

    SelectedLanguage = GetCodeFromCombo(cbo_Language)
    
Trace_End:
    #If CapDebug Then
        If Not go_Trace Is Nothing Then go_Trace.WriteTraceProc False, "PrnChoice:SelectedLanguage_Get", "result=" & SelectedLanguage
    #End If
    CapMouseOn
    Exit Property

Trace_Err:
    If Not go_Trace Is Nothing Then go_Trace.WriteTraceError Err.Number, Err.Description, "PrnChoice:SelectedLanguage_Get"
    CapMouseOn

End Property
