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

 

 


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Crear Facturas
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Crear Facturas  (Leído 1,825 veces)
Bourne Ultimatum


Desconectado Desconectado

Mensajes: 382



Ver Perfil WWW
Crear Facturas
« en: 6 Julio 2005, 00:55 am »

Holas queria hablar de un tema q seguramente la gran mayoria paso alguna vez tratando de hacer o haciendo
las facturas, como se hacen en VB6.0
como hacer para imprimirlas, como hacer para que te imprima lo q quieres en el lugar que quieres
bueno si alguien tiene experiencia o alguna idea en esto comentelo q somos muchos los q estamos interesados en aprender esto :D
por mi parte pasare el codigo de como guardar los datos y como hacer para imprimirlos al estilo picture (lo busco y lo pongo)
pero taria bueno si alguien sabe como hacer para imprimir el texto ;)


En línea

"El pertenecia a esa clase singular de hombres que la especie produce rara vez,
en quienes el ansia de poder ilimitado es tan extremo que para conseguirlo
cualquier sufrimiento parece natural" Ernesto CHE Guevara

http://www.desdeabajorugby.com.ar
Kizar


Desconectado Desconectado

Mensajes: 1.325


kizar_net


Ver Perfil
Re: Crear Facturas
« Respuesta #1 en: 6 Julio 2005, 14:26 pm »

Lo he sacado de esta pagina, aqui tienes muchos codigos utiles:
http://www.elhacker.net/trucosvisual.htm

Imprimir un RichTextBox tal y como se ve:
Imprimir un RichTextBox con su formato original.
Código:
Private Sub Command1_Click()
On Error GoTo ErrorDeImpresion
Printer.Print ""
RichTextBox1.SelPrint Printer.hDC
Printer.EndDoc
Exit Sub
ErrorDeImpresion:
Exit Sub
End Sub

Otra forma:

Código:
En el Formulario [Form1 por defecto] :
Private Sub Form_Load()
     Dim LineWidth As Long
     Me.Caption = "Rich Text Box Ejemplo de Impresion"
     Command1.Move 10, 10, 600, 380
     Command1.Caption = "&Imprimir"
     RichTextBox1.SelFontName = "Verdana, Tahoma, Arial"
     RichTextBox1.SelFontSize = 10
     LineWidth = WYSIWYG_RTF(RichTextBox1, 1440, 1440)
     Me.Width = LineWidth + 200
End Sub

Private Sub Form_Resize()
     RichTextBox1.Move 100, 500, Me.ScaleWidth - 200, Me.ScaleHeight - 600
End Sub

Private Sub Command1_Click()
     PrintRTF RichTextBox1, 1440, 1440, 1440, 1440
End Sub

Crear un módulo y escribir:

Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Type CharRange
cpMin As Long
cpMax As Long
End Type

Private Type FormatRange
hdc As Long
hdcTarget As Long
rc As Rect
rcPage As Rect
chrg As CharRange
End Type

