Exemplo n.º 1
0
        private void RemplirDgvPrestations()
        {
            int joursRestants;

            DtPrestations = new DataTable();
            DtPrestations.Columns.Add(new DataColumn("IdPresta", Type.GetType("System.Int32") ?? throw new InvalidOperationException()));
            DtPrestations.Columns.Add("Interimaire");
            DtPrestations.Columns.Add("Entreprise");
            DtPrestations.Columns.Add("Travail");
            DtPrestations.Columns.Add("DateDebut");
            DtPrestations.Columns.Add("DateFin");
            DtPrestations.Columns.Add("JourRestant");
            DtPrestations.Columns.Add("Facture");
            DtPrestations.Columns.Add("Status");
            foreach (var prestation in Prestations)
            {
                C_t_facture    facture     = Factures.Find(x => x.id_fact == prestation.id_fact);
                C_t_categorie  travail     = Travails.Find(x => x.id_categ == prestation.id_categ);
                C_t_interimeur interimaire = Interimaires.Find(x => x.id_inte == facture.id_inte);
                C_t_entreprise entreprise  = Entreprises.Find(x => x.id_entre == facture.id_entre);
                //MessageBox.Show(entreprise.nom_entre);
                joursRestants = Convert.ToInt32((prestation.date_fin - DateTime.Today).TotalDays);
                if (joursRestants < 0)
                {
                    joursRestants = 0;
                }
                DtPrestations.Rows.Add(prestation.Id_travail, interimaire.nom_inte, entreprise.nom_entre, travail.nom_categ, prestation.date_debut.ToString("dd-MM-yyyy"), prestation.date_fin.ToString("dd-MM-yyyy"), joursRestants, facture.date_fact, (prestation.date_fin > DateTime.Today) ? "En Cours" : "Terminer");
            }
            BsPrestations = new BindingSource {
                DataSource = DtPrestations
            };
            dgvPrestations.DataSource = BsPrestations;
        }
        public ActionResult FactureSearch(string searchValue)
        {
            if (searchValue != null && searchValue != "")
            {
                Session["Infosearch"] = searchValue;
            }
            else
            {
                return(View("ListFacture"));
            }

            redactapplicationEntities bds = new Models.redactapplicationEntities();
            Guid user = Guid.Parse(HttpContext.User.Identity.Name);

            Factures db     = new Factures();
            var      answer = db.SearchFacture(searchValue);

            if (answer == null || answer.Count == 0)
            {
                List <FACTUREViewModel> listeFacture = new List <FACTUREViewModel>();
                answer = listeFacture;
                ViewBag.SearchUserNoResultat = 1;
            }

            ViewBag.Search = true;
            redactapplicationEntities e = new redactapplicationEntities();

            List <FACTUREViewModel> listeDataFactureFiltered = new List <FACTUREViewModel>();

            ViewBag.listeFactureVm = answer;

            return(View("ListFacture"));
        }
Exemplo n.º 3
0
        //Retourne la liste des factures d'un client à partir d'une date donnée(par défault sur un an glissant)
        public IList <Facture> GetFactureClient(int idClient, DateTime date)
        {
            DateTime dateMax  = date.AddMonths(12);
            var      factures = Factures.Where(f => f.IdClient == idClient && f.DateFacture >= date && f.DateFacture <= dateMax).ToList();

            return(factures);
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Delete(int id)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Factures _factures = _unitOfWork.Factures.GetSingleOrDefault(e => e.Id == id);
                    if (_factures != null)
                    {
                        _unitOfWork.Factures.Remove(_factures);
                        await _unitOfWork.SaveChangesAsync();

                        return(Ok("OK"));
                    }
                    else
                    {
                        return(BadRequest());
                    }
                }
                catch (Exception ex)
                {
                    return(BadRequest(ex.Data));
                }
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Put(int id, [FromBody] FacturesViewModel factures)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Factures        _factures = Mapper.Map <Factures>(factures);
                    Demandes        dmd       = _unitOfWork.Demandes.GetSingleOrDefault(e => e.Id == factures.DemandesId);
                    ComptesInternes ci        = _unitOfWork.ComptesInternes.GetSingleOrDefault(e => e.Id == factures.ComptesInternesId);
                    _factures.ComptesInternes = ci;
                    _factures.Demandes        = dmd;

                    //_factures.Name = _factures.Name.ToUpper ();
                    _unitOfWork.Factures.Update(_factures);

                    await _unitOfWork.SaveChangesAsync();

                    return(Ok("OK"));
                }
                catch (Exception ex)
                {
                    return(BadRequest(ex.Data));
                }
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
Exemplo n.º 6
0
        private void button3_Click(object sender, EventArgs e)
        {
            Factures fac = new Factures();

            fac.Show();
            this.Hide();
        }
