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
|
Try
Me.DataGridView1.Visible = True
strDateSys = CStr(Mid(Format(Date.Now, "dd/MM/yyyy"), 1, 10))
strDateDebut = CStr(Mid(Format(DateTimePicker3.Value, "dd/MM/yyyy"), 1, 10))
strDateFin = CStr(Mid(Format(DateTimePicker4.Value, "dd/MM/yyyy"), 1, 10))
'si un champ n'est pas rempli fin de procédure
If Me.TextBoxaffairefitech.Text = "" Or
Me.TextBoxfournitures.Text = "" Or
Me.TextBoxdevis.Text = "" Or
Me.TextBoxheures.Text = "" Or
Me.Combohdeb.Text = "" Or
Me.ComboBox2.Text = "" Or
Me.TextBoxheures.Text = "" Or
Me.ComboRespAffaire.Text = "" Or
Me.ComboBox4.Text = "" Or
Me.TextBoxLocation.Text = "" Or
Me.TextBoxDefChantier.Text = "" Or
Me.ComboBox4.Text = "" Or
Me.TextBoxheures.Text = "" Or
Me.ComboRespAffaire.Text = "" Or
Me.ComboBox2.Text = "" Or
Me.Combohdeb.Text = "" Or
Me.ComboBox1.Text = "" Then
MessageBox.Show("Vous devez remplir tous les champs !", "Erreur...", MessageBoxButtons.OK, MessageBoxIcon.Error)
Me.TextBoxaffairefitech.Focus()
Exit Sub
End If
'crátion d'une nouvelle ligne avec les données des textbox
dtr = dts.Tables("T_Affaires").NewRow
' dtr("IdClient") = Me.Txtref.Text
dtr("NFitech") = Me.TextBoxaffairefitech.Text
dtr("Montant") = Me.TextBoxdevis.Text
dtr("NbHeures") = Me.TextBoxheures.Text
dtr("MontFourni") = Me.TextBoxfournitures.Text
dtr("client") = Me.ComboBox1.Text
dtr("Respaff") = Me.ComboRespAffaire.Text
dtr("Lieux") = Me.TextBoxLocation.Text
dtr("Commentaire") = Me.TextBoxDefChantier.Text
dtr("Personnel") = Me.ComboBox4.Text
dtr("Datedebut") = strDateDebut
dtr("DateFin") = strDateFin
dtr("Dateenregis") = strDateSys
dtr("Hdebut") = Me.Combohdeb.Text
dtr("Hfin") = Me.ComboBox2.Text
'ajout de la ligne dans le DataSet
dts.Tables("T_Affaires").Rows.Add(dtr)
'création et exécution du commandbuilder
'pour mettre à jour le DataAdapter
cmdb = New OleDbCommandBuilder(dta)
'mise à jour des données du DataAdapter
'à partir du commandbuilder
dta.Update(dts, "T_Affaires")
'on vide le dataset pour le recréer avec
'les nouvelles données
dts.Clear()
dta.Fill(dts, "T_Affaires")
dtt = dts.Tables("T_Affaires")
'mise à jour de la datagrid
'DataGrid1.SetDataBinding(dts, "T_Affaires")
DataGridView1.DataSource = dtt
'affichage des données dans les texbox
' Me.Txtref.Text = dtt.Rows(rownum).Item("Idclient")
Me.TextBoxdevis.Text = dtt.Rows(rownum).Item("Montant")
Me.TextBoxheures.Text = dtt.Rows(rownum).Item("NbHeures")
Me.TextBoxfournitures.Text = dtt.Rows(rownum).Item("MontFourni")
Me.ComboRespAffaire.Text = dtt.Rows(rownum).Item("Respaff")
Me.TextBoxLocation.Text = dtt.Rows(rownum).Item("Lieux")
Me.TextBoxDefChantier.Text = dtt.Rows(rownum).Item("Commentaire")
Me.ComboBox4.Text = dtt.Rows(rownum).Item("Personnel")
strDateDebut = dtt.Rows(rownum).Item("Datedebut")
strDateFin = dtt.Rows(rownum).Item("Datefin")
strDateSys = dtt.Rows(rownum).Item("Dateenregis")
Me.Combohdeb.Text = dtt.Rows(rownum).Item("Hdebut")
Me.ComboBox2.Text = dtt.Rows(rownum).Item("Hfin")
btnmod.Enabled = True
btnsup.Enabled = True
btnajou.Enabled = True
btnenr.Enabled = False
btnajou.Text = "Ajouter"
Dim num As String = TextBoxaffairefitech.Text
Dim clienfitech As String
clienfitech = Mid(Me.ComboBox1.Text, 1, 20)
Dim PHOTOS As String = "PHOTOS"
Dim DOC As String = "DOCUMENTATIONS"
Dim PLANS As String = "PLANS"
Dim DEV As String = "DEVIS-COMMANDE CLIENT"
Dim DONCOMMC As String = "DOSSIER COMMERCIAL CLIENT"
Dim DONCOMMF As String = "DOSSIER COMMERCIAL FOURNISSEUR"
Dim FOUR As String = "FOURNITURES"
Dim COR As String = "CORRESPONDANCES"
Dim DEVIS As String = "DEVIS"
Dim COMMANDE As String = "COMMANDE"
Dim BONLIV As String = "BON DE LIVRAISON"
Dim DEVIS1 As String = "DEVIS"
Dim COMMANDE1 As String = "COMMANDE"
' If System.IO.Directory.Exists("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH") = False Then
System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & PHOTOS)
System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & DOC)
System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & PLANS)
' System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & FOUR)
System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & COR)
System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & DONCOMMC & "/" & BONLIV)
System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & DONCOMMC & "/" & COMMANDE)
System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & DONCOMMC & "/" & DEVIS)
System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & DONCOMMF & "/" & DEVIS1)
System.IO.Directory.CreateDirectory("C:\Users\Philippe GUILLOT\Desktop\Dossier Affaires FITECH" & "/" & clienfitech & " " & "N° Cde" & " " & num & "/" & DONCOMMF & "/" & COMMANDE1)
' End If
''''''''''''''''''''
''''##############################
''''#############################
Dim objApp As Outlook.Application
Dim objAppointment As Outlook.AppointmentItem
Dim hdeb, hfin As String
hdeb = Me.Combohdeb.Text
hfin = Me.ComboBox2.Text
objApp = New Outlook.Application
objAppointment = objApp.CreateItem(ItemType:=Outlook.OlItemType.olAppointmentItem)
varDate = DateTimePicker3.Text
varDate1 = DateTimePicker4.Text
Try
With objAppointment
.Importance = Outlook.OlImportance.olImportanceHigh
.Subject = Me.ComboBox1.Text + " " + Me.TextBoxLocation.Text + " " + Me.ComboRespAffaire.Text + " Affaire N°" + " " + Me.TextBoxaffairefitech.Text
.Location = TextBoxLocation.Text
.Start = varDate.AddHours(hdeb)
.End = varDate1.AddHours(hfin)
.BusyStatus = Outlook.OlBusyStatus.olOutOfOffice
.Body = Me.TextBoxDefChantier.Text
.Sensitivity = Outlook.OlSensitivity.olPrivate
.Save()
End With
'Catch ex As Exception
' MsgBox(ex)
Finally
objAppointment.Display()
' Me.Close()
End Try
Dim strdateSys1 As Date
strdateSys1 = CStr(Mid(Format(Date.Now, "dd/MM/yyyy"), 1, 10))
For x As Integer = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(x).Cells(7).Value < strdateSys1 Then
DataGridView1.Rows(x).DefaultCellStyle.BackColor = Color.Tomato
' MessageBox.Show("Attention le système a détécté un employé sans matricule ...", "Erreur...", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
If DataGridView1.Rows(x).Cells(7).Value > strdateSys1 Then
DataGridView1.Rows(x).DefaultCellStyle.BackColor = Color.LightGreen
' MessageBox.Show("Attention le système a détécté un employé sans matricule ...", "Erreur...", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
If DataGridView1.Rows(x).Cells(7).Value = strdateSys1 Then
DataGridView1.Rows(x).DefaultCellStyle.BackColor = Color.Orange
' MessageBox.Show("Attention le système a détécté un employé sans matricule ...", "Erreur...", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
' If DataGridView1.Rows(x).Cells(0).Value = Me.TextBoxaffairefitech.Text Then
' MessageBox.Show("Numéros d'affaire déja existant , recommencez !", "Modification...", MessageBoxButtons.OK, MessageBoxIcon.Information)
' End If
Next
Me.DataGridView1.Columns(0).HeaderText = "Numéro affaire FITECH"
Me.DataGridView1.Columns(1).HeaderText = "Montant du devis"
Me.DataGridView1.Columns(2).HeaderText = "Nombre d'heure(s)"
Me.DataGridView1.Columns(3).HeaderText = "Montant des fornitures"
Me.DataGridView1.Columns(4).HeaderText = "Nom du client"
Me.DataGridView1.Columns(5).HeaderText = "Nom du responsable affaire FITECH"
Me.DataGridView1.Columns(6).HeaderText = "Jour de début"
Me.DataGridView1.Columns(7).HeaderText = "Jour de fin"
Me.DataGridView1.Columns(8).HeaderText = "Date d'enregistrement de l'affaire"
Me.DataGridView1.Columns(9).HeaderText = "Lieu d'intervention"
Me.DataGridView1.Columns(10).HeaderText = "Commentaires"
Me.DataGridView1.Columns(11).HeaderText = "Nb de personnes"
Catch ex As Exception
MessageBox.Show("Numéros d'affaire déja existant , recommencez !", "Modification...", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
End Try |
Partager