private void Buscarbutton_Click(object sender, EventArgs e)
        {
            int     id      = Convert.ToInt32(reciboIdNumericUpDown.Value);
            Recibos recibos = ReciboBLL.Buscar(id);

            if (recibos != null)
            {
                LlenaCampos(recibos);


                if (MessageBox.Show("¿Desea Imprimir el Recibo?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                {
                    foreach (var item in  ReciboBLL.GetList(X => true))
                    {
                        if (item.ReciboId == reciboIdNumericUpDown.Value)
                        {
                            VentanaReciboReporte abrir = new VentanaReciboReporte(ReciboBLL.GetList(X => X.ReciboId == item.ReciboId));
                            abrir.Show();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("No se encontro!", "Fallo",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        private void Imprimirbutton_Click(object sender, EventArgs e)
        {
            Recibos recibo = new Recibos();

            if (RecibodataGridView.Rows.Count > 0 && RecibodataGridView.CurrentRow != null)
            {
                //convertir el grid en la lista
                List <Recibos> detalle = (List <Recibos>)RecibodataGridView.DataSource;

                //selecciona la fila
                int id = detalle.ElementAt(RecibodataGridView.CurrentRow.Index).ReciboId;

                VentanaReciboReporte abrir = new VentanaReciboReporte(BLL.ReciboBLL.GetList(x => x.ReciboId == id));
                abrir.Show();
            }
            else
            {
                MessageBox.Show("No Hay Nada dentro del Grid", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
        }
        private void Guardarbutton_Click(object sender, EventArgs e)
        {
            if (Validar(2))
            {
                MessageBox.Show("Debe Agregar Algun Producto al Grid", "Validación",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else
            {
                foreach (var item in BLL.ActivodeNegocioBLL.GetList(x => x.ActivodeNegocioId == 1))
                {
                    if (item.Activo < Convert.ToDecimal(montoTotalTextBox.Text))
                    {
                        MessageBox.Show("La Compraventa No dispone de Esa Cantidad de dinero ", "Validacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                Recibos recibos = LlenaClase();
                bool    Paso    = false;

                //Determinar si es Guardar o Modificar


                if (reciboIdNumericUpDown.Value == 0)
                {
                    Paso = ReciboBLL.Guardar(recibos);
                    HayErrores.Clear();
                }
                else
                {
                    var V = ReciboBLL.Buscar(Convert.ToInt32(reciboIdNumericUpDown.Value));

                    if (V != null)
                    {
                        Paso = ReciboBLL.Editar(recibos);
                    }
                    HayErrores.Clear();
                }


                if (MessageBox.Show("¿Desea Imprimir el Recibo?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                {
                    List <Recibos> list = ReciboBLL.GetList(X => true);

                    List <Recibos> nuevo = new List <Recibos>();

                    nuevo.Add(list.Last());

                    VentanaReciboReporte abrir = new VentanaReciboReporte(nuevo);
                    abrir.Show();
                }


                //Informar el resultado
                if (Paso)
                {
                    MessageBox.Show("Guardado!!", "Exito",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("No se pudo guardar!!", "Fallo",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }