Example #1
0
 public static Facture getAjoutFacture(Facture a)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         string insert = "insert into yvs_com_doc_ventes"
                 + "(num_piece, type_doc, statut, client,  supp, actif, "
                 + "num_doc, entete_doc, heure_doc, montant_avance, solde, date_save, mouv_stock)"
                 + "values ('" + a.NumPiece + "', '" + a.TypeDoc + "', '" + a.Statut + "', " + a.Client.Id + ",  false, true, "
                 + "'" + a.NumDoc + "', " + a.Entete.Id + ", '" + a.HeureDoc.ToString("T") + "', " + a.MontantAvance + ", " + a.Solde + ", '" + DateTime.Now + "', " + a.MouvStock + ")"; ;
         if ((a.Categorie != null) ? a.Categorie.Id > 0 : false)
         {
             insert = "insert into yvs_com_doc_ventes"
                 + "(num_piece, type_doc, statut, client, categorie_comptable, supp, actif, "
                 + "num_doc, entete_doc, heure_doc, montant_avance, solde, date_save, mouv_stock)"
                 + "values ('" + a.NumPiece + "', '" + a.TypeDoc + "', '" + a.Statut + "', " + a.Client.Id + ", " + a.Categorie.Id + ", false, true, "
                 + "'" + a.NumDoc + "', " + a.Entete.Id + ", '" + a.HeureDoc.ToString("T") + "', " + a.MontantAvance + ", " + a.Solde + ", '" + DateTime.Now + "', " + a.MouvStock + ")";
         }
         NpgsqlCommand cmd = new NpgsqlCommand(insert, con);
         cmd.ExecuteNonQuery();
         a.Id = getCurrent();
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Example #2
0
 public static bool ChangeEtat(Facture f)
 {
     try
     {
         return FactureDao.getChangeEtatFacture(f);
     }
     catch (Exception ex)
     {
         throw new Exception("Impossible de modifier cette enregistrement", ex);
     }
 }
