private void textBox1_TextChanged(object sender, EventArgs e) { DataTable dt = new DatCatGenerico().ObtenerLista_BitacoraCliente(textBox1.Text); gdvLista.DataSource = dt; DataTablePersonalizado.Multilinea(ref gdvLista); }
public void Agregar_TipoUsuario(CatalogoGenerico c) { int filasAfectadas = new DatCatGenerico().Insertar_TipoUsuario(c); if (filasAfectadas != 1) { throw new ApplicationException("Ocurrio un error al insertar"); } }
public void AgregarCategoriasGenericas(CatalogoGenerico c, int valor) { int resultado = new DatCatGenerico().InsertarDatosCatalago(c, valor); if (resultado != 1) { throw new ApplicationException("Ocurrió un error al dar de alta la categoria, contacte al administrador"); } }
public void AgregarCategoria(string c, string pordefecto) { int resultado = new DatCatGenerico().InsertarCatalogo(c, pordefecto); if (resultado != 1) { throw new ApplicationException("Ocurrió un error, contacte la administrador"); } }
public User ObtenerUsuario(string serialPC) { DataRow dr = new DatCatGenerico().Obtener_InicioSesion(serialPC); User u = new User(); u.Id = Convert.ToInt32(dr["Usuario_Id"]); u.Foto = (byte[])dr["Foto"]; u.Rol = dr["Tipo_Usuario"].ToString(); u.Nombre = dr["Nombre"].ToString(); return(u); }
private void gdvLista_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == this.gdvLista.Columns["Detalle"].Index) { int oneKey = Convert.ToInt32(gdvLista.SelectedCells[1].Value); DataTable dt = new DatCatGenerico().ObtenerDetalle_BitacoraCliente(oneKey); decimal suma = dt.AsEnumerable().Select(c => c.Field <Decimal>("Monto Abonado")).Sum(); txtCliente.Text = dt.Rows[0].Field <String>(3); txtComunidad.Text = dt.Rows[0].Field <String>(4); txtFolio.Text = dt.Rows[0].Field <String>(8); txtComprobante.Text = dt.Rows[0].Field <String>(7); txtFecha.Text = dt.Rows[0].Field <DateTime>(6).ToString(); txtMonto.Text = dt.Rows[0].Field <Decimal>(9).ToString(); txtEstatus.Text = dt.Rows[0].Field <String>(10); txtSaldo.Text = dt.Rows[0].Field <Decimal>(11).ToString(); txtNAbono.Text = dt.Rows.Count.ToString(); decimal montoInicial = Convert.ToDecimal(txtMonto.Text) - suma; txtAbonoInicial.Text = suma == Convert.ToDecimal(txtMonto.Text) ? "0" : montoInicial.ToString(); if (txtEstatus.Text.Equals("PAGADO")) { pbEstatus2.Visible = false; pbEstatusOK.Visible = true; } else { pbEstatusOK.Visible = false; pbEstatus2.Visible = true; } gdvDetalle.DataSource = dt; gdvDetalle.Columns[3].Visible = false; gdvDetalle.Columns[4].Visible = false; gdvDetalle.Columns[5].Visible = false; gdvDetalle.Columns[6].Visible = false; gdvDetalle.Columns[7].Visible = false; gdvDetalle.Columns[8].Visible = false; gdvDetalle.Columns[9].Visible = false; gdvDetalle.Columns[10].Visible = false; gdvDetalle.Columns[11].Visible = false; DataTablePersonalizado.Multilinea(ref gdvDetalle); } }
private decimal obtenerPagoCredito() { try { decimal totalCredito = 0; totalCredito = new DatCatGenerico().ObtenerPago_CreditoAbonado(idUsuario); return(totalCredito); } catch (Exception ex) { MessageBox.Show("Ocurrió un error al mostrar los pagos a crédito : " + ex.Message, "Error de lectura", MessageBoxButtons.OK, MessageBoxIcon.Error); return(0); } }
public List <CatalogoGenerico> ListarTipoPresentacion() { DataTable dt = DatCatGenerico.ListarCat_TipoPresentacion(); List <CatalogoGenerico> catalogoGenericos = new List <CatalogoGenerico>(); foreach (DataRow dr in dt.Rows) { CatalogoGenerico c = new CatalogoGenerico(); c.Id = Convert.ToInt32(dr["Id_TipoPresentacion"]); c.Nombre = dr["Nombre"].ToString(); c.Descripcion = dr["NombreCorto"].ToString(); catalogoGenericos.Add(c); } return(catalogoGenericos); }
public List <CatalogoGenerico> ListarCatProducto() { DataTable dt = new DatCatGenerico().MostrarCategorias(); List <CatalogoGenerico> lsCat = new List <CatalogoGenerico>(); foreach (DataRow dataRow in dt.Rows) { CatalogoGenerico c = new CatalogoGenerico(); c.Id = Convert.ToInt32(dataRow["Id"]); c.Nombre = dataRow["Nombre"].ToString(); c.Descripcion = dataRow["Por_Defecto"].ToString(); lsCat.Add(c); } return(lsCat); }
private void textBox1_TextChanged(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtBuscar.Text)) { gdvConcepto.Visible = false; } else { DataTable dt = new DatCatGenerico().Buscar_Concepto(txtBuscar.Text); gdvConcepto.Visible = true; gdvConcepto.DataSource = dt; gdvConcepto.Columns[1].Visible = false; DataTablePersonalizado.Multilinea(ref gdvConcepto); } } catch (Exception ex) { MessageBox.Show("error al mostrar los datos", "Datos inexistentes", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void AgregarSerializacion_Ticket() { try { #region INSERTAR DATOS SERIALIZACION Serializacion s = new Serializacion(); s.Serie = "T"; s.Cantidad_Numero = "6"; s.NumeroFin = "0"; s.Tipo_Documento = "TICKET"; s.Destino = "VENTAS"; s.Por_Defecto = "SI"; new BusSerializacion().Agregar_Serializacion(s); Serializacion s1 = new Serializacion(); s1.Serie = "R"; s1.Cantidad_Numero = "6"; s1.NumeroFin = "0"; s1.Tipo_Documento = "RECIBO"; s1.Destino = "VENTAS"; s1.Por_Defecto = "NO"; new BusSerializacion().Agregar_Serializacion(s1); Serializacion s2 = new Serializacion(); s2.Serie = "F"; s2.Cantidad_Numero = "6"; s2.NumeroFin = "0"; s2.Tipo_Documento = "FACTURA"; s2.Destino = "VENTAS"; s2.Por_Defecto = "NO"; new BusSerializacion().Agregar_Serializacion(s2); Serializacion s3 = new Serializacion(); s3.Serie = "I"; s3.Cantidad_Numero = "6"; s3.NumeroFin = "0"; s3.Tipo_Documento = "INGRESO"; s3.Destino = "INGRESO DE COBROS"; s3.Por_Defecto = "NO"; new BusSerializacion().Agregar_Serializacion(s3); Serializacion s4 = new Serializacion(); s4.Serie = "E"; s4.Cantidad_Numero = "6"; s4.NumeroFin = "0"; s4.Tipo_Documento = "EGRESO"; s4.Destino = "EGRESO DE PAGOS"; s4.Por_Defecto = "NO"; new BusSerializacion().Agregar_Serializacion(s4); #endregion #region INSERTAR DATOS TICKET try { Ticket t = new Ticket(); t.Identificador_Fiscal = "RUC Identificador Fiscal de la Empresa"; t.Direccion = "Santa Maria Chilchotla"; t.Provincia = "Santa María Chilchotla-Oaxaca-México"; t.Moneda = "Peso Mexicano"; t.Agradecimiento = "Gracias por su Compra!, vuelva pronto..."; t.Pagina_Web = "Agrega tu pagina"; t.Anuncio = "aqui tu anuncio /Cupones / Descuentos"; t.Datos_Fiscales = "Datos Fiscales - Num. Autorización - Resolución..."; t.Default = "Ticket No Fiscal"; new BusTicket().Agregar_Ticket(t); } catch (Exception ex) { MessageBox.Show("error en la insercion de ticket " + ex.Message); } #endregion #region INSERTAR DATOS CATEGORIA USUARIO try { CatalogoGenerico c = new CatalogoGenerico(); c.Descripcion = "CONTROL TOTAL DEL SISTEMA"; c.Estado = true; c.Nombre = "ADMINISTRADOR"; new BusCatGenerico().Agregar_TipoUsuario(c); } catch (Exception ex) { MessageBox.Show("error en la insercion de " + ex.Message); } #endregion #region INSERTA FORMA DE PAGOS DatCatGenerico.Insertar_FormaPago("Contado", "Pago en efectivo"); DatCatGenerico.Insertar_FormaPago("Credito", "Pagos a créditos"); #endregion #region INSERTAR ROLES DE USUARIOS CatalogoGenerico rol = new CatalogoGenerico(); rol.Nombre = "CAJERO"; rol.Descripcion = "VENTAS Y COBROS"; rol.Estado = true; new BusCatGenerico().Agregar_TipoUsuario(rol); CatalogoGenerico rol2 = new CatalogoGenerico(); rol2.Nombre = "VENDEDOR"; rol2.Descripcion = "SOLO VENTAS"; rol2.Estado = true; new BusCatGenerico().Agregar_TipoUsuario(rol2); #endregion } catch (Exception ex) { MessageBox.Show("Ocurrio un error al agregar la serialización " + ex.Message, "Error ", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAbonar_Click_1(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtMontoAbonar.Text)) { MessageBox.Show("Ingrese la cantidad a Abonar", "Datos necesarios", MessageBoxButtons.OK, MessageBoxIcon.Hand); txtMontoAbonar.Focus(); } else { string _strEstadoPago = Convert.ToDecimal(txtMontoAbonar.Text) >= Convert.ToDecimal(txtSaldoActual.Text) ? "PAGADO" : "PENDIENTE"; decimal _saldo = Convert.ToDecimal(txtPendienteLiquidar.Text) <= 0 ? 0 : Convert.ToDecimal(txtPendienteLiquidar.Text); int _idVenta = Convert.ToInt32(lblIdVenta.Text); decimal abonado = Convert.ToDecimal(txtPendienteLiquidar.Text) <= 0 ? Convert.ToDecimal(txtSaldoActual.Text) : Convert.ToDecimal(txtMontoAbonar.Text); decimal efectivo = Convert.ToDecimal(lblTotalAbonado.Text) + Convert.ToDecimal(txtMontoAbonar.Text); new BusVentas().Actualizar_VentaACredito(_idVenta, _saldo, _strEstadoPago, efectivo); #region BITACORA PAGO CLIENTE ManagementObject mos = new ManagementObject(@"Win32_PhysicalMedia='\\.\PHYSICALDRIVE0'"); string serialPC = mos.Properties["SerialNumber"].Value.ToString().Trim(); int idUsuario = new BusUser().ObtenerUsuario(EncriptarTexto.Encriptar(serialPC)).Id; DatCatGenerico.Agregar_BitacoraCliente(_idVenta, idUsuario, abonado); #endregion #region TICKET rptComprobanteAbono _rpt = new rptComprobanteAbono(); DataTable dt = new DatVenta().Obtener_ComprobanteCredito(_idVenta, abonado); _rpt.tbCobro.DataSource = dt; _rpt.DataSource = dt; reportViewer1.Report = _rpt; reportViewer1.RefreshReport(); pnlVistaTicket.Visible = true; #endregion try { string impresora = DatBox.Obtener_ImpresoraTicket(serialPC, "TICKET"); TICKET = new PrintDocument(); TICKET.PrinterSettings.PrinterName = impresora; if (TICKET.PrinterSettings.IsValid) { PrinterSettings printerSettings = new PrinterSettings(); printerSettings.PrinterName = impresora; ReportProcessor reportProcessor = new ReportProcessor(); reportProcessor.PrintReport(reportViewer1.ReportSource, printerSettings); } } catch (Exception ex) { MessageBox.Show("Error al imprimir el ticket : " + ex.Message, "Error de impresión", MessageBoxButtons.OK, MessageBoxIcon.Information); } LimpiarCampos(); ListarVentar_PorCobrar(""); MessageBox.Show("Abono realizado correctamente", "Éxito!", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("Error : " + ex.Message, "Error de actulizacion de pagos a crédito", MessageBoxButtons.OK, MessageBoxIcon.Error); } }