Respuesta: Solo imprimir una parte Private Sub DibujarPieDePagina()
For Each PieDePagina As String In LineasDelPie
If (PieDePagina.Length > MaximoCaracter()) Then
Dim currentChar As Integer = 0
Dim LongitudPieDePagina As Integer = PieDePagina.Length
While (LongitudPieDePagina > MaximoCaracter())
CadenaPorEscribirEnLinea = PieDePagina
gfx.DrawString(CadenaPorEscribirEnLinea.Substring( currentChar, MaximoCaracter), FuenteImpresa, ColorDeLaFuente, MargenIzquierdo, Renglon(), New StringFormat())
contador += 1
currentChar += MaximoCaracter()
LongitudPieDePagina -= MaximoCaracter()
End While
CadenaPorEscribirEnLinea = PieDePagina
gfx.DrawString(CadenaPorEscribirEnLinea.Substring( currentChar, CadenaPorEscribirEnLinea.Length - currentChar), FuenteImpresa, ColorDeLaFuente, MargenIzquierdo, Renglon(), New StringFormat())
contador += 1
Else
CadenaPorEscribirEnLinea = PieDePagina
gfx.DrawString(CadenaPorEscribirEnLinea, FuenteImpresa, ColorDeLaFuente, MargenIzquierdo, Renglon(), New StringFormat())
contador += 1
End If
Next PieDePagina
MargenIzquierdo = 10
DibujaEspacio()
End Sub
Private Sub DibujaEspacio()
CadenaPorEscribirEnLinea = " "
gfx.DrawString(CadenaPorEscribirEnLinea, FuenteImpresa, ColorDeLaFuente, MargenIzquierdo, Renglon(), New StringFormat())
contador += 1
End Sub
Public Sub New()
End Sub
End Class
Public Class OrdernarTotal
Public delimitador() As Char = " "
Public Sub OrdernarTotal(ByVal delimit As Char)
Dim delimitador As Char = delimit
End Sub
Public Function ObtenerTotalNombre(ByVal totalItem As String) As String
Dim delimitado() As String = totalItem.Split(delimitador)
Return delimitado(0)
End Function
Public Function ObtenerTotalCantidad(ByVal totalItem As String) As String
Dim delimitado() As String = totalItem.Split(delimitador)
Return delimitado(1)
End Function
Public Function GenerarTotal(ByVal totalName As String, ByVal price As String) As String
GenerarTotal = totalName + delimitador(0) + price
End Function
End Class
Public Class Form2
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
original()
Me.Close()
End Sub
Private Sub original()
Dim factura
Dim copia
mysqlconn3.ConnectionString = cadenacon
mysqlconn3.Open()
strsqlmsql3 = "select * from imprimir order by madre desc"
mysqlcmd3.CommandText = strsqlmsql3
mysqlcmd3.Connection = mysqlconn3
mysqlda3.SelectCommand = mysqlcmd3
mysqldr3 = mysqlcmd3.ExecuteReader
If mysqldr3.Read Then
factura = mysqldr3.Item("factura")
copia = mysqldr3.Item("copia")
End If
mysqlcmd3.Dispose()
mysqldr3.Close()
mysqlconn3.Close()
'''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''
mysqlconn.ConnectionString = cadenacon
mysqlconn.Open()
strsqlmsql = "SELECT * from movimientos where factura='" & factura & "'"
mysqlcmd.CommandText = strsqlmsql
mysqlcmd.Connection = mysqlconn
mysqlda.SelectCommand = mysqlcmd
mysqldr = mysqlcmd.ExecuteReader
If mysqldr.Read Then
Dim fechai = Format(mysqldr.Item("fechaf"), "dd/MM/yy")
Dim hora = Format(mysqldr.Item("fechaf"), "hh:mm:ss tt")
Dim a As ticket = New ticket
a.AnadirLineatitulo(" TU NEGOCIO")
a.AnadirLineaCabeza(" eslogan")
a.AnadirLineaCabeza(" RTN xxxxx")
a.AnadirLineaCabeza(" Tel. (xxx) xxxx")
a.AnadirLineaCabeza(" ubicacion")
a.AnadirLineaCabeza(" xxxxx xxx")
a.AnadirLineaSubcabeza("Factura #" & mysqldr.Item("factura") & " CAJA#1")
a.AnadirLineaSubcabeza("Fecha: " & fechai & " " & hora)
a.AnadirLineaSubcabeza("Cliente: " & mysqldr.Item("cliente") & " " & mysqldr.Item("identificacion"))
''''''''''''''''''''''
mysqlconn3.ConnectionString = cadenacon
mysqlconn3.Open()
strsqlmsql3 = "select SUBSTRING(nombre_producto,1,35) as nombre_producto,cantidad,total_plato,subtotal,valo r_impuesto,descuento,total from movimientos where factura='" & factura & "' and (titulo_plato='' or titulo_plato='TOTAL PLATO') order by madre asc"
mysqlcmd3.CommandText = strsqlmsql3
mysqlcmd3.Connection = mysqlconn3
mysqlda3.SelectCommand = mysqlcmd3
mysqldr3 = mysqlcmd3.ExecuteReader
Dim valorimpuesto = 0
Dim valordescuento = 0
Dim subtotal = 0
Dim totalimpuesto = 0
Dim total = 0
Dim cantidad
Dim ncantidad
While mysqldr3.Read
a.AnadirElemento("" & cantidad & "", " " & mysqldr3.Item("nombre_producto") & ";", ";" & FormatNumber(mysqldr3.Item("total"), 2) & "")
valorimpuesto = valorimpuesto + mysqldr3.Item("valor_impuesto")
valordescuento = valordescuento + mysqldr3.Item("descuento")
subtotal = subtotal + (mysqldr3.Item("subtotal") - mysqldr3.Item("valor_impuesto") - mysqldr3.Item("descuento"))
total = total + mysqldr3.Item("total")
End While
mysqlcmd3.Dispose()
mysqldr3.Close()
mysqlconn3.Close()
''''''''''''''''''''''
'El metodo AddTotal requiere 2 parametros, la descripcion del total, y el precio
a.AnadirTotal("Subtotal", "" & FormatNumber(subtotal, 2) & "")
a.AnadirTotal("Descuento", "" & FormatNumber(valordescuento, 2) & "")
a.AnadirTotal("Impuesto", "" & FormatNumber(valorimpuesto, 2) & "")
a.AnadirTotal("Total", "" & FormatNumber(total, 2) & "")
a.AnadirTotal("", "") ' //Ponemos un total en blanco que sirve de espacio
If mysqldr.Item("efectivo") > 0 Then
a.AnadirTotal("Efectivo", "" & FormatNumber(mysqldr.Item("efectivo"), 2) & "")
Else
End If
If mysqldr.Item("tarjeta") > 0 Then
a.AnadirTotal("Tarjeta", "" & FormatNumber(mysqldr.Item("tarjeta"), 2) & "")
Else
End If
a.AnadirTotal("Cambio", "" & FormatNumber(mysqldr.Item("cambio"), 2) & "")
a.AnadirTotal("", "") '/Ponemos un total en blanco que sirve de espacio
'//El metodo AddFooterLine funciona igual que la cabecera
a.AnadeLineaAlPie(" Total item: " & ncantidad & "")
a.AnadeLineaAlPie(" La factura es beneficio de todos")
a.AnadeLineaAlPie(" EXIJALA!!!")
a.AnadeLineaAlPie(" usuario: " & mysqldr.Item("usuario"))
a.AnadeLineaAlPie(" www.pagina.com")
If (copia <> "") Then
a.AnadeLineaAlPie(" ---- Copia ---")
End If
a.ImprimeTicket(impresora)
End If
mysqlcmd.Dispose()
mysqldr.Close()
mysqlconn.Close()
End Sub
End Class
ese es el cogido!!!!!
me tiene sin pelo ya!!! |