protected void OnButtonPagarClicked(object sender, EventArgs e) { ControladorBaseDatos BD = new ControladorBaseDatos(); numBoleta = BD.ObtenerBoleta(); PagoTarjeta pago = new PagoTarjeta(numBoleta,comboboxentryTipoTarjeta.ActiveText.Trim(),entryNroTransaccion.Text.Trim(),entryMonto.Text.Trim()); Venta nuevaVenta = new Venta(numBoleta, DateTime.Now.ToString("yyyy-MM-dd"), pagototal, "TarjetaEfectivo", Int32.Parse("0"), usuario_, "false"); BD.AgregarVentaBd(nuevaVenta); try { for(int i=0; i<listaPago_.Count;i++) { Console.WriteLine("ANTES DE codigo barra"); string codigoBarra = BD.ObtenerCodigoBarraBd((listaPago_[i].getNombre().Trim())); Console.WriteLine(codigoBarra); for(int j=0; j<listaPago_[i].getCantidad(); j++){ BD.AgregarVentaDetalleBd(numBoleta,codigoBarra); } } } catch (Exception ex) { Console.WriteLine("Excepcion:--->"+ex); } Console.WriteLine(comboboxentryTipoTarjeta.ActiveText.Trim()); Console.WriteLine(entryNroTransaccion.Text.Trim()); Console.WriteLine(entryMonto.Text.Trim()); BD.AgregarPagoTarjeta(pago); buttonPagar.Sensitive = false; }
protected void OnButtonOkClicked(object sender, EventArgs e) { this.db = new ControladorBaseDatos(); numBoleta = db.ObtenerBoleta(); PagoCheque pago = new PagoCheque(comboboxBanco.ActiveText.Trim(),comboboxPlaza.ActiveText.Trim(),entryMonto.Text.Trim(),numBoleta,entryNroSerie.Text.Trim()); Console.WriteLine ("BoletaCheque"+numBoleta); Venta nuevaVenta = new Venta(numBoleta, DateTime.Now.ToString("yyyy-MM-dd"), pagototal, "Cheque", Int32.Parse("0"), usuario_, "false"); db.AgregarVentaBd(nuevaVenta); try { for(int i=0; i<listaPago_.Count;i++) { Console.WriteLine("largo de listapago "+listaPago_.Count); string codigoBarra = db.ObtenerCodigoBarraBd((listaPago_[i].getNombre().Trim())); Console.WriteLine(codigoBarra); for(int j=0; j<listaPago_[i].getCantidad(); j++){ db.AgregarVentaDetalleBd(numBoleta,codigoBarra); } } } catch (Exception ex) { Console.WriteLine("Excepcion:--->"+ex); } Console.WriteLine(comboboxBanco.ActiveText.Trim()); Console.WriteLine(comboboxPlaza.ActiveText.Trim()); Console.WriteLine(entryNroSerie.Text.Trim()); Console.WriteLine(entryMonto.Text.Trim()); this.db.AgregarPagoCheque(pago); }
public void CargarUsuariosModificarCombobox() { ControladorBaseDatos db = new ControladorBaseDatos(); try { List<Usuario> tipos = db.ObtenerUsuariosBd(); comboboxUsuarioModificar.Clear(); CellRendererText cell = new CellRendererText(); comboboxUsuarioModificar.PackStart(cell, false); comboboxUsuarioModificar.AddAttribute(cell, "text", 0); this.usuariosModel = new Gtk.ListStore(typeof (string)); comboboxUsuarioModificar.Model = usuariosModel; foreach (Usuario tp in tipos) { this.usuariosModel.AppendValues(tp.Userlogin); } if (tipos.Count != 0) { this.comboboxUsuarioModificar.Active = 0; } } catch (Exception ex) { Console.WriteLine("Excepcion:"+ex); } }
public familiaproductosdialog(Gtk.Window parent) : base("Administrar familia", parent, Gtk.DialogFlags.DestroyWithParent) { this.Build (); this.db = new ControladorBaseDatos(); bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } Gtk.TreeViewColumn nombre_column = new Gtk.TreeViewColumn(); nombre_column.Title = "Nombre"; Gtk.CellRendererText nombre_cell = new Gtk.CellRendererText(); nombre_column.PackStart(nombre_cell, true); this.FamiliaProductosTreeview.AppendColumn(nombre_column); nombre_column.AddAttribute(nombre_cell, "text", 0); this.FamiliaProductosTreeview.Selection.Changed += OnFamiliasTreeViewSelectionChanged; GLib.ExceptionManager.UnhandledException += ExcepcionDesconocida; this.Deletable = true; }
public PrincipalWindow() : base(Gtk.WindowType.Toplevel) { #if DEBUG Console.WriteLine ("En debug"); #endif this.Build (); this.db = new ControladorBaseDatos (); bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if (!correcta) { //mostrar dialog configuracion basedatosdialog bdd = new basedatosdialog (this); bdd.Run (); this.db = null; this.db = new ControladorBaseDatos (); correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if (!correcta) { Gtk.Application.Quit (); } } }
protected void OnButtonIngresarClicked(object sender, EventArgs e) { ControladorBaseDatos Bd = new ControladorBaseDatos(); string[] usuarioClave = new string[2]; usuarioClave = Bd.ObtenerUsuarioContraseñaBd(entryUsuario.Text); if(usuarioClave[0].Equals(entryUsuario.Text) & usuarioClave[1].Equals(entryClave.Text)) { //PrincipalWindow principal = new PrincipalWindow(entryUsuario.Text); VenderProductosDialog principal = new VenderProductosDialog(entryUsuario.Text); base.Destroy(); principal.Show(); } else { Dialog dialog = new Dialog("Iniciar Sesion", this, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.Resizable = false; Gtk.Label etiqueta = new Gtk.Label(); etiqueta.Markup = "Usuario/Clave incorrectos"; dialog.BorderWidth = 8; dialog.VBox.BorderWidth = 8; dialog.VBox.PackStart(etiqueta, false, false, 0); dialog.AddButton ("Cerrar", ResponseType.Close); dialog.ShowAll(); dialog.Run (); dialog.Destroy (); } }
public AnularBoletaDialog() { this.Build (); this.db = new ControladorBaseDatos (); bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if (!correcta) { this.db = null; this.db = new ControladorBaseDatos (); correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } } }
public PagoChequeDialog(Gtk.Window parent,string monto, List<Produc> listapago,string usuario) : base("Pago Con Cheque", parent, Gtk.DialogFlags.DestroyWithParent) { this.listaPago_ = listapago; this.usuario_ = usuario; this.pagototal = monto; this.Build (); this.db = new ControladorBaseDatos(); bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if (!correcta) { this.db = null; this.db = new ControladorBaseDatos(); correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } } comboboxBanco.AppendText("Santander"); comboboxBanco.AppendText("Chile"); comboboxBanco.AppendText("BCI"); comboboxPlaza.AppendText("Valdivia"); comboboxPlaza.AppendText("Santiago"); comboboxPlaza.AppendText("Rancagua"); comboboxPlaza.AppendText("Talca"); comboboxPlaza.AppendText("Chillan"); comboboxPlaza.AppendText("Concepcion"); comboboxPlaza.AppendText("Osorno"); comboboxPlaza.AppendText("Puerto Montt"); entryMonto.Text=monto; }
public PagarDialog(Gtk.Window parent,string total, string usuario, List<Produc> listapago) : base("Medios de Pago ", parent, Gtk.DialogFlags.DestroyWithParent) { this.db = new ControladorBaseDatos(); this.pagototal=total; this.usuario_=usuario; this.listaPago_=listapago; this.Build (); bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if (!correcta) { this.db = null; this.db = new ControladorBaseDatos(); correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if(!correcta) { Application.Quit(); } } frame1.Hide (); frame2.Show (); this.buttonPagoEfectivo.IsFocus=true; labeltotalcompra.ModifyFont(Pango.FontDescription.FromString("Arial 20")); labelEfectivo.ModifyFont(Pango.FontDescription.FromString("Arial 20")); labelTotal.ModifyFont(Pango.FontDescription.FromString("Arial 20")); labelVuelto.ModifyFont(Pango.FontDescription.FromString("Arial 20")); // labelVuelto.Hide (); this.Deletable = true; }
protected void OnButtonIngresarDineroClicked(object sender, EventArgs e) { ControladorBaseDatos baseDatos = new ControladorBaseDatos(); try { int boleta = baseDatos.ObtenerBoleta(); Venta nVenta = new Venta(boleta, DateTime.Now.ToString("yyyy-MM-dd"), entryMontoDinero.Text.Trim(), "IngresoDineroCaja", Int32.Parse("0"), usuario_, "false"); baseDatos.AgregarVentaBd(nVenta); entryMontoDinero.Text = ""; Dialog dialog = new Dialog("INGRESAR MONTO DINERO", this, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.Resizable = false; Gtk.Label etiqueta = new Gtk.Label(); etiqueta.Markup = "La operación ha sido realizada con éxito"; dialog.BorderWidth = 8; dialog.VBox.BorderWidth = 8; dialog.VBox.PackStart(etiqueta, false, false, 0); dialog.AddButton ("Cerrar", ResponseType.Close); dialog.ShowAll(); dialog.Run (); dialog.Destroy (); } catch (Exception ex) { Dialog dialog = new Dialog("INGRESAR MONTO DINERO", this, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.Resizable = false; Gtk.Label etiqueta = new Gtk.Label(); etiqueta.Markup = "Ha ocurrido un error al ingresar monto dinero"; dialog.BorderWidth = 8; dialog.VBox.BorderWidth = 8; dialog.VBox.PackStart(etiqueta, false, false, 0); dialog.AddButton ("Cerrar", ResponseType.Close); dialog.ShowAll(); dialog.Run (); dialog.Destroy (); Console.WriteLine("error ingresar monto: "+ex); } }
public EditarProductoDialog(Gtk.Window parent, string nombre, string precio,string familia) : base("Editar producto", parent, Gtk.DialogFlags.DestroyWithParent) { this.Build (); this.db = new ControladorBaseDatos(); entryNombre.Text = nombre.Trim(); entryPrecio.Text = precio.Trim(); // entryFamilia.Text = familia.Trim(); //familiaActual=entryFamilia.Text.Trim(); //comboboxFamilia.ActiveText=familia.Trim(); //ventamodel.AppendValues(comboboxFamilia.ActiveText); comboboxFamilia.AppendText(familia.Trim()); comboboxFamilia.Active =0; }
protected void OnButtonPagarClicked(object sender, EventArgs e) { ControladorBaseDatos db = new ControladorBaseDatos(); numBoleta = db.ObtenerBoleta(); Console.WriteLine("*************************************************"); Console.WriteLine("usuario:"+usuario_); Console.WriteLine("boleta:"+numBoleta); Console.WriteLine("pago total:"+pagototal); int vuelto = (Int32.Parse(entryPagoEfectivo.Text.Trim())-Int32.Parse(pagototal)); Console.WriteLine("vuelto:"+vuelto); Console.WriteLine("tipo pago: Pago Efectivo"); Console.WriteLine("fecha :"+DateTime.Now); Console.WriteLine("*************************************************"); Venta nuevaVenta = new Venta(numBoleta, DateTime.Now.ToString("yyyy-MM-dd"), pagototal, "efectivo", vuelto, usuario_, "false"); db.AgregarVentaBd(nuevaVenta); try { for(int i=0; i<listaPago_.Count;i++) { Console.WriteLine("ANTES DE codigo barra"); string codigoBarra = db.ObtenerCodigoBarraBd((listaPago_[i].getNombre().Trim())); Console.WriteLine(codigoBarra); for(int j=0; j<listaPago_[i].getCantidad(); j++){ db.AgregarVentaDetalleBd(numBoleta,codigoBarra); } } } catch (Exception ex) { Console.WriteLine("Excepcion:--->"+ex); } this.buttonOk.IsFocus=true; buttonPagar.Sensitive = false; }
public basedatosdialog(Gtk.Window parent) : base("Configuración de Conexión a Base de Datos", parent, Gtk.DialogFlags.DestroyWithParent) { this.db = new ControladorBaseDatos(); this.Build (); this.entry1.Text = this.db.Server; this.entry2.Text = this.db.Database; this.entry3.Text = this.db.User; this.entry4.Text = this.db.Password; try { this.era_correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { this.era_correcta = false; } GLib.ExceptionManager.UnhandledException += ExcepcionDesconocida; this.Deletable = true; }
public PagoTarjetaDialog(Gtk.Window parent,string monto, List<Produc> listapago,string usuario) : base("Pago Con Tarjeta", parent, Gtk.DialogFlags.DestroyWithParent) { this.listaPago_ = listapago; this.usuario_ = usuario; this.pagototal = monto; this.Build (); this.db = new ControladorBaseDatos(); bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if (!correcta) { this.db = null; this.db = new ControladorBaseDatos(); correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } } comboboxentryTipoTarjeta.AppendText("RedCompra"); comboboxentryTipoTarjeta.AppendText("Visa"); comboboxentryTipoTarjeta.AppendText("Mastercard"); entryMonto.Text=monto; }
protected void OnButtonVentaClicked(object sender, EventArgs e) { ControladorBaseDatos db = new ControladorBaseDatos(); ventamodel.Clear(); double temp=Convert.ToDouble(db.ObtenerBoleta()); temp=temp+1; Console.WriteLine("temp"); Console.WriteLine(temp); boleta=temp.ToString(); Console.WriteLine(boleta); entryNumBoleta.Text=boleta; Console.WriteLine(entryNumBoleta.Text); // Venta pago = new Venta(Int32.Parse(entryNumBoleta.Text.Trim()),DateTime.Now,Int32.Parse(labelTotalVenta.Text.Trim())); Console.WriteLine(DateTime.Now); Console.WriteLine(Int32.Parse(entryNumBoleta.Text.Trim())); // this.db.AgregarVentaDetalle(pago); PagarDialog rcd = new PagarDialog(this,labelTotalVenta.Text.Trim(),usuarioLogin, productoventa); try { rcd.Run(); rcd.Destroy(); } catch (MySql.Data.MySqlClient.MySqlException ex) { rcd.Destroy(); #if DEBUG Console.WriteLine("entra al OnEntry1KeyPressEvent "); #endif } labelTotalVenta.Text="0"; preciototal=0; }
protected void OnBotonAgregarClicked(object sender, EventArgs e) { ControladorBaseDatos db = new ControladorBaseDatos(); bool existe = db.ExisteUsuarioBd(entryNombreUsuario.Text.Trim()); if (existe) { Dialog dialog = new Dialog("USUARIO YA EXISTE", this, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.Resizable = false; Gtk.Label etiqueta = new Gtk.Label(); etiqueta.Markup = "El Usuario que intenta agregar ya existe en la Base de Datos"; dialog.BorderWidth = 8; dialog.VBox.BorderWidth = 8; dialog.VBox.PackStart(etiqueta, false, false, 0); dialog.AddButton ("Cerrar", ResponseType.Close); dialog.ShowAll(); dialog.Run (); dialog.Destroy (); } else { Usuario NuevoUsuario = new Usuario(entryNombreUsuario.Text.Trim(), entryContraseña.Text.Trim(), entryNombre.Text.Trim(), entryApellidos.Text.Trim(), entryTelefono.Text.Trim(), entryRut.Text.Trim(), comboboxTipoUsuario.ActiveText); db.AgregarUsuarioBd(NuevoUsuario); Dialog dialog = new Dialog("USUARIO AGREGADO", this, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.Resizable = false; Gtk.Label etiqueta = new Gtk.Label(); etiqueta.Markup = "El Usuario se ha agregado correctamente"; dialog.BorderWidth = 8; dialog.VBox.BorderWidth = 8; dialog.VBox.PackStart(etiqueta, false, false, 0); dialog.AddButton ("Cerrar", ResponseType.Close); dialog.ShowAll(); dialog.Run (); dialog.Destroy (); this.CargarUsuariosModificarCombobox(); } }
protected virtual void OnConexionBaseDatosActivated(object sender, System.EventArgs e) { this.db = null; this.db = new ControladorBaseDatos(); bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if(!correcta) { Gtk.Application.Quit(); } }
public PrincipalWindow(string usuario) : base(Gtk.WindowType.Toplevel) { this.usuario_ = usuario; #if DEBUG Console.WriteLine ("En debug"); #endif this.Build (); this.db = new ControladorBaseDatos (); nivelUsuario = db.ObtenerNivelUsuarioBd(usuario_); if(nivelUsuario.Equals("Cajero")) { ProductosAction.Visible = false; UsuariosAction.Visible = false; } bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } Gtk.TreeViewColumn cantidad_column = new Gtk.TreeViewColumn(); cantidad_column.Title = "Cantidad"; Gtk.CellRendererText cantidad_cell = new Gtk.CellRendererText(); cantidad_column.PackStart(cantidad_cell, true); Gtk.TreeViewColumn precio_column = new Gtk.TreeViewColumn(); precio_column.Title = "Precio"; Gtk.CellRendererText precio_cell = new Gtk.CellRendererText(); precio_column.PackStart(precio_cell, true); Gtk.TreeViewColumn nombre_column = new Gtk.TreeViewColumn(); nombre_column.Title = "Nombre"; Gtk.CellRendererText nombre_cell = new Gtk.CellRendererText(); nombre_column.PackStart(nombre_cell, true); this.treeviewListaProductos.AppendColumn(cantidad_column); cantidad_column.AddAttribute(cantidad_cell, "text", 0); this.treeviewListaProductos.AppendColumn(nombre_column); nombre_column.AddAttribute(nombre_cell, "text", 1); this.treeviewListaProductos.AppendColumn(precio_column); precio_column.AddAttribute(precio_cell, "text", 2); #if DEBUG Console.WriteLine(this.db.ObtenerBoleta()); #endif double temp=Convert.ToDouble( this.db.ObtenerBoleta()); temp=temp+1; Console.WriteLine("temp"); Console.WriteLine(temp); boleta=temp.ToString(); Console.WriteLine(boleta); entryNumBoleta.Text=boleta; Console.WriteLine(entryNumBoleta.Text); this.treeviewListaProductos.Selection.Changed += TreeView2SelectionChanged; GLib.ExceptionManager.UnhandledException += ExcepcionDesconocida; this.Deletable = true; labelTotalVenta.ModifyFont(Pango.FontDescription.FromString("Courier bold 32")); }
protected void OnBotonModificarClicked(object sender, EventArgs e) { ControladorBaseDatos db = new ControladorBaseDatos(); try { string [] aux = db.ObtenerusuarioAntiguoBd(entryUsuarioEdit.Text.Trim()); Usuario usuarioAntiguo = new Usuario(aux[0],aux[1],aux[2],aux[3],aux[4],aux[5],aux[6]); Usuario usuarioNuevo = new Usuario(entryUsuarioEdit.Text.Trim(), entryContraseñaEdit.Text.Trim(), entryNombreEdit.Text.Trim(), entryApellidosEdit.Text.Trim(), entryTelefonoEdit.Text.Trim(), entryRutEdit.Text.Trim(), comboboxTipoUsuarioMod.ActiveText); db.ActualizarUsuarioBd(usuarioAntiguo,usuarioNuevo); Dialog dialog = new Dialog("USUARIO ACTUALIZADO", this, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.Resizable = false; Gtk.Label etiqueta = new Gtk.Label(); etiqueta.Markup = "Actualización correcta"; dialog.BorderWidth = 8; dialog.VBox.BorderWidth = 8; dialog.VBox.PackStart(etiqueta, false, false, 0); dialog.AddButton ("Cerrar", ResponseType.Close); dialog.ShowAll(); dialog.Run (); dialog.Destroy (); } catch (Exception ex) { Console.WriteLine("Excepcion:"+ex); } }
/* public void CargarFechaInicial() { ControladorBaseDatos db = new ControladorBaseDatos(); try { //db.ordenarFecha(); List<string> fechaInicial = db.ObtenerFechaBd(); comboboxFechasInicial.Clear(); CellRendererText cell = new CellRendererText(); comboboxFechasInicial.PackStart(cell, false); comboboxFechasInicial.AddAttribute(cell, "text", 0); this.fechaInicialModel = new Gtk.ListStore(typeof (string)); comboboxFechasInicial.Model = fechaInicialModel; foreach (string i in fechaInicial) { this.fechaInicialModel.AppendValues(i); } if (fechaInicial.Count != 0) { this.comboboxFechasInicial.Active = 0; } } catch (Exception ex) { Console.WriteLine("Excepcion:"+ex); } } public void CargarFechaFinal() { ControladorBaseDatos db = new ControladorBaseDatos(); //db.ordenarFecha(); try { List<string> fechaFinal = db.ObtenerFechaBd(); comboboxFechasFinal.Clear(); CellRendererText cell2 = new CellRendererText(); comboboxFechasFinal.PackStart(cell2, false); comboboxFechasFinal.AddAttribute(cell2, "text", 0); this.fechaFinalModel = new Gtk.ListStore(typeof (string)); comboboxFechasFinal.Model = fechaFinalModel; foreach (string j in fechaFinal) { this.fechaFinalModel.AppendValues(j); } if (fechaFinal.Count != 0) { this.comboboxFechasFinal.Active = 0; } } catch (Exception ex) { Console.WriteLine("Excepcion:"+ex); } } */ protected void OnButtonGuardarReporteClicked(object sender, EventArgs e) { string fechaInicial = calendarFInicial.GetDate ().ToString ("yyyy-MM-dd").Trim (); string fechaFinal = calendarFFinal.GetDate ().ToString ("yyyy-MM-dd").Trim (); this.OnCalendarFInicialDaySelected(sender,e); this.OnCalendarFFinalDaySelected(sender,e); if(fechaInicial.CompareTo(fechaFinal)==1){ Dialog dialog = new Dialog("ADVERTENCIA", this, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.Resizable = false; Gtk.Label etiqueta = new Gtk.Label(); etiqueta.Markup = "fecha final no puede ser anterior a fecha inicial"; dialog.BorderWidth = 8; dialog.VBox.BorderWidth = 8; dialog.VBox.PackStart(etiqueta, false, false, 0); dialog.AddButton ("Cerrar", ResponseType.Close); dialog.ShowAll(); dialog.Run (); dialog.Destroy (); } else{ // string fechaInicial = comboboxFechasInicial.ActiveText; // string fechaFinal = comboboxFechasFinal.ActiveText; Document myDocument; SeleccionarRuta(); // for(int aux=0; aux<listaVentas.Count; aux++){ // Console.WriteLine("Numero Boleta: "+Convert.ToString(listaVentas[aux].Idventa)); //myDocument.Add(new Paragraph("Numero Boleta: "+listaVentas[aux].Idventa)); // } if(this.ruta_destino!=null){ Console.WriteLine("iText Demo"); // step 1: creation of a document-object myDocument = new Document(PageSize.LETTER); Console.WriteLine("hora: "+DateTime.Now.ToShortTimeString()); Console.WriteLine("Fecha: "+DateTime.Now.ToShortDateString()); // step 2: // Now create a writer that listens to this doucment and writes the document to desired Stream. PdfWriter.GetInstance(myDocument, new FileStream(this.ruta_destino, FileMode.Create)); // step 3: Open the document now using myDocument.Open(); PdfPTable tabla = new PdfPTable(4); tabla.AddCell("N° Boleta "); tabla.AddCell("Fecha " ); tabla.AddCell("Total Venta " ); tabla.AddCell("Cajero "); foreach (PdfPCell celda in tabla.Rows[0].GetCells()) { celda.BackgroundColor = BaseColor.LIGHT_GRAY; celda.HorizontalAlignment = 1; celda.Padding = 3; } try { ControladorBaseDatos objeto = new ControladorBaseDatos(); //List<string> listaVentas = objeto.ObtenerIntervaloFechasBd(fechaInicial,fechaFinal); List<Venta> listaVentas = objeto.ObtenerIntervaloFechasBd(fechaInicial,fechaFinal); Console.WriteLine("tamaño listaVentas"+listaVentas.Count); myDocument.Add(new Paragraph(" Emitido el: "+DateTime.Now.ToShortDateString()+ " a las: "+DateTime.Now.ToShortTimeString()+" Horas", FontFactory.GetFont("arial", // fuente 8, // tamaño Font.NORMAL, // estilo BaseColor.BLACK))); myDocument.Add(new Paragraph(" ")); myDocument.Add(new Paragraph(" Reporte Ventas Minimarket El Coke", FontFactory.GetFont("arial", // fuente 18, // tamaño Font.NORMAL, // estilo BaseColor.BLACK))); // AQUI VA EL LOGO DEL MINIMARKET iTextSharp.text.Image imgP = iTextSharp.text.Image.GetInstance("/Users/Esteban/Projects/Git43Felo/punto.gui/iconos/imagen.png"); imgP.ScalePercent(40, 40); imgP.Alignment = Element.ALIGN_CENTER; myDocument.Add(imgP); myDocument.Add(new Paragraph(" ")); myDocument.Add(new Paragraph(" Ventas realizadas entre "+fechaInicial+" y "+fechaFinal, FontFactory.GetFont("arial", // fuente 10, // tamaño Font.NORMAL, // estilo BaseColor.BLACK))); int tamanio = listaVentas.Count; string[,] arreglo = new string[tamanio,4]; for(int i=0; i<tamanio; i++){ for(int j=0; j<4; j++){ switch(j) { case 0: arreglo[i,j] =Convert.ToString(listaVentas[i].Idventa); break; case 1: arreglo[i,j] =listaVentas[i].Var_fecha; break; case 2: arreglo[i,j] =listaVentas[i].Total; break; case 3: arreglo[i,j] =listaVentas[i].Usuarios_userlogin; break; default: Console.WriteLine("Default case"); break; } } } List<string> lista2 = new List<string>(); for(int i=0; i<tamanio; i++){ for(int j=0; j<4; j++){ Console.WriteLine("["+i+"]["+j+"]: "+arreglo[i,j]+" "); lista2.Add(arreglo[i,j]); } Console.WriteLine("\n"); } for (int i = 0; i < (tamanio*4); i++){ tabla.AddCell(lista2[i]); } int total = 0; for(int aux=0; aux<listaVentas.Count; aux++){ total+=Int32.Parse(listaVentas[aux].Total); } Console.WriteLine("Total: "+total); myDocument.Add(new Paragraph(" ")); myDocument.Add(tabla); myDocument.Add(new Paragraph(" ")); myDocument.Add(new Paragraph(" Total______$"+total+".-", FontFactory.GetFont("arial", // fuente 22, // tamaño Font.NORMAL, // estilo BaseColor.RED))); /* for(int aux=0; aux<listaVentas.Count; aux++){ Console.WriteLine("Numero Boleta: "+listaVentas[aux].Tipo_pago); myDocument.Add(new Paragraph("Numero Boleta: "+Convert.ToString(listaVentas[aux].Idventa))); myDocument.Add(new Paragraph("Fecha: "+listaVentas[aux].Var_fecha)); myDocument.Add(new Paragraph("Total: "+listaVentas[aux].Total)); myDocument.Add(new Paragraph("Cajero: "+listaVentas[aux].Usuarios_userlogin)); myDocument.Add(new Paragraph("***********************")); }*/ } catch (Exception ex) { Console.WriteLine("Excepcion:"+ex); } // step 4: Now add some contents to the document // for(int aux=0; aux<listaVentas.Count; aux++){ // Console.WriteLine("Numero Boleta: "+Convert.ToString(listaVentas[aux].Idventa)); //myDocument.Add(new Paragraph("Numero Boleta: "+listaVentas[aux].Idventa)); // } // step 5: Remember to close the documnet myDocument.Close(); Dialog dialog2 = new Dialog("MENSAJE", this, Gtk.DialogFlags.DestroyWithParent); dialog2.Modal = true; dialog2.Resizable = false; Gtk.Label etiqueta2 = new Gtk.Label(); etiqueta2.Markup = "Documento PDF creado correctamente"; dialog2.BorderWidth = 8; dialog2.VBox.BorderWidth = 8; dialog2.VBox.PackStart(etiqueta2, false, false, 0); dialog2.AddButton ("Cerrar", ResponseType.Close); dialog2.ShowAll(); dialog2.Run (); dialog2.Destroy (); } } }
public VenderProductosDialog(string usuario) { this.usuarioLogin = usuario; this.ventamodel = new Gtk.ListStore (typeof(int), typeof(string), typeof(string)); this.Build (); this.db = new ControladorBaseDatos (); bool correcta = false; nivelUsuario = db.ObtenerNivelUsuarioBd(usuarioLogin); if(nivelUsuario.Equals("Cajero")) { ProductosAction.Visible = false; UsuarioAction.Visible = false; } labelNombreCajero.Text = usuarioLogin.ToString(); labelFecha.ModifyFont (Pango.FontDescription.FromString ("Arial 15")); labelFecha.Text = "Fecha: "+DateTime.Now.ToShortDateString(); labelCajero.ModifyFont (Pango.FontDescription.FromString ("Arial 14")); labelNombreCajero.ModifyFont (Pango.FontDescription.FromString ("Arial 14")); labelTotal1.ModifyFont (Pango.FontDescription.FromString ("Arial 15")); labelTotalVenta.ModifyFont (Pango.FontDescription.FromString ("Arial 32")); try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if (!correcta) { this.db = null; this.db = new ControladorBaseDatos (); correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } } Gtk.TreeViewColumn cantidad_column = new Gtk.TreeViewColumn (); cantidad_column.Title = " Cantidad"; Gtk.CellRendererText cantidad_cell = new Gtk.CellRendererText (); cantidad_column.PackStart (cantidad_cell, true); // cantidad_column.Width{}; Gtk.TreeViewColumn precio_column = new Gtk.TreeViewColumn (); precio_column.Title = "Precio"; Gtk.CellRendererText precio_cell = new Gtk.CellRendererText (); precio_column.PackStart (precio_cell, true); Gtk.TreeViewColumn descArticulo_column = new Gtk.TreeViewColumn (); descArticulo_column.Title = " Descripcion Articulo"; Gtk.CellRendererText descArticulo_cell = new Gtk.CellRendererText (); descArticulo_column.PackStart (descArticulo_cell, true); this.treeviewListaProductos.AppendColumn (cantidad_column); cantidad_column.Title = "Cantidad"; cantidad_column.AddAttribute (cantidad_cell, "text", 0); this.treeviewListaProductos.AppendColumn (descArticulo_column); descArticulo_column.AddAttribute (descArticulo_cell, "text", 1); precio_column.Title = "Precio"; this.treeviewListaProductos.AppendColumn (precio_column); precio_column.AddAttribute (precio_cell, "text", 2); descArticulo_column.Title = "Descripcion Articulo"; #if DEBUG Console.WriteLine(this.db.ObtenerBoleta()); #endif double temp = Convert.ToDouble (this.db.ObtenerBoleta ()); temp = temp + 1; Console.WriteLine ("temp"); Console.WriteLine (temp); boleta = temp.ToString (); Console.WriteLine (boleta); // this.treeviewListaProductos.Selection.Changed += TreeView2SelectionChanged; GLib.ExceptionManager.UnhandledException += ExcepcionDesconocida; this.Deletable = true; }
protected void OnComboboxUsuarioModificarChanged(object sender, EventArgs e) { ControladorBaseDatos db = new ControladorBaseDatos(); List<Usuario> tipos = db.ObtenerUsuariosBd(); for (int i = 0; i < tipos.Count; i++) { Console.WriteLine("lista"+i); if(tipos[i].Userlogin.Equals(comboboxUsuarioModificar.ActiveText)) { entryUsuarioEdit.Text = tipos[i].Userlogin; entryUsuarioEdit.QueueDraw(); entryNombreEdit.Text = tipos[i].Nombre; entryNombreEdit.QueueDraw(); entryApellidosEdit.Text = tipos[i].Apellidos; entryApellidosEdit.QueueDraw(); entryTelefonoEdit.Text = tipos[i].Telefono; entryTelefonoEdit.QueueDraw(); entryRutEdit.Text = tipos[i].Rut; entryRutEdit.QueueDraw(); entryContraseñaEdit.Text = tipos[i].Userpass; entryContraseñaEdit.QueueDraw(); comboboxTipoUsuarioMod.Clear(); CellRendererText cell = new CellRendererText(); comboboxTipoUsuarioMod.PackStart(cell, false); comboboxTipoUsuarioMod.AddAttribute(cell, "text", 0); ListStore ListaCombobox = new ListStore(typeof (string)); comboboxTipoUsuarioMod.Model = ListaCombobox; ListaCombobox.AppendValues (tipos[i].Nivel_user); if(tipos[i].Nivel_user.Equals("Cajero")) { ListaCombobox.AppendValues ("Administrador"); ListaCombobox.AppendValues ("Empleado"); } if((tipos[i].Nivel_user.Equals("Administrador"))) { ListaCombobox.AppendValues ("Cajero"); ListaCombobox.AppendValues ("Empleado"); } if((tipos[i].Nivel_user.Equals("Empleado"))) { ListaCombobox.AppendValues ("Administrador"); ListaCombobox.AppendValues ("Cajero"); } this.comboboxTipoUsuarioMod.Active = 0; // ListaCombobox.GetIterFirst(out it); } } }
protected virtual void OnConexionBaseDatosActivated(object sender, System.EventArgs e) { //mostrar dialog configuracion basedatosdialog bdd = new basedatosdialog(this); bdd.Run(); bdd.Destroy(); this.db = null; this.db = new ControladorBaseDatos(); bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if(!correcta) { Gtk.Application.Quit(); } }
protected void OnCalendarFInicialDaySelected(object sender, EventArgs e) { ControladorBaseDatos db = new ControladorBaseDatos (); string fechaI=""; //DateTime.Now.ToString("yyyy-MM-dd") fechaI = calendarFInicial.GetDate ().ToString ("yyyy-MM-dd").Trim (); Console.WriteLine("fecha seleccionada I: "+fechaI); if (!db.ExisteFechaBd (fechaI)) { Console.WriteLine ("NO existe venta"); Dialog dialog = new Dialog("Advertencia", this, Gtk.DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.Resizable = false; Gtk.Label etiqueta = new Gtk.Label(); etiqueta.Markup = "No existen ventas en el día seleccionado"; dialog.BorderWidth = 8; dialog.VBox.BorderWidth = 8; dialog.VBox.PackStart(etiqueta, false, false, 0); dialog.AddButton ("Cerrar", ResponseType.Close); dialog.ShowAll(); dialog.Run (); dialog.Destroy (); } else { Console.WriteLine ("existe venta"); } }
public IngresarProductosDialog(Gtk.Window parent) : base("Ingresar Productos", parent, Gtk.DialogFlags.DestroyWithParent) { this.Build (); this.db = new ControladorBaseDatos(); bool correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if (!correcta) { this.db = null; this.db = new ControladorBaseDatos(); correcta = false; try { correcta = this.db.ConfiguracionCorrectaBd; } catch (Exception ex) { correcta = false; } if(!correcta) { Application.Quit(); } } GLib.ExceptionManager.UnhandledException += ExcepcionDesconocida; this.Deletable = true; Gtk.TreeViewColumn nombre_column = new Gtk.TreeViewColumn(); nombre_column.Title = "Nombre"; Gtk.CellRendererText nombre_cell = new Gtk.CellRendererText(); nombre_column.PackStart(nombre_cell, true); Gtk.TreeViewColumn precio_column = new Gtk.TreeViewColumn(); precio_column.Title = "Precio"; Gtk.CellRendererText precio_cell = new Gtk.CellRendererText(); precio_column.PackStart(precio_cell, true); Gtk.TreeViewColumn familia_column = new Gtk.TreeViewColumn(); familia_column.Title = "Familia"; Gtk.CellRendererText familia_cell = new Gtk.CellRendererText(); familia_column.PackStart(familia_cell, true); Gtk.TreeViewColumn vigente_column = new Gtk.TreeViewColumn(); vigente_column.Title = "Vigente"; Gtk.CellRendererText vigente_cell = new Gtk.CellRendererText(); vigente_column.PackStart(vigente_cell, true); this.treeviewModificarProducto.AppendColumn(nombre_column); nombre_column.AddAttribute(nombre_cell, "text", 0); this.treeviewModificarProducto.AppendColumn(precio_column); precio_column.AddAttribute(precio_cell, "text", 1); this.treeviewModificarProducto.AppendColumn(familia_column); familia_column.AddAttribute(familia_cell, "text", 2); this.treeviewModificarProducto.AppendColumn(vigente_column); vigente_column.AddAttribute(vigente_cell, "text", 3); }