Visual Basic - Ayudita

Life is soft - evento anual de software empresarial
 
Vista:

Ayudita

Publicado por ADRIAN (1 intervención) el 13/03/2013 23:19:47
necesito ayuda en un formato de cotizaciones, algunos de mis clientes tienen por defecto una lista de precios de acuerdo a sus compras pero necesito que en las cotizaciones salga el precio base para que puedan comparar sus descuentos, me podrian ayudar a modificar ese reporte??….


Sub Main()
Call imprimirCotizacion
'Call imprimirCotizacion
'Call imprimirCotizacion
End Sub



Sub imprimirCotizacion()
'Formato de cotización de Bollhoff
'Autor: Alfonso Ramos

Dim rstEncabezado 'RecordSet de los datos generales
Dim rstPartidas 'RecordSet de las partidas de la cotización
Dim rstCliente 'RecordSet de los datos del cliente

'Creamos el RecordSet del encabezado de la cotización
Set rstEncabezado = Rst("SELECT * FROM cotiza WHERE cotizacion = " & prn.Documento, Ambiente.Connection)

'Verificamos que la cotización que se desea imprimir exista
If rstEncabezado.EOF Then
MsgBox "La cotización seleccionada no existe", vbInformation
Exit Sub
End If

'Creamos el RecordSet de las partidas que componen la cotización
Set rstPartidas = Rst("SELECT * FROM cotizpar WHERE cotizacion = " & rstEncabezado.Fields("cotizacion"), Ambiente.Connection)

'Creamos el RecordSet con los datos del cliente
Set rstCliente = Rst("SELECT * FROM clients WHERE cliente = '" & rstEncabezado.Fields("cliente") & "'", Ambiente.Connection)


'Iniciamos la impresión del encabezado de la forma
IniciaDocumento

'Picture Ambiente.Path & "\Images\bol1.jpg", Col(4.4), Row(03), Col(15), Row(1.1)
'Picture Ambiente.Path & "\Images\bol2.jpg", Col(61), Row(02), Col(5), Row(3)

'EstableceFuente "Arial", 8
'FontItalic True
'Say Prn.Row(6.7), Col(58), "Elementos de fijación y ensamble"
'FontItalic False

EstableceFuente "Arial", 12
Say Prn.Row(08), Col(60), "Cotización No. " & rstEncabezado.Fields("no_cotiz")

EstableceFuente "Arial", 12
Say Prn.Row(09), Col(60), " Pedido No. " & rstEncabezado.Fields("no_ped")

EstableceFuente "Arial", 12
Say Prn.Row(5.5), Col(07), Ambiente.Empresa

FontBold False
EstableceFuente "Arial", 10
Say Prn.Row(07), Col(07), Ambiente.Direccion1
Say Prn.Row(08), Col(07), Ambiente.Direccion2 & " C.P." & Ambiente.CP
Say Prn.Row(09), Col(07), Ambiente.Telefonos
Say Prn.Row(10), Col(07), Ambiente.Email

If rstEncabezado.Fields("estado") = "CO" Then
strEstado = "SOLAMENTE COTIZADO"
End If

If rstEncabezado.Fields("estado") = "PE" Then
strEstado = "PEDIDO FORMAL"
End If

Linea Col(06), Row(11.5), Col(77), Row(11.5)
Linea Col(06), Row(11.6), Col(77), Row(11.6)

'Columna inicial,Renglón inicial,Ancho Columna,Ancho Renglón
FontBold True
Box 6.2, 2.1, 2, 1
Say Row(13), Col(59), "Fecha: "
FontBold False
Say Row(13), Col(64), rstEncabezado.Fields("f_emision")
FontBold True

EstableceFuente "Arial", 9
nLineas = CuantasLineas( rstEncabezado.Fields("observ") )
nRenglon = 15
For n = 1 to nLineas
Say Row(nRenglon), Col(59), strLinea(Trim(rstEncabezado.Fields("observ")),n)
nRenglon = nRenglon + 1
Next

Box 0.6, 2.1, 5.5, 1
FontBold True
Say Row(13), Col(07), "Estatus: "
FontBold False
Say Row(13), Col(15), strEstado
FontBold True
Say Row(14), Col(07), "Cliente: "
FontBold False
Say Row(14), Col(15), rstEncabezado.Fields("Cliente") & " " & rstCliente.Fields("Nombre")
FontBold True
Say Row(15), Col(07), "Calle: "
FontBold False
Say Row(15), Col(15), rstCliente.Fields("Calle")
FontBold True
Say Row(16), Col(07), "Colonia: "
FontBold False
Say Row(16), Col(15), rstCliente.Fields("Colonia")
FontBold True
Say Row(17), Col(07), "Población: "
FontBold False
Say Row(17), Col(15), Trim(rstCliente.Fields("Pobla")) & " " & Trim(rstCliente.Fields("Estado")) & " " & Trim(rstCliente.Fields("Pais"))