Private Const WM_USER As Long = &H400
Private Const EM_FORMATRANGE As Long = WM_USER + 57
Private Const EM_SETTARGETDEVICE As Long = WM_USER + 72
Private Const PHYSICALOFFSETX As Long = 112
Private Const PHYSICALOFFSETY As Long = 113
Private Declare Function GetDeviceCaps Lib "gdi32" ( _
ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Declare Function SendMessage Lib "USER32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal msg As Long, ByVal wp As Long, lp As Any) As Long
Private Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" _
(ByVal lpDriverName As String, ByVal lpDeviceName As String, _
ByVal lpOutput As Long, ByVal lpInitData As Long) As Long

Public Function WYSIWYG_RTF(RTF As RichTextBox, LeftMarginWidth As Long, _
RightMarginWidth As Long) As Long
Dim LeftOffset As Long, LeftMargin As Long, RightMargin As Long
Dim LineWidth As Long
Dim PrinterhDC As Long
Dim r As Long
Printer.Print Space(1)
Printer.ScaleMode = vbTwips
LeftOffset = Printer.ScaleX(GetDeviceCaps(Printer.hdc, _
PHYSICALOFFSETX), vbPixels, vbTwips)
LeftMargin = LeftMarginWidth - LeftOffset
RightMargin = (Printer.Width - RightMarginWidth) - LeftOffset
LineWidth = RightMargin - LeftMargin
PrinterhDC = CreateDC(Printer.DriverName, Printer.DeviceName, 0, 0)
r = SendMessage(RTF.hWnd, EM_SETTARGETDEVICE, PrinterhDC, _
ByVal LineWidth)
Printer.KillDoc
WYSIWYG_RTF = LineWidth
End Function

Public Sub PrintRTF(RTF As RichTextBox, LeftMarginWidth As Long, _
TopMarginHeight, RightMarginWidth, BottomMarginHeight)
Dim LeftOffset As Long, TopOffset As Long
Dim LeftMargin As Long, TopMargin As Long
Dim RightMargin As Long, BottomMargin As Long
Dim fr As FormatRange
Dim rcDrawTo As Rect
Dim rcPage As Rect
Dim TextLength As Long
Dim NextCharPosition As Long
Dim r As Long
Printer.Print Space(1)
Printer.ScaleMode = vbTwips
LeftOffset = Printer.ScaleX(GetDeviceCaps(Printer.hdc, _
PHYSICALOFFSETX), vbPixels, vbTwips)
TopOffset = Printer.ScaleY(GetDeviceCaps(Printer.hdc, _
PHYSICALOFFSETY), vbPixels, vbTwips)
LeftMargin = LeftMarginWidth - LeftOffset
TopMargin = TopMarginHeight - TopOffset
RightMargin = (Printer.Width - RightMarginWidth) - LeftOffset
BottomMargin = (Printer.Height - BottomMarginHeight) - TopOffset
rcPage.Left = 0
rcPage.Top = 0
rcPage.Right = Printer.ScaleWidth
rcPage.Bottom = Printer.ScaleHeight
rcDrawTo.Left = LeftMargin
rcDrawTo.Top = TopMargin
rcDrawTo.Right = RightMargin
rcDrawTo.Bottom = BottomMargin
fr.hdc = Printer.hdc
fr.hdcTarget = Printer.hdc
fr.rc = rcDrawTo
fr.rcPage = rcPage
fr.chrg.cpMin = 0
fr.chrg.cpMax = -1
TextLength = Len(RTF.Text)
Do
NextCharPosition = SendMessage(RTF.hWnd, EM_FORMATRANGE, True, fr)
If NextCharPosition >= TextLength Then Exit Do
fr.chrg.cpMin = NextCharPosition
Printer.NewPage
Printer.Print Space(1)
fr.hDC = Printer.hDC
fr.hDCTarget = Printer.hDC
Loop
Printer.EndDoc
r = SendMessage(RTF.hWnd, EM_FORMATRANGE, False, ByVal CLng(0))
End Sub

Salu2


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Facturas Movistar.
Foro Libre
B€T€B€ 4 2,987 Último mensaje 17 Enero 2013, 18:30 pm
por B€T€B€
Los operadores deben dejar de cobrar las facturas en papel
Noticias
wolfbcn 1 1,306 Último mensaje 13 Junio 2014, 18:48 pm
por crazykenny
Solución a empresa de cobro que llama por facturas de ONO pagadas
Foro Libre
ccrunch 1 2,005 Último mensaje 31 Julio 2014, 00:09 am
por #!drvy
Cuidado con los cobros ocultos en las facturas de las teleoperadoras
Noticias
wolfbcn 1 1,447 Último mensaje 10 Junio 2015, 20:56 pm
por B€T€B€
Japón permitirá pagar facturas de servicios en bitcoin
Noticias
wolfbcn 0 1,127 Último mensaje 26 Septiembre 2016, 21:08 pm
por wolfbcn
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines