Esempio n. 1
0
        private void SaveChangesToSale()
        {
            _currentSale.CustBalance -= txtAmountPaid.Text.ToDecimal();
            _currentSale.AmountPaid   = txtAmountPaid.Text.ToDecimal();
            _currentSale.SaleID       = _currentsaleID;
            _currentSale.Amount       = txtTotalAmt.Text.ToDecimal();
            _currentSale.SubTotal     = txtSubTotal.Text.ToDecimal();
            _currentSale.Discount     = txtSaleDiscount.Text.ToDecimal();

            if (!(txtAmountPaid.Text.ToDecimal() <= 0))
            {
                _currentSale.SaleStatusID = _currentSale.CustBalance <= 0 ? (int)SaleStatuses.Closed : (int)SaleStatuses.Invoiced;
            }

            _sale.Update(_currentSale);
            _saleDetail.SaveChangesToAffectedProducts(_affectedProduts);

            _dirty = false;
            UpdateUI(_currentSale.SaleStatusID);
            _affectedProduts.Clear();

            Helper.ShowMessage("Changes has been committed successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }