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

Publicado el — Dejar un comentario

Ticket con descuentos

Este es el código fuente del formato “Ticket con descuentos”

' Mybusiness POS v. 2011
Sub Main()

if Ambiente.rstEstacion("torreta") <> 0 Then
if clAt( "LPT", Ambiente.rstEstacion("ptorreta") ) > 0 Then
Out Trim(Ambiente.rstEstacion("ptorreta")), Chr( 12 ) & "Total: $" & Formato( Val2( txtFields(4) ), "###,###.00" )
else
On Error resume next
Ambiente.torreta.PortOpen = True
if Ambiente.torreta.PortOpen Then
Ambiente.Torreta.OutPut = Chr( 12 ) & "Total: $" & Formato( Val2( txtFields(4) ), "###,###.00" )
end if
end if
end if

If Ambiente.rstEstacion("ventasportelefono") <> 0 Then

cSalida = ""

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

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

Exit Sub
End If

'If MsgBox( "Desea imprimir el ticket", vbQuestion + vbYesNo + vbDefaultButton2 ) = vbNo Then
' Exit Sub
'End If

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

' Verificamos que la venta que se desea imprimir exista
if rstEncabezado.EOF Then
MsgBox "No existe la venta seleccionada",vbInformation
Exit Sub
end if

' Creamos el recordSet de las partidas que componen la venta
Set rstPartidas = Rst("SELECT partvta.iespecial, partvta.articulo, prods.precio1,prods.descrip, partvta.precio, partvta.cantidad, partvta.descuento, partvta.impuesto, partvta.preciobase, partvta.prdescrip FROM partvta INNER JOIN prods ON prods.articulo = partvta.articulo WHERE venta =" & rstEncabezado.fields("Venta"), Ambiente.Connection )

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

' Traemos los datos de cobranza si es que existe
Set rstCobranza = Rst( "SELECT * FROM cobranza WHERE venta = " & rstEncabezado("venta"), Ambiente.Connection )

cSalida = ""

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

Set rstTextTicket = CreaRecordSet( "SELECT * FROM tickettext", Ambiente.Connection )

If rstTextTicket.EOF Then
cSalida = cSalida & "" & Ambiente.Empresa & Chr(13) & Chr(10)
cSalida = cSalida & "" & Trim( Ambiente.Direccion1 ) & Chr(13) & Chr(10)
cSalida = cSalida & "" & Trim( Ambiente.Direccion2 ) & Chr(13) & Chr(10)
cSalida = cSalida & "" & Trim( Ambiente.Telefonos ) & Chr(13) & Chr(10)
Else
cSalida = cSalida & rstTextTicket("textheader")
End If

cSalida = cSalida & "" & Trim( rstEncabezado("Usuario") ) & " " & Trim( Ambiente.Estacion ) & " Ticket: " & rstEncabezado("No_referen") & Chr(13) & Chr(10)
cSalida = cSalida & Formato( rstEncabezado("f_emision"),"dd-MM-yyyy" ) & " Hora: " & rstEncabezado("usuHora") & Chr(13) & Chr(10)
cSalida = cSalida & Trim( rstCliente("cliente") ) & " " & Trim( rstCliente("Nombre") ) & Chr(13) & Chr(10)
cSalida = cSalida & Ambiente.rstEstacion("leyendacomodin") & " " & rstEncabezado("comodin") & Chr(13) & Chr(10)
cSalida = cSalida & "Vendedor: " & rstEncabezado("Vend") & Chr(13) & Chr(10)
cSalida = cSalida & "CANT. DESCRIPCION PRECIO IMPORTE" & Chr(13) & Chr(10)

nImporteTotal = 0
nImpuesto = 0
nCantidadTotal = 0
nDescuentoTotal = 0
nImporteOrigen = 0

'PrintText cSalida

If Ambiente.Tag <> "HTML" Then

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

cSalida = ""

End If

While Not rstPartidas.EOF

