private void traerUltimoCorteAbierto() { try { clsCorte corteAbierto = new clsCorte(); DataSet corte = new DataSet(); decimal fondoCaja = 0; DataTable ventas = new DataTable(); DataTable ventasDetalle = new DataTable(); string idCorte = corteAbierto.leerCorteUsuario(Sesion.Usuario); string idVentas = ""; decimal venTot = 0; decimal venTotEfectivo = 0; decimal efectivoCaja = 0; decimal tarCredito = 0; decimal tarDebito = 0; decimal transferencia = 0; decimal credito = 0; if (!string.IsNullOrEmpty(corteAbierto.mensaje)) { MessageBox.Show(corteAbierto.mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!string.IsNullOrEmpty(idCorte)) { corteAbierto.cor_keycor = idCorte; fondoCaja = Convert.ToDecimal(corteAbierto.leerFondoCaja(idCorte)); if (!string.IsNullOrEmpty(corteAbierto.mensaje)) { MessageBox.Show(corteAbierto.mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (fondoCaja > 0) { lblFondoCaja.Text = fondoCaja.ToString("N"); } ventas = corteAbierto.leerVentasDelCorte().Tables[0]; if (!string.IsNullOrEmpty(corteAbierto.mensaje)) { MessageBox.Show(corteAbierto.mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } foreach (DataRow item in ventas.Rows) { item[0].ToString(); idVentas += item[0].ToString() + ','; } if (!string.IsNullOrEmpty(idVentas)) { idVentas = idVentas.Substring(0, idVentas.Length - 1); } ventasDetalle = corteAbierto.leerVentasDetalleDelCorte(idVentas).Tables[0]; if (!string.IsNullOrEmpty(corteAbierto.mensaje)) { MessageBox.Show(corteAbierto.mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } foreach (DataRow item in ventasDetalle.Rows) { item[0].ToString(); venTot += Convert.ToDecimal(item[1].ToString()); switch (item[0].ToString()) { case "Efectivo": venTotEfectivo = Convert.ToDecimal(item[1].ToString()); break; case "Tarjeta de crédito": tarCredito = Convert.ToDecimal(item[1].ToString()); break; case "Crédito": credito = Convert.ToDecimal(item[1].ToString()); break; case "Tarjeta de débito": tarDebito = Convert.ToDecimal(item[1].ToString()); break; case "Transferencia": transferencia = Convert.ToDecimal(item[1].ToString()); break; default: break; } } lblEfectivo.Text = efectivoCaja.ToString("N"); lblTransferencia.Text = transferencia.ToString("N"); lblTarjetaDebito.Text = tarDebito.ToString("N"); lblCredito.Text = credito.ToString("N"); lblTarjetaCredito.Text = tarCredito.ToString("N"); lblEfectivo.Text = venTotEfectivo.ToString("N"); if (venTotEfectivo > 0) { lblVentasEfectivo.Text = venTotEfectivo.ToString("N"); } if (venTot > 0) { lblTotalVentas.Text = venTot.ToString("N"); lblVentasTotales.Text = venTot.ToString("N"); } efectivoCaja = venTotEfectivo + fondoCaja; lblTotalDineroCaja.Text = efectivoCaja.ToString("N"); cmbCortes.SelectedText = idCorte; cmbCortes.SelectedValue = idCorte; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void ConsultarCorte() { clsCorte cCorte = new clsCorte(); Sesion.CodigoCorte = cCorte.leerCorteUsuario(Sesion.Usuario); }