1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
| Private Function InitialisationDuTableauRemarques(ByVal projectName As String) As Boolean
Dim params As Variant
Dim ligneCourant As Integer
Dim objDBHelper As New DBHelper
Dim cnx As ADODB.Connection
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim prm As ADODB.Parameter
Dim identifiant As Integer
Dim sequenceCourant As String
Dim premiereLigne As Integer
Dim premiereFois As Boolean
Dim remarquesPresents As Boolean
premiereFois = True
Set cnx = New ADODB.Connection
With cnx
.ConnectionString = objDBHelper.GetConnectionString
Call .Open
End With
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnection = cnx
.CommandType = adCmdStoredProc
.CommandText = "usp_MSP_Extract_Tableau"
Set prm = cmd.CreateParameter("@ProjectName", adVarChar, adParamInput, 4000, projectName)
Call .Parameters.Append(prm)
End With
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cnx
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenForwardOnly
End With
Call rs.Open(cmd, , , , adCmdStoredProc)
'Affichage du résultat
With rs
If .RecordCount > 0 Then
Do While rs.EOF = False
If (IsNull(rs!Notes) = False) And (rs!Notes = True) And (IsNull(rs!RNotes) = False) And (rs!RNotes = True) Then '''''''''' j'ai commenté cette ligne
''And IsNull(rs!Notes) = False And rs!Notes = True
''IsNull(rs!RNotes) = False And rs!RNotes = True
remarquesPresents = True
If premiereFois = True Then
Call ConstructionDeLEnteteDuTableauRemarque
Call Application.Goto(Reference:="PremiereLigneDuTableauRemarque")
premiereLigne = ActiveCell.Value
Call Application.Goto(Reference:="ORIGINE")
ligneCourant = premiereLigne - PremiereLigneDuTableauPrincipal + 1
premiereFois = False
End If
If IsNull(rs!Sequence) = False Then
'Il faut rajouter un index pour toutes les ressources uniquements
If IsNull(rs!DisplayOrder) = False Then
'1 : Correspond à une tâche
'2 : Correspond à une ressource
If rs!DisplayOrder = 1 Then
sequenceCourant = rs!Sequence
identifiant = 0
Else
identifiant = identifiant + 1
sequenceCourant = rs!Sequence & "." & identifiant
End If
ActiveCell.Offset(ligneCourant, -2).Value = rs!DisplayOrder
End If
ActiveCell.Offset(ligneCourant, -1).Value = "'" & CStr(sequenceCourant)
End If
If IsNull(rs!ProjectCode) = False Then
ActiveCell.Offset(ligneCourant, 0).Value = rs!ProjectCode
End If
If IsNull(rs!TaskName) = False Then
ActiveCell.Offset(ligneCourant, 1).Value = rs!TaskWBS & " / " & rs!TaskName '''''' mon rajout pour le code WBS
End If
If IsNull(rs!Notes) = False Then
ActiveCell.Offset(ligneCourant, 2).Value = rs!Notes
End If
ligneCourant = ligneCourant + 1
End If
Call .MoveNext
Loop
End If
Call .Close
End With
Call cnx.Close
InitialisationDuTableauRemarques = remarquesPresents
Set cnx = Nothing
Set rs = Nothing
End Function |
Partager