Red de conocimiento informático - Problemas con los teléfonos móviles - ¿Cómo hacer informes e imprimir en VB?

¿Cómo hacer informes e imprimir en VB?

Este es un ejemplo que escribí. Ddh se usa para consultas. Es posible que no lo necesite. Si hay muchos datos, puede considerar la paginación.

Llame:

llame a caigoudd. (impresora, " 0001") 'Imprimir

O puedes usar el marco de la imagen para mostrar

llamar a caigoudd( imagen1, "0001") 'Mostrar

Sub CaiGoudd(Obj As Object, ByVal Ddh As String) 'Imprimir orden de compra

Dim Shang As Integer, Zhuo As Integer 'Depósito

Dim Cangmin As String, Addr As String, Tel Como cadena, fax como cadena

Dim Hen como simple, Su como simple, Hh como simple, Hh1 como simple, Beisu como simple, Ss como simple, mm como simple

Dim Gongfa Como cadena

Dim i como entero, nn como entero, Rsnum como entero

Dim Rs como nuevo ADODB.Open cnStr

sqlStr = "select * from cgjl donde el número de pedido es como '" & Ddh & "'"

Rs.Open sqlStr, Cn, adOpenStatic, adLockReadOnly

If Rs.EOF Then

MsgBox " El número de pedido no existe, ¡por favor avise bien!" , "Nota"

Rs.Open sqlStr, Cn, adOpenStatic, adLockReadOnly

Si Rs.EOF Entonces

MsgBox "El número de pedido no existe, ¡por favor avise bien!, "Atención"

Rs.Close

Cn.Close

Salir Sub

Fin Si

Rsnum = Rs.RecordCount

Si Rsnum > 6 Entonces

MsgBox "Si los artículos de compra son más de 6 , utilice números de pedido diferentes.

, "Nota"

Rs.Close

Cn.Close

Salir Sub

Fin si

sqlStr = "seleccione * de gfxx donde el nombre corto del proveedor como '" & Rs.Fields("Nombre del proveedor") & Rs., "Nota"

Rs.Close

RS1.Close

Cn.Close

Salir Sub

Finalizar si

Ddh = "NO: " & Ddh

Cangmin = "Electrical Appliance Co.p> Dirección = "Provincia de Zhejiang"

Teléfono = "22222222222"

Fax = "22222222222"

Usar Obj

.ScaleMode = 6 'La unidad de medida es milímetros

mm = .ScaleWidth / 210 '210 es el ancho del papel A4 y milímetros es el ancho de la pantalla ScaleWidth / 210 '210 es el ancho del papel A4 El ancho en milímetros es el multiplicador de la pantalla

shang = 25 * mm

zhuo = 15 * mm

nn =. 12 * mm

Norte = (Obj.ScaleWidth - 2 * Zhuo) / nn

.DrawWidth = IIf(TypeName (Obj) = "Impresora", 7, 1) 'Línea Ancho

.FontName = "Italic_GB2312"

.FontSize = 20 * mm

'Imprimir encabezado

Hen = .ScaleWidth

Su = .ScaleHeight

.CurrentX = (.ScaleWidth - .TextWidth(Cangmin)) / 2 'Centrado

.

.CurrentX = (.ScaleWidth - . TextWidth(Cangmin)) 'Centro

.CurrentY = Shang

Obj./ 2

.CurrentY = .CurrentY + 3 * mm

Obj.Print "PurchaseOrder"

.FontName = "宋体"

.FontSize = 14 * mm

.CurrentY = .CurrentY + 3 * mm

.CurrentX = Zhuo

Obj.Print " RHF7.4-07A";

.CurrentX = Gallina - .TextWidth( Ddh) - Zhuo - 3 * mm

Obj.Print " RHF7.4-07A";

.Print Ddh

'Dibujar la mesa

Hh = Zhuo' Coordenadas de la esquina superior izquierda de la tabla

Ss = .CurrentY + 3*mm

Para i = 0 A 9

Obj.Line (Hh, Ss + i * nn) - (Hen - Zhuo, Ss + i * nn) 'Línea horizontal.

Línea (Hh + 7 * nn, Ss + 2 * nn)-(Hh + 7 * nn, Ss + 9 * nn)

Obj.Línea (Hh + 8 * nn, Ss + 2 * nn )-(Hh + 8 * nn, Ss + 9 * nn)

Línea Obj. (Hh + 9.5 * nn, Ss + 2 * nn)

