コード例 #1
0
        private void AddProductRadButton_Click(object sender, EventArgs e)
        {
            bool isAdded = false;

            if (ToValidateAddProductoToGrid())
            {
                InvoiceDetailGridModel _p = new InvoiceDetailGridModel()
                {
                    ProductDetailID = CurrentProductToSelected.ProductDetailID,
                    ProductID       = CurrentProductToSelected.ProductID,
                    ProductCode     = CurrentProductToSelected.ProductCode,
                    ProductName     = CurrentProductToSelected.ProductName,
                    UnitPrice       = Convert.ToDecimal(UnitPriceRadMaskedEditBox.Value),
                    Quantity        = Convert.ToInt32(AmountMaskedEditBox.Value)
                };

                foreach (InvoiceDetailGridModel active in _invoiceDetailGridModel)
                {
                    if (active.ProductID == _p.ProductID)
                    {
                        isAdded = true;
                        RadMessageBox.Show("Este producto ya ha sido agregado a la venta", "JOSIAS INDUSTRIAL SRL", MessageBoxButtons.OK, RadMessageIcon.Info);
                        SearchProductComboBox.SelectedIndex = -1;
                        SearchProductComboBox.Focus();
                        break;
                    }
                }
                if (!isAdded)
                {
                    _invoiceDetailGridModel.Add(_p);
                    FillProductRadGridView();
                    CalculateSubTotalAndMore();
                    SearchProductComboBox.SelectedIndex = -1;
                    SearchProductComboBox.Focus();
                }
                ClearProductFields();
                return;
            }
        }
