1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| For Each uneLigne As DataGridViewRow In dgv_com_cli.Rows
If (uneLigne.Cells(8).Value <> 1) Then
If IsNumeric(uneLigne.Cells(0).Value.ToString()) Then
'Instancier un objet Commande
Obj_Command = New OleDbCommand()
'initialiser l'objet Command
Obj_Command.Connection = laConnection
Obj_Command.CommandText = "INSERT INTO LIGNE_COMMANDE_CLIENT(COM_ID,TYPE_ART_ID,LC_HT,LC_ECO_PART,LC_REMISE,LC_QTTE_ART,LC_TOTAL_LIGNE_HT,LC_TVA,LC_TOTAL_LIGNE_TTC) VALUES(" + tbx_com_cli_code.Text + "," + uneLigne.Cells(0).Value.ToString() + "," + Replace(uneLigne.Cells(2).Value.ToString(), ",", ".") + ",0.00," + Replace(uneLigne.Cells(4).Value.ToString(), ",", ".") + "," + Replace(uneLigne.Cells(3).Value.ToString(), ",", ".") + "," + Replace(uneLigne.Cells(5).Value.ToString(), ",", ".") + "," + Replace(fromPercent(uneLigne.Cells(6).Value.ToString()), ",", ".").ToString() + "," + Replace(uneLigne.Cells(7).Value.ToString(), ",", ".") + ")"
Obj_Command.ExecuteNonQuery()
Else
'Instancier un objet Commande
Obj_Command = New OleDbCommand()
'initialiser l'objet Command
Obj_Command.Connection = laConnection
Obj_Command.CommandText = "UPDATE LIGNE_COMMANDE_CLIENT SET LC_ECO_PART=" + Replace(uneLigne.Cells(2).Value.ToString(), ",", ".") + ",LC_TOTAL_LIGNE_HT=LC_TOTAL_LIGNE_HT+" + Replace(uneLigne.Cells(5).Value.ToString(), ",", ".") + ",LC_TOTAL_LIGNE_TTC=LC_TOTAL_LIGNE_TTC+" + Replace(uneLigne.Cells(7).Value.ToString(), ",", ".") + " WHERE COM_ID=" + tbx_com_cli_code.Text + " AND TYPE_ART_ID=" + Replace(uneLigne.Cells(0).Value.ToString(), "EP", "") + ""
Obj_Command.ExecuteNonQuery()
End If |