Exemplo n.º 1
0
        private void btnShowReport_Click(object sender, EventArgs e)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;
                DataSet  dsRecords = new DataSet();
                DateTime dtCurrent = DateTime.Now;

                DateTime       dtStartofDay  = new DateTime(dtPickerStart.Value.Year, dtPickerStart.Value.Month, dtPickerStart.Value.Day, 0, 0, 0);
                DateTime       dtEndofDay    = new DateTime(dtPickerEnd.Value.Year, dtPickerEnd.Value.Month, dtPickerEnd.Value.Day, 23, 59, 59);
                CReportManager objReportMgnr = new CReportManager();
                CResult        objResult     = objReportMgnr.GetInventorySalesRecords(dtStartofDay.Ticks, dtEndofDay.Ticks);
                dsRecords = (DataSet)objResult.Data;


                DataTable dtDetails = GetInventroySalesReport(dsRecords);

                if (dsRecords.Tables[0].Rows.Count > 0)
                {
                    Int32            totalCovers = Convert.ToInt32("0" + dsRecords.Tables[0].Rows[0]["guest_count"].ToString());
                    rptSalesInterval objSales    = new rptSalesInterval();
                    objSales.SetDataSource(dtDetails);

                    objSales.SetParameterValue(0, dtPickerStart.Value.ToString("dd/MM/yyyy"));
                    objSales.SetParameterValue(1, dtPickerEnd.Value.ToString("dd/MM/yyyy"));
                    objSales.SetParameterValue(2, DateTime.Now.ToString("dd/MM/yyyy"));


                    string reportHeader = RMSAdminController.CollectHeader();
                    string reportFooter = RMSAdminController.CollectFooter();
                    objSales.SetParameterValue(3, reportHeader);
                    objSales.SetParameterValue(4, reportFooter);
                    objSales.SetParameterValue(5, totalCovers.ToString());

                    RecportViewerCtl objRptViewer = new RecportViewerCtl(m_parentForm);
                    objRptViewer.cRptViewerAdmin.ReportSource = objSales;

                    m_parentForm.pnlContext.Controls.Clear();

                    objRptViewer.Parent = this;
                    m_parentForm.pnlContext.Controls.Add(objRptViewer);
                    objRptViewer.Dock = DockStyle.Fill;
                }
                else
                {
                    MessageBox.Show("There is no record.", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                this.Cursor = Cursors.Default;
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Exemplo n.º 2
0
        private void CollectFoodType()
        {
            String sqlCommand = String.Empty;

            sqlCommand = SqlQueries.GetQuery(Query.ViewCategory1);

            CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

            String tempConnStr = oTempDal.ConnectionString;

            // Create a new data adapter based on the specified query.
            SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr);

            SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

            DataTable table = new DataTable();

            table.Locale = System.Globalization.CultureInfo.InvariantCulture;
            dataAdapter.Fill(table);

            rptFoodType objFoodType = new rptFoodType();

            objFoodType.SetDataSource(table);
            string reportHeader = RMSAdminController.CollectHeader();
            string reportFooter = RMSAdminController.CollectFooter();

            objFoodType.SetParameterValue(0, reportHeader);
            objFoodType.SetParameterValue(1, reportFooter);


            dataAdapter.Dispose();



            RecportViewerCtl objRptViewer = new RecportViewerCtl(this);

            objRptViewer.cRptViewerAdmin.ReportSource = objFoodType;


            pnlContext.Controls.Clear();

            objRptViewer.Parent = this;
            pnlContext.Controls.Add(objRptViewer);
            objRptViewer.Dock = DockStyle.Fill;
        }