Ejemplo n.º 1
0
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            string    etat    = "validée";
            string    etatcmd = "";
            DataTable dt      = new DataTable();

            dt     = fun.get_cltByDesign(lookUpEdit1.Text);
            id_clt = Convert.ToInt32(dt.Rows[0][0]);
            test   = 0;
            string timbre = "0.500";

            for (int i = 0; i < gridView1.DataRowCount; i++)
            {
                DataRow row = gridView1.GetDataRow(i);

                /*
                 * DataTable dat = new DataTable();
                 * dat = fun.get_piececmdbynump(Convert.ToInt32(row[0]));
                 * Double quantiterestante = Convert.ToDouble(dat.Rows[0][12].ToString());
                 * Double qterst = Convert.ToDouble(dat.Rows[0][12].ToString()) - Convert.ToDouble(row[3].ToString());
                 * Double prremis = Convert.ToDouble(dat.Rows[0][7].ToString()) - Convert.ToDouble(row[7].ToString());
                 * prixtotc+=prremis;
                 * fun.update_qterestcommande(qterst.ToString(),row[0].ToString());
                 *
                 */
                tva = Convert.ToDouble(row[9].ToString().Replace('.', ','));
                fun.insert_piecee_factachat(row[0].ToString(), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), row[5].ToString(), row[6].ToString(), tnumcommandebase.Text, row[8].ToString(), row[9].ToString(), row[10].ToString());
            }

            fun.insert_into_factachat(id_clt.ToString(), etat, lookUpEdit1.Text, tnbcmd.Text, prixtotc.ToString(), timbre, tva.ToString());
            numbl = Convert.ToInt32(tnumcommandebase.Text);
            MessageBox.Show("Facture proformat ajoutée avec succées");
            this.Close();
            facturepf factpf = new facturepf();

            factpf.MdiParent = Form1.ActiveForm;
            factpf.Show();
            factpf.BringToFront();
            this.Close();
        }