Example #3
0
 public static bool getChangeEtatFacture(Facture a)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         string delete = "update yvs_com_doc_ventes set statut = '" + a.Statut + "' where id = " + a.Id;
         NpgsqlCommand Ucmd = new NpgsqlCommand(delete, con);
         Ucmd.ExecuteNonQuery();
         return true;
     }
     catch (Exception e)
     {
         Messages.Exception(e);
         return false;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
 private void ResetFicheFacture()
 {
     rowFacture = -1;
     facture = new Facture();
     facture.TypeDoc = Constantes.TYPE_FV;
     facture.Statut = Constantes.ETAT_EN_ATTENTE;
     facture.Client = BLL.ClientBll.Default();
     facture.Categorie = facture.Client.Categorie;
     facture.HeureDoc = DateTime.Now;
     facture.MouvStock = true;
     com_client.ResetText();
     dgv_contenu.Rows.Clear();
     dgv_reglement.Rows.Clear();
     configClient(facture.Client);
     com_typeDoc.Text = "Facture";
     SetStateFacture(true);
     configFacture(null);
     ResetFicheContenu();
 }
Example #5
0
 private static void TotalRemiseDoc(RemiseFacture r, Facture doc)
 {
     double qte = 0;
     foreach (Contenu c in doc.Contenus)
     {
         qte += c.Quantite;
     }
     Remise r_ = r.Remise;
     double remise = MontantRemise(r.Remise, qte, doc.MontantTTC);
     r.Montant = remise;
     doc.MontantRemise += remise;
 }
Example #6
0
 public static void TotalRRRDoc(Facture doc)
 {
     if (doc.Remises != null)
     {
         foreach (RemiseFacture r in doc.Remises)
         {
             if (r.Remise != null)
             {
                 double mtant = doc.MontantTTC;
                 TotalRemiseDoc(r, doc);
                 doc.MontantTTC = mtant - r.Montant;
             }
         }
     }
 }
 private void DeleteCurrentFacture(Facture f)
 {
     if ((f != null) ? f.Id > 0 : false)
     {
         String type = f.TypeDoc;
         String etat = f.Statut;
         switch (type)
         {
             case Constantes.TYPE_BCV:
                 Constantes.Entete.Commandes.Remove(f);
                 dgv_commande.Rows.RemoveAt(Utils.GetRowData(dgv_commande, f.Id));
                 break;
             case Constantes.TYPE_FV:
                 switch (etat)
                 {
                     case Constantes.ETAT_EN_ATTENTE:
                         Constantes.Entete.FacturesEnAttente.Remove(f);
                         dgv_facture_wait.Rows.RemoveAt(Utils.GetRowData(dgv_facture_wait, f.Id));
                         break;
                     case Constantes.ETAT_EN_COURS:
                         Constantes.Entete.FacturesEnCours.Remove(f);
                         dgv_facture_cours.Rows.RemoveAt(Utils.GetRowData(dgv_facture_cours, f.Id));
                         break;
                     case Constantes.ETAT_REGLE:
                         Constantes.Entete.FacturesRegle.Remove(f);
                         dgv_facture_regle.Rows.RemoveAt(Utils.GetRowData(dgv_facture_regle, f.Id));
                         break;
                 }
                 break;
         }
     }
 }
 private void AddRowFacture(DataGridView data, Facture f)
 {
     if (f != null)
     {
         data.Rows.Add(new object[] { f.Id, f.NumDoc, f.HeureDoc.ToString("T"), f.Client.Nom_prenom, f.MontantTTC, f.MontantReste, null, f.Supp });
     }
 }
 private void UpdateRowFacture(DataGridView data, Facture f)
 {
     data.Rows.RemoveAt(Utils.GetRowData(data, f.Id));
     AddRowFacture(data, f);
 }
 private void SetCurrentFacture(long id, bool supp, DataGridView data)
 {
     if (id > 0)
     {
         Facture f = new Facture(id);
         switch (data.Name)
         {
             case "dgv_commande":
                 f = Constantes.Entete.Commandes.Find(x => x.Id == id);
                 f.Supp = supp;
                 Constantes.Entete.Commandes[Constantes.Entete.Commandes.FindIndex(x => x.Id == f.Id)] = f;
                 UpdateRowFacture(dgv_commande, f);
                 break;
             case "dgv_facture_wait":
                 f = Constantes.Entete.FacturesEnAttente.Find(x => x.Id == id);
                 f.Supp = supp;
                 Constantes.Entete.FacturesEnAttente[Constantes.Entete.FacturesEnAttente.FindIndex(x => x.Id == f.Id)] = f;
                 UpdateRowFacture(dgv_facture_wait, f);
                 break;
             case "dgv_facture_cours":
                 f = Constantes.Entete.FacturesEnCours.Find(x => x.Id == id);
                 f.Supp = supp;
                 Constantes.Entete.FacturesEnCours[Constantes.Entete.FacturesEnCours.FindIndex(x => x.Id == f.Id)] = f;
                 UpdateRowFacture(dgv_facture_cours, f);
                 break;
             case "dgv_facture_regle":
                 f = Constantes.Entete.FacturesRegle.Find(x => x.Id == id);
                 f.Supp = supp;
                 Constantes.Entete.FacturesRegle[Constantes.Entete.FacturesRegle.FindIndex(x => x.Id == f.Id)] = f;
                 UpdateRowFacture(dgv_facture_regle, f);
                 break;
         }
     }
 }
Example #11
0
 public static Facture getOneFacture_(String reference)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_com_doc_ventes where num_doc like '" + reference + "' order by num_doc desc limit 1";
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         Facture a = new Facture();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Supp = (Boolean)((lect["supp"] != null) ? (!lect["supp"].ToString().Trim().Equals("") ? lect["supp"] : false) : false);
                 var t = lect["impression"];
                 a.Impression = (Int32)((lect["impression"] != null) ? (!lect["impression"].ToString().Trim().Equals("") ? lect["impression"] : 0) : 0);
                 a.Solde = Convert.ToBoolean((lect["solde"] != null) ? (!lect["solde"].ToString().Trim().Equals("") ? lect["solde"].ToString().Trim() : "false") : "false");
                 a.Categorie = (lect["categorie_comptable"] != null
                     ? (!lect["categorie_comptable"].ToString().Trim().Equals("")
                     ? BLL.CategorieComptableBll.One(Convert.ToInt64(lect["categorie_comptable"].ToString()))
                     : new CategorieComptable())
                     : new CategorieComptable());
                 a.Client = (lect["client"] != null
                     ? (!lect["client"].ToString().Trim().Equals("")
                     ? BLL.ClientBll.One(Convert.ToInt64(lect["client"].ToString()))
                     : new Client())
                     : new Client());
                 a.HeureDoc = Convert.ToDateTime((lect["heure_doc"] != null) ? (!lect["heure_doc"].ToString().Trim().Equals("") ? lect["heure_doc"].ToString().Trim() : "00/00/0000") : "00/00/0000");
                 a.NumDoc = lect["num_doc"].ToString();
                 a.NumPiece = lect["num_piece"].ToString();
                 a.TypeDoc = lect["type_doc"].ToString();
                 a.Statut = lect["statut"].ToString();
                 a.MontantAvance = (Double)((lect["montant_avance"] != null) ? ((!lect["montant_avance"].ToString().Trim().Equals("")) ? lect["montant_avance"] : 0) : 0);
                 a.Contenus = BLL.ContenuBll.Liste("select * from yvs_com_contenu_doc_vente where doc_vente = " + a.Id);
                 a.Remises = BLL.RemiseFactureBll.Liste("select * from yvs_com_remise_doc_vente where doc_vente = " + a.Id);
                 a.Update = true;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Example #12
0
 public static Facture getOneFacture(long id)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         String search = "select * from yvs_com_doc_ventes where id = " + id;
         NpgsqlCommand Lcmd = new NpgsqlCommand(search, con);
         NpgsqlDataReader lect = Lcmd.ExecuteReader();
         Facture a = new Facture();
         if (lect.HasRows)
         {
             while (lect.Read())
             {
                 a.Id = Convert.ToInt64(lect["id"].ToString());
                 a.Solde = Convert.ToBoolean((lect["solde"] != null) ? (!lect["solde"].ToString().Trim().Equals("") ? lect["solde"].ToString().Trim() : "false") : "false");
                 a.Supp = (Boolean)((lect["supp"] != null) ? (!lect["supp"].ToString().Trim().Equals("") ? lect["supp"] : false) : false);
                 a.Impression = (Int32)((lect["impression"] != null) ? (!lect["impression"].ToString().Trim().Equals("") ? lect["impression"] : 0) : 0);
                 a.Categorie = (lect["categorie_comptable"] != null
                     ? (!lect["categorie_comptable"].ToString().Trim().Equals("")
                     ? BLL.CategorieComptableBll.One(Convert.ToInt64(lect["categorie_comptable"].ToString()))
                     : new CategorieComptable())
                     : new CategorieComptable());
                 a.Client = (lect["client"] != null
                     ? (!lect["client"].ToString().Trim().Equals("")
                     ? BLL.ClientBll.One(Convert.ToInt64(lect["client"].ToString()))
                     : new Client())
                     : new Client());
                 a.HeureDoc = Convert.ToDateTime((lect["heure_doc"] != null) ? (!lect["heure_doc"].ToString().Trim().Equals("") ? lect["heure_doc"].ToString().Trim() : "00/00/0000") : "00/00/0000");
                 a.NumDoc = lect["num_doc"].ToString();
                 a.NumPiece = lect["num_piece"].ToString();
                 a.TypeDoc = lect["type_doc"].ToString();
                 a.Statut = lect["statut"].ToString();
                 a.MontantAvance = (Double)((lect["montant_avance"] != null) ? ((!lect["montant_avance"].ToString().Trim().Equals("")) ? lect["montant_avance"] : 0) : 0);
                 a.Contenus = BLL.ContenuBll.Liste("select * from yvs_com_contenu_doc_vente where doc_vente = " + a.Id);
                 a.Remises = BLL.RemiseFactureBll.Liste("select * from yvs_com_remise_doc_vente where doc_vente = " + a.Id);
                 a.Mensualites = BLL.MensualiteBll.Liste("select * from yvs_com_mensualite_facture_vente where facture = " + a.Id + " order by date_reglement");
                 double mtant = 0;
                 foreach (Mensualite m in a.Mensualites)
                 {
                     mtant += m.MontantVerse;
                     foreach (PieceCaisse p in m.Reglements)
                     {
                         a.Reglements.Add(p);
                     }
                 }
                 if (mtant > a.MontantAvance)
                 {
                     a.MontantAvance = mtant;
                 }
                 Utils.MontantTotalDoc(a);
                 a.Update = true;
             }
             lect.Close();
         }
         return a;
     }
     catch (NpgsqlException e)
     {
         Messages.Exception(e);
         return null;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
Example #13
0
 public FactureBll(Facture unFacture)
 {
     facture = unFacture;
 }
Example #14
0
 public bool Control(Facture bean)
 {
     if (bean == null)
     {
         TOOLS.Messages.ShowErreur("La facture ne peut pas être nulle!");
         return false;
     }
     if ((bean.client == null) ? bean.client.Id > 0 : false)
     {
         TOOLS.Messages.ShowErreur("Vous devez entrer le client!");
         return false;
     }
     if (bean.typeDoc == null || bean.typeDoc.Trim().Equals(""))
     {
         bean.typeDoc = TOOLS.Constantes.TYPE_FV;
     }
     if (bean.numDoc == null || bean.numDoc.Trim().Equals(""))
     {
         bean.numDoc = TOOLS.Utils.GenererReference(TOOLS.Constantes.DOC_FACTURE);
     }
     if (bean.statut == null || bean.statut.Trim().Equals(""))
     {
         bean.statut = TOOLS.Constantes.ETAT_EN_COURS;
     }
     return true;
 }
 private void configFacture(Facture f)
 {
     if (f != null)
     {
         lb_numPiece.Text = f.NumDoc;
         txt_reference.Text = f.NumPiece;
         txt_montantTTC.Text = f.MontantTTC.ToString();
         txt_montantReste.Text = f.MontantReste.ToString();
         txt_montantVerse.Text = f.MontantAvance.ToString();
         txt_montantRemise.Text = f.MontantRemise.ToString();
         txt_montantHt.Text = f.MontantHT.ToString();
     }
     else
     {
         lb_numPiece.Text = Utils.GenererReference(Constantes.DOC_FACTURE);
         txt_reference.ResetText();
         txt_montantTTC.Text = "0";
         txt_montantReste.Text = "0";
         txt_montantVerse.Text = "0";
         txt_montantRemise.Text = "0";
         txt_montantHt.Text = "0";
     }
 }
 private Facture RecopieViewFacture()
 {
     Facture f = new Facture();
     f.Id = fact.Id;
     f.Categorie = fact.Categorie;
     f.Client = clientZero;
     f.Entete = Constantes.Entete;
     f.HeureDoc = DateTime.Now;
     f.MontantAvance = Convert.ToDouble(SommeVersee.Text.Trim());
     f.MontantTTC = Convert.ToDouble(SommeP.Text.Trim());
     f.MontantReste = Convert.ToDouble(Relicat.Text.Trim());
     f.Update = fact.Update;
     f.Statut = fact.Statut;
     f.TypeDoc = fact.TypeDoc;
     f.Solde = fact.Solde;
     if (fact.Update)
     {
         f.NumDoc = lb_numPiece.Text;
     }
     else
     {
         switch (fact.TypeDoc)
         {
             case Constantes.TYPE_BCV:
                 f.NumDoc = Utils.GenererReference(Constantes.DOC_COMMANDE);
                 break;
             case Constantes.TYPE_FV:
                 f.NumDoc = Utils.GenererReference(Constantes.DOC_FACTURE);
                 break;
         }
     }
     f.NumPiece = txt_reference.Text.Trim();
     f.MontantCommission = fact.MontantCommission;
     f.MontantHT = fact.MontantHT;
     f.MontantRemise = fact.MontantRemise;
     f.MontantRistourne = fact.MontantRistourne;
     f.MontantTaxe = fact.MontantTaxe;
     f.New_ = true;
     f.Contenus = fact.Contenus;
     f.Mensualites = fact.Mensualites;
     f.Remises = fact.Remises;
     f.MouvStock = fact.MouvStock;
     return f;
 }
 private void ResetFicheFacture()
 {
     rowFacture = -1;
     fact = new Facture();
     fact.TypeDoc = Constantes.TYPE_FV;
     fact.Statut = Constantes.ETAT_EN_ATTENTE;
     fact.Client = BLL.ClientBll.Default();
     fact.Categorie = clientZero.Categorie;
     fact.HeureDoc = DateTime.Now;
     fact.MouvStock = true;
     dataGridView1.Rows.Clear();
     dgv_reglement.Rows.Clear();
     fact.Client = clientZero;
     com_typeDoc.Text = "Facture";
     SetStateFacture(true);
     configFacture(null);
     contenu = new Contenu();
 }
Example #18
0
 public static bool getUpdateFacture(Facture a)
 {
     NpgsqlConnection con = Connexion.Connection();
     try
     {
         string update = "update yvs_com_doc_ventes set "
             + " num_piece = '" + a.NumPiece + "', type_doc = '" + a.TypeDoc + "', statut = '" + a.Statut + "', client = " + a.Client.Id + ","
             + " num_doc = '" + a.NumDoc + "', entete_doc = " + a.Entete.Id + ", heure_doc = '" + a.HeureDoc.ToString("T") + "',"
             + " montant_avance = " + a.MontantAvance + ", solde = " + a.Solde + ", date_save = '" + DateTime.Now + "', mouv_stock = " + a.MouvStock + ""
             + " where id = " + a.Id;
         if ((a.Categorie != null) ? a.Categorie.Id > 0 : false)
         {
             update = "update yvs_com_doc_ventes set "
                 + " num_piece = '" + a.NumPiece + "', type_doc = '" + a.TypeDoc + "', statut = '" + a.Statut + "', client = " + a.Client.Id + ","
                 + " categorie_comptable = " + a.Categorie.Id + ", num_doc = '" + a.NumDoc + "', entete_doc = " + a.Entete.Id + ", heure_doc = '" + a.HeureDoc.ToString("T") + "',"
                 + " montant_avance = " + a.MontantAvance + ", solde = " + a.Solde + ", date_save = '" + DateTime.Now + "', mouv_stock = " + a.MouvStock + ""
                 + " where id = " + a.Id;
         }
         NpgsqlCommand Ucmd = new NpgsqlCommand(update, con);
         Ucmd.ExecuteNonQuery();
         return true;
     }
     catch (Exception e)
     {
         Messages.Exception(e);
         return false;
     }
     finally
     {
         Connexion.Deconnection(con);
     }
 }
 private void UpdateCurrentFacture(Facture f)
 {
     if ((f != null) ? f.Id > 0 : false)
     {
         String type = f.TypeDoc;
         String etat = f.Statut;
         switch (type)
         {
             case Constantes.TYPE_BCV:
                 Constantes.Entete.Commandes[Constantes.Entete.Commandes.FindIndex(x => x.Id == f.Id)] = f;
                 UpdateRowFacture(dgv_commande, f);
                 break;
             case Constantes.TYPE_FV:
                 switch (etat)
                 {
                     case Constantes.ETAT_EN_ATTENTE:
                         Constantes.Entete.FacturesEnAttente[Constantes.Entete.FacturesEnAttente.FindIndex(x => x.Id == f.Id)] = f;
                         UpdateRowFacture(dgv_facture_wait, f);
                         break;
                     case Constantes.ETAT_EN_COURS:
                         Constantes.Entete.FacturesEnCours[Constantes.Entete.FacturesEnCours.FindIndex(x => x.Id == f.Id)] = f;
                         UpdateRowFacture(dgv_facture_cours, f);
                         break;
                     case Constantes.ETAT_REGLE:
                         Constantes.Entete.FacturesRegle[Constantes.Entete.FacturesRegle.FindIndex(x => x.Id == f.Id)] = f;
                         UpdateRowFacture(dgv_facture_regle, f);
                         break;
                 }
                 break;
         }
     }
 }
 public void FullContenu(Facture f)
 {
     if (f != null)
     {
         foreach (Contenu c in f.Contenus)
         {
             AddRowContenu(c);
         }
     }
 }
 private void AddCurrentFacture(Facture f)
 {
     if (f != null)
     {
         String type = f.TypeDoc;
         String etat = f.Statut;
         switch (type)
         {
             case Constantes.TYPE_BCV:
                 Constantes.Entete.Commandes.Add(f);
                 AddRowFacture(dgv_commande, f);
                 break;
             case Constantes.TYPE_FV:
                 switch (etat)
                 {
                     case Constantes.ETAT_EN_ATTENTE:
                         Constantes.Entete.FacturesEnAttente.Add(f);
                         AddRowFacture(dgv_facture_wait, f);
                         break;
                     case Constantes.ETAT_EN_COURS:
                         Constantes.Entete.FacturesEnCours.Add(f);
                         AddRowFacture(dgv_facture_cours, f);
                         break;
                     case Constantes.ETAT_REGLE:
                         Constantes.Entete.FacturesRegle.Add(f);
                         AddRowFacture(dgv_facture_regle, f);
                         break;
                 }
                 break;
         }
     }
 }
 public void FullReglement(Facture f)
 {
     if (f != null)
     {
         foreach (PieceCaisse p in f.Reglements)
         {
             AddRowReglement(p);
         }
     }
 }
 private void configFacture(Facture f)
 {
     if (f != null)
     {
         lb_numPiece.Text = f.NumDoc;
         txt_reference.Text = f.NumPiece;
         SommeP.Text = f.MontantTTC.ToString();
         Relicat.Text = f.MontantReste.ToString();
         SommeVersee.Text = f.MontantAvance.ToString();
         TotalRemz.Text = f.MontantRemise.ToString();
         SommSR.Text = f.MontantHT.ToString();
     }
     else
     {
         lb_numPiece.Text = Utils.GenererReference(Constantes.DOC_FACTURE);
         txt_reference.ResetText();
         SommeP.Text = "0";
         Relicat.Text = "0";
         SommeVersee.Text = "0";
         TotalRemz.Text = "0";
         SommSR.Text = "0";
     }
 }
        private void NvoTicket_Click(object sender, EventArgs e)
        {
            contenu = new Contenu();

            InitButton(buttonAs, labelAs);
            initZonePrix();
            clientZero = BLL.ClientBll.Default();
            dataGridView1.Rows.Clear();
            picClient.Enabled = true;
            btnEnregistrer.Enabled = true;
            archive = false;
            fact = new Facture();
            fact.TypeDoc = Constantes.TYPE_FV;
            fact.Statut = Constantes.ETAT_EN_ATTENTE;
            fact.Client = BLL.ClientBll.Default();
            fact.Categorie = fact.Client.Categorie;
            fact.HeureDoc = DateTime.Now;
            fact.MouvStock = true;

            com_typeDoc.Text = "Facture";
            SetStateFacture(true);
            configFacture(null);
            clientZero = BLL.ClientBll.Default();
            dpt = TOOLS.Constantes.Creneau.Depot;
            indTabF = 0; indTabA = 0;
            // création de la liste des boutons famille
            buttonFs = new List<Button> { button7, button8, button9, button10, button11, button12, button13, button14 };
            // création de la liste des labels famille
            labelFs = new List<Label> { lbl1, lbl2, lbl3, lbl4, lbl5, lbl6, lbl7, lbl8 };

            // création de la liste des boutons article
            buttonAs = new List<Button> { button15, button16, button17, button18, button19, button20, button21, button22 };
            // création de la liste des labels article
            labelAs = new List<Label> { label18, label20, label21, label22, label23, label24, label25, label26 };
            //lise datagridviews
            datagrids = new List<DataGridView> { dgv_commande, dgv_facture_cours, dgv_facture_regle, dgv_facture_wait, dgv_reglement };
            InitButton(buttonFs, labelFs);
            InitButton(buttonAs, labelAs);
            initZonePrix();
            InitInfoClient();
        }
Example #25
0
 public static void TotalRRRContenuDoc(Facture d, Contenu c)
 {
     if ((d != null) ? d.Client != null : false)
     {
         TotalRemiseContenuDoc(c, d.Client.CategorieClt);
     }
 }
 private void NvoTicket_Click_1(object sender, EventArgs e)
 {
     contenu = new Contenu();
     ConfigForm();
     initZonePrix();
     clientZero = BLL.ClientBll.Default();
     dataGridView1.Rows.Clear();
     picClient.Enabled = true;
     btnEnregistrer.Enabled = true;
     fact = new Facture();
     fact.TypeDoc = Constantes.TYPE_FV;
     fact.Statut = Constantes.ETAT_EN_ATTENTE;
     fact.Client = BLL.ClientBll.Default();
     fact.Categorie = fact.Client.Categorie;
     fact.HeureDoc = DateTime.Now;
     fact.MouvStock = true;
     com_typeDoc.Text = "Facture";
     SetStateFacture(true);
     configFacture(null);
     initZonePrix();
     InitInfoClient();
     nbrPgA = 0;
     btn_cpt_Famille.Text = "0/" + nbrPgF;
     btn_cpt_Articles.Text = "0/" + nbrPgA;
     SearchDirectionF(true);
 }
Example #27
0
        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;
        }
        private void PopulateViewFacture(Facture f)
        {
            ResetFicheFacture();
            fact = f;
            clientZero = f.Client;
            configFacture(f);
            FullContenu(f);
            FullReglement(f);
            btnEnregistrer.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE);
            btnReglement.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE);
            btn_regl_tick.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE);

            foreach (Button btn in buttonAs)
            {
                btn.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE);
            }
            SetStateFacture(false);
        }
