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
| Dim strConnexion As String
Private objetDataAdapter As OleDb.OleDbDataAdapter
Public objetDataSet As New DataSet
Public objetRemDataSet As New DataSet
Private objetDataTable As New DataTable
Private objetCB As New OleDb.OleDbCommandBuilder
Private objetDataGridView As New DataGridView
'DEBUT FORM_LOAD
Private Sub frmRemunerations_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Me.txtBDD.LoadFile("\PAIE2\AFRIPAID\BDD.txt", RichTextBoxStreamType.PlainText)'Chaine de connexion stockée dans le fichier BDD
strConnexion = Me.txtBDD.Text.ToString' Recuperation de la chaine de connexion et la charger dans l'interface
Dim conneXion As New OleDb.OleDbConnection(strConnexion)
Dim cmdSelect, cmdVerification As New OleDb.OleDbCommand
Dim strErreur As String
strErreur = ""
cmdSelect.CommandText = "SELECT * FROM EMPLOYE" 'commande pour afficher les données des employés
cmdSelect.CommandType = CommandType.Text
cmdSelect.Connection = conneXion
conneXion.Open()
objetDataAdapter = New OleDb.OleDbDataAdapter(cmdSelect)
objetCB = New OleDb.OleDbCommandBuilder(objetDataAdapter)
objetDataAdapter.Fill(objetDataSet, "EMPLOYE")
objetDataTable = objetDataSet.Tables("EMPLOYE")
objetDataSet.Tables("EMPLOYE").Clear()
EMPLOYEDataGridView.DataBindings.Clear()
objetDataAdapter.Fill(objetDataSet, "EMPLOYE")
objetDataTable = objetDataSet.Tables("EMPLOYE")
EMPLOYEDataGridView.DataSource = objetDataTable 'affectation des données dans le datagridview
conneXion.Close()
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub 'FIN FORM_LOAD
Private Sub btnEnregistrerRem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnregistrerRem.Click
Try
Dim strMatricule, strNom, strDept, strService, strDescriptionPrime, strDescriptionCharges As String
Dim dblBase, dblSSalNet, dblAllocations, dblBrut, dblCotisation, dblCharges, dblPrimes, dblNetImposable, dblINSS1, dblINSS2, dblINSS3, dblCorrection, dblIPR, dblNetBanque, intNbJour As Long
Dim dblCoeff As Double
Dim conneXion As New OleDb.OleDbConnection(strConnexion)
Dim cmdAjouter As New OleDb.OleDbCommand
cmdAjouter.CommandText = "INSERT INTO REMUNERATION" & "(nb_jour,type_salaire,matricule,employe,departement,service,mois,annee,base,allocation,prime,charges,brute,cotisation,net_imposable,coefficient,val_correction,ipr,INSS_employe,INSS_employeur,INSS_risque_employeur,net_paye,date_paye,logement,deplacement,indfonction,pension,sal_net)" & "VALUES('" & intNbJour & "','Mensuel','" & strMatricule & "','" & strNom & "','" & strDept & "','" & strService & "','" & Me.lblMoisRem.Text & "','" & CType(Now.Year, Long) & "','" & dblBase & "','" & dblAllocations & "','" & dblPrimes & "','" & dblCharges & "','" & dblBrut & "','" & dblCotisation & "','" & dblNetImposable & "','" & dblCoeff & "','" & dblCorrection & "','" & dblIPR & "','" & dblINSS1 & "','" & dblINSS2 & "','" & dblINSS3 & "','" & dblNetBanque & "','" & Now.Date.ToShortDateString & "','" & dblIndLog & "','" & dblIndDepl & "'," & dblIndFx & "," & dblPensionComplementaire & "," & dblSSalNet & ");"
cmdAjouter.CommandType = CommandType.Text
cmdAjouter.Connection = conneXion
conneXion.Open()
cmdAjouter.ExecuteNonQuery()
conneXion.Close()
Me.Refresh()
MsgBox("L'opération a été enregistrée avec succès!", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "PAID: Opération réussie")
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try
End Sub |
Partager