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; } }
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; }
private void tsRptInventorySoldToday_Click(object sender, EventArgs e) { try { this.Cursor = Cursors.WaitCursor; DataSet dsRecords = new DataSet(); DateTime dtCurrent = DateTime.Now; DateTime dtStartofDay = new DateTime(dtCurrent.Year, dtCurrent.Month, dtCurrent.Day, 0, 0, 0); DateTime dtEndofDay = new DateTime(dtCurrent.Year, dtCurrent.Month, dtCurrent.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 (dtDetails.Rows.Count > 0) { string reportHeader = RMSAdminController.CollectHeader(); string reportFooter = RMSAdminController.CollectFooter(); Int32 totalCovers = Convert.ToInt32("0" + dsRecords.Tables[0].Rows[0]["guest_count"].ToString()); rptCurrentdaySalesReport objCurrentSales = new rptCurrentdaySalesReport(); objCurrentSales.SetDataSource(dtDetails); objCurrentSales.SetParameterValue(0, reportHeader); objCurrentSales.SetParameterValue(1, reportFooter); objCurrentSales.SetParameterValue(2, totalCovers.ToString()); RecportViewerCtl objRptViewer = new RecportViewerCtl(this); objRptViewer.cRptViewerAdmin.ReportSource = objCurrentSales; pnlContext.Controls.Clear(); objRptViewer.Parent = this; 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; } }
private void CollectParentCategory() { try { String sqlCommand = SqlQueries.GetQuery(Query.ViewParentCategory); 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 parentCategory = new DataTable(); parentCategory.Locale = System.Globalization.CultureInfo.InvariantCulture; dataAdapter.Fill(parentCategory); rptParentCategory objParentCategory = new rptParentCategory(); objParentCategory.SetDataSource(parentCategory); string reportHeader = RMSAdminController.CollectHeader(); string reportFooter = RMSAdminController.CollectFooter(); objParentCategory.SetParameterValue(0, reportHeader); objParentCategory.SetParameterValue(1, reportFooter); dataAdapter.Dispose(); RecportViewerCtl objRptViewer = new RecportViewerCtl(this); objRptViewer.cRptViewerAdmin.ReportSource = objParentCategory; pnlContext.Controls.Clear(); objRptViewer.Parent = this; pnlContext.Controls.Add(objRptViewer); objRptViewer.Dock = DockStyle.Fill; } catch (Exception exp) { throw exp; } }