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
|
protected void GridViewListePrestations_SelectedIndexChanged(object sender, EventArgs e)
{
//GridViewListePrestations.DataBind();
GridView Gv = (GridView)GridViewListePrestations;
if ((Gv.SelectedRow.RowState & DataControlRowState.Selected) == DataControlRowState.Selected)
{
DataRowView _rowview = (DataRowView)Gv.SelectedRow.DataItem;
//Récupération des valeurs de la sélection à ajouter à la vente
string _codeitem = _rowview.Row.ItemArray[1].ToString();
int _idPrestation = (int)_rowview.Row.ItemArray[2];
string _prestation = _rowview.Row.ItemArray[3].ToString();
double _tarif = (double)_rowview.Row.ItemArray[9];
double _tva = (double)_rowview.Row.ItemArray[10];
//Calcul de la valeur Hors TVA
double _tarif_ht;
if (_tva == 0 || _tva == null)
_tarif_ht = 0;
else
_tarif_ht = _tarif / (1 + _tva);
//Calcul de la valeur remisée
double _val_remisee;
_val_remisee = _tarif;
//Récupération de l'ID_VENTE du détailsview
DetailsView Dv = (DetailsView)DetailsViewVente;
int _idVente = (int)Dv.DataKey.Value;
//Insertion d'une ligne dans la table T_VENTE_DETAIL
VenteDetailBLL _DetailVente = new VenteDetailBLL();
//Paramètres: @ID_VENTE,@ID_ARTICLE,@ID_PRESTATION,@Code_Item,@Item,@Prix_Unitaire_HT,@Taux_TVA
// @Prix_Unitaire_TTC,@Quantite,@Remise,@Total_Article
_DetailVente.InsertVenteDetail(_idVente, 0, _idPrestation, _codeitem, _prestation, _tarif_ht, _tva, _tarif, 1, 0, _val_remisee);
//Mise à jour de l'affichage dans le gridview
ODS_PrestationsRDV.Select();
//ODS_PrestationsRDV.DataBind();
GridViewDetailVente.DataBind();
}
} |
Partager