Example #29
0
        public static void MontantTotalDoc(Facture doc)
        {
            doc.MontantHT = 0;
            doc.MontantTTC = 0;
            doc.MontantTaxe = 0;
            doc.MontantRemise = 0;
            doc.MontantRistourne = 0;
            doc.MontantCommission = 0;

            foreach (Contenu c in doc.Contenus)
            {
                if (c.PrixTotal == 0)
                {
                    c.PrixTotal = (c.Quantite * c.Prix);
                }
                TotalTaxeContenuDoc(doc, c);
                TotalRRRContenuDoc(doc, c);

                doc.MontantRemise = (doc.MontantRemise + c.RemiseArt + c.RemiseCat);
                doc.MontantRistourne = (doc.MontantRistourne + c.Ristourne);
                doc.MontantCommission = (doc.MontantCommission + c.Commission);
                doc.MontantHT = (doc.MontantHT + c.PrixTotal);
                doc.MontantTaxe = (doc.MontantTaxe + c.PrixTaxe);
            }
            doc.MontantTTC = (doc.MontantHT + doc.MontantTaxe - doc.MontantRemise);
            TotalRRRDoc(doc);
            doc.MontantReste = (doc.MontantTTC - doc.MontantAvance);
        }
 private void PopulateViewFacture(Facture f)
 {
     ResetFicheFacture();
     facture = f;
     configClient(f.Client);
     configFacture(f);
     FullContenu(f);
     FullReglement(f);
     com_client.SelectedText = clients.Find(a => a.Id == facture.Client.Id).Nom_prenom;
     btn_save.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE);
     btn_reglement.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE);
     btn_regl_tick.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE);
     btn_add_contenu.Enabled = !f.Statut.Equals(Constantes.ETAT_REGLE);
     txt_montantVerse.ReadOnly = f.Statut.Equals(Constantes.ETAT_REGLE);
     SetStateFacture(false);
 }