private void TimerRefrescar_Tick(object sender, EventArgs e) { TimerRefrescar.Stop(); ListaHistoral.SuspendLayout(); ListaHistoral.BeginUpdate(); System.Data.DataTable LogsTable = this.Connection.Select("SELECT * FROM sys_log WHERE tabla='" + this.Tabla + "' AND item_id=" + this.ItemId.ToString() + " ORDER BY id_log DESC"); Lbl.ColeccionGenerica<Lbl.Sys.Log.Entrada> Logs = new Lbl.ColeccionGenerica<Lbl.Sys.Log.Entrada>(this.Connection, LogsTable); for (int i = 0; i < Logs.Count; i++) { Lbl.Sys.Log.Entrada Log = Logs[i]; Lfx.Data.Row Usuario = this.Connection.Tables["personas"].FastRows[Log.IdUsuario]; ListViewItem Itm = ListaHistoral.Items.Add(Lfx.Types.Formatting.FormatSmartDateAndTime(Log.Fecha)); if (Usuario == null) Itm.SubItems.Add(""); else Itm.SubItems.Add(Usuario.Fields["nombre_visible"].Value.ToString()); switch (Log.Comando) { case Lbl.Sys.Log.Acciones.Save: Itm.SubItems.Add("Guardar"); break; case Lbl.Sys.Log.Acciones.Comment: Itm.SubItems.Add("Comentario"); break; case Lbl.Sys.Log.Acciones.Print: Itm.SubItems.Add("Imprimir"); break; case Lbl.Sys.Log.Acciones.Delete: Itm.SubItems.Add("Eliminar"); break; case Lbl.Sys.Log.Acciones.DeleteAndRevert: Itm.SubItems.Add("Eliminar y revertir"); break; case Lbl.Sys.Log.Acciones.LogOn: Itm.SubItems.Add("Ingreso al sistema"); break; default: Itm.SubItems.Add(Log.Comando.ToString()); break; } if (Log.Comando == Lbl.Sys.Log.Acciones.Save) Itm.SubItems.Add(Log.ExplainSave(false)); else Itm.SubItems.Add(Log.Carga); Itm.Tag = Log; if (ListaHistoral.Items.Count == 200) { // Muestro un parcial ListaHistoral.EndUpdate(); System.Windows.Forms.Application.DoEvents(); ListaHistoral.BeginUpdate(); } } ColDatos.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); ListaHistoral.EndUpdate(); ListaHistoral.ResumeLayout(true); }
private void FormSeleccionarImpresora_Activated(object sender, System.EventArgs e) { Listado.Items.Clear(); if (MuestraImpresorasLazaro) { Lbl.ColeccionGenerica <Lbl.Impresion.Impresora> Impresoras = Lbl.Sys.Config.Actual.Impresion.Impresoras; if (Impresoras != null) { foreach (Lbl.Impresion.Impresora Impresora in Impresoras) { this.AgregarImpresora(Impresora); } } } if (MuestraImpresorasDeWindows) { foreach (string NombreImpresora in PrinterSettings.InstalledPrinters) { //PrinterSettings PrinterInfo = new PrinterSettings(); //PrinterInfo.PrinterName = Impresora; Lbl.Impresion.Impresora Impr = Lbl.Impresion.Impresora.InstanciarImpresoraLocal(this.Connection, NombreImpresora); this.AgregarImpresora(Impr); } } Listado.Columns[1].Width = -2; if (Listado.Items.Count > 0 && Listado.SelectedItems.Count == 0) { Listado.Items[0].Selected = true; Listado.Items[0].Focused = true; } }
/// <summary> /// Carga en memoria los componentes registrados en la base de datos /// </summary> public static void CargarComponentes() { // Cargo el componente Core Lbl.Componentes.Componente ComLfc = new Lbl.Componentes.Componente(Lfx.Workspace.Master.MasterConnection); ComLfc.Crear(); ComLfc.Nombre = "Lfc"; ComLfc.EspacioNombres = "Lfc"; ComLfc.Assembly = System.Reflection.Assembly.LoadFrom("Lfc.dll"); Lfx.Components.Manager.RegisterComponent(ComLfc); if (Lfx.Workspace.Master.Tables.ContainsKey("sys_components")) { Lbl.ColeccionGenerica <Lbl.Componentes.Componente> Comps = Lbl.Componentes.Componente.ObtenerActivos(); // Inicializar todos los componentes foreach (Lbl.Componentes.Componente Comp in Comps) { // Registro el componente con el actualizador if (Lfx.Updates.Updater.Master != null) { Lfx.Updates.Package Pkg = new Lfx.Updates.Package(); Pkg.Name = Comp.EspacioNombres; Pkg.RelativePath = "Components" + System.IO.Path.DirectorySeparatorChar + Comp.EspacioNombres + System.IO.Path.DirectorySeparatorChar; Pkg.Url = Comp.UrlActualizaciones; Lfx.Updates.Updater.Master.Packages.Add(Pkg); } try { Lfx.Components.Manager.RegisterComponent(Comp); if (Comp.Estructura != null) { var Doc = new System.Xml.XmlDocument(); Doc.LoadXml(Comp.Estructura); Lfx.Workspace.Master.Structure.AddToBuiltIn(Doc); } if (Lfx.Environment.SystemInformation.DesignMode == false && Comp.ObtenerVersionActual() > Comp.Version) { // Actualizo el CIF y la estrucutra en la BD Comp.Version = Comp.ObtenerVersionActual(); Comp.Guardar(); } } catch (Exception ex) { if (Lfx.Workspace.Master != null && Lfx.Workspace.Master.DebugMode == false) { Lfx.Workspace.Master.RunTime.Toast("No se puede registrar el componente " + Comp.Nombre + "." + ex.Message, "Error"); throw; } else { throw; } } } } }
protected override void OnCreateControl() { base.OnCreateControl(); if (this.Connection != null) { EntradaStockActual.DecimalPlaces = Lbl.Sys.Config.Articulos.Decimales; EntradaStockMinimo.DecimalPlaces = Lbl.Sys.Config.Articulos.Decimales; EntradaCosto.DecimalPlaces = Lfx.Workspace.Master.CurrentConfig.Moneda.DecimalesCosto; EntradaPvp.DecimalPlaces = Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales; Lfx.Data.Row Nombre = null; Nombre = Lfx.Workspace.Master.Tables["articulos_codigos"].FastRows[1]; if (Nombre != null) { EtiquetaCodigo1.Text = Nombre["nombre"].ToString(); } Nombre = Lfx.Workspace.Master.Tables["articulos_codigos"].FastRows[2]; if (Nombre != null) { EtiquetaCodigo2.Text = Nombre["nombre"].ToString(); } Nombre = Lfx.Workspace.Master.Tables["articulos_codigos"].FastRows[3]; if (Nombre != null) { EtiquetaCodigo3.Text = Nombre["nombre"].ToString(); } Nombre = Lfx.Workspace.Master.Tables["articulos_codigos"].FastRows[4]; if (Nombre != null) { EtiquetaCodigo4.Text = Nombre["nombre"].ToString(); } this.Margenes = new Lbl.ColeccionGenerica <Lbl.Articulos.Margen>(this.Connection, Lfx.Workspace.Master.Tables["margenes"]); int i = 0; string[] ListaMargenes = new string[this.Margenes.Count + 1]; //Ordeno el listado de Margenes this.Margenes.Sort((x, y) => x.Porcentaje.CompareTo(y.Porcentaje)); foreach (Lbl.Articulos.Margen Mg in this.Margenes) { ListaMargenes[i] = Mg.Nombre + " (" + Lfx.Types.Formatting.FormatNumber(Mg.Porcentaje, 2) + "%)|" + Mg.Id.ToString(); i++; } ListaMargenes[i] = "Otro|0"; IgnorarCostoMargenPvpPvpIvaTextChanged++; EntradaMargen.SetData = ListaMargenes; IgnorarCostoMargenPvpPvpIvaTextChanged--; } }
public void Verificar() { this.Estado = "Verificando existencias..."; //Lbl.ColeccionGenerica<Lbl.Articulos.Situacion> Situaciones = new Lbl.ColeccionGenerica<Lbl.Articulos.Situacion>(this.Connection.Tables["articulos_situaciones"]); Lbl.ColeccionGenerica<Lbl.Articulos.Articulo> Articulos = new Lbl.ColeccionGenerica<Lbl.Articulos.Articulo>(this.Connection.Tables["articulos"]); foreach (Lbl.Articulos.Articulo Art in Articulos) { this.Estado = Art.ToString(); } }
public void Verificar() { this.Estado = "Verificando existencias..."; //Lbl.ColeccionGenerica<Lbl.Articulos.Situacion> Situaciones = new Lbl.ColeccionGenerica<Lbl.Articulos.Situacion>(this.Connection.Tables["articulos_situaciones"]); Lbl.ColeccionGenerica <Lbl.Articulos.Articulo> Articulos = new Lbl.ColeccionGenerica <Lbl.Articulos.Articulo>(this.Connection.Tables["articulos"]); foreach (Lbl.Articulos.Articulo Art in Articulos) { this.Estado = Art.ToString(); } }
private void MostrarImpresoras(Lbl.ColeccionGenerica <Lbl.Impresion.TipoImpresora> impresoras) { Listado.SuspendLayout(); Listado.Items.Clear(); if (impresoras != null) { foreach (Lbl.Impresion.TipoImpresora Impr in impresoras) { this.MostrarImpresora(Impr); } } Listado.ResumeLayout(); }
private void CompletarMargenes() { this.Margenes = new Lbl.ColeccionGenerica <Lbl.Articulos.Margen>(this.Connection, Lfx.Workspace.Master.Tables["margenes"]); int i = 0; string[] ListaMargenes = new string[this.Margenes.Count + 1]; foreach (Lbl.Articulos.Margen Mg in this.Margenes) { ListaMargenes[i] = Mg.Nombre + " (" + Lfx.Types.Formatting.FormatNumber(Mg.Porcentaje, 2) + "%)|" + Mg.Id.ToString(); i++; } ListaMargenes[i] = "Otro|0"; EntradaMargen.SetData = ListaMargenes; }
protected override void OnCreateControl() { base.OnCreateControl(); if (this.Connection != null) { EntradaStockActual.DecimalPlaces = Lbl.Sys.Config.Articulos.Decimales; EntradaStockMinimo.DecimalPlaces = Lbl.Sys.Config.Articulos.Decimales; EntradaCosto.DecimalPlaces = Lfx.Workspace.Master.CurrentConfig.Moneda.DecimalesCosto; EntradaPvp.DecimalPlaces = Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales; Lfx.Data.Row Nombre = null; Nombre = this.Connection.Tables["articulos_codigos"].FastRows[1]; if (Nombre != null) EtiquetaCodigo1.Text = Nombre["nombre"].ToString(); Nombre = this.Connection.Tables["articulos_codigos"].FastRows[2]; if (Nombre != null) EtiquetaCodigo2.Text = Nombre["nombre"].ToString(); Nombre = this.Connection.Tables["articulos_codigos"].FastRows[3]; if (Nombre != null) EtiquetaCodigo3.Text = Nombre["nombre"].ToString(); Nombre = this.Connection.Tables["articulos_codigos"].FastRows[4]; if (Nombre != null) EtiquetaCodigo4.Text = Nombre["nombre"].ToString(); this.Margenes = new Lbl.ColeccionGenerica<Lbl.Articulos.Margen>(this.Connection, this.Connection.Tables["margenes"]); int i = 0; string[] ListaMargenes = new string[this.Margenes.Count + 1]; foreach (Lbl.Articulos.Margen Mg in this.Margenes) { ListaMargenes[i] = Mg.Nombre + " (" + Lfx.Types.Formatting.FormatNumber(Mg.Porcentaje, 2) + "%)|" + Mg.Id.ToString(); i++; } ListaMargenes[i] = "Otro|0"; IgnorarCostoMargenTextChanged++; EntradaMargen.SetData = ListaMargenes; IgnorarCostoMargenTextChanged--; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (this.Connection != null) { //Lleno la tabla de PVs System.Data.DataTable TablaPvs = this.Connection.Select("SELECT * FROM pvs WHERE tipo=2 AND id_sucursal=" + Lfx.Workspace.Master.CurrentConfig.Empresa.SucursalActual.ToString()); this.PuntosDeVenta = new Lbl.ColeccionGenerica <Lbl.Comprobantes.PuntoDeVenta>(this.Connection, TablaPvs); string[] PvsDataSet = new string[TablaPvs.Rows.Count]; int i = 0; foreach (Lbl.Comprobantes.PuntoDeVenta Punto in this.PuntosDeVenta) { PvsDataSet[i++] = "Punto de venta Nº " + Punto.ToString() + "|" + Punto.Id.ToString(); } EntradaPv.SetData = PvsDataSet; if (EntradaPv.SetData.Length > 0) { //Busco el PV para esta estación, en esta sucursal this.Pv = Connection.FieldInt("SELECT id_pv FROM pvs WHERE tipo=2 AND id_sucursal=" + Lfx.Workspace.Master.CurrentConfig.Empresa.SucursalActual.ToString() + " AND estacion='" + Lfx.Environment.SystemInformation.MachineName + "'"); this.Pventa = Connection.FieldInt("SELECT numero FROM pvs WHERE tipo=2 AND id_sucursal=" + Lfx.Workspace.Master.CurrentConfig.Empresa.SucursalActual.ToString() + " AND estacion='" + Lfx.Environment.SystemInformation.MachineName + "'"); if (this.Pv == 0) { //Busco el PV para alguna estación, en esta sucursal this.Pv = Connection.FieldInt("SELECT id_pv FROM pvs WHERE tipo=2 AND id_sucursal=" + Lfx.Workspace.Master.CurrentConfig.Empresa.SucursalActual.ToString()); } this.Pventa = Connection.FieldInt("SELECT numero FROM pvs WHERE tipo=2 AND id_sucursal=" + Lfx.Workspace.Master.CurrentConfig.Empresa.SucursalActual.ToString() + " AND estacion='" + Lfx.Environment.SystemInformation.MachineName + "'"); if (this.Pv != 0) { EntradaPv.ValueInt = this.Pv; } } MostrarDatos(); } }
private void TimerRefrescar_Tick(object sender, EventArgs e) { TimerRefrescar.Stop(); ListaHistoral.SuspendLayout(); ListaHistoral.BeginUpdate(); System.Data.DataTable LogsTable = this.Connection.Select("SELECT * FROM sys_log WHERE tabla='" + this.Tabla + "' AND item_id=" + this.ItemId.ToString() + " ORDER BY id_log DESC"); Lbl.ColeccionGenerica <Lbl.Sys.Log.Entrada> Logs = new Lbl.ColeccionGenerica <Lbl.Sys.Log.Entrada>(this.Connection, LogsTable); for (int i = 0; i < Logs.Count; i++) { Lbl.Sys.Log.Entrada Log = Logs[i]; Lfx.Data.Row Usuario = Lfx.Workspace.Master.Tables["personas"].FastRows[Log.IdUsuario]; ListViewItem Itm = ListaHistoral.Items.Add(Lfx.Types.Formatting.FormatSmartDateAndTime(Log.Fecha)); if (Usuario == null) { Itm.SubItems.Add(""); } else { Itm.SubItems.Add(Usuario.Fields["nombre_visible"].Value.ToString()); } switch (Log.Comando) { case Lbl.Sys.Log.Acciones.Save: Itm.SubItems.Add("Guardar"); break; case Lbl.Sys.Log.Acciones.Comment: Itm.SubItems.Add("Comentario"); break; case Lbl.Sys.Log.Acciones.Print: Itm.SubItems.Add("Imprimir"); break; case Lbl.Sys.Log.Acciones.Delete: Itm.SubItems.Add("Eliminar"); break; case Lbl.Sys.Log.Acciones.DeleteAndRevert: Itm.SubItems.Add("Eliminar y revertir"); break; case Lbl.Sys.Log.Acciones.LogOn: Itm.SubItems.Add("Ingreso al sistema"); break; default: Itm.SubItems.Add(Log.Comando.ToString()); break; } if (Log.Comando == Lbl.Sys.Log.Acciones.Save) { Itm.SubItems.Add(Log.ExplainSave(false)); } else { Itm.SubItems.Add(Log.Carga); } Itm.Tag = Log; if (ListaHistoral.Items.Count == 200) { // Muestro un parcial ListaHistoral.EndUpdate(); System.Windows.Forms.Application.DoEvents(); ListaHistoral.BeginUpdate(); } } ColDatos.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); ListaHistoral.EndUpdate(); ListaHistoral.ResumeLayout(true); }