示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            ArticleSegregationFormReport rpt = new ArticleSegregationFormReport();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void previewReport(string qry)
        {
            DataTable table = new DataTable();

            MySqlDataReader reader = null;

            table.Columns.Add("Department", typeof(string));
            table.Columns.Add("Article", typeof(string));
            table.Columns.Add("Color", typeof(string));
            table.Columns.Add("Size", typeof(string));
            table.Columns.Add("Qty", typeof(int));

            try
            {
                reader = DBConnection.getData(qry);

                if (reader.HasRows)
                {
                    while (reader.Read())
                    {
                        table.Rows.Add(reader.GetString("Department"), reader.GetString("Article"), reader.GetString("Color"), reader.GetString("Size"), reader.GetInt32("Qty"));
                    }

                    reader.Close();

                    Report.ArticleSegregationFormReport rpt = new Report.ArticleSegregationFormReport();

                    rpt.Database.Tables["Items"].SetDataSource(table);

                    categoryReportViewer.ReportSource = null;
                    categoryReportViewer.ReportSource = rpt;
                }
                else
                {
                    reader.Close();

                    MessageBox.Show("No records!", "Items picker", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex, "Items picker", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }