Exemplo n.º 1
0
        // genarate Sales report
        public static ReportClass Sales(DateTime?from, DateTime?To)
        {
            OdbcDataAdapter reportAdapter;
            DataSet         reportDataSet;
            ReportClass     currentReport = null;

            if (from == null || To == null)
            {
                reportAdapter = new OdbcDataAdapter("select * from salesview", DBConnection.getConnection());
            }
            else
            {
                reportAdapter = new OdbcDataAdapter("select * from salesview where InvoiceDate between date(?) and date(?)", DBConnection.getConnection());
                reportAdapter.SelectCommand.Parameters.Add("@from", OdbcType.VarChar).Value = String.Format("{0:yyyy-MM-dd}", from);
                reportAdapter.SelectCommand.Parameters.Add("@to", OdbcType.VarChar).Value   = String.Format("{0:yyyy-MM-dd}", To);
            }
            reportDataSet = new reportDS();

            reportAdapter.Fill(reportDataSet, "sales");
            if (reportDataSet.Tables["sales"].Rows.Count > 0)
            {
                currentReport = new RptSales();
                currentReport.SetDataSource(reportDataSet);
            }
            return(currentReport);
        }
Exemplo n.º 2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            RptSales rpt = new RptSales();

            rpt.Site = this.Site;
            return(rpt);
        }