Exemplo n.º 7
0
        //Modifie Paiement et Date facture existante
        public void UpdateFacture(Facture fact)
        {
            var facture = Factures.Find(fact.Id);

            facture.DatePaiement     = fact.DatePaiement;
            facture.CodeModePaiement = fact.CodeModePaiement;
            SaveChanges();
        }
        private FACTUREViewModel SetFactureViewModel()
        {
            Factures         val       = new Factures();
            FACTUREViewModel factureVm = new FACTUREViewModel();

            factureVm.dateDebut     = DateTime.Now.AddMonths(-1).AddDays(1);
            factureVm.dateFin       = DateTime.Now;
            factureVm.ListRedacteur = val.GetListRedacteurItem();
            return(factureVm);
        }
        public ObjetContenuFacture(Factures.ObjetFacture objFacture)
        {
            string strIdContenuFacture = "";

            do
            {
                strIdContenuFacture = clsTools.GenerationIdContenu();
            }
            while (objFacture.IsContenuFactureIdExist(strIdContenuFacture));

            this.m_strIdContenuFacture = strIdContenuFacture;
        }
        // GET: Facture/Details/5
        public ActionResult Details(Guid?hash)
        {
            if (hash == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var factureVm = new Factures().GetDetailsFacture(hash);

            Session["factureNum"] = factureVm.factureNumero;
            Session["logo"]       = Server.MapPath("~/images/logo_mc_large.png");
            Session["redact"]     = factureVm.REDACTEUR.userNom.Trim().ToLower();
            return(View(factureVm));
        }
Exemplo n.º 11
0
        public frmContenuFacture(int intTypeChargementFicheContenuFacture, Factures.ContenuFacture.ObjetContenuFacture objContenuFacture)
        {
            InitializeComponent();
            this.m_intTypeChargementFicheContenuFacture = intTypeChargementFicheContenuFacture;
            Classes.clsTools.LoadTypesQuantiteInComboBox(this.CMB_TYPE_QUANTITE_CONTENU_FACTURE);
            Classes.clsTools.LoadTypesTvaInComboBox(this.CMB_TYPE_TAUX_TVA_FACTURE);

            this.CMB_TYPE_TAUX_TVA_FACTURE.SelectedValue = (int)Classes.clsProperties.TypeTva.Tva20;

            if (objContenuFacture != null)
                this.m_objContenuFacture = (Factures.ContenuFacture.ObjetContenuFacture)objContenuFacture.Clone();

            this.Initialize();
        }
Exemplo n.º 12
0
        private void btnConfirmer_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbId.Text))
            {
                if (string.IsNullOrEmpty(tbNomPresta.Text) || string.IsNullOrEmpty(tbSalPresta.Text))
                {
                    MessageBox.Show(@"Please fill all require information");
                }
                else // ajouter dans la base de donnees
                {
                    //try
                    //{
                    //MessageBox.Show(cbCategorie.SelectedItem.ToString()+" - "+cbFacture.SelectedItem.ToString() );
                    //foreach (var f in Factures)
                    //    MessageBox.Show(f.id_fact.ToString()+" "+f.date_fact.ToString());
                    C_t_categorie categorie = Categories.Find(x => x.nom_categ == cbCategorie.SelectedItem.ToString());
                    C_t_facture   facture   = Factures.Find(x => x.date_fact.ToString("dd/MM/yyyy") == cbFacture.SelectedItem.ToString());
                    //MessageBox.Show(facture.id_fact.ToString() + " - " + categorie.id_categ.ToString());
                    //MessageBox.Show(facture.id_fact.ToString());
                    new G_t_travail(SChonn).Ajouter(tbNomPresta.Text, double.Parse(tbSalPresta.Text), dtpStart.Value,
                                                    dtpEnd.Value, categorie.id_categ, facture.id_fact);
                    //}
                    //catch (Exception ex){ MessageBox.Show(ex.Message);}
                    //finally { RemplireDgv(); }
                }
            }

            else // modification de la base de donnees
            {
                var nId = int.Parse(tbId.Text);
                //foreach (var f in Factures)
                //    MessageBox.Show(f.date_fact.ToString("dd/MM/yyyy") +"->"+ cbFacture.Text);
                C_t_categorie categorie = Categories.Find(x => x.nom_categ == cbCategorie.Text);
                C_t_facture   facture   = Factures.Find(x => x.date_fact.ToString("dd/MM/yyyy") == cbFacture.Text);
                MessageBox.Show(categorie.nom_categ + " " + facture.date_fact.ToString("dd/MM/yyyy"));
                new G_t_travail(SChonn).Modifier(nId, tbNomPresta.Text, Convert.ToDouble(tbSalPresta.Text), dtpStart.Value, dtpEnd.Value, categorie.id_categ, facture.id_fact);
                dgvPrestation.SelectedRows[0].Cells["NomTravail"].Value = tbNomPresta.Text;
                dgvPrestation.SelectedRows[0].Cells["DtDebut"].Value    = dtpStart.Text;
                dgvPrestation.SelectedRows[0].Cells["DtFin"].Value      = dtpEnd.Text;
                dgvPrestation.SelectedRows[0].Cells["SalTravail"].Value = tbSalPresta.Text;
                dgvPrestation.SelectedRows[0].Cells["IdCateg"].Value    = cbCategorie.SelectedItem;
                dgvPrestation.SelectedRows[0].Cells["IdFact"].Value     = cbFacture.Text;
                dgvPrestation.EndEdit();
                Activer(true);
            }
            RefreshDgv();
            ClearTb();
        }
