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); } }
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); } }
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); } }