コード例 #1
0
ファイル: BLNOCommandeBL.cs プロジェクト: Abbassimohamed/Aqua
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            if (verifierQuantite())
            {
                DataRowView rowView1 = (DataRowView)lookUpEdit1.GetSelectedDataRow();
                string      numer_bl = tnumcommandebase.Text;
                DataTable   dt_blo   = fun.GetBlByNum(int.Parse(numer_bl));
                if (dt_blo.Rows.Count > 0)
                {
                    XtraMessageBox.Show("Il existe un bon livraison avec ce numéro");
                }
                else
                {
                    if (rowView1 == null)
                    {
                        XtraMessageBox.Show("Choisir un client SVP");
                    }
                    else
                    {
                        if (dateEdit1.Text == "")
                        {
                            MessageBox.Show("Entrer la date SVP");
                        }
                        else
                        {
                            string    etat    = "en cours";
                            string    etatcmd = "";
                            DataTable dt      = new DataTable();
                            dt     = fun.get_cltByDesign(lookUpEdit1.Text);
                            id_clt = Convert.ToInt32(dt.Rows[0][0]);
                            test   = 0;
                            string timbre = textBox5.Text;
                            string id_bl  = (get_maxbl() + 1).ToString();

                            fun.insert_into_bl2(id_clt.ToString(), etat, lookUpEdit1.Text, tnbcmd.Text, "0", prixtotc.ToString(), timbre, numer_bl, textEdit1.Text, textEdit2.Text, textEdit3.Text, dateEdit1.Text.Substring(0, 10));
                            prix_ht = 0; prixtotc = 0;
                            double prix_rem = 0;
                            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());
                                 *
                                 */
                                Double pnetvente = Convert.ToDouble(row[2].ToString().Replace('.', ',')) * Convert.ToDouble(row[5].ToString().Replace('.', ','));
                                prix_rem = pnetvente - ((pnetvente * Convert.ToDouble(row[8].ToString().Replace('.', ','))) / 100);
                                prix_ht += prix_rem;
                                Double pnetventetc = prix_rem + ((prix_rem * Convert.ToDouble(row[9].ToString().Replace('.', ','))) / 100);
                                prixtotc += pnetventetc;
                                fun.insert_piecee_bl(row[0].ToString(), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), row[5].ToString(), row[6].ToString(), int.Parse(id_bl), row[8].ToString(), row[9].ToString(), row[10].ToString());
                                // fun.update_sousstock_after_accept2(double.Parse(row[2].ToString().Replace('.', ',')), row[0].ToString());
                            }
                            //  DataTable dattt = fun.get_AllprodbyCMD(liste_cde_client.id_commande.ToString());



                            numbl = int.Parse(id_bl);
                            BLReport report = new BLReport(Convert.ToInt32(id_bl));
                            report.ShowPreview();
                            //MessageBox.Show("BL ajouté avec succées");
                            //Bon_livraisonsanscmd bl = new Bon_livraisonsanscmd();

                            //bl.ShowDialog();
                            this.Close();
                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: CommandeBL.cs プロジェクト: Abbassimohamed/Aqua
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            if (verifierQuantite())
            {
                string    numer_bl = tnumbl.Text;
                DataTable dt_blo   = fun.GetBlByNum(int.Parse(numer_bl));
                if (dt_blo.Rows.Count > 0)
                {
                    XtraMessageBox.Show("Il existe un bon livraison avec ce numéro");
                }
                else
                {
                    if (dateEdit1.Text == "")
                    {
                        MessageBox.Show("Entrer la date SVP");
                    }
                    else
                    {
                        prixtotc = 0;
                        Double    test    = 0;
                        string    etat    = "en cours";
                        string    etatcmd = "servi";
                        DataTable dt      = new DataTable();
                        dt = fun.get_cltByDesign(lookUpEdit1.Text);
                        string id_clt = dt.Rows[0][0].ToString();

                        string timbre = liste_cde_client.timbre;
                        string id_bl  = (get_maxbl() + 1).ToString();

                        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());
                            double prix_net = 0;
                            prix_net  = double.Parse(row[6].ToString().Replace('.', ',')) * double.Parse(row[3].ToString().Replace('.', ',')); //qt*prix
                            prix_net  = prix_net - ((prix_net * double.Parse(row[9].ToString().Replace('.', ','))) / 100);                     //-remise
                            prix_net  = prix_net + ((prix_net * double.Parse(row[10].ToString().Replace('.', ','))) / 100);                    //+tva
                            prixtotc += prix_net;
                            fun.update_qterestcommande(qterst.ToString(), row[0].ToString());
                            fun.insert_piecee_bl(row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), row[5].ToString(), row[6].ToString(), row[7].ToString(), int.Parse(id_bl), row[9].ToString(), row[10].ToString(), row[11].ToString());
                            //fun.update_sousstock_after_accept2(double.Parse(row[3].ToString().Replace('.', ',')), row[1].ToString());
                        }
                        fun.insert_into_bl2(id_clt, etat, lookUpEdit1.Text, tnbcmd.Text, liste_cde_client.id_commande.ToString(), prixtotc.ToString(), timbre, numer_bl, textEdit1.Text, textEdit2.Text, textEdit3.Text, dateEdit1.Text.Substring(0, 10));

                        DataTable dattt = fun.get_AllprodbyCMD(liste_cde_client.id_commande.ToString());

                        for (int i = 0; i < dattt.Rows.Count; i++)
                        {
                            DataRow row = dattt.Rows[i];

                            test += Convert.ToDouble(row[12]);
                        }
                        if (test == 0)
                        {
                            fun.update_etatcmd(etatcmd, liste_cde_client.id_commande.ToString());
                        }



                        fun.update_etat(etatcmd, liste_cde_client.id_commande.ToString());

                        numbl = Convert.ToInt32(id_bl);
                        MessageBox.Show("BL ajouté avec succées");
                        BLReport report = new BLReport(Convert.ToInt32(id_bl));
                        report.ShowPreview();
                        //Bon_livraison bl = new Bon_livraison();
                        //bl.ShowDialog();
                        this.Close();
                    }
                }
            }
        }