Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         data = new SqlDataAdapter("select * from Livraison where CodeLivr=" + textBox8.Text, con);
         data.Fill(set, "Livraison");
         data = new SqlDataAdapter("select cha.* from Charge_Commande as cha inner join Chargement as ch on ch.CodeChargement=cha.CodeChargement inner Join Livraison as l on l.CodeChargement=ch.CodeChargement where l.CodeLivr=" + textBox8.Text, con);
         data.Fill(set, "Charge_Commande");
         data = new SqlDataAdapter("select ch.* from Chargement as ch  inner Join Livraison as l on l.CodeChargement=ch.CodeChargement where l.CodeLivr=" + textBox8.Text, con);
         data.Fill(set, "Chargement");
         data = new SqlDataAdapter("select chau.* from chauffeur as chau  inner join Chargement as ch on chau.CodeChauffeur=ch.CodeChauf  inner Join Livraison as l on l.CodeChargement=ch.CodeChargement where l.CodeLivr=" + textBox8.Text, con);
         data.Fill(set, "Chauffeur");
         data = new SqlDataAdapter("select C.* from Commande as C inner Join Charge_Commande as char on C.Codecommande=char.CodeCommande  inner join Chargement as ch on ch.CodeChargement=char.CodeChargement  inner Join Livraison as l on l.CodeChargement=ch.CodeChargement where l.CodeLivr=" + textBox8.Text, con);
         data.Fill(set, "Commande");
         data = new SqlDataAdapter("select Cl.* from Client as Cl inner Join Commande as C on C.CodeClient=Cl.Codeclient inner Join Charge_Commande as char on C.Codecommande=char.CodeCommande  inner join Chargement as ch on ch.CodeChargement=char.CodeChargement  inner Join Livraison as l on l.CodeChargement=ch.CodeChargement where l.CodeLivr=" + textBox8.Text, con);
         data.Fill(set, "Client");
         BonLivraison b = new BonLivraison();
         b.SetDataSource(set);
         Report_Viewer_Form r = new Report_Viewer_Form();
         r.Text = "Bon de Livraison N° " + textBox8.Text;
         r.crystalReportViewer1.ReportSource = b;
         r.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text != null)
            {
                try
                {
                    data = new SqlDataAdapter("select * from Facture where CodeComm=" + comboBox1.Text, con);
                    data.Fill(set, "Facture");
                    data = new SqlDataAdapter("select C.* from Commande as C inner Join Facture as F on C.Codecommande=F.CodeComm where F.CodeComm=" + comboBox1.Text, con);
                    data.Fill(set, "Commande");
                    data = new SqlDataAdapter("select Cl.* from Client as Cl inner join Commande as C on C.CodeClient=Cl.Codeclient inner Join Facture as F on C.Codecommande=F.CodeComm where F.CodeComm=" + comboBox1.Text, con);
                    data.Fill(set, "Client");
                    Facturation f = new Facturation();
                    f.SetDataSource(set);
                    Report_Viewer_Form r = new Report_Viewer_Form();
                    r.Text = "Facture N° " + comboBox1.Text;
                    r.crystalReportViewer1.ReportSource = f;
                    r.Show();
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Voulez choisir une Facture", "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        private void btnBonCmd_Click(object sender, EventArgs e)
        {
            Report_Viewer_Form frm = new Report_Viewer_Form();

            DataSet Data_Set = SqlServer_Classes.getBonCommande(codeCommande);

            BonCommande reportCommande = new BonCommande();

            reportCommande.SetDataSource(Data_Set);

            frm.Text = "Bon De Commande N°= " + codeCommande;
            frm.crystalReportViewer1.ReportSource = reportCommande;
            frm.Show();
        }
Example #4
0
        private void btnPrintBonCmd_Click(object sender, EventArgs e)
        {
            Report_Viewer_Form frm = new Report_Viewer_Form();

            frm.Text = "Bon De Commande N°= " + lblCodeCommande.Text;

            DataSet set = SqlServer_Classes.getBonCommande(int.Parse(lblCodeCommande.Text));

            BonCommande reportCommande = new BonCommande();

            reportCommande.SetDataSource(set);

            frm.crystalReportViewer1.ReportSource = reportCommande;
            frm.Show();
        }
Example #5
0
        public static void FacturerCommande_Print(int CodeCommande)
        {
            try
            {
                int CodeFacture = int.Parse(ExecuteScalar("select CodeFacture from Facture where CodeComm = '" + CodeCommande + "'").ToString());

                DataSet Data_Set = getFacture(CodeCommande);

                Facturation reportCommande = new Facturation();
                reportCommande.SetDataSource(Data_Set);

                Report_Viewer_Form frm = new Report_Viewer_Form();
                frm.Text = "Facture N°: " + CodeFacture + " pour la commande N°: " + CodeCommande;
                frm.crystalReportViewer1.ReportSource = reportCommande;
                frm.Show();
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message, "Un Erreur est survenue", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #6
0
        public static void ConfirmerChargement_Commande(int CodeCommande, int CodeChauffeur, int CodeCamion)
        {
            try
            {
                string CodeTour    = DateTime.Now.Year + "" + CodeCommande;
                int    CodeTournee = int.Parse(CodeTour);

                ExecuteQuery("insert into Tournee values(@CodeTournee, @DateTournee)", new SqlParameter[] { new SqlParameter("@DateTournee", DateTime.Now), new SqlParameter("@CodeTournee", CodeTournee) });
                SqlParameter[] parametre = new SqlParameter[]
                {
                    new SqlParameter("@CodeChauf", CodeChauffeur),
                    new SqlParameter("@CodeCamion", CodeCamion),
                    new SqlParameter("@CodeTournee", CodeTournee)
                };

                ExecuteQuery("update Commande set numTournee = @CodeTournee where Codecommande = @CodeComm", new SqlParameter[]
                {
                    new SqlParameter("CodeTournee", CodeTournee),
                    new SqlParameter("@CodeComm", CodeCommande)
                });

                ExecuteQuery("insert into Chargement(CodeChauf, CodeCamion, CodeTournee) values(@CodeChauf, @CodeCamion, @CodeTournee)", parametre);

                int CodeChargement = int.Parse(ExecuteScalar("select IDENT_CURRENT('Chargement')").ToString());

                DataSet Data_Set = getBonChargement(CodeChargement);

                BonDeChargement reportCommande = new BonDeChargement();
                reportCommande.SetDataSource(Data_Set);

                Report_Viewer_Form frm = new Report_Viewer_Form();
                frm.Text = "Bon De Chargement N°: " + CodeChargement + " pour la commande N°: " + CodeCommande;
                frm.crystalReportViewer1.ReportSource = reportCommande;
                frm.Show();
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message, "Un Erreur est survenue", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                data = new SqlDataAdapter("select CodeFacture,Total from Facture where CodeComm=" + textBox6.Text, con);
                data.Fill(set, "Facture");
                data = new SqlDataAdapter("select C.CodeDepot,C.CodeClient,C.DateCommande,C.Codecommande from Commande as C inner Join Facture as F on C.Codecommande=F.CodeComm where F.CodeComm=" + textBox6.Text, con);
                data.Fill(set, "Commande");
                data = new SqlDataAdapter("select Cl.Nom,Cl.Prenom,Cl.Cin,Cl.Tel,Cl.Adresse,Cl.Email from Client as Cl inner join Commande as C on C.CodeClient=Cl.Codeclient inner Join Facture as F on C.Codecommande=F.CodeComm where F.CodeComm=" + textBox6.Text, con);
                data.Fill(set, "Client");
                Facturation f = new Facturation();
                f.SetDataSource(set);
                Report_Viewer_Form r = new Report_Viewer_Form();
                r.Text = "Facture N° " + textBox6.Text;
                r.crystalReportViewer1.ReportSource = f;
                r.Show();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #8
0
        public static void LivrerCommande_Print(int CodeCommande)
        {
            try
            {
                int CodeTournee    = int.Parse(ExecuteScalar("select numTournee from Commande where Codecommande = '" + CodeCommande + "'").ToString());
                int CodeChargement = int.Parse(ExecuteScalar("select CodeChargement from Chargement where CodeTournee = '" + CodeTournee + "'").ToString());
                ExecuteQuery("insert into Livraison(CodeChargement) values('" + CodeChargement + "')");
                int CodeLivraison = int.Parse(ExecuteScalar("select IDENT_CURRENT('Livraison')").ToString());

                DataSet Data_Set = getBonLivraison(CodeLivraison);

                BonLivraison reportCommande = new BonLivraison();
                reportCommande.SetDataSource(Data_Set);

                Report_Viewer_Form frm = new Report_Viewer_Form();
                frm.Text = "Bon De Livraison N°: " + CodeLivraison + " pour la commande N°: " + CodeCommande;
                frm.crystalReportViewer1.ReportSource = reportCommande;
                frm.Show();
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message, "Un Erreur est survenue", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }