Example #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;
            }
        }
Example #2
0
        private static void Init()
        {
            ConfigManager.Init();
            ConfigManager.ReloadConfig();
            CCommonConstants oTempConstant = ConfigManager.GetConfig<CCommonConstants>();

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

            CLogin oLogin = new CLogin();
            oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), oTempConstant.RemoteURL);

            CResult oResult = oLogin.GetInitialDBStr();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                DataSet dsRecords = new DataSet();
                String oTempStr = (String)oResult.Data;
                oTempConstant.DBConnection = oTempStr;
                RMSGlobal.m_serverConnectionString = oTempConstant.DBConnection;

                CReportManager objReportMgnr = new CReportManager();
                CResult objFoodType = objReportMgnr.GetFoodTypesRecords();
                dsRecords = (DataSet)objFoodType.Data;
                m_foodTypeRecords=dsRecords.Tables[0];

                objFoodType = objReportMgnr.GetFoodCategoryRecords();
                dsRecords = (DataSet)objFoodType.Data;
                m_categoryRecords= dsRecords.Tables[0];

                objFoodType = objReportMgnr.GetFoodItemRecords();
                dsRecords = (DataSet)objFoodType.Data;
                 m_foodItemRecords= dsRecords.Tables[0];

                objFoodType = objReportMgnr.GetSelectionofItemsRecords();
                dsRecords = (DataSet)objFoodType.Data;
                m_selectionItemRecords=dsRecords.Tables[0];

                //m_initDataSet.Relations.Add("category1_to_category2",
                //      m_foodTypeRecords.Columns["cat1_id"],
                //      m_categoryRecords.Columns["cat1_id"], false);
            }
        }