Box 0.6, 3.3, 7.6, 6.5
FontBold True
Say Row(20), Col(08), "Ctd."
Say Row(20), Col(14), "Descripción"
Say Row(20), Col(55), "Precio"
Say Row(20), Col(61), "P.Especial"
Say Row(20), Col(70), "Total"
FontBold False

Linea Col(06), Row(21.5), Col(77.1), Row(21.5)
Linea Col(13), Row(19.8), Col(13), Row(58.8)
Linea Col(54), Row(19.8), Col(54), Row(58.8)
Linea Col(60), Row(19.8), Col(60), Row(58.8)
Linea Col(67), Row(19.8), Col(67), Row(58.8)

nRenglon = 22

EstableceFuente "Courier New", 8

While Not rstPartidas.EOF

' No congelamos el sistema
Ev = DoEvents

Say Row(nRenglon), Col(07), PadL(Formato(rstPartidas.Fields("Cantidad"),"#,###,###"),7)
'Say Row(nRenglon), Col(07), Trim(rstPartidas.Fields("Articulo"))
Say Row(nRenglon), Col(59), PadL(Formato(rstPartidas.Fields("Precio"), "###,###,###.00"),12)
'


' Calculamos el importe
ImportePartida = rstPartidas.Fields("Precio") * rstPartidas.Fields("Cantidad")
ImportePartida = ImportePartida - ( ImportePartida * ( rstPartidas.Fields("Descuento") / 100 ) )

Say Row(nRenglon), Col(69), PadL(Formato(ImportePartida,"$###,###,###.00"),12)

' Contamos las lineas que tiene el campo memo
' Imprimimos las lineas al final para poder incrementar los renglones
' sin afectar a las partidas
nLineas = CuantasLineas( rstPartidas.Fields("Observ") )

' Imprimimos cada una de ellas
For n = 1 to nLineas
Say Row(nRenglon), Col(14), strLinea( Trim(rstPartidas.Fields("Observ")), n)
nRenglon = nRenglon + 1
Next

' Si no existen comentarios no disminuimos en un renglon.
if nLineas > 0 Then
nRenglon = nRenglon - 1
end if

rstPartidas.MoveNext
nRenglon = nRenglon + 1

Wend

EstableceFuente "Arial", 8

' Imprimimos las observaciones de la operacion
nLineas = CuantasLineas( rstEncabezado.Fields("Observ") )

' Imprimimos cada una de ellas
For n = 1 to nLineas
nRenglon = nRenglon + 1
Say Row(nRenglon), Col(19), strLinea( rstEncabezado.Fields("Observ"), n)
Next

' Imprimimos la leyenda en letra y los totales
ImporteTotal = rstEncabezado.fields("Importe")
Impuesto = rstEncabezado.fields("Impuesto")

Set rstMoneda = rst("SELECT * FROM monedas WHERE moneda = '" & rstEncabezado.fields("Moneda") & "'", Ambiente.Connection )

EstableceFuente "Courier New", 9
Say Row(55.5), Col(60), "Importe: "
Say Row(55.5), Col(68), PadL(Formato(ImporteTotal,"$###,###,###.00"),12)
Say Row(56.5), Col(60), "Impuesto: "
Say Row(56.5), Col(68), PadL(Formato(Impuesto,"###,###,###.00"),12)
Say Row(57.5), Col(60), "Total: "
Say Row(57.5), Col(68), PadL(Formato(ImporteTotal + Impuesto,"$###,###,###.00"),12)
EstableceFuente "Arial", 8
strLetra = Letra(ImporteTotal + Impuesto, rstMoneda.fields("Descrip"), True,Trim(rstMoneda.fields("Nombre")))
Say Row(59), Col(13), "***" & Trim(strLetra) & "***"

Linea Col(06), Row(61), Col(77), Row(61)
Linea Col(06), Row(61.1), Col(77), Row(61.1)
EstableceFuente "Arial", 10
FontItalic True
Say Row(61.4), Col(30), "Gracias por la oportunidad de servirle"
FontItalic False

' Se da por terminado el documento
FinDocumento

End Sub
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder