예제 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            //Validacion
            bool bFlag = false;

            DocumentoErrorProvider.Clear();
            bFlag = ValidarCliente();
            bFlag = ValidarProducto();
            bFlag = ValidarCantidad();

            if (!bFlag)
            {
                //Agregar Items
                ItemBE oItem = new ItemBE();
                oItem = oFacturaBL.ObtenerItem(oFacturaBL.GetDetalle(), otmpProducto.CodProducto);

                if (oItem == null)
                {
                    oFacturaBL.AgregarDetalle(new ItemBE()
                    {
                        Cantidad = Convert.ToInt32(txtcantidad.Text),
                        Precio   = Convert.ToDecimal(txtprecio.Text),
                        Producto = otmpProducto
                    });
                }
                else
                {
                    oFacturaBL.EliminarItem(oFacturaBL.GetDetalle(), otmpProducto.CodProducto);

                    oFacturaBL.AgregarDetalle(new ItemBE()
                    {
                        Cantidad = oItem.Cantidad + Convert.ToInt32(txtcantidad.Text),
                        Precio   = Convert.ToDecimal(txtprecio.Text),
                        Producto = otmpProducto
                    });
                }



                //Actualizar DataGrid
                dataGridView1.DataSource = null;
                dataGridView1.DataSource = oFacturaBL.GetDetalle();


                txtsubtotal.Text = oFacturaBL.SubTotal.ToString();
                txtigv.Text      = oFacturaBL.IGV.ToString();
                txttotal.Text    = oFacturaBL.Total.ToString();
            }
        }
예제 #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            //Validar TextBox Cantidad Sea Numerico y != Nulo
            string cantidad = txtcantidad.Text;

            if (string.IsNullOrWhiteSpace(cantidad) || !(cantidad.Any(Char.IsDigit)))
            {
                MessageBox.Show("Por favor ingresar cantidad con valores numericos y diferente a Nulo");
                txtcantidad.Focus();
                return;
            }

            //Boton Agregar a Factura
            oFacturaBL.AgregarDetalle(new ItemBE()
            {
                Cantidad = Convert.ToInt32(txtcantidad.Text),
                Precio   = Convert.ToDecimal(txtprecio.Text),
                Producto = otmpProducto
            });

            //Actualizar DataGrid
            dataGridView1.DataSource = null;
            dataGridView1.DataSource = oFacturaBL.GetDetalle();

            txtsubtotal.Text = oFacturaBL.SubTotal.ToString();
            txtigv.Text      = oFacturaBL.IGV.ToString();
            txttotal.Text    = oFacturaBL.Total.ToString();
        }
예제 #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (txtcantidad.Text == "")
            {
                MessageBox.Show("Este campo esta vacio");
            }
            else
            {
                MessageBox.Show("Ok");
            }


            //Boton agregar Factura

            try
            {
                oFacturaBL.AgregarDetalle(new ItemBE()
                {
                    Cantidad = Convert.ToInt32(txtcantidad.Text),
                    Precio   = Convert.ToDecimal(txtprecio.Text),
                    Producto = otmpProducto
                });

                //Actualizar DataGrid
                dataGridView1.DataSource = null;
                dataGridView1.DataSource = oFacturaBL.GetDetalle();

                txtsubtotal.Text = oFacturaBL.SubTotal.ToString();
                txtigv.Text      = oFacturaBL.IGV.ToString();
                txttotal.Text    = oFacturaBL.Total.ToString();
            }
            catch (Exception ex)
            {
            }
        }
예제 #4
0
 private void asignaDetalle()
 {
     oFacturaBL.AgregarDetalle(new ItemBE()
     {
         Cantidad = Convert.ToInt32(txtcantidad.Text),
         Precio   = Convert.ToDecimal(txtprecio.Text),
         Producto = otmpProducto
     });
 }
예제 #5
0
        private void button3_Click(object sender, EventArgs e)
        {
            //Boton agregar a factura
            oFacturaBL.AgregarDetalle(new ItemBE()
            {
                Cantidad=Convert.ToInt32(txtcantidad.Text),
                Precio=Convert.ToInt32(txtprecio.Text),
                Producto=otmmpProducto
            });

               //Actualozar DataGrid
               dataGridView1.DataSource = oFacturaBL.GetDetalle();
               txtsubtotal.Text = oFacturaBL.IGV.ToString();
               txttotal.Text = oFacturaBL.Total.ToString();
        }
예제 #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            //Boton Agregar a Factura
            oFacturaBL.AgregarDetalle(new ItemBE()
            {
                Cantidad = Convert.ToInt32(txtcantidad.Text),
                Precio   = Convert.ToDecimal(txtprecio.Text),
                Producto = otmpProducto
            });

            //Actualizar DataGrid
            DocumentobindingSource.DataSource = null;
            DocumentobindingSource.DataSource = oFacturaBL.GetDetalle();

            txtsubtotal.Text = oFacturaBL.SubTotal.ToString();
            txtigv.Text      = oFacturaBL.IGV.ToString();
            txttotal.Text    = oFacturaBL.Total.ToString();
        }
예제 #7
0
        private void button3_Click(object sender, EventArgs e)
        {
            //Boton Agregar a Factura
            ItemBE oItemBE = new ItemBE
            {
                Cantidad = Convert.ToInt32(txtcantidad.Text),
                Precio   = Convert.ToDecimal(txtprecio.Text),
                Producto = otmpProducto
            };
            ValidationResults results = ItemBEValidator.Validate(oItemBE);

            if (!results.IsValid)
            {
                StringBuilder builder = new StringBuilder();
                builder.AppendLine("Customer is not valid:");
                foreach (ValidationResult result in results)
                {
                    builder.AppendLine(
                        string.Format(
                            CultureInfo.CurrentCulture,
                            "{0}: {1}",
                            result.Key,
                            result.Message));
                }
                MessageBox.Show(
                    this,
                    builder.ToString(),
                    "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                return;
            }
            else
            {
                oFacturaBL.AgregarDetalle(oItemBE);
                //Actualizar DataGrid
                dataGridView1.DataSource = null;
                dataGridView1.DataSource = oFacturaBL.GetDetalle();

                txtsubtotal.Text = oFacturaBL.SubTotal.ToString();
                txtigv.Text      = oFacturaBL.IGV.ToString();
                txttotal.Text    = oFacturaBL.Total.ToString();
            }
        }
예제 #8
0
        private void button3_Click(object sender, EventArgs e)
        {
            int codprodu   = 0;
            int dgCantidad = 0;

            //Boton Agregar Factura
            if (txtcantidad.Text == "" || txtcantidad.Text == "0")
            {
                MessageBox.Show("Ingresar Cantidad", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                if (dataGridView1.Rows.Count > 0)
                {
                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        for (int row = Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value); row == Convert.ToInt32(otmpProducto.CodProducto); row++)
                        {
                            dgCantidad = Convert.ToInt32(dataGridView1.Rows[i].Cells[4].Value);
                            codprodu   = row;
                            if (codprodu == Convert.ToInt32(otmpProducto.CodProducto))
                            {
                                dgCantidad = dgCantidad + Convert.ToInt32(txtcantidad.Text);
                                oFacturaBL.modCantidad(dgCantidad, codprodu.ToString());
                                CargarGrilla();
                            }
                        }
                    }
                }
                if (codprodu != Convert.ToInt32(otmpProducto.CodProducto))
                {
                    oFacturaBL.AgregarDetalle(new ItemBE()
                    {
                        Cantidad = Convert.ToInt32(txtcantidad.Text),
                        Precio   = Convert.ToDecimal(txtprecio.Text),
                        Producto = otmpProducto,
                    });

                    CargarGrilla();
                }
            }
        }
예제 #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            //BOTON AGREGAR LA FACTURA

            oFacturaBL.AgregarDetalle(new ItemBE()
            {
                Cantidad = Convert.ToInt32(txtcantidad.Text),
                Precio   = Convert.ToInt32(txtprecio.Text),
                Producto = otmpProducto
            });


            //Actualizar DataGrid
            dataGridView1.DataSource = null;
            dataGridView1.DataSource = oFacturaBL.GetDetalle();

            txtsubtotal.Text = oFacturaBL.SubTotal.ToString();
            txtigv.Text      = oFacturaBL.IGV.ToString();
            txttotal.Text    = oFacturaBL.Total.ToString();
        }