コード例 #2
0
        private void NewInvoiceRadForm_Load(object sender, EventArgs e)
        {
            this.InvoiceDetailsRadGridView.EnableGrouping    = false;
            this.InvoiceDetailsRadGridView.TableElement.Text = "No hay Producto agregado";
            if (this._stateForm == StateForm.NEW)
            {
                this.Text = "Nueva Fáctura";
                this.SearchCustomerComboBox.Enabled = true;
            }
            else if (this._stateForm == StateForm.EDIT)
            {
                this.Text = String.Format("Editando Fáctura - {0} ", this._currentInvoiceToEdit.InvoiceNumber.GetInvoiceNumberExt());
                this.SearchCustomerComboBox.Enabled = false;

                StringBuilder sb = new StringBuilder();
                //SearchCustomerComboBox.Text = this._currentInvoiceToEdit.Customer.CustomerCode;

                var _customer = this._currentInvoiceToEdit.Customer;
                sb.AppendLine(_customer.CompanyName + " || " + _customer.ContactName)
                .AppendLine(_customer.Phone1)
                .AppendLine(_customer.Address1)
                .AppendLine(_customer.Province.Name + ", " + _customer.Municipality.Name);
                CustomerPersonalDataRadTextBox.Text = sb.ToString();


                EmployeesComboBox.SelectedValue              = this._currentInvoiceToEdit.Employee.EmployeeID;
                TypeOfPayComboBox.SelectedValue              = this._currentInvoiceToEdit.TypeOfPay.TypeOfPayID;
                InvoiceDateRadDateTimePicker.Value           = this._currentInvoiceToEdit.InvoiceDate;
                ExpirationInvoiceDateRadDateTimePicker.Value = this._currentInvoiceToEdit.ExpirationInvoiceDate;
                InvoiceNumberRadTextBox.Text    = this._currentInvoiceToEdit.InvoiceNumber.GetInvoiceNumberExt();
                RefInvoiceRadMaskedEditBox.Text = this._currentInvoiceToEdit.ReferenceInvoice;

                if (this._currentInvoiceToEdit.DisCount.HasValue)
                {
                    DiscountRadMaskedEditBox.Value = this._currentInvoiceToEdit.DisCount.Value;
                }

                if (this._currentInvoiceToEdit.TaxID.HasValue)
                {
                    TaxIDComboBox.SelectedValue = this._currentInvoiceToEdit.TaxID.Value;
                }


                foreach (var item in this._currentInvoiceToEdit.InvoiceDetails)
                {
                    InvoiceDetailGridModel linea = new InvoiceDetailGridModel()
                    {
                        ProductCode     = item.Kardex.ProductDetail.Product.ProductCode,
                        ProductDetailID = item.ProductDetailID,
                        ProductID       = item.Kardex.ProductDetail.Product.ProductID,
                        ProductName     = item.Kardex.ProductDetail.Product.ProductName,
                        UnitPrice       = item.UnitPrice,
                        Quantity        = item.Quantity
                    };
                    _invoiceDetailGridModel.Add(linea);
                }
                FillProductRadGridView();
                CalculateSubTotalAndMore();
                //ProductCodeRadMaskedEditBox.Focus();
            }
            else if (this._stateForm == StateForm.SEE_MORE)
            {
                this.Text = String.Format("Detalle de Fáctura - {0} ", this._currentInvoiceToEdit.InvoiceNumber.GetInvoiceNumberExt());
                this.SearchCustomerComboBox.Enabled            = false;
                DeleteLineaRadButton.Enabled                   = false;
                UpdateListRadButton.Enabled                    = false;
                SaveToPrintRadButton.Enabled                   = false;
                SaveToExitRadButton.Enabled                    = false;
                AmountMaskedEditBox.Enabled                    = false;
                UnitPriceRadMaskedEditBox.Enabled              = false;
                AddProductRadButton.Enabled                    = false;
                EmployeesComboBox.Enabled                      = false;
                TypeOfPayComboBox.Enabled                      = false;
                InvoiceDateRadDateTimePicker.Enabled           = false;
                ExpirationInvoiceDateRadDateTimePicker.Enabled = false;
                RefInvoiceRadMaskedEditBox.Enabled             = false;
                DiscountRadMaskedEditBox.Enabled               = false;
                TaxIDComboBox.Enabled = false;


                StringBuilder sb = new StringBuilder();
                SearchCustomerComboBox.SelectedValue = this._currentInvoiceToEdit.Customer.CustomerID;

                var _customer = this._currentInvoiceToEdit.Customer;
                sb.AppendLine(_customer.CompanyName + " || " + _customer.ContactName)
                .AppendLine(_customer.Phone1)
                .AppendLine(_customer.Address1)
                .AppendLine(_customer.Province.Name + ", " + _customer.Municipality.Name);
                CustomerPersonalDataRadTextBox.Text = sb.ToString();


                EmployeesComboBox.SelectedValue              = this._currentInvoiceToEdit.Employee.EmployeeID;
                TypeOfPayComboBox.SelectedValue              = this._currentInvoiceToEdit.TypeOfPay.TypeOfPayID;
                InvoiceDateRadDateTimePicker.Value           = this._currentInvoiceToEdit.InvoiceDate;
                ExpirationInvoiceDateRadDateTimePicker.Value = this._currentInvoiceToEdit.ExpirationInvoiceDate;
                InvoiceNumberRadTextBox.Text    = this._currentInvoiceToEdit.InvoiceNumber.GetInvoiceNumberExt();
                RefInvoiceRadMaskedEditBox.Text = this._currentInvoiceToEdit.ReferenceInvoice;

                if (this._currentInvoiceToEdit.DisCount.HasValue)
                {
                    DiscountRadMaskedEditBox.Value = this._currentInvoiceToEdit.DisCount.Value;
                }

                if (this._currentInvoiceToEdit.TaxID.HasValue)
                {
                    TaxIDComboBox.SelectedValue = this._currentInvoiceToEdit.TaxID.Value;
                }


                foreach (var item in this._currentInvoiceToEdit.InvoiceDetails)
                {
                    InvoiceDetailGridModel linea = new InvoiceDetailGridModel()
                    {
                        ProductCode     = item.Kardex.ProductDetail.Product.ProductCode,
                        ProductDetailID = item.ProductDetailID,
                        ProductID       = item.Kardex.ProductDetail.Product.ProductID,
                        ProductName     = item.Kardex.ProductDetail.Product.ProductName,
                        UnitPrice       = item.UnitPrice,
                        Quantity        = item.Quantity
                    };
                    _invoiceDetailGridModel.Add(linea);
                }
                FillProductRadGridView();
                CalculateSubTotalAndMore();
                //ProductCodeRadMaskedEditBox.Focus();
            }
        }