Línea Obj. (Hh + 9.Línea (Gallina/2, Ss + 12,5 * nn) - (Gallina/2, Ss + 18 * nn)

'Rellena los datos

Hh1 = (nn - . TextHeight("suministro"))/ 2

.CurrentX = Hh + (3.5 * nn - .TextWidth("unidad de suministro"))/ 2

.CurrentY = Ss + Hh1

Obj.Print "Unidad proveedora";

.CurrentX = Hh + 3.5 * nn + ((Beisu - 3.5) * nn - .TextWidth(RS1.Fields(" Nombre completo del proveedor") & ""))/ 2

Obj.Print RS1.Fields("Nombre completo del proveedor") & ""

.CurrentX = Hh + (3.5 * nn - .TextWidth("Número de fax"))

.CurrentY = Ss + nn + Hh1

Obj.Print "Número de fax";

.CurrentX = Hh + 3.5 * nn + ((Beisu - 3.5) * nn - .TextWidth(RS1.Fields("Fax") & ""))/ 2

Obj.Print RS1.Fields("Fax " &""")

.CurrentX = Hh + (nn - .TextWidth("Número de serie"))/ 2

.CurrentY = Ss + 2 * nn + Hh1< / p>

Obj.Print "Número de serie";

."Nombre del artículo")/ 2

Obj.Print "Nombre del artículo";

.CurrentX = Hh + 3.5 * nn + (3.5 * nn - .TextWidth("Número de modelo"))/ 2

Obj.Print "Número de modelo";

.CurrentX = Hh + 7 * nn + (nn - .nn + (nn - .TextWidth("Unidades"))/ 2

Obj.Print "Unidades";

.CurrentX = Hh + 8 * nn + (1.5 * nn - .TextWidth("Cantidad"))/ 2

Obj.Print "Cantidad";

.CurrentX = Hh + 9.5 * nn + ( 2 * nn - .TextWidth("Fecha de Entrega"))/ 2

Obj.Print "Fecha de Entrega";

.CurrentX = Hh + 11.5 * nn + (( Beisu - 11.5)*n

n - .TextWidth("Notas"))/ 2

.)/ 2

Obj.Imprimir "Notas"

.FontSize = 12 * mm

Hh1 = (nn - .TextHeight("For"))/ 2

Para i = 1 To Rsnum

.CurrentX = Hh + (nn - . TextWidth(Format(i)))/ 2

.CurrentY = Ss + (2 + i) * nn + Hh1

Obj.Print Format(i);

.CurrentX = Hh + nn + (2.5 * nn - .Fields("Nombre del producto"))/ 2

Obj.Print Rs.Fields("Nombre del producto");

.CurrentX = Hh + 3.5 * nn + (3.5 * nn - .TextWidth(Rs.Fields("Especificación")))/ Print Rs.Fields("Modelo de especificación");

. CurrentX = Hh + 7 * nn + (nn - .TextWidth(Rs.Fields("Units")))/ 2

Obj. = Hh + 8 * nn + (1.5 * nn - .TextWidth( Format(Rs.Fields("Cantidad de compra" ))))))/ 2

Obj.Print Format(Rs.Fields("Cantidad de compra"));

.CurrentX = Hh + 9.5 * nn + (2 * nn - .TextWidth(Rs.Fields("Fecha de entrega")))/ 2

Obj.Print Rs.Fields("Fecha de entrega"); p>

.CurrentX = Hh + 11.5 * nn + ((Beisu - 11.5) * nn - .TextWidth(Rs.Fields("Observaciones"))/ 2

Obj.Print Rs .Fields ("Observaciones")

Rs.MoveNext

Siguiente

Rs.Close

RS1.Close

Cn.Close

.CurrentY = Ss + 9 * nn

Obj.Print

.CurrentX = Hh + 3 * mm

Obj.Print "Nota:"

Obj.Print "1. Las reclamaciones de los clientes debido a problemas de calidad del producto del proveedor y las pérdidas económicas causadas por la falta de entrega a tiempo correrán a cargo del proveedor."

Obj.Print

.CurrentX = Hh + 3 * mm

Obj.Print "2. Después de recibir la orden de compra, séllela y fírmela Devuelva rápidamente, si no hay respuesta dentro de dos días, se considerará como la fecha de entrega predeterminada.

"

Obj.Imprimir

.CurrentX = Hh + 3 * mm

Obj.Imprimir "3. FontSize = 14 * mm

.CurrentY = Ss + 12.5 * nn

Obj.p>

.CurrentX = Hh + 3 * mm

Obj.Print "Unidades del lado de la demanda (capítulos)";

.CurrentX = .ScaleWidth / 2 + 3 * mm

Obj.Print "Unidades del lado de la oferta ( capítulos) "

Obj.Print "Unidad del lado de la demanda (capítulo)";

.CurrentY = Ss + 12,5 * nn

.> .CurrentX = Hh + 3 * mm

Obj.Print " "; Cangmin

.CurrentY = .CurrentY + 0.5 * .TextHeight("A")

.FontSize = 12 * mm

Obj.Print "Dirección:"; Izquierda(Dirección, 11)

.CurrentY = .CurrentY + 0.5 * .TextHeight("A")

.CurrentX = Hh + 3 * mm

Obj.Print "; Derecha(Dirección, 8)

.CurrentY = .CurrentY + 0.5 * .TextHeight("A ")

.5 * .TextHeight("A")

.CurrentX = Hh + 3 * mm

Obj.CurrentY = .CurrentY + 0.5 * .TextHeight( "A")

.CurrentX = Hh + 3 * mm

Obj.Imprimir "Fax:"; + 0.5 * . ("A")

.CurrentX = Hh + 3 * mm

Obj.Imprimir "Contacto:"

Obj.dd día " )

Obj.Print Format(Fecha, "aaaa año mm mes dd día");

.CurrentX = .ScaleWidth - Zhuo - .TextWidth("año mes día ")

Obj.TypeName(Obj) = "Impresora" Luego

.EndDoc

Finalizar si

Terminar con

Fin Sub