Exemplo n.º 13
0
        public frmFicheFacture(int intTypeChargementFicheFacture, Factures.ObjetFacture objFacture)
        {
            InitializeComponent();
            Classes.clsTools.LoadStatutsFactureInComboBox(CMB_STATUT_FACTURE);
            Classes.clsTools.LoadTypesPaiementInComboBox(CMB_PAIEMENT);
            Classes.clsTools.LoadTypesEcheanceInComboBox(CMB_ECHEANCE);
            Classes.clsTools.LoadTypesCouleurInComboBox(CMB_COULEUR_OBJET_FACTURE);
            this.CMB_ECHEANCE.SelectedValue = (int)Classes.clsProperties.TypeEcheance.TrenteJours;
            this.CMB_COULEUR_OBJET_FACTURE.SelectedValue = (int)Classes.clsProperties.TypeCouleur.Noir;
            this.LW_PRESTATIONS.Template = (int)Classes.clsProperties.TemplateListView.ContenuFacture;

            this.m_intTypeChargementFicheFacture = intTypeChargementFicheFacture;

            if (objFacture != null)
                this.m_objFacture = (Factures.ObjetFacture)objFacture.Clone();

            this.Inititialize();
        }
Exemplo n.º 14
0
        public async Task <IActionResult> Post([FromBody] FacturesViewModel factures)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Factures _factures = Mapper.Map <Factures>(factures);

                    //_factures.Name = _factures.Name.ToUpper ();
                    await _unitOfWork.Factures.AddAsync(_factures);

                    return(Ok(await _unitOfWork.SaveChangesAsync()));
                }
                catch (Exception ex)
                {
                    return(BadRequest(ex.Data));
                }
            }
            return(BadRequest());
        }
Exemplo n.º 15
0
 private void btnEditer_Click_1(object sender, EventArgs e)
 {
     if (dgvPrestation.SelectedRows.Count > 0)
     {
         Activer(false);
         tbId.Text = dgvPrestation.SelectedRows[0].Cells["IdPresta"].Value.ToString();
         var travail = new G_t_travail(SChonn).Lire_ID(int.Parse(tbId.Text));
         tbNomPresta.Text = travail.nom_travail;
         tbSalPresta.Text = Convert.ToString(travail.prix_travail, CultureInfo.InvariantCulture);
         dtpStart.Text    = Convert.ToString(travail.date_debut, CultureInfo.CurrentCulture);
         dtpEnd.Text      = Convert.ToString(travail.date_fin, CultureInfo.CurrentCulture);
         C_t_categorie categorie = Categories.Find(x => x.id_categ == travail.id_categ);
         C_t_facture   facture   = Factures.Find(x => x.id_fact == travail.id_fact);
         cbCategorie.Text = categorie.nom_categ;
         cbFacture.Text   = facture.date_fact.ToString("dd/MM/yyyy");
     }
     else
     {
         MessageBox.Show(@"There is no row selected!");
     }
 }
Exemplo n.º 16
0
 private void RemplireDgv()
 {
     _info.CurrencySymbol = " € ";
     DtPrestation         = new DataTable();
     DtPrestation.Columns.Add(new DataColumn("IdPresta", Type.GetType("System.Int32") ?? throw new InvalidOperationException()));
     DtPrestation.Columns.Add("NomTravail");
     DtPrestation.Columns.Add("DtDebut");
     DtPrestation.Columns.Add("DtFin");
     DtPrestation.Columns.Add("SalTravail");
     DtPrestation.Columns.Add("IdCateg");
     DtPrestation.Columns.Add("IdFact");
     foreach (var prestation in Prestations)
     {
         C_t_categorie categorie = Categories.Find(x => x.id_categ == prestation.id_categ);
         C_t_facture   facture   = Factures.Find(x => x.id_fact == prestation.id_fact);
         //MessageBox.Show(facture.id_fact.ToString() + "->" + prestation.Id_travail);
         DtPrestation.Rows.Add(prestation.Id_travail, prestation.nom_travail, string.Format("{0:dd/MM/yyyy}", prestation.date_debut), string.Format("{0:dd/MM/yyyy}", prestation.date_fin), string.Format(_info, "{0:C}", prestation.prix_travail), categorie.nom_categ, string.Format("{0:dd/MM/yyyy}", facture.date_fact));
     }
     BsPrestation = new BindingSource {
         DataSource = DtPrestation
     };
     dgvPrestation.DataSource = BsPrestation;
 }
Exemplo n.º 17
0
        private void BtnImpression_Click(object sender, EventArgs e)
        {
            DateTime DateDebut = DateTime.ParseExact(dateEditDateDebut.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            DateTime DateFin = DateTime.ParseExact(dateEditDateFin.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            List <Factures> Factures  = new List <Factures>();
            int             rowHandle = 0;

            while (gridView1.IsValidRowHandle(rowHandle))
            {
                Factures Facture = gridView1.GetRow(rowHandle) as Factures;
                Factures.Add(Facture);
                bool isSelected = gridView1.IsRowSelected(rowHandle);
                rowHandle++;
            }
            var    Sage = db.BaseDonees.Where(x => x.Name == "Sage").SingleOrDefault();
            var    CHAABANECORPORATE = db.BaseDonees.Where(x => x.Name == "CHAABANECORPORATE").SingleOrDefault();
            string con = Sage.StringConnection(Sage);
            ReleveeFournisseurRapport RF = new ReleveeFournisseurRapport();

            using (IDbConnection dbConnection = new SqlConnection(Sage.StringConnection(Sage)))
            {
                if (dbConnection.State == System.Data.ConnectionState.Closed)
                {
                    dbConnection.Open();
                }

                var Societe = dbConnection.Query <Societe>(QuerrySociete, commandType: CommandType.Text).FirstOrDefault();
                RF.Parameters["Adresse"].Value         = Societe.Adresse;
                RF.Parameters["Adresse"].Visible       = false;
                RF.Parameters["Fax"].Value             = Societe.Fax.Substring(5, 8);
                RF.Parameters["Fax"].Visible           = false;
                RF.Parameters["Profession"].Value      = Societe.Profession;
                RF.Parameters["Profession"].Visible    = false;
                RF.Parameters["RaisonSociale"].Value   = Societe.RaisonSociale;
                RF.Parameters["RaisonSociale"].Visible = false;
                RF.Parameters["Telephone"].Value       = Societe.Tel.Substring(5, 8);
                RF.Parameters["Telephone"].Visible     = false;
            }
            //RF.Parameters.

            RF.Parameters["Client"].Value      = Factures.Select(x => x.TiersNumero).First();
            RF.Parameters["Client"].Visible    = false;
            RF.Parameters["DateDebut"].Value   = DateDebut;
            RF.Parameters["DateDebut"].Visible = false;
            RF.Parameters["DateFin"].Value     = DateFin;
            RF.Parameters["DateFin"].Visible   = false;



            RF.DataSource = Factures.ToList();

            ReportPrintTool tool = new ReportPrintTool(RF);

            tool.ShowPreview();

            // Etat de Activiè Caisse

            // var d = cbDevis.Properties.DisplayMember = "D_Mode";

            //    F_Ecriture_BindingSource.DataSource = dbConnection.Query<Models.F_ECRITUREC>(Query, commandType: CommandType.Text);


            BtnImpression.Enabled = true;
            BtnRecherche.Enabled  = true;
        }
Exemplo n.º 18
0
 private void LoadInfosFactureInObject(Factures.ObjetFacture objFacture)
 {
     this.m_objFacture.DateFacture = this.DTE_DATE_FACTURE.Value;
     this.m_objFacture.StatutFacture.IdStatutFacture = int.Parse(this.CMB_STATUT_FACTURE.SelectedValue.ToString());
     this.m_objFacture.Avoir = this.CHK_AVOIR.Checked;
     this.m_objFacture.TypePaiement.IdTypePaiement = int.Parse(this.CMB_PAIEMENT.SelectedValue.ToString());
     this.m_objFacture.TypeEcheance.IdTypeEcheance = int.Parse(this.CMB_ECHEANCE.SelectedValue.ToString());
     this.m_objFacture.DateEcheanceFacture = this.DTE_DATE_ECHEANCE.Value;
     this.m_objFacture.MajorationFacture = decimal.Parse(this.TXT_MAJORATION_FACTURE.Text);
 }
Exemplo n.º 19
0
 // ajout d'une facture
 public void AddFacture(Facture fact)
 {
     Factures.Add(fact);
     SaveChanges();
 }
Exemplo n.º 20
0
 // charge toutes les factures (et lignes) et retourne le nombre de factures
 public List <Facture> GetToutesFactures()
 {
     return(Factures.ToList());
 }
Exemplo n.º 21
0
        //Retourne la liste des factures d'un client à partir d'une date donnée(par défault sur un an glissant)
        public IList <Facture> GetFactureClient(int idClient)
        {
            var factures = Factures.Where(f => f.IdClient == idClient).ToList();

            return(factures);
        }
Exemplo n.º 22
0
 public IEnumerable <Facture> GetFactures(DateTime?debut, DateTime?fin) =>
 Factures.Where(f =>
                (!debut.HasValue || f.DateReglement >= debut) &&
                (!fin.HasValue || f.DateReglement <= fin)
                );
Exemplo n.º 23
0
        private void btnCA_Click(object sender, EventArgs e)
        {
            float total  = 0f;
            float amount = 0f;

            if (dgvFacture.Rows.Count > 0)
            {
                Document  doc = new Document(PageSize.LETTER, 40, 40, 30, 25);
                PdfWriter pw  = PdfWriter.GetInstance(doc, new FileStream(@"E:\C#\InterimDesktopApp\Doc\CAM12mois.pdf", FileMode.Create));
                doc.Open();// opening the pdf to write in
                Image     logo      = Image.GetInstance(@"E:\C#\InterimDesktopApp\Images\circle.png");
                Paragraph logo_name = new Paragraph("Circle", small_font);
                Paragraph date      = new Paragraph("Le" + " " + DateTime.Today.ToString("dd/MM/yyyy"), date_font);
                Paragraph title     = new Paragraph("Chiffres d'affaire mensuel", header_font);
                Paragraph newLine   = new Paragraph("\n");
                logo.ScalePercent(10.0f);
                logo.Alignment  = 0;// 0 = left; 1=center ; 2=right
                logo.Alignment  = 0;
                date.Alignment  = 2;
                title.Alignment = 1;
                doc.Add(logo);
                doc.Add(logo_name);
                doc.Add(date);
                doc.Add(title);
                doc.Add(newLine);
                PdfPTable table_prestation = new PdfPTable(2);
                PdfPCell  title_table      = new PdfPCell(new Phrase("Chiffres d'affaires", normal_font));
                title_table.Colspan             = 2;
                title_table.BackgroundColor     = BaseColor.ORANGE;
                title_table.HorizontalAlignment = 1;
                PdfPCell col_prestation    = new PdfPCell(new Phrase("Nom Prestation", normal_font));
                PdfPCell col_Amount        = new PdfPCell(new Phrase("Prix", normal_font));
                PdfPCell description_total = new PdfPCell(new Phrase("Total"));
                col_prestation.HorizontalAlignment = 1;
                col_Amount.HorizontalAlignment     = 1;
                table_prestation.AddCell(title_table);
                table_prestation.AddCell(col_prestation);
                table_prestation.AddCell(col_Amount);
                for (int i = 0; i < dgvFacture.RowCount - 1; i++)
                {
                    var            nId        = Convert.ToInt32(dgvFacture.Rows[i].Cells[0].Value);
                    C_t_facture    facture    = Factures.Find(x => x.id_fact == (int)nId);
                    C_t_travail    prestation = Prestations.Find(x => x.id_fact == facture.id_fact);
                    C_t_categorie  categorie  = Categories.Find(x => x.id_categ == prestation.id_categ);
                    C_t_interimeur interimeur = Interimeurs.Find(x => x.specialisation == categorie.nom_categ);
                    MessageBox.Show(categorie.nom_categ + "=>" + interimeur.nom_inte);
                    amount = (float)prestation.prix_travail + (float)((prestation.prix_travail * interimeur.bonus_sal) / 100);
                    total += amount;
                    PdfPCell cell_prestation = new PdfPCell(new Phrase(prestation.nom_travail, normal_font));
                    table_prestation.AddCell(cell_prestation);
                    table_prestation.AddCell(amount + "€");
                }
                doc.Add(newLine);
                table_prestation.AddCell(description_total);
                table_prestation.AddCell(total.ToString() + "€");
                doc.Add(table_prestation);
                total = 0f;
                doc.Close(); //closing the pdf
            }
            else
            {
                MessageBox.Show("Vous n'avez pas de facture dans votre base de données");
            }
        }
Exemplo n.º 24
0
 public void LoadInfosContenufacture(Factures.ObjetFacture objFacture, ref ObjetContenuFacture objContenuFactureSource)
 {
     foreach (ObjetContenuFacture objContenuFacture in objFacture.ListContenuFacture)
     {
         if (objContenuFacture.IdContenuFacture == objContenuFactureSource.IdContenuFacture)
         {
             objContenuFactureSource = objContenuFacture;
             break;
         }
     }
 }
Exemplo n.º 25
0
        private void BtnRecherche_Click(object sender, EventArgs e)
        {
            CultureInfo culture          = Thread.CurrentThread.CurrentCulture;
            string      decimalSeparator = culture.NumberFormat.NumberDecimalSeparator;
            decimal     Debit;
            decimal     Credit;
            decimal     Solde;
            decimal     Montant;
            DateTime    DateDebut = DateTime.ParseExact(dateEditDateDebut.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            DateTime DateFin = DateTime.ParseExact(dateEditDateFin.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            List <Factures> ListFacture       = new List <Factures>();
            var             Sage              = db.BaseDonees.Where(x => x.Name == "Sage").SingleOrDefault();
            var             CHAABANECORPORATE = db.BaseDonees.Where(x => x.Name == "CHAABANECORPORATE").SingleOrDefault();

            string con = Sage.StringConnection(Sage);


            /// getselectRowColumn from comboboxdevis
            GridView view                = SbFounisseur.Properties.View;
            int      rowHandle           = view.FocusedRowHandle;
            string   fieldName           = "CT_Num"; // or other field name
            object   FournisseurSelected = view.GetRowCellValue(rowHandle, fieldName);

            /// getselectRowColumn from comboboxdevis

            ///Condition existance Fournisseur
            if (FournisseurSelected == null)
            {
                XtraMessageBox.Show("Choisir un Fournisseur ", "Fournisseur", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                SbFounisseur.Focus();

                BtnImpression.Enabled = false;
            } ///Condition existance devis

            //Recherche
            else
            {
                //  var parameters = new { Fournisseur = "F4000"};
                //using (IDbConnection dbConnection = new SqlConnection(CHAABANECORPORATE.StringConnection(CHAABANECORPORATE)))
                //{
                //    if (dbConnection.State == System.Data.ConnectionState.Closed)
                //        dbConnection.Open();



                //    var Resulat = dbConnection.Query<Factures>(sqlFounissuer,0, commandType: CommandType.Text);

                //}

                using (var cn = new SqlConnection(CHAABANECORPORATE.StringConnection(CHAABANECORPORATE)))
                {
                    cn.Open();
                    var cmd = new SqlCommand();
                    cmd.Connection     = cn;
                    cmd.CommandTimeout = 0;
                    cmd.CommandType    = CommandType.Text;
                    cmd.CommandText    = @"SELECT E.TiersNo
	  ,E.[TiersNumero]
      ,E.[TiersIntitule]
      ,CASE E.SENS 
		WHEN 0 THEN  E.[Montant] * (-1)
		ELSE E.[Montant] 
	  END      [Montant]
      ,E.[Sens]
      ,E.[Intitule]		'Libelle'
      ,E.[Date]
      ,E.[Journal]
      ,E.[SocieteNo]
	  ,CASE E.SENS 
		WHEN 0 THEN  E.[Montant]
		ELSE 0
	  END 'Debit'
	  ,CASE E.SENS 
		WHEN 1 THEN  E.[Montant]
		ELSE 0
	    END 'Credit'
	  ,CASE ISNULL(EX.ANNEE , 0) WHEN   0 THEN 0 ELSE 1 END 'IsLastExercice'
	  ,'EC'		'TypeCode'
	  ,E.[Journal]		'Mode'
	  ,CASE  E.Reference WHEN  ' ' THEN E.RefPiece ELSE E.Reference END	'Numero'
	,E.IsLettre
	,E.Echeance		
	,E.PieceTreso			'Piece'
	,E.Contact
	,E.Adresse
	,E.Complement
	,E.CodePostal
	,E.Ville
	,E.CodeRegion
	,E.Pays
	,E.Tel
	,E.Fax
  FROM [dbo].[vEcritureFournisseur] AS E
  LEFT JOIN vExercice AS EX ON EX.Debut <= E.Date AND EX.Fin >= E.Date AND E.[SocieteNo] = EX.[SocieteNo] 
	AND EX.ANNEE  IN( SELECT TOP 1 L.ANNEE FROM vExercice AS L  ORDER BY L.ANNEE asc )  
	 where  E.[TiersNumero] ='"     + FournisseurSelected + "' and   E.[Date]   BETWEEN '" + DateDebut.ToString("dd/MM/yyyy") + "' AND '" + DateFin.ToString("dd/MM/yyyy") + @"'
    UNION  
    SELECT 
      T.No					'TiersNo'
      ,T.Numero				'TiersNumero'
	  ,T.Intitule			'TiersIntitule'
	  ,MV.MontantReglement * (-1)		'Montant'
	  ,0					'Sens'
	  ,MV.LibelleReglement		'Libelle'
	  ,Mv.DateReglement			'Date'
	  ,''					'Journal'
	  ,MV.SocieteNo				'SocieteNo'
	  ,MontantReglement			'Debit'
	  ,0					'Credit'
	  ,0					'IsLastExercice'
	  ,					    'TypeCode' =
      CASE MV.[TypeReglement]
         WHEN 0 THEN 'Espece'
         WHEN 1 THEN 'Cheque'
         WHEN 2 THEN 'Traite'
         WHEN 3 THEN 'Virement'
         WHEN 4 THEN 'Retenu'
      END
	  ,M.CodeMode			'Mode'
	  ,MV.NumeroReglement			'Numero'
	  ,0					'IsLettre'
	  ,MV.EchanceReglement		'Echeance'
	  ,MV.PieceReglement			'Piece'
	  ,T.Contact
	 ,T.Adresse
	 ,T.Complement
	 ,T.CodePostal
	 ,T.Ville
	 ,T.CodeRegion
	 ,T.Pays
	 ,T.Tel
	 ,T.Fax
  FROM Reglements AS MV
  INNER JOIN vTiers AS T ON MV.TiersNo = T.No AND MV.SocieteNo = T.SocieteNo AND T.Type = 1
  INNER JOIN ModesReg	AS M ON M.ModeReglementNo	= MV.ModeReglementNo
  WHERE  MV.DomaineReglement = 1 AND MV.ComptaReglement = 0 and T.Numero ='" + FournisseurSelected + "'";
                    var rdr = cmd.ExecuteReader();


                    while (rdr.Read())
                    {
                        Console.WriteLine(rdr.GetValue(0).ToString());
                        Factures FA = new Factures();
                        // DateTime startDate = DateTime.ParseExact("01/01/2020", "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        // FA.Date =  DateTime.ParseExact(rdr["Date"].ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        FA.Date     = Convert.ToDateTime(rdr["Date"]);
                        FA.Echeance = Convert.ToDateTime(rdr["Echeance"]);
                        FA.IsLettre = rdr["IsLettre"].ToString();
                        FA.Journal  = rdr["Journal"].ToString();
                        FA.Libelle  = rdr["Libelle"].ToString();
                        FA.Mode     = rdr["Mode"].ToString();
                        string MontantStr = rdr["Montant"].ToString().Replace(",", decimalSeparator).Replace(".", decimalSeparator);
                        decimal.TryParse(MontantStr, out Montant);
                        FA.Montant = Montant;
                        if (Montant < 0)
                        {
                            FA.Credit    = Math.Round(Montant * (-1), 3);
                            FA.CreditStr = FA.Credit.ToString();
                            FA.DebitStr  = "";
                        }
                        else
                        {
                            FA.Debit     = Math.Round(Montant, 3);
                            FA.DebitStr  = FA.Debit.ToString();
                            FA.CreditStr = "";
                        }
                        FA.Solde         = Montant;
                        FA.Numero        = rdr["Numero"].ToString();
                        FA.Sens          = Convert.ToInt32(rdr["Sens"].ToString());
                        FA.SocieteNo     = rdr["SocieteNo"].ToString();
                        FA.TiersIntitule = rdr["TiersIntitule"].ToString();
                        FA.TiersNo       = rdr["TiersNo"].ToString();

                        //   bool isParsable = Int32.TryParse(rdr["TiersNumero"].ToString(), out number);
                        FA.TiersNumero = rdr["TiersNumero"].ToString();
                        FA.TypeCode    = rdr["TypeCode"].ToString();
                        ListFacture.Add(FA);
                        //rdr.GetValue(0).ToString() pour avoir la valeur de la premiére colonne en format de chaine de caractére
                    }
                    var resultat = ListFacture.ToList();
                    facturesBindingSource.DataSource = ListFacture.ToList().OrderBy(x => x.Date);//OrderByDescending(x=>x.Date);
                }



                // var d = cbDevis.Properties.DisplayMember = "D_Mode";

                //    F_Ecriture_BindingSource.DataSource = dbConnection.Query<Models.F_ECRITUREC>(Query, commandType: CommandType.Text);
                XtraMessageBox.Show("Recherche Terminer", "Recherche", MessageBoxButtons.OK, MessageBoxIcon.Information);

                BtnImpression.Enabled = true;
                BtnRecherche.Enabled  = true;
            }
            //Recherche
        }