Sub ImprimirPedido
Dim EsteArticulo As ArtPedido
DateTime.DateFormat = "dd/MM/yy"
'Documento y Fecha
If cmbTipoVenta.SelectedIndex=0 Then
PrintBuffer= " " & Chr(13) & Chr(10) & " " & Chr(13) & Chr(10) &" " & Forma(1, 5, CStr(DateTime.Date(DateTime.Now)))&" "& Forma(1, 15, "CONTADO "& strSerie & CStr(intContadoActual)) & " " & Forma(1, 5, CStr(DateTime.Date(DateTime.Now)))&" "& Forma(1, 15, "CONTADO "& strSerie & CStr(intContadoActual))
Else
PrintBuffer= " " & Chr(13) & Chr(10) & " " & Chr(13) & Chr(10) &" " & Forma(1, 5, CStr(DateTime.Date(DateTime.Now)))&" "& Forma(1, 15, "CREDITO "& strSerie & CStr(intContadoActual)) & " " & Forma(1, 5, CStr(DateTime.Date(DateTime.Now)))&" "& Forma(1, 15, "CREDITO "& strSerie & CStr(intContadoActual))
End If
'RUT
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& " "
If ClienteActual.ObtenerRUTCliente.Length > 2 Then
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& " " & Forma(1,29,ClienteActual.ObtenerRUTCliente) & " " & ClienteActual.ObtenerRUTCliente
Else
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& " X X"
End If
'Cliente
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& "CLIENTE: " & Forma(1, 26, "(" & CStr(ClienteActual.ObtenerIdClienteCliente ) & ")" & " " & ClienteActual.ObtenerNombreCliente ) & " CLIENTE: " & Forma(1, 26, "(" & CStr(ClienteActual.ObtenerIdClienteCliente ) & ")" & " " & ClienteActual.ObtenerNombreCliente)
'Direccion
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& "DIRECCION: " & Forma(1, 25, CStr(ClienteActual.ObtenerDireccionCliente )) & " "& "DIRECCION: " & Forma(1, 25, CStr(ClienteActual.ObtenerDireccionCliente ))
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& " "
'Articulos
For I=1 To ArticulosPedido.Size
EsteArticulo = ArticulosPedido.Get(I-1)
'Cantidad, Detalle, Precio y Subtotal
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& Forma(2, 5, redondeo2(EsteArticul
btenerCantidad,1)) & " " & Forma(1, 18, EsteArticul
btenerDetalle ) & " " & Forma(2, 6, SinImpuestos(EsteArticul
btenerPrecio , EsteArticul
bteneriva )) & Forma(2, 7, SinImpuestos(EsteArticul
btenerCantidad*EsteArticul
btenerPrecio , EsteArticul
bteneriva )) &" "&Forma(2, 5, redondeo2(EsteArticul
btenerCantidad,1)) & " " & Forma(1, 18, EsteArticul
btenerDetalle ) & " " & Forma(2, 6, SinImpuestos(EsteArticul
btenerPrecio , EsteArticul
bteneriva )) & Forma(2, 7, SinImpuestos(EsteArticul
btenerCantidad*EsteArticul
btenerPrecio , EsteArticul
btenerIVA ))
Next
For j = ArticulosPedido.Size To 12
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& " "
Next
'IVA BÁSICO
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& Forma(1, 2, CStr(IvaBasico)) & "% " & Forma(2, 9, "$" & CStr(Round2(ObtenerSubtotalBasico,1))) & " " & Forma(2, 8, "$" & CStr(Round2(ObtenerIvaBas,1))) & " " & Forma(2, 7, "$" & CStr(Round2(ObtenerSubtotalBasico + ObtenerSubtotalMinimo + ObtenerSubtotalExento,1))) & " " & Forma(1, 2, CStr(IvaBasico)) & "% " & Forma(2, 8, "$" & CStr(Round2(ObtenerSubtotalBasico,1))) & " " & Forma(2, 8, "$" & CStr(Round2(ObtenerIvaBas,1))) & " " & Forma(2, 9, "$" & CStr(Round2(ObtenerSubtotalBasico + ObtenerSubtotalMinimo + ObtenerSubtotalExento,1)))
'IVA Mínimo
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& Forma(1, 2, CStr(IvaMinimo)) & "% " & Forma(2, 9, "$" & CStr(Round2(ObtenerSubtotalMinimo,1))) & " " & Forma(2, 8, "$" & CStr(Round2(ObtenerIvaMin,1))) & " " & Forma(2, 7, "$" & CStr(Round2(ObtenerIvaMin + ObtenerIvaBas,1))) & " " & Forma(1, 2, CStr(IvaMinimo)) & "% " & Forma(2, 8, "$" & CStr(Round2(ObtenerSubtotalMinimo,1))) & " " & Forma(2, 8, "$" & CStr(Round2(ObtenerIvaMin,1))) & " " & Forma(2, 9, "$" & CStr(Round2(ObtenerIvaMin + ObtenerIvaBas,1)))
'IVA EXENTO
PrintBuffer=PrintBuffer & Chr(13)&Chr(10)& " 0% " & Forma(2, 9, "$" & ObtenerSubtotalExento) & " $0 " & Forma(2, 9, "$" & CStr(Round(ObtenerValorVenta))) & " 0% " & Forma(2, 9, "$" & ObtenerSubtotalExento) & " $0 " & Forma(2, 9, "$" & CStr(Round(ObtenerValorVenta)))
StartPrinter
End Sub
Sub Printer_Connected (Success As Boolean)
If Success Then
printer.Initialize(cmp20.OutputStream)
printer.Write(PrintBuffer)
printer.Flush
printer.Write (" ")
printer.WriteLine (" ")
PrintBuffer=""
Msgbox("Proceso de Impresión realizado","")
printer.Close
cmp20.Disconnect
Else
If Msgbox2("", "Error de Impresión","Reintentar","Cancelar","",Null) = DialogResponse.POSITIVE Then
StartPrinter
End If
End If
End Sub
Sub StartPrinter
Dim PairedDevices As Map
PairedDevices.Initialize
Try
PairedDevices = cmp20.GetPairedDevices
Catch
Msgbox("Imposible conectar Bluetooth","Error de Impresión")
printer.Close
cmp20.Disconnect
End Try
If PairedDevices.Size = 0 Then
Return
Else
cmp20.Connect(DirMac)
End If
End Sub