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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446
| Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
' enregister et envoyé
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Dim nom_fichier As String
Dim madate = CStr(Date.Today)
Dim fichierexiste
Dim i
Dim xlUp = 0
Dim numhot As Integer
madate = Replace(madate, "/", "-")
madate = Mid(madate, 4)
nom_fichier = ("c:\hotline\" & madate & " " & mesinfos.TextBox2.Text)
fichierexiste = My.Computer.FileSystem.FileExists("c:\hotline\" & madate & " " & mesinfos.TextBox2.Text & ".xls")
'contole de format des données
If mesinfos.TextBox2.Text = "" Then
info.Text = "Veuillez remplir le champs ITC dans mes infos."
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If ComboBox4.Text = "" Or ComboBox4.Text = "Temps Passée" Then
info.Text = "Veuillez sélectionner un TEMPS"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If ComboBox2.SelectedIndex = 0 Then
info.Text = "Veuillez sélectionner un Département"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If TextBox1.Text = "" Then
info.Text = "Veuillez remplir le champs Société"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If TextBox2.Text = "" Then
info.Text = "Veuillez remplir le champs Contact"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If IsNumeric(TextBox7.Text) = False Then
info.Text = "un Code Agence est composé de chiffres !"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If IsNumeric(TextBox4.Text) = False Then
info.Text = "un Compte SOON est composé de chiffres !"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If ComboBox3.SelectedIndex = 0 Then
info.Text = "Veuillez sélectionner une Famille Produit"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If TextBox3.Text = "" Then
info.Text = "Veuillez remplir le champs Demandeur hotline"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If TextBox6.Text = "" Then
info.Text = "Veuillez remplir le champs Questions"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If TextBox8.Text = "" Then
info.Text = "Veuillez remplir le champs Réponses"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If CheckBox1.Checked = True Then
If TextBox9.Text = "" And CheckBox1.Checked = True Then
info.Text = "l'adresse mail Demandeur est invalide..."
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
End If
If mesinfos.TextBox5.Text = "" And CheckBox1.Checked = True Then
info.Text = "l'adresse mail ITC est invalide..."
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If CheckBox1.Checked = True Then
If TextBox9.Text Like "?*@?*.??*" Then
Else
info.Text = "l'adresse mail du demandeur est invalide !"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If nbrcaractere.NbOc(TextBox9.Text, "@", False) > 1 Then
info.Text = "l'adresse mail du demandeur est invalide !"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
End If
If mesinfos.TextBox12.Text = "" And CheckBox1.Checked = True Then
info.Text = "User invalide...Voir dans mes infos !"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If mesinfos.TextBox11.Text = "" And CheckBox1.Checked = True Then
info.Text = "Password invalide...Voir dans mes infos !"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
If mesinfos.TextBox13.Text = "" And CheckBox1.Checked = True Then
info.Text = "SMTP invalide...Voir dans mes infos !"
System.Windows.Forms.Application.DoEvents()
Exit Sub
End If
'enregistrement des données
If fichierexiste Then
If CheckBox1.Checked = True Then
testconnexion.testconnexion()
If testok = True Then
If CheckBox3.Checked = False Then
principal.destinatairemail = TextBox9.Text
Else
principal.destinatairemail = TextBox9.Text & ";" & mesinfos.TextBox5.Text
End If
principal.entetemail = "réponse de votre demande de hotline"
principal.messagemail = "Bonjour," & vbLf & vbLf & "Veuillez trouver ci-dessous notre réponse :" & vbLf & vbLf & "ITC de Hotline : " & (mesinfos.TextBox2.Text) & vbLf & vbLf & "Date : " & (DateTimePicker1.Text) & vbLf & vbLf & "Client : " & (TextBox1.Text) & vbLf & vbLf & "Contact : " & (TextBox2.Text) & vbLf & vbLf & "TEL : " & (TextBox14.Text) & vbLf & vbLf & "Code Soon : " & (TextBox4.Text) & vbLf & vbLf & "Question : " & vbLf & (TextBox6.Text) & vbLf & vbLf & "Réponse : " & vbLf & (TextBox8.Text) & vbLf & vbLf & "Action Commerciale à mener : " & (TextBox10.Text) & vbLf & vbLf & "Temps Passée : " & (ComboBox4.Text) & " .Minutes" & vbLf & vbLf & vbLf & "Vous en Souhaitant Bonne Réception." & vbLf & "Cordialement." & vbLf & vbLf & (mesinfos.TextBox2.Text)
principal.piecejointemail = Label11.Text
envoimail.envoimail()
If mailok = True Then
Else
Exit Sub
End If
Else
Exit Sub
End If
End If
'Create a new instance of Excel
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Open(Filename:=nom_fichier & ".xls")
oSheet = oExcel.ActiveSheet
If oBook.ReadOnly = True Then
info.Text = "le fichier est déjà ouvert, veuillez fermer le fichier et Excel !"
System.Windows.Forms.Application.DoEvents()
oExcel.DisplayAlerts = False
oBook.close(Filename:=nom_fichier & ".xls")
oExcel.Quit()
oExcel.DisplayAlerts = True
oExcel = Nothing
oBook = Nothing
KillProcessus.KillProcessus("Excel")
Exit Sub
Else
With oExcel.Sheets("suivi hotline")
i = oExcel.WorksheetFunction.CountA(oExcel.Worksheets("suivi hotline").Columns(1))
i = i + 1.0
' demandeur
.Cells(i, 1).Numberformat = "@" 'Cellules au format texte
.Cells(i, 1).Value = TextBox3.Text
'noms ITC
.Cells(i, 2).Numberformat = "@" 'Cellules au format texte
.Cells(i, 2).Value = mesinfos.TextBox2.Text
' date
.Cells(i, 3).Value = DateTimePicker1.Text
' Temps passée
.Cells(i, 4).Value = ComboBox4.Text
' client
.Cells(i, 5).Numberformat = "@" 'Cellules au format texte
.Cells(i, 5).Value = TextBox1.Text
' contact client
.Cells(i, 6).Numberformat = "@" 'Cellules au format texte
.Cells(i, 6).Value = TextBox2.Text
' N° SOON
.Cells(i, 7).Value = TextBox4.Text
' code agence
.Cells(i, 8).Value = TextBox7.Text
'noms DEPARTEMENT
.Cells(i, 9).Numberformat = "@" 'Cellules au format texte
.Cells(i, 9).Value = ComboBox2.Text
' famille
.Cells(i, 10).Numberformat = "@" 'Cellules au format texte
.Cells(i, 10).Value = ComboBox3.Text
'Questions
.Cells(i, 11) = Replace(TextBox6.Text, Chr(13) & Chr(10), " ")
'Réponse
.Cells(i, 12) = Replace(TextBox8.Text, Chr(13) & Chr(10), " ")
'email
.Cells(i, 13).Numberformat = "@" 'Cellules au format texte
.Cells(i, 13).Value = TextBox9.Text
'action
.Cells(i, 14).Value = TextBox10.Text
'téléphone
'appel du module pour espace tel.
telephone = TextBox14.Text
ESPACE.espace(telephone, TextBox14.Text)
System.Windows.Forms.Application.DoEvents()
.Cells(i, 15).Numberformat = "@" 'Cellules au format texte
.Cells(i, 15).Value = TextBox14.Text
'attribution n° hotline
If (.cells((i - 1), 16).value) < 1 Then
.cells(i, 16).value = 1
Else
.cells(i, 16).value = (.cells((i - 1), 16).value) + 1
numhot = .cells(i, 16).value
End If
'autoajustage des colonnes
.Cells.Columns.AutoFit()
'fermeture des instances Excel
oExcel.DisplayAlerts = False
If Val(oExcel.Version) > 11 Then
oBook.Saveas(Filename:=nom_fichier, FileFormat:=56)
Else
oBook.Saveas(Filename:=nom_fichier & ".xls")
End If
oBook.close(Filename:=nom_fichier & ".xls")
oExcel.Quit()
oExcel.DisplayAlerts = True
oSheet = Nothing
oExcel = Nothing
oBook = Nothing
KillProcessus.KillProcessus("Excel")
info.Text = "Enregistrement réussi !"
System.Windows.Forms.Application.DoEvents()
MsgBox("Votre N° de hotline local est : " & numhot, MsgBoxStyle.Information, AcceptButton)
Timer3.Enabled = True
End With
Exit Sub
End If
Else
If CheckBox1.Checked = True Then
testconnexion.testconnexion()
If testok = True Then
If CheckBox3.Checked = False Then
principal.destinatairemail = TextBox9.Text
Else
principal.destinatairemail = TextBox9.Text & ";" & mesinfos.TextBox5.Text
End If
'appel du module pour espace tel.
telephone = TextBox14.Text
ESPACE.espace(telephone, TextBox14.Text)
System.Windows.Forms.Application.DoEvents()
principal.entetemail = "réponse de votre demande de hotline"
principal.messagemail = "Bonjour," & vbLf & vbLf & "Veuillez trouver ci-dessous notre réponse :" & vbLf & vbLf & "ITC de Hotline : " & (mesinfos.TextBox2.Text) & vbLf & vbLf & "Date : " & (DateTimePicker1.Text) & vbLf & vbLf & "Client : " & (TextBox1.Text) & vbLf & vbLf & "Contact : " & (TextBox2.Text) & vbLf & vbLf & "TEL : " & (TextBox14.Text) & vbLf & vbLf & "Code Soon : " & (TextBox4.Text) & vbLf & vbLf & "Question : " & (TextBox6.Text) & vbLf & vbLf & "Réponse : " & (TextBox8.Text) & vbLf & vbLf & "Action Commerciale à mener : " & (TextBox10.Text) & vbLf & vbLf & "Temps Passée : " & (ComboBox4.Text) & " .Minutes" & vbLf & vbLf & vbLf & "Vous en Souhaitant Bonne Réception." & vbLf & "Cordialement." & vbLf & vbLf & (mesinfos.TextBox2.Text)
principal.piecejointemail = Label11.Text
envoimail.envoimail()
If mailok = True Then
Else
Exit Sub
End If
Else
Exit Sub
End If
End If
'Create a new instance of Excel
oExcel = CreateObject("Excel.Application")
oBook = oExcel.Workbooks.Add
oSheet = oExcel.ActiveSheet
With oExcel.Sheets("Feuil1")
i = oExcel.WorksheetFunction.CountA(oExcel.Worksheets("feuil1").Columns(1))
i = i + 1.0
' demandeur
.Cells(i, 1).Value = "DEMANDEUR"
'noms ITC
.Cells(i, 2).Value = "NOMS ITC"
' date
.Cells(i, 3).Value = "DATE"
' temps passée
.Cells(i, 4).Value = "TEMPS"
' client
.Cells(i, 5).Value = "CLIENT"
' contact client
.Cells(i, 6).Value = "CONTACT"
' N° SOON
.Cells(i, 7).Value = "N° SOON"
' code agence
.Cells(i, 8).Value = "CODE AGENCE"
'noms DEPARTEMENT
.Cells(i, 9).Value = "DEPARTEMENT"
' famille
.Cells(i, 10).Value = "FAMILLE"
'Questions
.Cells(i, 11).Value = "QUESTIONS"
'Réponse
.Cells(i, 12).Value = "REPONSE"
'email
.Cells(i, 13).Value = "Email Demandeur"
'action
.Cells(i, 14).Value = "Action Commerciale ?"
'telephone
.Cells(i, 15).Value = "Tel Client"
'num hot
.Cells(i, 16).Value = "NUM HOTLINE"
i = i + 1
' demandeur
.Cells(i, 1).Numberformat = "@" 'Cellules au format texte
.Cells(i, 1).Value = TextBox3.Text
'noms ITC
.Cells(i, 2).Numberformat = "@" 'Cellules au format texte
.Cells(i, 2).Value = mesinfos.TextBox2.Text
' date
.Cells(i, 3).Value = DateTimePicker1.Text
' Temps passée
.Cells(i, 4).Value = ComboBox4.Text
' client
.Cells(i, 5).Numberformat = "@" 'Cellules au format texte
.Cells(i, 5).Value = TextBox1.Text
' contact client
.Cells(i, 6).Numberformat = "@" 'Cellules au format texte
.Cells(i, 6).Value = TextBox2.Text
' N° SOON
.Cells(i, 7).Value = TextBox4.Text
' code agence
.Cells(i, 8).Value = TextBox7.Text
'noms DEPARTEMENT
.Cells(i, 9).Numberformat = "@" 'Cellules au format texte
.Cells(i, 9).Value = ComboBox2.Text
' famille
.Cells(i, 10).Numberformat = "@" 'Cellules au format texte
.Cells(i, 10).Value = ComboBox3.Text
'Questions
.Cells(i, 11) = Replace(TextBox6.Text, Chr(13) & Chr(10), " ")
'Réponse
.Cells(i, 12) = Replace(TextBox8.Text, Chr(13) & Chr(10), " ")
'email
.Cells(i, 13).Numberformat = "@" 'Cellules au format texte
.Cells(i, 13).Value = TextBox9.Text
'action
.Cells(i, 14).Value = TextBox10.Text
'téléphone
'appel du module pour espace tel.
telephone = TextBox14.Text
ESPACE.espace(telephone, TextBox14.Text)
System.Windows.Forms.Application.DoEvents()
.Cells(i, 15).Numberformat = "@" 'Cellules au format texte
.Cells(i, 15).Value = TextBox14.Text
'attribution n° hotline
.cells(i, 16).value = 1
numhot = .cells(i, 16).value
.name = "suivi hotline" ' renomage de l'onglet
'autoajustage des colonnes
.Cells.Columns.AutoFit()
End With
With oExcel.Sheets("Feuil2")
i = oExcel.WorksheetFunction.CountA(oExcel.Worksheets("Feuil2").Columns(1))
i = i + 1.0
'creation nombre de demande incorrect
.Cells(i, 1).Value = "Demande Hotline incorrect"
' demandeur
.Cells(i, 2).Value = "DEMANDEUR"
'noms ITC
.Cells(i, 3).Value = "NOMS ITC"
' date
.Cells(i, 4).Value = "DATE"
.name = "demande incorrecte"
'autoajustage des colonnes
.Cells.Columns.AutoFit()
End With
With oExcel.Sheets("Feuil3")
i = oExcel.WorksheetFunction.CountA(oExcel.Worksheets("feuil3").Columns(1))
i = i + 1.0
' demandeur
.Cells(i, 1).Value = "DEMANDEUR"
'noms ITC
.Cells(i, 2).Value = "NOMS ITC"
' date
.Cells(i, 3).Value = "DATE"
' temps passée
.Cells(i, 4).Value = "TEMPS"
' client
.Cells(i, 5).Value = "CLIENT"
' contact client
.Cells(i, 6).Value = "CONTACT"
' N° DEVIS
.Cells(i, 7).Value = "N°DEVIS"
' MONTANT
.Cells(i, 8).Value = "MONTANT"
'noms DEPARTEMENT
.Cells(i, 9).Value = "DEPARTEMENT"
' famille
.Cells(i, 10).Value = "FAMILLE"
'Descriptif
.Cells(i, 11).Value = "DESCRIPTIF"
'telephone
.Cells(i, 12).Value = "Tel Client"
'implication avv
.Cells(i, 13).Value = "AVV Client"
'implication Définiton Produits
.Cells(i, 14).Value = "Définiton Produits"
'Validation Produits
.Cells(i, 15).Value = "Validation Produits"
'Relance Affaire
.Cells(i, 16).Value = "Suivi Affaire"
'Saisie Soon
.Cells(i, 17).Value = "Saisie Soon"
'Réserve
.Cells(i, 18).Value = "Traitement Solo"
.name = "suivi affaire" ' renomage de l'onglet
'autoajustage des colonnes
.Cells.Columns.AutoFit()
'fermeture des instances Excel
oExcel.DisplayAlerts = False
If Val(oExcel.Version) > 11 Then
oBook.Saveas(Filename:=nom_fichier, FileFormat:=56)
Else
oBook.Saveas(Filename:=nom_fichier & ".xls")
End If
oBook.close(Filename:=nom_fichier & ".xls")
oExcel.Quit()
oExcel.DisplayAlerts = True
oSheet = Nothing
oExcel = Nothing
oBook = Nothing
KillProcessus.KillProcessus("Excel")
End With
info.Text = "Enregistrement réussi !"
System.Windows.Forms.Application.DoEvents()
MsgBox("Votre N° de hotline local est : " & numhot, MsgBoxStyle.Information, AcceptButton)
Timer3.Enabled = True
End If
End Sub |