nPrecio = rstPartidas("Precio") * ( 1 - (rstPartidas("Descuento")/100) ) * (1 + ( rstPartidas("impuesto") / 100 ) )
nPrecioBase = Round( rstPartidas("PrecioBase") * (1 + ( rstPartidas("impuesto") / 100 ) ), 2)
nDescuento = (nPrecioBase - nPrecio) * rstPartidas("Cantidad")

If nPrecioBase > 0 Then
nDescPor = ( nPrecio / nPrecioBase ) * 100
Else
nDescPor = 0
End If

nDescuentoTotal = nDescuentoTotal + nDescuento
nImporte = nPrecio * rstPartidas("Cantidad")

nCantidad = PadL(Formato( rstPartidas("cantidad"), "##,##0.00" ),3)

cDescrip = Mid( rstPartidas("Descrip"), 1, 16 )
nCantidadTotal = nCantidadTotal + rstPartidas("cantidad")

nImporteTotal = nImporteTotal + nImporte
nImpuesto = nImpuesto + ( nImporteTotal * ( rstPartidas("impuesto") / 100 ) )

nPrecio = 0
nIEspecial = rstPartidas("Precio") * (Val2(rstPartidas("iespecial")) / 100)
nIVa = rstPartidas("Precio") * (rstPartidas("impuesto") / 100)
nPrecio = rstPartidas("Precio") + nIEspecial + nIVa

cPrecio = PadL(Trim(Formato( nPrecio, Ambiente.FDinero )),8)
cImporte = PadL(Trim(Formato( Round( nPrecio, 2) * rstPartidas("cantidad") * (1 - (rstPartidas("descuento") / 100)), Ambiente.FDinero )),8)
nPrecioOrigen = Round( rstPartidas("PrecioBase") * (1 + ( rstPartidas("impuesto") / 100 )),2) * rstPartidas("cantidad")
nImporteOrigen = nImporteOrigen + nPrecioOrigen

strSalida = PadL(Formato( nCantidad, Ambiente.Formato ),2) & " " & cDescrip & " " & cPrecio & " " & cImporte

'If rstPartidas("Precio1") > rstPartidas("Precio") Then
' nDescuentoPartida = ( rstPartidas("Precio1") - rstPartidas("Precio") ) * nCantidad
' strSalida = strSalida & " Descuento: " & Formato( nDescuentoPartida, "##,##0.00" ) & vbCrLf
'End If

cSalida = cSalida & strSalida & Chr(13) & Chr(10)

If Not clEmpty( cNull( rstPartidas("prdescrip") ) ) Then
cSalida = cSalida & Trim( rstPartidas("prdescrip") ) & vbCrLf
End If

rstPartidas.MoveNext
Wend

'PrintText cSalida

If Ambiente.Tag <> "HTML" Then

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

cSalida = ""

End If

cSalida = cSalida & Chr(13) & Chr(10)
cSalida = cSalida & Chr(13) & Chr(10)

