private void buttonSalesByPLU_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet ds = new DataSet();
                DateTime sysDate = new DayProcessDAL().GetCurrentDayProcessDate();
                string plu = string.Empty;
                if (comboBoxSubItems.SelectedValue != null)
                {
                    plu = comboBoxSubItems.Text;
                    ds = new InvoiceDAL().GetSalesByPLUReport(sysDate, sysDate, int.Parse(comboBoxSubItems.SelectedValue.ToString()));
                }

                LoadSalesbyPluReport(ds, sysDate, sysDate, plu);
            }
            catch
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("U_007"), true);
            }
        }
        private void backgroundWorkerDailysales_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                if (!ErrorOccured)
                {
                    var result=new DayProcessDAL().CompleteDayProcess(Common.User.UserId);

                    if (result)
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("ADM_001"), false);
                        Close();
                        Main.FormMain.Close();
                    }
                    else
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("ADM_005"), false);
                    }
                }
                else
                {
                    MessageBoxClass.ShowMessage(CommonMethods.GetError("ADM_002"), true);
                }

                progressBarDailySales.Visible = false;
                Cursor.Current = Cursors.Arrow;
            }
            catch
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("ADM_003"), true);
            }
        }
        private void treeViewReports_AfterSelect(object sender, TreeViewEventArgs e)
        {
            reportViewerMain.Clear();
            reportViewerMain.LocalReport.DataSources.Clear();
            reportViewerMain.RefreshReport();
            reportViewerMain.Reset();

            panelRefundReport.Visible = false;
            panelSalesByPlu.Visible = false;

            if (e.Node.Name == "dailySalesNode")
            {
                tableLayoutPanelReport.RowStyles[0].Height = 0;

                DateTime sysDate = new DayProcessDAL().GetCurrentDayProcessDate();
                DataSet ds = new InvoiceDAL().GetDailySalesReport(sysDate, sysDate);

                tableLayoutPanelReport.Visible = true;
                LoadDailySalesReport(ds, sysDate, sysDate);
            }
            if (e.Node.Name == "DailyInventoryNode")
            {
                tableLayoutPanelReport.RowStyles[0].Height = 0;

                DataSet ds = new ItemDAL().GetAllItemsReport();

                tableLayoutPanelReport.Visible = true;
                LoadInventoryReport(ds);
            }
            if (e.Node.Name == "SalesbyPLUNode")
            {
                tableLayoutPanelReport.RowStyles[0].Height = 10;

                panelReportForm.Controls.Add(panelSalesByPlu);
                panelSalesByPlu.Dock = DockStyle.Fill;
                panelSalesByPlu.Visible = true;

                LoadSubItems(comboBoxSubItems);
                tableLayoutPanelReport.Visible = true;
            }
            if (e.Node.Name == "RefundNode")
            {
                tableLayoutPanelReport.RowStyles[0].Height = 20;

                panelReportForm.Controls.Add(panelRefundReport);
                panelRefundReport.Dock = DockStyle.Fill;
                panelRefundReport.Visible = true;

                LoadSubItems(comboBoxRefundItem);
                tableLayoutPanelReport.Visible = true;
            }
        }
        private void LoadInventoryReport(DataSet dataSet)
        {
            try
            {
                if (dataSet.Tables[0] != null)
                {
                    if (dataSet.Tables[0].Rows.Count > 0)
                    {
                        ReportParameter[] param = new ReportParameter[1];
                        DateTime sysDate = new DayProcessDAL().GetCurrentDayProcessDate();
                        param[0] = new ReportParameter("Report_Parameter_CurrentDate", sysDate.ToString("dd-MMM-yyyy"), true);

                        reportViewerMain.LocalReport.DataSources.Clear();

                        reportViewerMain.LocalReport.ReportEmbeddedResource = "Anushka.Juice_bar.Reports.RDLC.Inventory.rdlc";

                        ReportDataSource reportDataSource = new ReportDataSource("DSInventory_GetAllItems", dataSet.Tables[0]);

                        reportViewerMain.LocalReport.DataSources.Add(reportDataSource);
                        reportViewerMain.LocalReport.EnableExternalImages = true;
                        reportViewerMain.LocalReport.SetParameters(param);

                        //reportViewerMain.Show();
                        reportViewerMain.RefreshReport();
                        // lblSuccessmsg.Text = Common.GerErrorMessage("LN-503");
                    }
                    else
                    {
                        reportViewerMain.Reset();
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_013"), false);
                    }
                }
                else
                {
                    reportViewerMain.Reset();
                    MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_013"), false);
                }
            }
            catch (Exception ex)
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("U_007"), true);
            }
        }