public static void TotalTaxeContenuDoc(Facture doc, Contenu cont) { double taux = 0; double s = cont.PrixTotal; double r = cont.RemiseArt + cont.RemiseCat; CategorieComptable c = doc.Categorie; if (c != null) { foreach (ArticleComptable a in c.Articles) { if (a.Article.Equals(cont.Article.Article) && a.Actif) { foreach (ArticleTaxe t in a.Articles) { taux += (s * (t.Taxe.Taux / 100)); if (t.AppRemise) { taux += (r * (t.Taxe.Taux / 100)); } } } } } cont.PrixTaxe = taux; doc.MontantTaxe += taux; }
public static List <CategorieComptable> getListCategorieComptable(String query) { NpgsqlConnection con = Connexion.Connection(); try { List <CategorieComptable> l = new List <CategorieComptable>(); NpgsqlCommand Lcmd = new NpgsqlCommand(query, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); if (lect.HasRows) { while (lect.Read()) { CategorieComptable a = new CategorieComptable(); a.Id = Convert.ToInt64(lect["id"].ToString()); a.CodeAppel = lect["code_appel"].ToString(); a.Designation = lect["designation"].ToString(); a.Articles = BLL.ArticleComptableBll.Liste("select * from yvs_base_article_categorie_comptable where categorie = " + a.Id); a.Update = true; l.Add(a); } lect.Close(); } return(l); } catch (NpgsqlException e) { Messages.Exception(e); return(null); } finally { Connexion.Deconnection(con); } }
public static CategorieComptable getOneCategorieComptable(long id) { NpgsqlConnection con = Connexion.Connection(); try { String search = "select * from yvs_base_categorie_comptable where id = " + id + ""; NpgsqlCommand Lcmd = new NpgsqlCommand(search, con); NpgsqlDataReader lect = Lcmd.ExecuteReader(); CategorieComptable a = new CategorieComptable(); if (lect.HasRows) { while (lect.Read()) { a.Id = Convert.ToInt64(lect["id"].ToString()); a.CodeAppel = lect["code_appel"].ToString(); a.Designation = lect["designation"].ToString(); a.Articles = BLL.ArticleComptableBll.Liste("select * from yvs_base_article_categorie_comptable where categorie = " + a.Id); a.Update = true; } lect.Close(); } return(a); } catch (NpgsqlException e) { Messages.Exception(e); return(null); } finally { Connexion.Deconnection(con); } }
public static CategorieComptable getAjoutCategorieComptable(CategorieComptable a) { NpgsqlConnection con = Connexion.Connection(); try { string insert = ""; NpgsqlCommand cmd = new NpgsqlCommand(insert, con); cmd.ExecuteNonQuery(); a.Id = getCurrent(); return(a); } catch { return(null); } finally { Connexion.Deconnection(con); } }
public static bool getUpdateCategorieComptable(CategorieComptable a) { NpgsqlConnection con = Connexion.Connection(); try { string update = ""; NpgsqlCommand Ucmd = new NpgsqlCommand(update, con); Ucmd.ExecuteNonQuery(); return(true); } catch (Exception e) { Messages.Exception(e); return(false); } finally { Connexion.Deconnection(con); } }
public CategorieComptableBll(CategorieComptable unCategorieComptable) { categorie = unCategorieComptable; }