cSalida = cSalida & " Importe: " & PadL(Formato( Val2(rstEncabezado("importe")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)
cSalida = cSalida & " Impuesto: " & PadL(Formato( Val2(rstEncabezado("impuesto")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)

if Val2(rstEncabezado("iespecial")) > 0 Then
cSalida = cSalida & " Impuesto 2%: " & PadL(Formato( Val2(rstEncabezado("iespecial")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)
end if

if nDescuentoTotal > 0 Then
cSalida = cSalida & " Importe: " & PadL(Formato( nImporteOrigen, Ambiente.FDinero ),10) & Chr(13) & Chr(10)
cSalida = cSalida & " Descuento: " & PadL(Formato( nDescuentoTotal, Ambiente.FDinero ),10) & Chr(13) & Chr(10)
end if

cSalida = cSalida & " Importe: " & PadL(Formato( Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("iespecial")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)
cSalida = cSalida & " Redondeo: " & PadL(Formato( Val2(rstEncabezado("Redondeo")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)
cSalida = cSalida & Chr(13) & Chr(10)
cSalida = cSalida & PadL(Formato( nCantidadTotal, "###,###" ),4) & " ----- TOTALES ---- " & PadL(Formato( (Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("iespecial")) + Val2(rstEncabezado("redondeo"))), Ambiente.FDinero ),10) & Chr(13) & Chr(10)

nPagoTotal = Val2(rstEncabezado("Pago1")) + Val2(rstEncabezado("Pago2")) + Val2(rstEncabezado("Pago3"))

if rstEncabezado("Pago1") > 0 Then
cSalida = cSalida & " Pago en " & rstEncabezado("Concepto1") & " " & PadL(Formato( Val2(rstEncabezado("Pago1")), Ambiente.FDinero ),9) & Chr(13) & Chr(10)
end if

if rstEncabezado("Pago2") > 0 Then
cSalida = cSalida & " Pago en " & rstEncabezado("Concepto2") & " " & PadL(Formato( Val2(rstEncabezado("Pago2")), Ambiente.FDinero ),9) & Chr(13) & Chr(10)
end if

if rstEncabezado("Pago3") > 0 Then
cSalida = cSalida & " Pago en " & rstEncabezado("Concepto3") & " " & PadL(Formato( Val2(rstEncabezado("Pago3")), Ambiente.FDinero ),9) & Chr(13) & Chr(10)
end if

Eventos

If rstEncabezado("Comision") > 0 Then
cSalida = cSalida & " Comisión: " & PadL(Formato( Val2(rstEncabezado("comision")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)
End If

nComision = rstEncabezado("comision")

if nPagoTotal < (Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("iespecial")) + Val2(rstEncabezado("redondeo"))) Then cSalida = cSalida & " Credito: " & PadL(Formato( Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("iespecial")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("redondeo")) - nPagoTotal, Ambiente.FDinero ),9) & Chr(13) & Chr(10) else cSalida = cSalida & " Cambio: " & PadL(Formato( nPagoTotal - nComision - Val2(rstEncabezado("impuesto")) - Val2(rstEncabezado("iespecial")) - Val2(rstEncabezado("importe")) - Val2(rstEncabezado("redondeo")), Ambiente.FDinero ),9) & Chr(13) & Chr(10) end if Set rstMoneda = CreaRecordSet( "SELECT * FROM monedas WHERE moneda = '" & rstEncabezado("moneda") & "'", Ambiente.Connection ) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Letra( Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("iespecial")), Trim(rstMoneda("Descrip")), True,rstMoneda("Nombre") ) & Chr(13) & Chr(10) If rstTextTicket.EOF Then cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & "***** GRACIAS POR SU COMPRA *****" & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) Else cSalida = cSalida & rstTextTicket("textend") End If ' Esto manda un corte de papel 'PrintText cSalida if Ambiente.rstEstacion("ticketcorte") <> 0 Then
cSalida = cSalida & Chr(27) & Chr(105)
end if

If Ambiente.Tag = "HTML" Then

Ambiente.Tag = ""

cSalida = Replace( cSalida, Chr(13) & Chr(10), "
" )
cSalida = "

" & cSalida & "
"
CreaHtml "", (cSalida)

Else

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

End If

Dormir 100
Eventos

End Sub

Publicado el — Dejar un comentario

Formato de tickets para credito

' Mybusiness POS v. 2011
Sub Main()
Dim rstVenta

Set rstVenta = CreaRecordSet( _
"SELECT * FROM ventas WHERE venta = " & Documento, Ambiente.Connection )

If rstVenta("cobranza") > 0 Then
ImprimeTicket
ImprimeTicket
Else
ImprimeTicket
End If

End Sub

Sub ImprimeTicket

'If MsgBox( "Desea imprimir el ticket", vbQuestion + vbYesNo + vbDefaultButton2 ) = vbNo Then
' Exit Sub
'End If

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

' Verificamos que la venta que se desea imprimir exista
if rstEncabezado.EOF Then
MsgBox "No existe la venta seleccionada",vbInformation
Exit Sub
end if

' Creamos el recordSet de las partidas que componen la venta
Set rstPartidas = Rst("SELECT partvta.iespecial, partvta.articulo, prods.precio1,prods.descrip, partvta.precio, partvta.cantidad, partvta.descuento, partvta.impuesto, partvta.preciobase, partvta.prdescrip FROM partvta INNER JOIN prods ON prods.articulo = partvta.articulo WHERE venta =" & rstEncabezado.fields("Venta"), Ambiente.Connection )

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

' Traemos los datos de cobranza si es que existe
Set rstCobranza = Rst( "SELECT * FROM cobranza WHERE venta = " & rstEncabezado("venta"), Ambiente.Connection )

cSalida = ""

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

cSalida = cSalida & "" & Ambiente.Empresa & Chr(13) & Chr(10)
cSalida = cSalida & "" & Trim( Ambiente.Direccion1 ) & Chr(13) & Chr(10)
cSalida = cSalida & "" & Trim( Ambiente.Direccion2 ) & Chr(13) & Chr(10)
cSalida = cSalida & "" & Trim( Ambiente.Telefonos ) & Chr(13) & Chr(10)
cSalida = cSalida & "" & Trim( rstEncabezado("Usuario") ) & " " & Trim( Ambiente.Estacion ) & " Ticket: " & rstEncabezado("No_referen") & Chr(13) & Chr(10)

cSalida = cSalida & Formato( rstEncabezado("f_emision"),"dd-MM-yyyy" ) & " Hora: " & rstEncabezado("usuHora") & Chr(13) & Chr(10)
cSalida = cSalida & Trim( rstCliente("cliente") ) & " " & Trim( rstCliente("Nombre") ) & Chr(13) & Chr(10)
cSalida = cSalida & Ambiente.rstEstacion("leyendacomodin") & " " & rstEncabezado("comodin") & Chr(13) & Chr(10)
cSalida = cSalida & "Vendedor: " & rstEncabezado("Vend") & Chr(13) & Chr(10)
cSalida = cSalida & "CANT. DESCRIPCION PRECIO IMPORTE" & Chr(13) & Chr(10)

nImporteTotal = 0
nImpuesto = 0
nCantidadTotal = 0
nDescuentoTotal = 0
nImporteOrigen = 0

'PrintText cSalida

If Ambiente.Tag <> "HTML" Then

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

cSalida = ""

End If

While Not rstPartidas.EOF

nPrecio = rstPartidas("Precio") * ( 1 - (rstPartidas("Descuento")/100) ) * (1 + ( rstPartidas("impuesto") / 100 ) )
nPrecioBase = Round( rstPartidas("PrecioBase") * (1 + ( rstPartidas("impuesto") / 100 ) ), 2)
nDescuento = (nPrecioBase - nPrecio) * rstPartidas("Cantidad")

If nPrecioBase > 0 Then
nDescPor = ( nPrecio / nPrecioBase ) * 100
Else
nDescPor = 0
End If

nDescuentoTotal = nDescuentoTotal + nDescuento
nImporte = nPrecio * rstPartidas("Cantidad")

nCantidad = PadL(Formato( rstPartidas("cantidad"), "##,##0.00" ),3)

cDescrip = Mid( rstPartidas("Descrip"), 1, 16 )
nCantidadTotal = nCantidadTotal + rstPartidas("cantidad")

nImporteTotal = nImporteTotal + nImporte
nImpuesto = nImpuesto + ( nImporteTotal * ( rstPartidas("impuesto") / 100 ) )

nPrecio = 0
nIEspecial = rstPartidas("Precio") * (Val2(rstPartidas("iespecial")) / 100)
nIVa = rstPartidas("Precio") * (rstPartidas("impuesto") / 100)
nPrecio = rstPartidas("Precio") + nIEspecial + nIVa

cPrecio = PadL(Trim(Formato( nPrecio, Ambiente.FDinero )),8)
cImporte = PadL(Trim(Formato( Round( nPrecio, 2) * rstPartidas("cantidad") * (1 - (rstPartidas("descuento") / 100)), Ambiente.FDinero )),8)
nPrecioOrigen = Round( rstPartidas("PrecioBase") * (1 + ( rstPartidas("impuesto") / 100 )),2) * rstPartidas("cantidad")
nImporteOrigen = nImporteOrigen + nPrecioOrigen

strSalida = PadL(Formato( nCantidad, Ambiente.Formato ),2) & " " & cDescrip & " " & cPrecio & " " & cImporte

'If rstPartidas("Precio1") > rstPartidas("Precio") Then
' nDescuentoPartida = ( rstPartidas("Precio1") - rstPartidas("Precio") ) * nCantidad
' strSalida = strSalida & " Descuento: " & Formato( nDescuentoPartida, "##,##0.00" ) & vbCrLf
'End If

cSalida = cSalida & strSalida & Chr(13) & Chr(10)

If Not clEmpty( cNull( rstPartidas("prdescrip") ) ) Then
cSalida = cSalida & Trim( rstPartidas("prdescrip") ) & vbCrLf
End If

rstPartidas.MoveNext
Wend

'PrintText cSalida

If Ambiente.Tag <> "HTML" Then

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

cSalida = ""

End If

cSalida = cSalida & Chr(13) & Chr(10)
cSalida = cSalida & Chr(13) & Chr(10)

cSalida = cSalida & " Importe: " & PadL(Formato( Val2(rstEncabezado("importe")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)
cSalida = cSalida & " Impuesto: " & PadL(Formato( Val2(rstEncabezado("impuesto")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)

if Val2(rstEncabezado("iespecial")) > 0 Then
cSalida = cSalida & " Impuesto 2%: " & PadL(Formato( Val2(rstEncabezado("iespecial")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)
end if

if nDescuentoTotal > 0 Then
cSalida = cSalida & " Importe: " & PadL(Formato( nImporteOrigen, Ambiente.FDinero ),10) & Chr(13) & Chr(10)
cSalida = cSalida & " Descuento: " & PadL(Formato( nDescuentoTotal, Ambiente.FDinero ),10) & Chr(13) & Chr(10)
end if

cSalida = cSalida & " Importe: " & PadL(Formato( Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("iespecial")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)
cSalida = cSalida & " Redondeo: " & PadL(Formato( Val2(rstEncabezado("Redondeo")), Ambiente.FDinero ),10) & Chr(13) & Chr(10)
cSalida = cSalida & Chr(13) & Chr(10)
cSalida = cSalida & PadL(Formato( nCantidadTotal, "###,###" ),4) & " ----- TOTALES ---- " & PadL(Formato( (Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("iespecial")) + Val2(rstEncabezado("redondeo"))), Ambiente.FDinero ),10) & Chr(13) & Chr(10)

nPagoTotal = Val2(rstEncabezado("Pago1")) + Val2(rstEncabezado("Pago2")) + Val2(rstEncabezado("Pago3"))

if rstEncabezado("Pago1") > 0 Then
cSalida = cSalida & " Pago en " & rstEncabezado("Concepto1") & " " & PadL(Formato( Val2(rstEncabezado("Pago1")), Ambiente.FDinero ),9) & Chr(13) & Chr(10)
end if

if rstEncabezado("Pago2") > 0 Then
cSalida = cSalida & " Pago en " & rstEncabezado("Concepto2") & " " & PadL(Formato( Val2(rstEncabezado("Pago2")), Ambiente.FDinero ),9) & Chr(13) & Chr(10)
end if

if rstEncabezado("Pago3") > 0 Then
cSalida = cSalida & " Pago en " & rstEncabezado("Concepto3") & " " & PadL(Formato( Val2(rstEncabezado("Pago3")), Ambiente.FDinero ),9) & Chr(13) & Chr(10)
end if

Eventos

if nPagoTotal < (Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("iespecial")) + Val2(rstEncabezado("redondeo"))) Then cSalida = cSalida & " Credito: " & PadL(Formato( Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("iespecial")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("redondeo")) - nPagoTotal, Ambiente.FDinero ),9) & Chr(13) & Chr(10) cSalida = cSalida & "Debo y pagaré la cantidad de: " & PadL(Formato( Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("iespecial")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("redondeo")) - nPagoTotal, Ambiente.FDinero ),9) & vbCrLf cSalida = cSalida & vbCrLf cSalida = cSalida & "______________________________" & vbCrLf cSalida = cSalida & "Nombre: " & vbCrLf else cSalida = cSalida & " Cambio: " & PadL(Formato( nPagoTotal - Val2(rstEncabezado("impuesto")) - Val2(rstEncabezado("iespecial")) - Val2(rstEncabezado("importe")) - Val2(rstEncabezado("redondeo")), Ambiente.FDinero ),9) & Chr(13) & Chr(10) end if Set rstMoneda = CreaRecordSet( "SELECT * FROM monedas WHERE moneda = '" & rstEncabezado("moneda") & "'", Ambiente.Connection ) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Letra( Val2(rstEncabezado("impuesto")) + Val2(rstEncabezado("importe")) + Val2(rstEncabezado("iespecial")), Trim(rstMoneda("Descrip")), True,rstMoneda("Nombre") ) & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & "***** GRACIAS POR SU COMPRA *****" & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) cSalida = cSalida & Chr(13) & Chr(10) ' Esto manda un corte de papel 'PrintText cSalida if Ambiente.rstEstacion("ticketcorte") <> 0 Then
cSalida = cSalida & Chr(27) & Chr(105)
end if

If Ambiente.Tag = "HTML" Then

Ambiente.Tag = ""

cSalida = Replace( cSalida, Chr(13) & Chr(10), "
" )
cSalida = "

" & cSalida & "

"
CreaHtml "", (cSalida)

Else

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

End If

End Sub

Publicado el — 3 comentarios

Cómo solucionar el Error de decimales y Reportes en Blanco?

wpid-12921860_959637817437617_1017869236_o.png.jpg

A varios usuarios les ha sucedido que no pueden visualizar los reportes de manera correcta; solo se alcanza a visualizar un poco que se está cargando el reporte, pero al momento de mostrarlo se queda casi en blanco toda la ventana.

La solución que les comparto en esta ocasión tal vez suena muy simple,  sin embargo, estoy seguro que a más de uno le va a ser útil.

Debe configurar su equipo al idioma Español (México).

Esto se logra siguiendo la ruta INICIO — PANEL DE CONTROL — CONFIGURACION REGIONAL Y DE IDIOMA.

Ahí Seleccionamos el idioma Español de México  y también se recomienda la ubicación México.

Esto además soluciona el problema de que los aprecios de los artículos se ven en miles o millones de pesos (cuando en realidad su valor es unos pesos y algunos centavos).

Este tip también soluciona el problema de los decimales con coma (1,500) y muestra los decimales con el punto decimal(1.5) como lo conocemos en México.

Espero haber aportado algo para todos los visitantes del blog. cualquier duda contactarme a jofelchez@gmail.com

Publicado el — 6 comentarios

Double Entry v2012 | MyBusiness POS 2012

Desde hace dos meses, aproximadamente.  se ha estado promocionando el nuevo software Contable Double Entry V2012 de MyBusiness POS. Realmente solo conozco lo básico de contabilidad, sin embargo vamos a evaluar este software para conocer la bondades (o dificultades) que se presentan.

Simplemente recordemos que no ha sido muy bien recibido el módulo de MyMoney, esperemos que este producto que ofrece MyBusiness POS sea una solución real y rentable para los negocios.

Estaremos en contacto.