elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Tutorial básico de Quickjs


  Mostrar Temas
Páginas: [1]
1  Programación / .NET (C#, VB.NET, ASP) / Impresora termica usb en: 10 Noviembre 2013, 06:04 am
Hola a todos y muchas gracias por leer la pregunta.
El problema es el siguiente tengo una notebook que no tiene puertos seriales y compre una de esas impresoras térmicas de rollos usb que utiliza lenguaje ESC/POS. Necesito conectarme desde un programa que estoy implementado y hacer que me imprima recibos, solo que no puedo conectarme con el puerto usb para enviarle los comandos.
Leí un poco en Internet y me dice que tengo que utilizar la clase serialport pero cuando le asigno el valor "USB1" no hace nada. Les dejo el segmento de código.
Código
  1. Public Sub imprimir()
  2. post = New SerialPort("USB001")
  3. post.Open()
  4.  
  5. post.WriteLine("prueba")
  6.  
  7. post.Close()
  8. End Sub
  9.  
2  Programación / .NET (C#, VB.NET, ASP) / Ayuda imprimir VB .Net en: 30 Enero 2013, 22:05 pm
Hola necesito ayuda con un listado en un programa que estoy haciendo. Tengo una actividad para cada actividad tengo una colección de movimientos, los movimientos tienen personas que lo hacen. Necesito imprimir por cada persona los movimientos que tiene, la consulta esta pronta, pero el problema es cuando llego al final de la pagina en ves de agregarme una pagina nueva lo que hace es seguir imprimiendo en la misma pagina en la parte de arriba. Si alguien puede darme una ayuda, lo agradezco.
Aquí les dejo el segmento de código:

Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim ObjAct As Actividades = Nothing

        ObjAct = ComboBox1.SelectedItem



        If Not ObjAct Is Nothing Then
            ' Definir fuente para imprimir
            Dim fuenteimpresion As System.Drawing.Font = New Font("Arial", 12)
            Dim fuenteT As System.Drawing.Font = New Font("Arial", 12, FontStyle.Bold)

            Dim DE As DictionaryEntry
            Dim DE2 As DictionaryEntry
            Dim topMargin As Double = e.MarginBounds.Top
            Dim yPos As Double = 0
            Dim lineasXpagina As Double = 0
            Dim count As Integer = 0
            Dim texto As String = ""
            Dim linea As LineasMov
            Dim ObjMov As Movimientos
            Dim ColP As New Hashtable
            lineasXpagina = e.MarginBounds.Height / fuenteimpresion.GetHeight(e.Graphics)


            texto = vbTab & vbTab & ObjAct.Descripcion & " de la fecha " & ObjAct.Fecha

            yPos = topMargin + (count * fuenteimpresion.GetHeight(e.Graphics))

            e.Graphics.DrawString(texto, fuenteT, System.Drawing.Brushes.Black, 12, yPos)

            count += 2
            yPos = topMargin + (count * fuenteimpresion.GetHeight(e.Graphics))

            Dim Col As Hashtable = Administrador.DevolverInstancia.ObtenerMovimientos(ObjAct)

            For Each DE In Col

                ObjMov = DE.Value
                Dim total As Integer = 0
                total = (ObjMov.Cantidad * ObjMov.PrecioV) / ObjMov.Articulo.Unidad

                If ColP.ContainsKey(ObjMov.Persona.Id) = True Then
                    linea = Nothing
                    linea = ColP(ObjMov.Persona.Id)
                    If Not linea Is Nothing Then
                        linea.Total += total
                    End If
                Else
                    linea = New LineasMov(ObjMov.Id, ObjMov.Persona, total)
                    ColP.Add(linea.Persona.Id, linea)
                End If
            Next

            Col.Clear()


            For Each DE In ColP
                    linea = DE.Value
                    Col = Administrador.DevolverInstancia.ObtenerMovPersonas(linea.Persona, ObjAct)

                    Dim fuente2 As System.Drawing.Font = New Font("Arial", 12, FontStyle.Bold)
                    texto = vbTab & linea.Persona.Apellido & ", " & linea.Persona.Nombre
                    e.Graphics.DrawString(texto, fuente2, System.Drawing.Brushes.Black, 12, yPos)

                    count += 1
                    yPos = topMargin + (count * fuenteimpresion.GetHeight(e.Graphics))

                    texto = vbTab & "Cantidad"
                    e.Graphics.DrawString(texto, fuenteimpresion, System.Drawing.Brushes.Black, 12, yPos)

                    texto = vbTab & vbTab & vbTab & "Descripción"
                    e.Graphics.DrawString(texto, fuenteimpresion, System.Drawing.Brushes.Black, 12, yPos)

                    texto = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "Monto"
                    e.Graphics.DrawString(texto, fuenteimpresion, System.Drawing.Brushes.Black, 12, yPos)

                    count += 1
                    yPos = topMargin + (count * fuenteimpresion.GetHeight(e.Graphics))


                For Each DE2 In Col

                    ObjMov = DE2.Value

                    texto = vbTab & ObjMov.Cantidad
                    e.Graphics.DrawString(texto, fuenteimpresion, System.Drawing.Brushes.Black, 12, yPos)

                    texto = vbTab & vbTab & vbTab & ObjMov.Articulo.Descripcion
                    e.Graphics.DrawString(texto, fuenteimpresion, System.Drawing.Brushes.Black, 12, yPos)

                    texto = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & (ObjMov.PrecioV * ObjMov.Cantidad) / ObjMov.Articulo.Unidad
                    e.Graphics.DrawString(texto, fuenteimpresion, System.Drawing.Brushes.Black, 12, yPos)

                    count += 1
                    yPos = topMargin + (count * fuenteimpresion.GetHeight(e.Graphics))
                    xi += 1

                    If count > lineasXpagina Then
                        e.HasMorePages = True
                        count = 0
                    Else
                        e.HasMorePages = False
                    End If
                Next


                    texto = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "Total"
                    e.Graphics.DrawString(texto, fuenteimpresion, System.Drawing.Brushes.Black, 12, yPos)

                    count += 1
                    yPos = topMargin + (count * fuenteimpresion.GetHeight(e.Graphics))

                    texto = vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & linea.Total
                    e.Graphics.DrawString(texto, fuenteimpresion, System.Drawing.Brushes.Black, 12, yPos)

                    count += 2
                    yPos = topMargin + (count * fuenteimpresion.GetHeight(e.Graphics))

                If count > lineasXpagina Then
                    e.HasMorePages = True
                    count = 0
                Else
                    e.HasMorePages = False
                End If
            Next
        End If
    End Sub
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines