Ejemplo n.º 1
0
        private void CalcularDevuelta()
        {
            DevueltaerrorProvider.Clear();
            Factura.DineroPagado = Utilidades.TOINT(RecibidomaskedTextBox.Text);
            Factura.Monto        = Utilidades.TOINT(MontotextBox.Text);

            if (!string.IsNullOrEmpty(RecibidomaskedTextBox.Text))
            {
                if (Factura.DineroPagado < Factura.Monto)
                {
                    MessageBox.Show("El dinero no es suficiente para cubrir su comprar.");
                    RecibidomaskedTextBox.Clear();
                    RecibidomaskedTextBox.Focus();
                }
                else
                {
                    Factura.Devuelta     = Factura.DineroPagado - Factura.Monto;
                    DevueltatextBox.Text = Factura.Devuelta.ToString();
                }
            }
            else
            {
                RecibidoerrorProvider.SetError(RecibidomaskedTextBox, "Digite la cantidad de dinero pagada.");
                RecibidomaskedTextBox.Focus();
            }
        }
Ejemplo n.º 2
0
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            if (Validar())
            {
                if (FormaPagoComboBox.Text == "Contado")
                {
                    if (string.IsNullOrEmpty(RecibidomaskedTextBox.Text))
                    {
                        RecibidoerrorProvider.SetError(RecibidomaskedTextBox, "Por favor llenar el campo.");
                    }
                    else if (string.IsNullOrEmpty(DevueltatextBox.Text))
                    {
                        DevueltaerrorProvider.SetError(DevueltatextBox, "Por favor llenar el campo.");
                    }
                    else
                    {
                        Factura = LlenarCampos();

                        if (BLL.FacturasBLL.Guardar(Factura))
                        {
                            ReducirExistenciaProducto(CantidadnumericUpDown.Value);
                            FacturaIdmaskedTextBox.Text = Factura.FacturaId.ToString();
                            MessageBox.Show("Guardado con exito.");
                            RecibidomaskedTextBox.Enabled = false;
                        }
                        else
                        {
                            MessageBox.Show("Error! no se pudo guardar.");
                        }
                    }
                }
                else if (FormaPagoComboBox.Text == "Credito")
                {
                    Factura = LlenarCampos();

                    if (BLL.FacturasBLL.Guardar(Factura))
                    {
                        FacturaIdmaskedTextBox.Text = Factura.FacturaId.ToString();
                        ReducirExistenciaProducto(CantidadnumericUpDown.Value);
                        MessageBox.Show("Guardado con exito.");

                        RecibidomaskedTextBox.Enabled = false;
                    }
                    else
                    {
                        MessageBox.Show("Error! no se pudo guardar.");
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void Limpiar()
        {
            Detalle = new Entidades.FacturasProductos();
            Factura = new Entidades.Facturas();

            FacturaIdmaskedTextBox.Clear();
            ClienteIdmaskedTextBox.Clear();
            NombreClientetextBox.Clear();
            MontotextBox.Clear();
            FechadateTimePicker.Value = DateTime.Now;
            ProductoIdmaskedTextBox.Clear();
            DescripcionProductotextBox.Clear();
            ProductodataGridView.DataSource = null;
            CantidadnumericUpDown.Value     = 0;
            PreciotextBox.Clear();
            DevueltatextBox.Clear();
            RecibidomaskedTextBox.Clear();
            ComentariotextBox.Clear();
            NombreClienteerrorProvider.Clear();
            CantidaderrorProvider.Clear();
            ProductoerrorProvider.Clear();
            RecibidoerrorProvider.Clear();
            GriderrorProvider.Clear();
            ClienteIderrorProvider.Clear();
            FacturaIderrorProvider.Clear();
            DevueltaerrorProvider.Clear();
            FormaPagoComboBox.Text = null;

            ClienteIdmaskedTextBox.Enabled  = true;
            ProductoIdmaskedTextBox.Enabled = true;
            FechadateTimePicker.Enabled     = true;
            ComentariotextBox.Enabled       = true;
            FormaPagoComboBox.Enabled       = true;
            ProductodataGridView.Enabled    = true;
            RecibidomaskedTextBox.Enabled   = false;
            FacturaIdmaskedTextBox.Enabled  = true;
            CantidadnumericUpDown.Enabled   = false;
        }