private void BuscarTarjetaxCodVenta(Int32 CodVenta) { string Values = ""; cCobroTarjeta cobro = new cCobroTarjeta(); DataTable trdo = cobro.GetCobroTarjetaxCodVenta(CodVenta); if (trdo.Rows.Count > 0) { for (int i = 0; i < trdo.Rows.Count; i++) { string Tarjeta = trdo.Rows[i]["Nombre"].ToString(); string Cupon = trdo.Rows[i]["Cupon"].ToString(); string CodTarjeta = trdo.Rows[i]["CodTarjeta"].ToString(); string Importe = trdo.Rows[i]["Importe"].ToString(); string CodCobro = trdo.Rows[i]["CodCobro"].ToString(); string FechaEmision = trdo.Rows[i]["FechaEmision"].ToString(); string Recargo = trdo.Rows[i]["Recargo"].ToString(); Values = CodTarjeta + ";" + Tarjeta; Values = Values + ";" + Cupon + ";" + Importe; Values = Values + ";" + CodCobro + ";" + FechaEmision; Values = Values + ";" + Recargo; tbTarjeta = fun.AgregarFilas(tbTarjeta, Values); } grillaTarjetas.DataSource = tbTarjeta; grillaTarjetas.Columns[0].Visible = false; grillaTarjetas.Columns[1].Width = 175; grillaTarjetas.Columns[4].Visible = false; grillaTarjetas.Columns[5].HeaderText = "Emisión"; } }
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 CargarOpciones() { cFunciones fun = new cFunciones(); DataTable tb = fun.CrearTabla("CodOpcion;Opcion"); tb = fun.AgregarFilas(tb, "1;Comprador"); tb = fun.AgregarFilas(tb, "2;Vendedor"); fun.LlenarComboDatatable(cmbOpciones, tb, "Opcion", "CodOpcion"); }
private void Agregar() { if (txtCodJoya.Text == "") { Mensaje("Debe ingresar una joya para continuar"); return; } if (txtPrecio.Text == "") { Mensaje("Debe ingresar un precio para continuar"); return; } // string Col = "CodPresupuesto;CodJoya;Nombre;Tipo;Cantidad;Precio"; string CodPresupuesto = "0"; Int32 CodJoya = Convert.ToInt32(txtCodJoya.Text); string Nombre = txtNombreJoya.Text; string Precio = "0"; string Tipo = cmbTipo.Text; string Cantidad = "1"; Double SubTotal = 0; if (txtCantidad.Text != "") { Cantidad = txtCantidad.Text; } if (txtPrecio.Text != "") { Precio = txtPrecio.Text; } SubTotal = Convert.ToDouble(Cantidad) * Convert.ToDouble(Precio); string val = CodPresupuesto + ";" + CodJoya + ";" + Nombre + ";" + Tipo; val = val + ";" + Cantidad + ";" + Precio; val = val + ";" + SubTotal.ToString(); tbDetalle = fun.AgregarFilas(tbDetalle, val); Grilla.DataSource = tbDetalle; fun.AnchoColumnas(Grilla, "0;0;30;25;15;15;15"); Double Total = fun.TotalizarColumna(tbDetalle, "SubTotal"); txtTotal.Text = Total.ToString(); txtCodigo.Text = ""; txtCodJoya.Text = ""; txtPrecio.Text = ""; txtCantidad.Text = ""; txtCodigoBarra.Text = ""; AgregaCodigoBarra = false; AgregaCodigoBarra2 = 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; } 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 BuscarPapeles(Int32 CodCompra) { cPapeles papel = new Clases.cPapeles(); DataTable trdo = papel.GetPapelesxCodCompra(CodCompra); if (trdo.Rows.Count > 0) { string CodPapel = ""; string Nombre = ""; string Texto = ""; string Entrego = ""; string Fecha = ""; string FechaVencimiento = ""; string Val = ""; cFunciones fun = new cFunciones(); for (int i = 0; i < trdo.Rows.Count; i++) { CodPapel = trdo.Rows[i]["CodPapel"].ToString(); Nombre = trdo.Rows[i]["Nombre"].ToString(); Texto = trdo.Rows[i]["Texto"].ToString(); Entrego = trdo.Rows[i]["Entrego"].ToString(); Fecha = trdo.Rows[i]["Fecha"].ToString(); FechaVencimiento = trdo.Rows[i]["FechaVencimiento"].ToString(); Val = CodPapel + ";" + Nombre; Val = Val + ";" + Texto + ";" + Entrego; Val = Val + ";" + Fecha + ";" + FechaVencimiento; tbListaPapeles = fun.AgregarFilas(tbListaPapeles, Val); } GrillaPapeles.DataSource = tbListaPapeles; GrillaPapeles.Columns[0].Visible = false; } }
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 FrmEjecutarOrden_Load(object sender, EventArgs e) { fun = new cFunciones(); DateTime fecha = DateTime.Now; txtFechaHasta.Text = fecha.ToShortDateString(); fecha = fecha.AddMonths(-1); txtFechaDesde.Text = fecha.ToShortDateString(); lblAmarillo.BackColor = System.Drawing.Color.Yellow; lblOrdenesConSaldo.BackColor = System.Drawing.Color.LightGreen; lblOrdenesSinSaldo.BackColor = System.Drawing.Color.LightGray; DataTable ttipo = fun.CrearTabla("Codigo;Nombre"); ttipo = fun.AgregarFilas(ttipo, "1;Pre Ingresadas"); ttipo = fun.AgregarFilas(ttipo, "2;Con Saldo"); ttipo = fun.AgregarFilas(ttipo, "3;Sin Saldo"); fun.LlenarComboDatatable(CmbTipo, ttipo, "Nombre", "Codigo"); ValidarUsuario(); }
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; } 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; } } } // }
public void Buscar(DateTime FechaDesde, DateTime FechaHasta) { string Mes = ""; string Anio = ""; int NumeroMes = 0; string Total = ""; string TotalComision = ""; string TotalRendido = ""; string Val = ""; string Col = "Mes;Anio;Total;TotalComision;TotalRendido"; DataTable tbResumen = fun.CrearTabla(Col); cVenta venta = new Clases.cVenta(); DataTable trdo = venta.GetResumenVentas(FechaDesde, FechaHasta); if (trdo.Rows.Count > 0) { for (int i = 0; i < trdo.Rows.Count; i++) { Val = ""; NumeroMes = Convert.ToInt32(trdo.Rows[i]["Mes"].ToString()); Mes = Getmes(NumeroMes); Anio = trdo.Rows[i]["Anio"].ToString(); Total = trdo.Rows[i]["Total"].ToString(); TotalComision = trdo.Rows[i]["TotalComision"].ToString(); TotalRendido = trdo.Rows[i]["TotalRendido"].ToString(); Val = Mes + ";" + Anio; Val = Val + ";" + Total + ";" + TotalComision + ";" + TotalRendido; tbResumen = fun.AgregarFilas(tbResumen, Val); } } if (tbResumen.Rows.Count > 0) { tbResumen = fun.TablaaMiles(tbResumen, "Total"); tbResumen = fun.TablaaMiles(tbResumen, "TotalComision"); tbResumen = fun.TablaaMiles(tbResumen, "TotalRendido"); } Double dTotal = fun.TotalizarColumna(tbResumen, "Total"); Double dTotalComision = fun.TotalizarColumna(tbResumen, "TotalComision"); Double dTotalRendido = fun.TotalizarColumna(tbResumen, "TotalRendido"); txtTotal.Text = dTotal.ToString(); txtTotalRendido.Text = dTotalRendido.ToString(); txtTotalComision.Text = dTotalComision.ToString(); Grilla.DataSource = tbResumen; if (txtTotal.Text != "") { txtTotal.Text = fun.FormatoEnteroMiles(txtTotal.Text); } if (txtTotalComision.Text != "") { txtTotalComision.Text = fun.FormatoEnteroMiles(txtTotalComision.Text); } if (txtTotalRendido.Text != "") { txtTotalRendido.Text = fun.FormatoEnteroMiles(txtTotalRendido.Text); } string ancho = "30;10;20;20;20"; fun.AnchoColumnas(Grilla, ancho); Grilla.Columns[3].HeaderText = "Total Comisión"; Grilla.Columns[4].HeaderText = "Total Rendido"; }
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); } }