Publicado el Dejar un comentario

Recibo de efectivo

flujoEn esta ocasión mostramos el código del formato Recibo, el cual se imprime al tener un ingreso de efectivo por conceptos de cobranza tanto en punto de venta como en el asistente de cobranza. En algunas versiones se llama Abono y en las anteriores se llama Recibo.
'mybusiness pos 2011
Sub Main()
'mymessage "imprimir"
'PlaySound "c:\desarrollo\ScorpionMyBusiness.wav"
'MyMessage "Gracias por su pago"
ImprimeEnHojaCarta
'ImprimeEnTicket

End Sub

Sub ImprimeEnTicket()
Dim c

' Creamos el recordSet del encabezado de la venta
Set rstRecibo = CreaRecordSet("SELECT * FROM caja WHERE abono = " & prn.Documento, Ambiente.Connection )
' Traemos los datos del cliente
Set rstClientes = CreaRecordSet( "SELECT * FROM clients WHERE cliente = '" & rstRecibo("cliente") & "'", Ambiente.Connection )
' Traemos la moneda con la que se realizo el movimiento
Set rstMoneda = CreaRecordSet( "SELECT * FROM monedas WHERE moneda = '" & rstRecibo("moneda") & "'", Ambiente.Connection )

'Esto abre el cajon de dinero
if Ambiente.rstEstacion("Cajon") <> 0 Then
c = c & Chr(27) & Chr(112) & Chr(48) & Chr(20) & Chr(20)
c = c & Chr(7)
' Sansung de inyección
' cSalida = cSalida & Chr(27) & Chr(112) & Chr(48) & Chr(49)
end if

c = c & Ambiente.Empresa & vbCrLf
c = c & Ambiente.Direccion1 & vbCrLf
c = c & Ambiente.Direccion2 & vbCrLf
c = c & Ambiente.Telefonos & vbCrLf
c = c & vbCrLf
c = c & vbCrLf
c = c & vbCrLf
c = c & "COMPROBANTE DE INGRESOS" & vbCrLf
c = c & "CLIENTE: " & rstClientes("nombre") & vbCrLf
c = c & "DIRECCION: " & rstClientes("calle") & vbCrLf
c = c & rstClientes("colonia") & vbCrLf
c = c & rstClientes("pobla") & vbCrLf
c = c & rstClientes("pais") & vbCrLf
c = c & "C.P.: " & rstClientes("cp") & vbCrLf
c = c & vbCrLf
c = c & "Fecha: " & Formato( rstRecibo("fecha_dep"), "Long Date" ) & vbCrLf
c = c & "Usuario: " & rstRecibo("usuario") & " " & Ambiente.Estacion & " " & rstRecibo("usuhora") & vbCrLf
c = c & vbCrLf
c = c & "IMPORTE " & Formato( rstRecibo("importe"), "##,##0.00" ) & vbCrLf
c = c & Letra( rstRecibo("Importe"), Trim(rstMoneda("Descrip")), True,rstMoneda("Nombre") )
c = c & vbCrLf
c = c & vbCrLf
c = c & vbCrLf
c = c & " Autorizo " & vbCrLf
c = c & " ________________________" & vbCrLf
c = c & vbCrLf
c = c & vbCrLf
c = c & vbCrLf
c = c & vbCrLf

if Ambiente.rstEstacion("ticketcorte") <> 0 Then
c = c & Chr(27) & Chr(105)
end if

if Ambiente.rstEstacion("ticket") <> 0 Then
if clAt( "LPT", Ambiente.rstEstacion("pticket") ) > 0 Then
Out Trim(Ambiente.rstEstacion("pticket")), c
else
if Ambiente.Ticket.PortOpen Then
Ambiente.Ticket.Output = c
end if
end if
End if

End Sub

Sub ImprimeEnHojaCarta()
' Formato de recibos
' Por() Daniel
Dim rstRecibo ' Los datos del cobro
Dim rstCliente ' Los datos del cliente
Dim rstCobranza ' El dato de cobranza
Dim rstCobdet ' Detalle de cobranza

' Creamos el recordSet del encabezado de la venta
Set rstRecibo = Rst("SELECT * FROM caja WHERE abono = " & prn.Documento, Ambiente.Connection )

If rstRecibo.EOF Then
MsgBox "El movimiento no existe",vbInformation
Exit Sub
end if

' Traemos los datos del cliente
Set rstCliente = Rst("SELECT * FROM clients WHERE cliente = '" & rstRecibo.fields("CLIENTE") & "'",Ambiente.Connection )

' Traemos los datos de cobranza
Set rstCobdet = Rst( "SELECT * FROM cobdet WHERE abono = " & rstRecibo.fields( "Abono" ), Ambiente.Connection )

if Not rstCobdet.EOF Then
' Traemos los datos de cobranza
Set rstCobranza = Rst( "SELECT * FROM cobranza WHERE cobranza = " & rstCobdet.fields( "Cobranza" ), Ambiente.Connection )
end if

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

EstableceFuente "Courier New", 20
FontBold True

' Imprimimos el Nombre de la empres
FilledBox Col(3),0.2,Col(77),0.33, RGB( 200, 200, 200 )
Say Row(1),Col(3), Ambiente.Empresa

EstableceFuente "Courier New", 12
FontBold True

Say Row(3),Col(32), "RECIBO DE INGRESOS"

EstableceFuente "Courier New", 10
FontBold False

if Not rstCliente.EOF Then
Linea Col(3), Row(4), Col(74), Row(4)
Say Row(5),Col(3), "Fecha: " & rstRecibo.fields("Fecha_dep")
Say Row(6),Col(3), rstCliente.fields("Nombre")
Say Row(7),Col(3), rstCliente.fields("Calle") & " " & rstCliente.fields("Colonia")
Say Row(8),Col(3), rstCliente.fields("Pobla") & " " & rstCliente.fields("Estado") & " " & rstCliente.fields("Pais")
Say Row(9),Col(3), rstCliente.fields("RFC")

if Not rstCobdet.EOF Then
Say Row(10), Col(3), "AFECTA DOCUMENTO: " & rstCobranza.fields("TIPO_DOC" ) & " " & rstCobranza.fields("No_referen" )
Say Row(11), Col(3), "SALDO : " & Formato( rstCobranza.fields("SALDO" ), "###,###,###.00" )
end if
end if

Linea Col(3), Row(12), Col(74), Row(12)

Say Row(13),Col(3), "Pago No. " & rstRecibo.fields("Abono")
Say Row(14),Col(3), "Documento de pago: " & rstRecibo.fields("Tipo_doc") & " " & rstRecibo.fields("No_referen")
Say Row(15),Col(3), "Pago con : " & rstRecibo.fields("Moneda") & " " & Formato(rstRecibo.fields("Pago"),Ambiente.FDinero)
Say Row(16),Col(3), "Importe Neto : " & rstRecibo.fields("Moneda") & " " & Formato(rstRecibo.fields("Importe"),Ambiente.FDinero)
Say Row(17),Col(3), "Cambio : " & rstRecibo.fields("Moneda") & " " & Formato(rstRecibo.fields("Pago") - rstRecibo.fields("Importe"),Ambiente.FDinero)

nRenglon = 18

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

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

nRenglon = nRenglon + 1
Linea Col(3), Row(nRenglon), Col(74), Row(nRenglon)

FinDocumento

End Sub