private void report_Click(object sender, EventArgs e)
        {
            printSaleForm        printForm = new printSaleForm();
            medicalStoreDataSet6 dataSet   = new medicalStoreDataSet6();

            dataSet.EnforceConstraints = false;

            companyNameReport report = new companyNameReport();

            try
            {
                DataTable dt = new DataTable();
                foreach (DataGridViewRow row in this.dataGridView1.Rows)
                {
                    DataRow dr = dt.NewRow();

                    if (row.DataBoundItem != null)
                    {
                        dr = (DataRow)((DataRowView)row.DataBoundItem).Row;

                        dataSet.companyName.ImportRow(dr);
                    }
                }

                report.SetDataSource(dataSet);

                printForm.crystalReportViewer1.ReportSource = report;
                printForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void report_Click(object sender, EventArgs e)
        {
            printSaleForm printForm = new printSaleForm();
            stockDataSet  dataSet   = new stockDataSet();

            dataSet.EnforceConstraints = false;

            viewExpireStockReport report = new viewExpireStockReport();

            try
            {
                adapter1.Fill(dataSet.addStock);

                adapter2.Fill(dataSet.medicine);

                report.SetDataSource(dataSet);

                printForm.crystalReportViewer1.ReportSource = report;
                printForm.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #3
0
        private void print_Click(object sender, EventArgs e)
        {
            printSaleForm       printForm = new printSaleForm();
            invoideStoreDataSet dataSet   = new invoideStoreDataSet();
            CrystalReport2      report    = new CrystalReport2();

            try
            {
                String        conString = ConfigurationManager.ConnectionStrings["medical_Store.Properties.Settings.medicalStoreConnectionString"].ConnectionString;
                SqlConnection con       = new SqlConnection(conString);
                con.Open();

                String         sql     = "SELECT cashMemoNo,CustomerName,gross,disc,net  FROM masterSale WHERE cashMemoNo='" + cashMemoNo.Text + "'";
                SqlDataAdapter adapter = new SqlDataAdapter(sql, con);
                //DataTable table = new DataTable();
                adapter.Fill(dataSet.masterSale);

                String         sql2     = "SELECT medicineName,price,qty FROM childSale WHERE cashMemoNo='" + cashMemoNo.Text + "'";
                SqlDataAdapter adapter2 = new SqlDataAdapter(sql2, con);
                //DataTable table = new DataTable();
                adapter2.Fill(dataSet.childSale);
                report.SetDataSource(dataSet);

                dataSet.EnforceConstraints = false;
                printForm.crystalReportViewer1.ReportSource = report;
                printForm.Show();

                con.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }