private void btnAgregar_Click(object sender, EventArgs e) { if (Grilla.CurrentRow == null) { Mensaje("Debe seleccionar una cuota"); return; } string Valor = Grilla.CurrentRow.Cells[0].Value.ToString(); Valor = Valor + ";" + Grilla.CurrentRow.Cells[1].Value.ToString(); Valor = Valor + ";" + Grilla.CurrentRow.Cells[2].Value.ToString(); if (fun.Buscar(tbCuotas, "Cuota", Grilla.CurrentRow.Cells[1].Value.ToString()) == false) { tbCuotas = fun.AgregarFilas(tbCuotas, Valor); GrillaCuotas.DataSource = tbCuotas; } else { Mensaje("Ya se ha selecionado la cuota"); } CalcularTotales(); if (GrillaCuotas.Rows.Count > 0) { GrillaCuotas.Columns[0].Visible = false; } GrillaCuotas.Columns[0].Visible = false; GrillaCuotas.Columns[1].Width = 70; GrillaCuotas.Columns[2].HeaderText = "Importe"; }
private void btnAgregar_Click(object sender, EventArgs e) { if (GrillaPresupuesto.CurrentRow == null) { Mensaje("Debe seleccionar un registro"); return; } if (txtPorcentajeAplicado.Text == "") { Mensaje("Debe ingresar un porcentaje a a aplicar"); return; } if (txtCantidad.Text == "") { Mensaje("Debe ingresar una cantidad"); return; } string Val = ""; string CodRegistro = GrillaPresupuesto.CurrentRow.Cells[0].Value.ToString(); string CodJoya = GrillaPresupuesto.CurrentRow.Cells[1].Value.ToString(); string Codigo = GrillaPresupuesto.CurrentRow.Cells[2].Value.ToString(); string Nombre = GrillaPresupuesto.CurrentRow.Cells[3].Value.ToString(); // string Cantidad = GrillaPresupuesto.CurrentRow.Cells[4].Value.ToString(); string Cantidad = txtCantidad.Text; if (fun.Buscar(tbVenta, "CodRegistro", CodRegistro) == true) { Mensaje("Ya se ha ingresado el registro"); return; } // Double Precio =Convert.ToDouble (GrillaPresupuesto.CurrentRow.Cells[5].Value.ToString()); Double Precio = Convert.ToDouble(txtPrecio.Text); Double Por = fun.ToDouble(txtPorcentajeAplicado.Text); Double Comision = 0; Double SubTotal = 0; if (txtSubtotal.Text != "") { SubTotal = Convert.ToDouble(txtSubtotal.Text); } Comision = Precio * Convert.ToInt32(Cantidad) * Por / 100; Val = CodRegistro + ";" + CodJoya + ";" + Codigo; Val = Val + ";" + Nombre + ";" + Cantidad.ToString() + ";" + Precio.ToString() + ";" + Comision.ToString() + ";" + SubTotal; tbVenta = fun.AgregarFilas(tbVenta, Val); GrillaVentas.DataSource = tbVenta; string Col = "0;0;15;25;15;15;15;15"; fun.AnchoColumnas(GrillaVentas, Col); CalcularTotal(); txtSubtotal.Text = ""; txtPrecio.Text = ""; txtCantidad.Text = ""; }
private void btnAgregarPapel_Click(object sender, EventArgs e) { cFunciones fun = new cFunciones(); string CodPapel = Lista.SelectedValue.ToString(); string Nombre = Lista.Text; string Entrego = "0"; string Fecha = ""; string Texto = "No"; string FechaVencimiento = ""; if (chkEntrego.Checked == true) { if (fun.ValidarFecha(txtFechaEntregaPapel.Text) == false) { Mensaje("La fecha de entrega del documento es incorrecta"); } Entrego = "1"; Texto = "Si"; Fecha = txtFechaEntregaPapel.Text; } string xx = txtFechaVtoPapel.Text; if (fun.ValidarFecha(txtFechaVtoPapel.Text) == true) { FechaVencimiento = txtFechaVtoPapel.Text; } if (fun.Buscar(tbListaPapeles, "CodPapel", CodPapel) == true) { Mensaje("Ya se ha ingresado el documento"); return; } string Valor = CodPapel + ";" + Nombre; Valor = Valor + ";" + Entrego; Valor = Valor + ";" + Texto; Valor = Valor + ";" + Fecha; Valor = Valor + ";" + FechaVencimiento; tbListaPapeles = fun.AgregarFilas(tbListaPapeles, Valor); GrillaPapeles.DataSource = tbListaPapeles; GrillaPapeles.Columns[0].Visible = false; GrillaPapeles.Columns[2].Visible = false; GrillaPapeles.Columns[1].Width = 130; GrillaPapeles.Columns[3].Width = 80; GrillaPapeles.Columns[4].Width = 80; GrillaPapeles.Columns[5].Width = 90; GrillaPapeles.Columns[5].HeaderText = "Vencimiento"; GrillaPapeles.Columns[3].HeaderText = "Entrego"; }
private void Agregar() { if (txtCodigo.Text == "") { Mensaje("Debe ingresar un articulo"); return; } if (txtCantidad.Text == "") { Mensaje("Debe ingresar una cantidad"); return; } if (txtPrecio.Text == "") { Mensaje("Debe ingresar un precio"); return; } string Codigo = txtCodigo.Text; if (fun.Buscar(tbCompra, "CodArticulo", Codigo) == true) { Mensaje("Ya se ha ingresado el articulo"); return; } string Nombre = txt_Nombre.Text; Int32 Cantidad = Convert.ToInt32(txtCantidad.Text); Double Precio = fun.ToDouble(txtPrecio.Text); Double Descuento = 0; if (txtDescuento.Text != "") { Descuento = fun.ToDouble(txtDescuento.Text); } Double SubTotal = Cantidad * Precio - Descuento; string Val = Codigo + ";" + Nombre; Val = Val + ";" + Cantidad.ToString(); Val = Val + ";" + Precio.ToString(); Val = Val + ";" + Descuento.ToString(); Val = Val + ";" + SubTotal; tbCompra = fun.AgregarFilas(tbCompra, Val); Grilla.DataSource = tbCompra; CalcularTotal(); LimpiarArticulo(); fun.AnchoColumnas(Grilla, "0;40;15;15;15;15"); }
private void Agregar() { if (txtCodigo.Text == "") { Mensaje("Debe ingresar un articulo"); return; } if (txtCantidad.Text == "") { Mensaje("Debe ingresar una cantidad"); return; } if (txtPrecio.Text == "") { Mensaje("Debe ingresar un precio"); return; } Boolean Des = false; if (chkDescuento.Visible == true) { if (chkDescuento.Checked == true) { Des = true; } } //string Col = "CodArticulo;Nombre;Precio;Cantidad;Subtotal"; Int32 CodArticulo = Convert.ToInt32(txtCodigo.Text); int Cantidad = Convert.ToInt32(txtCantidad.Text); Double Precio = 0; if (Des == false) { Precio = Convert.ToDouble(txtPrecio.Text); } if (Des == true) { Precio = Convert.ToDouble(txtDescuento.Text); } Double Subtotal = Precio * Cantidad; string Nombre = txt_Nombre.Text; if (fun.Buscar(tbVenta, "CodArticulo", CodArticulo.ToString()) == true) { Mensaje("Ya se ha ingresado el articulo"); return; } int Libreria = 1; if (radioJugueteria.Checked == true) { Libreria = 0; } string Val = CodArticulo + ";" + Nombre; Val = Val + ";" + Precio.ToString(); Val = Val + ";" + Cantidad.ToString(); Val = Val + ";" + Subtotal.ToString(); Val = Val + ";" + Indice.ToString(); Val = Val + ";" + Libreria; tbVenta = fun.AgregarFilas(tbVenta, Val); Indice = Indice + 1; //Grilla.Sort(Grilla.Columns[3]), ListSortDirection.Ascending) if (tbVenta.Rows.Count > 1) { Grilla.Sort(Grilla.Columns[5], ListSortDirection.Descending); } Grilla.DataSource = tbVenta; Grilla.Columns[0].Visible = false; Grilla.Columns[5].Visible = false; Grilla.Columns[1].Width = 370; Double Total = fun.TotalizarColumna(tbVenta, "Subtotal"); txtTotal.Text = Total.ToString(); txtTotalConDescuento.Text = Total.ToString(); txtCodigo.Text = ""; txt_Codigo.Text = ""; txt_CodigoBarra.Text = ""; txt_Stock.Text = ""; txtPrecio.Text = ""; txtCantidad.Text = ""; txt_Nombre.Text = ""; // Valida = false; txt_CodigoBarra.Focus(); Grilla.Refresh(); if (tbVenta.Rows.Count > 0) { for (int i = 0; i < Grilla.Rows.Count - 1; i++) { if (i == 0) { Grilla.Rows[0].Selected = true; } else { Grilla.Rows[i].Selected = false; } } } // }
private void Agregar() { if (txtCodigo.Text == "") { Mensaje("Debe ingresar un articulo"); return; } if (txtCantidad.Text == "") { Mensaje("Debe ingresar una cantidad"); return; } if (txtPrecio.Text == "") { Mensaje("Debe ingresar un precio"); return; } string Codigo = txtCodigo.Text; if (fun.Buscar(tbCompra, "CodArticulo", Codigo) == true) { Mensaje("Ya se ha ingresado el articulo"); return; } int Libreria = 0; string Nombre = ""; if (chkLibreria.Checked == true) { Nombre = txt_Nombre.Text; Libreria = 1; } else { Nombre = txtNombreJuguete.Text; Libreria = 0; } Int32 Cantidad = Convert.ToInt32(txtCantidad.Text); Double Precio = fun.ToDouble(txtPrecio.Text); Double Descuento = 0; Double Efectivo = 0; Double Tarjeta = 0; if (txtEfectivo.Text != "") { Efectivo = Convert.ToDouble(txtEfectivo.Text); } if (txtTarjeta.Text != "") { Tarjeta = Convert.ToDouble(txtTarjeta.Text); } Double PorEfe = 0; Double PorTar = 0; if (txtPorEfe.Text != "") { PorEfe = Convert.ToDouble(txtPorEfe.Text); } if (txtPorTar.Text != "") { PorTar = Convert.ToDouble(txtPorTar.Text); } Indice = Indice + 1; Double SubTotal = Cantidad * Precio; string Val = Codigo + ";" + Nombre; Val = Val + ";" + Cantidad.ToString(); Val = Val + ";" + Precio.ToString(); Val = Val + ";" + Descuento.ToString(); Val = Val + ";" + Efectivo.ToString().Replace(",", "."); Val = Val + ";" + Tarjeta.ToString().Replace(",", "."); Val = Val + ";" + SubTotal; Val = Val + ";" + Libreria; Val = Val + ";" + PorEfe; Val = Val + ";" + PorTar; Val = Val + ";" + Indice.ToString(); tbCompra = fun.AgregarFilas(tbCompra, Val); Grilla.DataSource = tbCompra; CalcularTotal(); LimpiarArticulo(); fun.AnchoColumnas(Grilla, "0;40;10;10;0;10;10;10;0;5;5;0"); txt_Codigo.Focus(); if (tbCompra.Rows.Count > 1) { Grilla.Sort(Grilla.Columns[11], ListSortDirection.Descending); } }