Example #1
0
        private void navBarItem24_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            Avoircommande avoir = new Avoircommande();

            avoir.MdiParent = Form1.ActiveForm;
            avoir.Show();
            avoir.BringToFront();
        }
Example #2
0
        private void barButtonItem7_ItemClick(object sender, ItemClickEventArgs e)
        {
            int count = gridView1.DataRowCount;

            if (count != 0 && gridView1.FocusedRowHandle != DevExpress.XtraGrid.GridControl.AutoFilterRowHandle)
            {
                System.Data.DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);
                int           code      = Convert.ToInt32(row[0]);
                int           id        = Convert.ToInt32(row[14]);
                Avoircommande avoir     = new Avoircommande(code, id);
                avoir.ShowDialog();
            }
        }
Example #3
0
        private void simpleButton4_Click(object sender, EventArgs e)
        {
            montantht  = 0;
            montantttc = 0;
            string etat     = "en cours";
            string etat_fac = "en cours";
            string timbre   = textEdit1.Text;

            if (lookUpEdit1.Text.Trim() == "Choisir un client")
            {
                MessageBox.Show("Choisir un client svp !!!");
            }
            else
            {
                if (tnumcommandebase.Text == "")
                {
                    MessageBox.Show("Entrer le numéro d'avoir svp !!!");
                }
                else
                {
                    if (date.Text == "")
                    {
                        MessageBox.Show("Entrer la date svp !!!");
                    }
                    else
                    {
                        DataTable aux = fun.selectfromavoirsByNum(tnumcommandebase.Text);

                        if (CB_Fact.Text == "")
                        {
                            MessageBox.Show("Entrer le numero de la facture svp !!!");
                        }
                        else
                        {
                            DataTable dt = new DataTable();

                            dt = fun.get_cltByDesign(lookUpEdit1.Text);
                            string id_clt = dt.Rows[0][0].ToString();
                            if (numero_avoir != 0)
                            {
                                fun.delete_piece_avoir(numero_avoir);
                                if (gridView1.RowCount != 0)
                                {
                                    DataRowView rowView = (DataRowView)lookUpEdit1.GetSelectedDataRow();
                                    DataRow     rowv    = rowView.Row;

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


                                        // Double tva = Convert.ToDouble(row[6].ToString().Replace('.', ',')) * Convert.ToDouble(row[9].ToString()) / 100;
                                        //  montanttva += tva;
                                        montantttc += Convert.ToDouble(row[6].ToString().Replace('.', ','));// +tva;
                                        fun.insert_piecee_avoir(row[0].ToString(), row[1].ToString(), row[2].ToString().Replace('.', ','), row[10].ToString(), row[5].ToString(), row[8].ToString(), row[9].ToString(), id_clt.ToString(), Convert.ToInt32(tnumcommandebase.Text), row[6].ToString(), row[11].ToString());
                                        //mse a jour stok
                                        //stck
                                        // fun.update_sousstock_avoir2(double.Parse(row[2].ToString().Replace('.', ',')), row[11].ToString());
                                        //string vv = row[12].ToString();
                                    }
                                    double tmbr = 0;
                                    double.TryParse(timbre.Replace('.', ','), out tmbr);
                                    montantttc += tmbr;
                                    fun.update_avoir(CB_Fact.Text, id, etat, date.Text.Substring(0, 10), rowv[0].ToString(), rowv[1].ToString(), "0", montantttc.ToString(), timbre, tnumcommandebase.Text, "0", "0");
                                    MessageBox.Show("le bon d'avoir est modifier avec succées veuillez consulter la liste des avoir");
                                    this.Close();
                                }
                            }
                            else
                            {
                                if (aux.Rows.Count > 0)
                                {
                                    MessageBox.Show("Il existe un bon de retour avec ce numéro");
                                }
                                else
                                {
                                    if (gridView1.RowCount != 0)
                                    {
                                        DataRowView rowView = (DataRowView)lookUpEdit1.GetSelectedDataRow();
                                        DataRow     rowv    = rowView.Row;

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


                                            // Double tva = Convert.ToDouble(row[6].ToString().Replace('.', ',')) * Convert.ToDouble(row[9].ToString()) / 100;
                                            //  montanttva += tva;
                                            montantttc += Convert.ToDouble(row[6].ToString().Replace('.', ','));// +tva;
                                            fun.insert_piecee_avoir(row[0].ToString(), row[1].ToString(), row[2].ToString().Replace('.', ','), row[10].ToString(), row[5].ToString(), row[8].ToString(), row[9].ToString(), id_clt.ToString(), Convert.ToInt32(tnumcommandebase.Text), row[6].ToString(), row[11].ToString());
                                            //mse a jour stok
                                            //stck
                                            // fun.update_sousstock_avoir2(double.Parse(row[2].ToString().Replace('.', ',')), row[11].ToString());
                                            //string vv = row[12].ToString();
                                        }

                                        fun.insert_into_avoir(CB_Fact.Text, etat, date.Text.Substring(0, 10), rowv[0].ToString(), rowv[1].ToString(), "0", montantttc.ToString(), timbre, tnumcommandebase.Text, "0", "0");
                                        MessageBox.Show("le bon d'avoir est ajoutée avec succées veuillez consulter la liste des avoir");
                                        this.Close();
                                        Avoircommande lcmdclt = new Avoircommande();

                                        lcmdclt.MdiParent = Form1.ActiveForm;
                                        lcmdclt.Show();
                                        lcmdclt.BringToFront();
                                    }
                                    else
                                    {
                                        MessageBox.Show("veuillez insérer les lignes de commande");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }