Ejemplo n.º 1
0
        private void backgroundWorkerDailysales_DoWork(object sender, DoWorkEventArgs e)
        {
            var dal = new InvoiceDAL();
            try
            {
                int count = 1;
                invoiceList.ForEach(delegate(InvoiceHeaderBO obj)
                {
                    Thread.Sleep(10000);

                    var result = dal.DeleteInvoice(obj);

                    if (result)
                    {
                        double pCount = (double)count;
                        double pTotal = (double)invoiceList.Count();
                        double percentage = (pCount / pTotal) * 100;

                        backgroundWorkerDailysales.ReportProgress((int)percentage);

                        count++;
                    }
                    else
                    {
                        ErrorOccured = true;
                    }

                });

            }
            catch
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("ADM_003"), true);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        private void buttonShowRefundReport_Click(object sender, EventArgs e)
        {
            DateTime fromDate = dateTimePickerRefundFrom.Value;
            DateTime toDate = dateTimePickerRefundTo.Value;
            int pluID = -1;
            decimal amountFrom = 0;
            decimal amountTo = 0;
            string pluName = string.Empty;

            if (comboBoxRefundItem.SelectedValue != null)
            {
                pluID = int.Parse(comboBoxRefundItem.SelectedValue.ToString());
            }
            if (numericUpDownRefundAmountTo.Value > 0)
            {
                amountFrom = numericUpDownrefundAmountFrom.Value;
                amountTo = numericUpDownRefundAmountTo.Value;
            }
            DataSet ds = new DataSet();
            ds = new InvoiceDAL().GetSalesRefundReport(fromDate, toDate, pluID, amountFrom, amountTo);

            LoadSalesRefundReport(ds, fromDate, toDate, pluName, amountFrom, amountTo);
        }
Ejemplo n.º 4
0
        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;
            }
        }
Ejemplo n.º 5
0
        private void SaveInvoice(decimal balance)
        {
            try
            {
                if (InvoiceID > 0 && !ScreenFunctions.Update)
                {
                    MessageBoxClass.ShowMessage(CommonMethods.GetError("INV_020"), false);
                    return;
                }
                if (InvoiceID == -1 || InvoiceDetailBOList != null)
                {
                    var invoiceHeaderBO = new InvoiceHeaderBO();

                    string invoiceNumber = string.Empty;
                    if (textBoxInvoiceNumber.Text == "New")
                    {
                        invoiceNumber="INV00000000000000";
                    }
                    else
                    {
                        invoiceNumber = textBoxInvoiceNumber.Text.Trim();
                    }
                    invoiceHeaderBO.InvoiceID = InvoiceID;
                    invoiceHeaderBO.InvoiceNumber = invoiceNumber;
                    invoiceHeaderBO.CustomerID = 1;
                    invoiceHeaderBO.ReceivedAmount = numericUpDownAmount.Value;
                    invoiceHeaderBO.Balance = balance;
                    invoiceHeaderBO.StatusID = (int)CommonEnums.InvoiceStatus.Saved;
                    invoiceHeaderBO.CreatedUser = Common.User.UserId;
                    invoiceHeaderBO.Total = 0;

                    int invID = -1;
                    bool result = new InvoiceDAL().SaveInvoice(invoiceHeaderBO, InvoiceDetailBOList, ref invoiceNumber, ref invID);

                    InvoiceID = invID;

                    if (result)
                    {
                        textBoxInvoiceNumber.Text = invoiceNumber;
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_001"), false);
                        PrintReceipt();
                        ChangeStatus();
                    }
                    else
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_002"), false);
                    }
                }
                else
                {
                    MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_007"), false);
                }
            }
            catch (SqlException ex)
            {
                MessageBoxClass.ShowMessage(ex.Message, true);
            }
            catch
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_002"), true);
            }
        }
Ejemplo n.º 6
0
        private void buttonRefund_Click(object sender, EventArgs e)
        {
            try
            {
                if ((int)CommonEnums.InvoiceStatus.Refunded != InvoiceStatusID)
                {
                    var invoiceHeaderBO = new InvoiceHeaderBO();

                    invoiceHeaderBO.InvoiceID = InvoiceID;
                    invoiceHeaderBO.InvoiceNumber = textBoxInvoiceNumber.Text.Trim();
                    invoiceHeaderBO.CustomerID = 1;
                    invoiceHeaderBO.StatusID = (int)CommonEnums.InvoiceStatus.Refunded;
                    invoiceHeaderBO.CreatedUser = Common.User.UserId;
                    invoiceHeaderBO.Total = 0;

                    bool result = new InvoiceDAL().SaveInvoiceStatus(invoiceHeaderBO);

                    if (result)
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_005"), false);
                        IsRefunded = true;
                        PrintReceipt();
                        IsRefunded = false;
                        buttonNew_Click(null, null);
                    }
                    else
                    {
                        MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_006"), false);
                    }
                }
                else
                {
                    MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_009"), false);
                }

            }
            catch
            {
                MessageBoxClass.ShowMessage(CommonMethods.GetError("SAL_006"), true);
            }
        }
Ejemplo n.º 7
0
        private void SetLookUp(string lookupName)
        {
            try
            {
                Name = lookupName.Trim();

                if (LookUpType.Equals(CommonEnums.LookUps.Item))
                {
                    ItemList = new ItemDAL().GetAllItemsForLookUp();
                    dataGridViewLookUpData.DataSource = ItemList;
                }
                else if (LookUpType.Equals(CommonEnums.LookUps.MeasuringUnit))
                {
                    measuringUnitList = new MeasuringUnitDAL().GetAllMeasuringUnitsForLookUp();
                    dataGridViewLookUpData.DataSource = measuringUnitList;
                }
                else if (LookUpType.Equals(CommonEnums.LookUps.user))
                {
                    userList = new UserDAL().GetAllUsersForLookUp();
                    dataGridViewLookUpData.DataSource = userList;
                }
                else if (LookUpType.Equals(CommonEnums.LookUps.subItem))
                {
                    subItemList = new SubItemDAL().GetAllSubItemsForLookUp();
                    dataGridViewLookUpData.DataSource = subItemList;

                }
                else if (LookUpType.Equals(CommonEnums.LookUps.role))
                {
                    roleList = new RoleDAL().GetRolesLookUp();
                    dataGridViewLookUpData.DataSource = roleList;

                }
                else if (LookUpType.Equals(CommonEnums.LookUps.screen))
                {
                    screenList = new ScreenDAL().LoadScreensForLookUp();
                    dataGridViewLookUpData.DataSource = screenList;

                }
                else if (LookUpType.Equals(CommonEnums.LookUps.invoice))
                {
                    invoiceList = new InvoiceDAL().LoadAllInvoicesForLookUp();
                    dataGridViewLookUpData.DataSource = invoiceList;

                }
                CellResize();
                PopulateCombo();

                if (!string.IsNullOrEmpty(InitialValue))
                {
                    textBoxValue.Text = InitialValue;
                    buttonFind_Click(null, null);
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }