public void cargarProductos() { Productos_BLL productoBLL = new Productos_BLL(); ddlProducto.DataSource = productoBLL.cargarProductos(); ddlProducto.DataTextField = "nombreProducto"; ddlProducto.DataValueField = "idProducto"; ddlProducto.DataBind(); ddlProducto.Items.Insert(0, "Seleccione un producto"); }
public void cargarProductos() { DataTable dt = new DataTable(); Productos_BLL productoBLL = new Productos_BLL(); dt = productoBLL.cargarProductos(); ddlCodigo.DataSource = dt; ddlCodigo.DataTextField = "nombreProducto"; ddlCodigo.DataValueField = "idProducto"; ddlCodigo.DataBind(); ddlCodigo.Items.Insert(0, new ListItem("---------- Seleccione un Producto ----------", "0")); }
public void agregarVenta(int idCliente) { DataTable dtdt = new DataTable(); Productos_BLL productoBLL = new Productos_BLL(); Ventas_BLL ventaBLL = new Ventas_BLL(); VentasDetalle_BLL ventaDetalleBLL = new VentasDetalle_BLL(); Existencias_BLL existenciasBLL = new Existencias_BLL(); DateTime fechaVenta = DateTime.Now; string codigoProducto = ddlCodigo.SelectedValue; int cantidadProducto = int.Parse(txtCantidad.Text); dtdt = productoBLL.cargarProductos(); double aux = double.Parse(dtdt.Rows[0]["precioUnitario"].ToString()); double subtotal = (aux) * (int.Parse(txtCantidad.Text)); double IVA = ((aux) * (int.Parse(txtCantidad.Text))) * 0.16; double totalVenta = subtotal + IVA; lblSubtotal.Text = Convert.ToString(subtotal); lblIVA.Text = Convert.ToString(IVA); lblTotal.Text = Convert.ToString(totalVenta); int idProducto = int.Parse(dtdt.Rows[0]["idProducto"].ToString()); idProducto = ddlCodigo.SelectedIndex; ventaBLL.agregarVenta(idCliente, fechaVenta, totalVenta); dtdt = ventaBLL.cargarVenta(idCliente); int idVenta = int.Parse(dtdt.Rows[0]["idVenta"].ToString()); ventaDetalleBLL.agregarVentaDetalle(idVenta, idProducto, cantidadProducto); ClientScript.RegisterStartupScript(this.Page.GetType(), "alerta", "alert('Venta agregada exitosamente')", true); existenciasBLL.restarExistencia(cantidadProducto, idProducto); //DataTable dt = new DataTable(); //dt = (DataTable)ViewState["dtVentaCliente"]; //dt.Rows.Add(fechaVenta, codigoProducto, cantidadProducto, totalVenta); //grdVentaCliente.DataSource = dt; //grdVentaCliente.DataBind(); }
public void cargarPrecioProducto(string codigoProducto) { Productos_BLL productoBLL = new Productos_BLL(); cargarPrecioProducto(ddlCodigo.SelectedValue); }