mirror of
https://github.com/KeymonSoft/Marquez.git
synced 2026-04-17 21:06:15 +00:00
Cambios en ticket
This commit is contained in:
@@ -35,7 +35,7 @@ Sub Class_Globals
|
||||
Dim cuenta As String
|
||||
Dim tipo_venta As String = "PREVENTA"
|
||||
Dim MAC_IMPRESORA As String
|
||||
|
||||
Dim Printer1 As EscPosPrinter
|
||||
Dim c As Cursor
|
||||
Dim s As Cursor
|
||||
Dim DD As Cursor
|
||||
@@ -54,13 +54,13 @@ Sub Class_Globals
|
||||
Dim gest As Button
|
||||
Dim la_saldotot As Label
|
||||
Dim la_saldooper As Label
|
||||
|
||||
Dim impresoraConectada As Boolean = False
|
||||
Dim Tels As Button
|
||||
Dim Label10 As Label
|
||||
Dim Label11 As Label
|
||||
|
||||
Dim btAdmin As BluetoothAdmin
|
||||
Dim Tar As Button
|
||||
|
||||
Dim errorImpresora As Int = 0
|
||||
Dim la_comm As Label
|
||||
Dim la_actdte As Label
|
||||
Dim la_usuario As Label
|
||||
@@ -113,7 +113,7 @@ Sub Class_Globals
|
||||
Private HR_RES3 As String
|
||||
Private EXISTE As String
|
||||
Private TELEFONO As String
|
||||
|
||||
Dim t1 As Timer
|
||||
Private RB1 As RadioButton
|
||||
Private RB2 As RadioButton
|
||||
Private RB3 As RadioButton
|
||||
@@ -396,6 +396,24 @@ Sub B4XPage_Appear
|
||||
End If
|
||||
|
||||
|
||||
c = skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("MACIMP"))
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
Starter.MAC_IMPRESORA = c.GetString("CAT_VA_VALOR")
|
||||
End If
|
||||
If Starter.MAC_IMPRESORA = "" Then Starter.MAC_IMPRESORA = "0"
|
||||
' Log("|" & Starter.MAC_IMPRESORA & "|")
|
||||
Printer1.Initialize(Me, "Printer1")
|
||||
|
||||
If Printer1.IsConnected = False Then
|
||||
' Printer1.Connect
|
||||
' Log("1")
|
||||
Else
|
||||
Printer1.DisConnect
|
||||
Printer1.Connect
|
||||
Log("2")
|
||||
End If
|
||||
|
||||
pre_act = Subs.traeTotalClientepreventaparacredito
|
||||
|
||||
End Sub
|
||||
@@ -802,49 +820,550 @@ Sub b_mapa_Click
|
||||
End Sub
|
||||
|
||||
Sub B_IMP_Click
|
||||
|
||||
c = skmt.ExecQuery2("SELECT * FROM PEDIDO WHERE PE_FOLIO = ? AND PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA)",Array As String("VENTA"))
|
||||
If c.RowCount > 0 Then
|
||||
imprime_venta
|
||||
t1.Initialize("T1", 5000) ' 1000 = 1 second
|
||||
t1.Enabled = True
|
||||
Else If c.RowCount = 0 Then
|
||||
s = skmt.ExecQuery2("SELECT * FROM PEDIDO WHERE PE_FOLIO = ? AND PE_CLIENTE IN (SELECT CUENTA FROM CUENTAA)",Array As String("PREVENTA"))
|
||||
If s.RowCount > 0 Then
|
||||
imprime_preventa
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Sub t1_tick
|
||||
s = skmt.ExecQuery2("SELECT * FROM PEDIDO WHERE PE_FOLIO = ?",Array As String("PREVENTA"))
|
||||
If s.RowCount > 0 Then
|
||||
imprime_preventa
|
||||
End If
|
||||
t1.Enabled = False
|
||||
End Sub
|
||||
|
||||
Sub imprime_preventa
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c.Close
|
||||
' c=Starter.skmt.ExecQuery2("SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION =?", Array As String ("SUCURSAL"))
|
||||
' c.Position = 0
|
||||
' sucursal = c.GetString("CAT_VA_VALOR")
|
||||
' c.Close
|
||||
|
||||
ProgressDialogShow("Imprimiendo, un momento ...")
|
||||
Printer1.DisConnect
|
||||
If Not(Printer1.IsConnected) Then
|
||||
Log("Conectando a impresora ...")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada)
|
||||
Sleep(1000)
|
||||
Log("++++++ " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect 'Tratamos de reconectar
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
Else
|
||||
Log("conectando 2")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada) Or Not(Printer1.IsConnected)
|
||||
Sleep(1000)
|
||||
Log("****** " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
End If
|
||||
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
printer.Initialize(cmp20.OutputStream)
|
||||
printer.WriteLine("DURAKELO S.A. de C.V.")
|
||||
printer.WriteLine("RFC: DUR-011025-T12")
|
||||
printer.WriteLine("Tel.: 618-826-0104")
|
||||
printer.WriteLine("Vendedor: KMTS ")
|
||||
printer.WriteLine("Tienda: " & La_nombre.Text)
|
||||
printer.WriteLine("-----------PREVENTA-----------")
|
||||
s=B4XPages.MainPage.skmt.ExecQuery("select PE_PRONOMBRE, PE_CANT, length(pe_cant) as L_CANT, PE_COSTOU, length(PE_COSTOU) as L_COSTOU, PE_COSTO_TOT, length(PE_COSTO_TOT) as L_COSTO_TOT FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
' Dim bmp As Bitmap
|
||||
' bmp.InitializeResize(File.DirAssets, "mariana.jpg", 192, 250, True) 'ignore
|
||||
' Dim myimage As AnImage = Printer1.ImageToBWIMage(bmp)
|
||||
|
||||
' myimage = Printer1.DitherImage2D(myimage, 128)
|
||||
'
|
||||
' myimage= Printer1.PackImage(myimage)
|
||||
' Printer1.WriteString(CRLF) ' nudge the printer to show the user something is happening
|
||||
' Printer1.WriteString(Printer1.REVERSE)
|
||||
'
|
||||
' Printer1.PrintImage(myimage)
|
||||
' Printer1.WriteString(Printer1.UNREVERSE)
|
||||
|
||||
' Printer1.Justify = 1
|
||||
'printer.Initialize(cmp20.OutputStream)
|
||||
' Printer1.WriteString("DISTRIBUIDORA ROCHA TULA PACHUCA" & CRLF)
|
||||
Printer1.WriteString("Marquez Distribuciones" & CRLF)
|
||||
' Printer1.WriteString(sucursal & CRLF)
|
||||
Printer1.WriteString(sDate & CRLF)
|
||||
Printer1.WriteString(sTime & CRLF)
|
||||
Printer1.WriteString("Vendedor:" & usuario & CRLF)
|
||||
Printer1.WriteString("Tienda: " & La_nombre.Text & CRLF)
|
||||
Printer1.WriteString("ID.Cliente: " & la_cuenta.Text & CRLF)
|
||||
Printer1.WriteString("Calle: " & la_Calle.Text & CRLF)
|
||||
Printer1.WriteString("Colonia: " & la_col.Text & CRLF)
|
||||
' Printer1.WriteString("C.P.: " & la_cp.Text & CRLF)
|
||||
' Printer1.WriteString("Entre calle1: " & l_entre1.Text & CRLF)
|
||||
' Printer1.WriteString("Entre Calle2: " & l_entre2.Text & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
c = skmt.ExecQuery2("SELECT * FROM PEDIDO WHERE PE_FOLIO = ?",Array As String("PREVENTA"))
|
||||
If c.RowCount > 0 Then
|
||||
Printer1.WriteString("-----------PREVENTA-----------" & CRLF)
|
||||
|
||||
' Printer1.WriteString("--------------------------------" & CRLF)
|
||||
Printer1.WriteString("Cant. Precio Importe" & CRLF)
|
||||
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
' aqui es donde esta el pedo de julieta de los descuentos quitar el precio2 pero meter un if para saber si es ruta especial o es normal o que show.
|
||||
s=skmt.ExecQuery2("select PE_PRONOMBRE, PE_CANT, length(pe_cant) as L_CANT, PE_COSTOU, length(PE_COSTOU) as L_COSTOU,PE_CANT * PE_COSTOU AS PE_COSTO_TOT, length(PE_CANT * PE_COSTOU) as L_COSTO_TOT,PE_PROID, PE_CEDIS FROM PEDIDO WHERE PE_FOLIO = ? AND LENGTH(PE_CEDIS) < 4 AND PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PROID", Array As String("PREVENTA"))
|
||||
If S.RowCount>0 Then
|
||||
For i=0 To S.RowCount -1
|
||||
S.Position=i
|
||||
printer.WriteLine(s.GetString("PE_CANT") & " " & s.GetString("PE_PRONOMBRE"))
|
||||
If s.GetString("PE_CEDIS") = s.GetString("PE_PROID") Then
|
||||
Printer1.WriteString(s.GetString("PE_PRONOMBRE") & CRLF)
|
||||
|
||||
Else
|
||||
|
||||
Printer1.WriteString(s.GetString("PE_PRONOMBRE") & CRLF)
|
||||
LogColor(s.GetLong("L_CANT"),Colors.Magenta)
|
||||
LogColor(s.GetLong("L_COSTOU"),Colors.Magenta)
|
||||
LogColor(s.GetLong("L_COSTO_TOT"),Colors.Magenta)
|
||||
TAMANO = s.GetLong("L_CANT") + TAMANO
|
||||
|
||||
If s.GetLong("L_COSTOU") = 1 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 4
|
||||
Else If s.GetLong("L_COSTOU") = 2 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 3
|
||||
Else If s.GetLong("L_COSTOU") = 3 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 2
|
||||
Else If s.GetLong("L_COSTOU") = 4 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 1
|
||||
Else
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO
|
||||
End If
|
||||
|
||||
If s.GetLong("L_COSTO_TOT") = 1 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 4
|
||||
Else If s.GetLong("L_COSTO_TOT") = 2 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 3
|
||||
Else If s.GetLong("L_COSTO_TOT") = 3 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 2
|
||||
Else If s.GetLong("L_COSTO_TOT") = 4 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 1
|
||||
Else
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO
|
||||
End If
|
||||
|
||||
ESPACIO = ESPACIO - TAMANO
|
||||
|
||||
For E=0 To ESPACIO -1
|
||||
BLANCO = " " & BLANCO
|
||||
Next
|
||||
printer.WriteLine(BLANCO & s.GETSTRING("PE_CANT") & " X $" & s.GETSTRING("PE_COSTOU") & " $" & s.GETSTRING("PE_COSTO_TOT") )
|
||||
Printer1.Justify = 0
|
||||
Printer1.WriteString( s.GETSTRING("PE_CANT")& BLANCO)
|
||||
Printer1.Justify = 1
|
||||
Printer1.WriteString(s.GETSTRING("PE_COSTOU")& BLANCO)
|
||||
Printer1.Justify = 2
|
||||
Printer1.WriteString(s.GETSTRING("PE_COSTO_TOT") & CRLF )
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Printer1.Justify = 0
|
||||
s.Close
|
||||
printer.WriteLine("Total Preventa: $" & total_cliente)
|
||||
printer.WriteLine("------------VENTA-------------")
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine("TOTAL: $" & total_cliente)
|
||||
printer.WriteLine(" ")
|
||||
printer.WriteLine("----ESTE TICKET NO ES UN -----")
|
||||
printer.WriteLine("--COMPROBANTE FISCAL, SOLO ES-")
|
||||
printer.WriteLine("--------INFORMATIVO-----------")
|
||||
printer.WriteLine("------------------------------")
|
||||
printer.WriteLine(" ")
|
||||
printer.Flush
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
s=skmt.ExecQuery2("select PE_PRONOMBRE, PE_CANT, length(pe_cant) as L_CANT, PE_COSTOU, length(PE_COSTOU) as L_COSTOU,PE_CANT * PE_COSTOU AS PE_COSTO_TOT, length(PE_CANT * PE_COSTOU) as L_COSTO_TOT,PE_PROID, PE_CEDIS FROM PEDIDO WHERE PE_FOLIO = ? AND LENGTH(PE_CEDIS) > 3 AND PE_PROID NOT IN (SELECT CAT_PA_ID FROM PROMOS_COMP ) AND PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_CEDIS, PE_COSTOU", Array As String("PREVENTA"))
|
||||
If S.RowCount>0 Then
|
||||
Printer1.WriteString("-------PROMOS PREVENTA--------" & CRLF)
|
||||
Printer1.WriteString("Cant. Precio Importe" & CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
For i=0 To S.RowCount -1
|
||||
S.Position=i
|
||||
If s.GetString("PE_CEDIS") = s.GetString("PE_PROID") Then
|
||||
Printer1.WriteString(s.GetString("PE_PRONOMBRE") & CRLF)
|
||||
|
||||
Else
|
||||
|
||||
Printer1.WriteString(s.GetString("PE_PRONOMBRE") & CRLF)
|
||||
TAMANO = s.GetLong("L_CANT") + TAMANO
|
||||
If s.GetLong("L_COSTOU") = 1 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 4
|
||||
Else If s.GetLong("L_COSTOU") = 2 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 3
|
||||
Else If s.GetLong("L_COSTOU") = 3 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 2
|
||||
Else If s.GetLong("L_COSTOU") = 4 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 1
|
||||
Else
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO
|
||||
End If
|
||||
|
||||
If s.GetLong("L_COSTO_TOT") = 1 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 4
|
||||
Else If s.GetLong("L_COSTO_TOT") = 2 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 3
|
||||
Else If s.GetLong("L_COSTO_TOT") = 3 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 2
|
||||
Else If s.GetLong("L_COSTO_TOT") = 4 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 1
|
||||
Else
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO
|
||||
End If
|
||||
|
||||
ESPACIO = ESPACIO - TAMANO
|
||||
|
||||
For E=0 To ESPACIO -1
|
||||
BLANCO = " " & BLANCO
|
||||
Next
|
||||
' Printer1.WriteString(BLANCO & s.GETSTRING("PE_CANT") & " X $" & s.GETSTRING("PE_COSTOU") & " $" & s.GETSTRING("PE_COSTO_TOT") & CRLF )
|
||||
Printer1.Justify = 0
|
||||
Printer1.WriteString( s.GETSTRING("PE_CANT")& BLANCO)
|
||||
Printer1.Justify = 1
|
||||
Printer1.WriteString(s.GETSTRING("PE_COSTOU")& BLANCO)
|
||||
Printer1.Justify = 2
|
||||
Printer1.WriteString(s.GETSTRING("PE_COSTO_TOT") & CRLF )
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
End If
|
||||
Next
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
End If
|
||||
s.Close
|
||||
Printer1.Justify = 0
|
||||
s=skmt.ExecQuery2("select SUM(PE_COSTO_TOT) AS TOTAL FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) AND PE_FOLIO = ?", Array As String("PREVENTA"))
|
||||
s.Position =0
|
||||
' If s.GetString("TOTAL") - s.GetString("TOTAL2") <> 0 Then
|
||||
' Printer1.WriteString("Descuento: $" & (s.GetString("TOTAL2") - s.GetString("TOTAL")))
|
||||
' End If
|
||||
Printer1.WriteString("Total preventa: $" & s.GetString("TOTAL") & CRLF)
|
||||
s.Close
|
||||
c= skmt.ExecQuery2("select sum(PE_CANT) as PC_NOART from PEDIDO where PE_CLIENTE in (Select CUENTA from cuentaa) AND PE_PROID NOT IN (SELECT CAT_PA_ID FROM PROMOS_COMP ) AND PE_FOLIO = ?", Array As String("PREVENTA"))
|
||||
C.Position=0
|
||||
Printer1.WriteString("Total articulos preventa: " & c.GetString("PC_NOART") & CRLF)
|
||||
c.Close
|
||||
|
||||
' Printer1.WriteString(" " & CRLF)
|
||||
End If
|
||||
|
||||
|
||||
' Printer1.WriteString(" " & CRLF)
|
||||
' Printer1.WriteString("------------------------------" & CRLF)
|
||||
'
|
||||
' s=skmt.ExecQuery("select SUM(PE_COSTO_TOT) AS TOTAL FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
' s.Position =0
|
||||
' ' If s.GetString("TOTAL") - s.GetString("TOTAL2") <> 0 Then
|
||||
' ' Printer1.WriteString("Descuento: $" & (s.GetString("TOTAL2") - s.GetString("TOTAL")))
|
||||
' ' End If
|
||||
' Printer1.WriteString("Total: $" & s.GetString("TOTAL") & CRLF)
|
||||
' s.Close
|
||||
' c= skmt.ExecQuery("select sum(PE_CANT) as PC_NOART from PEDIDO where PE_CLIENTE in (Select CUENTA from cuentaa) AND PE_PROID NOT IN (SELECT CAT_PA_ID FROM PROMOS_COMP )")
|
||||
' C.Position=0
|
||||
' Printer1.WriteString("Total Articulos: " & c.GetString("PC_NOART") & CRLF)
|
||||
' c.Close
|
||||
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
' Printer1.WriteString("ENTREGA EN :" & CRLF)
|
||||
' Printer1.WriteString(la_Calle.Text & CRLF)
|
||||
Printer1.WriteString("----ESTE TICKET NO ES UN -----" & CRLF)
|
||||
Printer1.WriteString("--COMPROBANTE FISCAL, SOLO ES-" & CRLF)
|
||||
Printer1.WriteString("--------INFORMATIVO-----------" & CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Sleep(1000)
|
||||
Printer1.DisConnect
|
||||
|
||||
ProgressDialogHide
|
||||
' printer.Flush
|
||||
' printer.Close
|
||||
End Sub
|
||||
|
||||
Sub imprime_venta
|
||||
c=skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c.Close
|
||||
' c=Starter.skmt.ExecQuery2("SELECT CAT_VA_VALOR FROM CAT_VARIABLES WHERE CAT_VA_DESCRIPCION =?", Array As String ("SUCURSAL"))
|
||||
' c.Position = 0
|
||||
' sucursal = c.GetString("CAT_VA_VALOR")
|
||||
' c.Close
|
||||
|
||||
ProgressDialogShow("Imprimiendo, un momento ...")
|
||||
Printer1.DisConnect
|
||||
If Not(Printer1.IsConnected) Then
|
||||
Log("Conectando a impresora ...")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada)
|
||||
Sleep(1000)
|
||||
Log("++++++ " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect 'Tratamos de reconectar
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
Else
|
||||
Log("conectando 2")
|
||||
Printer1.Connect
|
||||
Private cont As Int = 0
|
||||
Do While Not(impresoraConectada) Or Not(Printer1.IsConnected)
|
||||
Sleep(1000)
|
||||
Log("****** " & cont)
|
||||
cont = cont + 1
|
||||
If cont = 2 Then Printer1.Connect
|
||||
If cont > 3 Then impresoraConectada = True
|
||||
Loop
|
||||
Sleep(500)
|
||||
impresoraConectada = False
|
||||
End If
|
||||
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
' Dim bmp As Bitmap
|
||||
' bmp.InitializeResize(File.DirAssets, "mariana.jpg", 192, 250, True) 'ignore
|
||||
' Dim myimage As AnImage = Printer1.ImageToBWIMage(bmp)
|
||||
|
||||
' myimage = Printer1.DitherImage2D(myimage, 128)
|
||||
'
|
||||
' myimage= Printer1.PackImage(myimage)
|
||||
' Printer1.WriteString(CRLF) ' nudge the printer to show the user something is happening
|
||||
' Printer1.WriteString(Printer1.REVERSE)
|
||||
'
|
||||
' Printer1.PrintImage(myimage)
|
||||
' Printer1.WriteString(Printer1.UNREVERSE)
|
||||
|
||||
' Printer1.Justify = 1
|
||||
'printer.Initialize(cmp20.OutputStream)
|
||||
' Printer1.WriteString("DISTRIBUIDORA ROCHA TULA PACHUCA" & CRLF)
|
||||
Printer1.WriteString("Marquez Distribuciones" & CRLF)
|
||||
' Printer1.WriteString(sucursal & CRLF)
|
||||
Printer1.WriteString(sDate & CRLF)
|
||||
Printer1.WriteString(sTime & CRLF)
|
||||
Printer1.WriteString("Vendedor:" & usuario & CRLF)
|
||||
Printer1.WriteString("Tienda: " & La_nombre.Text & CRLF)
|
||||
Printer1.WriteString("ID.Cliente: " & la_cuenta.Text & CRLF)
|
||||
Printer1.WriteString("Calle: " & la_Calle.Text & CRLF)
|
||||
Printer1.WriteString("Colonia: " & la_col.Text & CRLF)
|
||||
' Printer1.WriteString("C.P.: " & la_cp.Text & CRLF)
|
||||
' Printer1.WriteString("Entre calle1: " & l_entre1.Text & CRLF)
|
||||
' Printer1.WriteString("Entre Calle2: " & l_entre2.Text & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
c = skmt.ExecQuery2("SELECT * FROM PEDIDO WHERE PE_FOLIO = ?",Array As String("VENTA"))
|
||||
If c.RowCount > 0 Then
|
||||
Printer1.WriteString("-----------VENTA-----------" & CRLF)
|
||||
|
||||
' Printer1.WriteString("--------------------------------" & CRLF)
|
||||
Printer1.WriteString("Cant. Precio Importe" & CRLF)
|
||||
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
' aqui es donde esta el pedo de julieta de los descuentos quitar el precio2 pero meter un if para saber si es ruta especial o es normal o que show.
|
||||
s=skmt.ExecQuery2("select PE_PRONOMBRE, PE_CANT, length(pe_cant) as L_CANT, PE_COSTOU, length(PE_COSTOU) as L_COSTOU,PE_CANT * PE_COSTOU AS PE_COSTO_TOT, length(PE_CANT * PE_COSTOU) as L_COSTO_TOT,PE_PROID, PE_CEDIS FROM PEDIDO WHERE PE_FOLIO = ? AND LENGTH(PE_CEDIS) < 4 AND PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PROID", Array As String("VENTA"))
|
||||
If S.RowCount>0 Then
|
||||
For i=0 To S.RowCount -1
|
||||
S.Position=i
|
||||
If s.GetString("PE_CEDIS") = s.GetString("PE_PROID") Then
|
||||
Printer1.WriteString(s.GetString("PE_PRONOMBRE") & CRLF)
|
||||
|
||||
Else
|
||||
|
||||
Printer1.WriteString(s.GetString("PE_PRONOMBRE") & CRLF)
|
||||
TAMANO = s.GetLong("L_CANT") + TAMANO
|
||||
If s.GetLong("L_COSTOU") = 1 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 4
|
||||
Else If s.GetLong("L_COSTOU") = 2 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 3
|
||||
Else If s.GetLong("L_COSTOU") = 3 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 2
|
||||
Else If s.GetLong("L_COSTOU") = 4 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 1
|
||||
Else
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO
|
||||
End If
|
||||
|
||||
If s.GetLong("L_COSTO_TOT") = 1 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 4
|
||||
Else If s.GetLong("L_COSTO_TOT") = 2 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 3
|
||||
Else If s.GetLong("L_COSTO_TOT") = 3 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 2
|
||||
Else If s.GetLong("L_COSTO_TOT") = 4 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 1
|
||||
Else
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO
|
||||
End If
|
||||
|
||||
ESPACIO = ESPACIO - TAMANO
|
||||
|
||||
For E=0 To ESPACIO -1
|
||||
BLANCO = " " & BLANCO
|
||||
Next
|
||||
Printer1.Justify = 0
|
||||
Printer1.WriteString( s.GETSTRING("PE_CANT")& BLANCO)
|
||||
Printer1.Justify = 1
|
||||
Printer1.WriteString(s.GETSTRING("PE_COSTOU")& BLANCO)
|
||||
Printer1.Justify = 2
|
||||
Printer1.WriteString(s.GETSTRING("PE_COSTO_TOT") & CRLF )
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Printer1.Justify = 0
|
||||
s.Close
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
s=skmt.ExecQuery2("select PE_PRONOMBRE, PE_CANT, length(pe_cant) as L_CANT, PE_COSTOU, length(PE_COSTOU) as L_COSTOU,PE_CANT * PE_COSTOU AS PE_COSTO_TOT, length(PE_CANT * PE_COSTOU) as L_COSTO_TOT,PE_PROID, PE_CEDIS FROM PEDIDO WHERE PE_FOLIO = ? AND LENGTH(PE_CEDIS) > 3 AND PE_PROID NOT IN (SELECT CAT_PA_ID FROM PROMOS_COMP ) AND PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_CEDIS, PE_COSTOU", Array As String("VENTA"))
|
||||
If S.RowCount>0 Then
|
||||
Printer1.WriteString("-------PROMOS VENTA--------" & CRLF)
|
||||
Printer1.WriteString("Cant. Precio Importe" & CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
For i=0 To S.RowCount -1
|
||||
S.Position=i
|
||||
If s.GetString("PE_CEDIS") = s.GetString("PE_PROID") Then
|
||||
Printer1.WriteString(s.GetString("PE_PRONOMBRE") & CRLF)
|
||||
|
||||
Else
|
||||
|
||||
Printer1.WriteString(s.GetString("PE_PRONOMBRE") & CRLF)
|
||||
TAMANO = s.GetLong("L_CANT") + TAMANO
|
||||
If s.GetLong("L_COSTOU") = 1 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 4
|
||||
Else If s.GetLong("L_COSTOU") = 2 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 3
|
||||
Else If s.GetLong("L_COSTOU") = 3 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 2
|
||||
Else If s.GetLong("L_COSTOU") = 4 Then
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO + 1
|
||||
Else
|
||||
TAMANO = s.GetLong("L_COSTOU") + TAMANO
|
||||
End If
|
||||
|
||||
If s.GetLong("L_COSTO_TOT") = 1 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 4
|
||||
Else If s.GetLong("L_COSTO_TOT") = 2 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 3
|
||||
Else If s.GetLong("L_COSTO_TOT") = 3 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 2
|
||||
Else If s.GetLong("L_COSTO_TOT") = 4 Then
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO + 1
|
||||
Else
|
||||
TAMANO = s.GetLong("L_COSTO_TOT") + TAMANO
|
||||
End If
|
||||
|
||||
ESPACIO = ESPACIO - TAMANO
|
||||
|
||||
For E=0 To ESPACIO -1
|
||||
BLANCO = " " & BLANCO
|
||||
Next
|
||||
' Printer1.WriteString(BLANCO & s.GETSTRING("PE_CANT") & " X $" & s.GETSTRING("PE_COSTOU") & " $" & s.GETSTRING("PE_COSTO_TOT") & CRLF )
|
||||
Printer1.Justify = 0
|
||||
Printer1.WriteString( s.GETSTRING("PE_CANT")& BLANCO)
|
||||
Printer1.Justify = 1
|
||||
Printer1.WriteString(s.GETSTRING("PE_COSTOU")& BLANCO)
|
||||
Printer1.Justify = 2
|
||||
Printer1.WriteString(s.GETSTRING("PE_COSTO_TOT") & CRLF )
|
||||
TAMANO = 0
|
||||
ESPACIO = 21
|
||||
BLANCO = " "
|
||||
End If
|
||||
Next
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
End If
|
||||
s.Close
|
||||
Printer1.Justify = 0
|
||||
s=skmt.ExecQuery2("select SUM(PE_COSTO_TOT) AS TOTAL FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) AND PE_FOLIO = ?", Array As String("VENTA"))
|
||||
s.Position =0
|
||||
' If s.GetString("TOTAL") - s.GetString("TOTAL2") <> 0 Then
|
||||
' Printer1.WriteString("Descuento: $" & (s.GetString("TOTAL2") - s.GetString("TOTAL")))
|
||||
' End If
|
||||
Printer1.WriteString("Total venta: $" & s.GetString("TOTAL") & CRLF)
|
||||
s.Close
|
||||
c= skmt.ExecQuery2("select sum(PE_CANT) as PC_NOART from PEDIDO where PE_CLIENTE in (Select CUENTA from cuentaa) AND PE_PROID NOT IN (SELECT CAT_PA_ID FROM PROMOS_COMP ) AND PE_FOLIO = ?", Array As String("VENTA"))
|
||||
C.Position=0
|
||||
Printer1.WriteString("Total articulos venta: " & c.GetString("PC_NOART") & CRLF)
|
||||
c.Close
|
||||
|
||||
' Printer1.WriteString(" " & CRLF)
|
||||
End If
|
||||
|
||||
|
||||
' Printer1.WriteString(" " & CRLF)
|
||||
' Printer1.WriteString("------------------------------" & CRLF)
|
||||
'
|
||||
' s=skmt.ExecQuery("select SUM(PE_COSTO_TOT) AS TOTAL FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
' s.Position =0
|
||||
' ' If s.GetString("TOTAL") - s.GetString("TOTAL2") <> 0 Then
|
||||
' ' Printer1.WriteString("Descuento: $" & (s.GetString("TOTAL2") - s.GetString("TOTAL")))
|
||||
' ' End If
|
||||
' Printer1.WriteString("Total: $" & s.GetString("TOTAL") & CRLF)
|
||||
' s.Close
|
||||
' c= skmt.ExecQuery("select sum(PE_CANT) as PC_NOART from PEDIDO where PE_CLIENTE in (Select CUENTA from cuentaa) AND PE_PROID NOT IN (SELECT CAT_PA_ID FROM PROMOS_COMP )")
|
||||
' C.Position=0
|
||||
' Printer1.WriteString("Total Articulos: " & c.GetString("PC_NOART") & CRLF)
|
||||
' c.Close
|
||||
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
' Printer1.WriteString("ENTREGA EN :" & CRLF)
|
||||
' Printer1.WriteString(la_Calle.Text & CRLF)
|
||||
Printer1.WriteString("----ESTE TICKET NO ES UN -----" & CRLF)
|
||||
Printer1.WriteString("--COMPROBANTE FISCAL, SOLO ES-" & CRLF)
|
||||
Printer1.WriteString("--------INFORMATIVO-----------" & CRLF)
|
||||
Printer1.WriteString("------------------------------" & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Printer1.WriteString(" " & CRLF)
|
||||
Sleep(1000)
|
||||
Printer1.DisConnect
|
||||
|
||||
ProgressDialogHide
|
||||
' printer.Flush
|
||||
' printer.Close
|
||||
End Sub
|
||||
|
||||
Sub Printer1_Connected (Success As Boolean)
|
||||
' If Logger Then Log("Printer1_Connected")
|
||||
If Success Then
|
||||
ToastMessageShow("Impresora conectada", False)
|
||||
skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("MACIMP"))
|
||||
skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("MACIMP",Starter.mac_impresora))
|
||||
LogColor("Impresora conectada", Colors.Green)
|
||||
' B_IMP2.Enabled = True
|
||||
impresoraConectada = True
|
||||
Else
|
||||
' Msgbox(Printer1.ConnectedErrorMsg, "Error connecting.") 'ignore
|
||||
' ToastMessageShow("Error conectando la impresora", False)
|
||||
LogColor("Error conectando la impresora", Colors.Red)
|
||||
errorImpresora = errorImpresora + 1
|
||||
If errorImpresora > 1 Then
|
||||
Starter.MAC_IMPRESORA = "0"
|
||||
errorImpresora = 0
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Printer_Connected (Success As Boolean)
|
||||
If Success Then
|
||||
B_IMP.Enabled = True
|
||||
|
||||
@@ -2674,3 +2674,4 @@ Private Sub iv_abordo_Click
|
||||
B4XPages.MainPage.tipo_venta = "ABORDO"
|
||||
B4XPages.ShowPage("Productos")
|
||||
End Sub
|
||||
|
||||
|
||||
1158
B4A/EscPosPrinter.bas
Normal file
1158
B4A/EscPosPrinter.bas
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -20,6 +20,7 @@ ModuleBookmarks25=
|
||||
ModuleBookmarks26=
|
||||
ModuleBookmarks27=
|
||||
ModuleBookmarks28=
|
||||
ModuleBookmarks29=
|
||||
ModuleBookmarks3=
|
||||
ModuleBookmarks4=
|
||||
ModuleBookmarks5=
|
||||
@@ -49,6 +50,7 @@ ModuleBreakpoints25=
|
||||
ModuleBreakpoints26=
|
||||
ModuleBreakpoints27=
|
||||
ModuleBreakpoints28=
|
||||
ModuleBreakpoints29=
|
||||
ModuleBreakpoints3=
|
||||
ModuleBreakpoints4=
|
||||
ModuleBreakpoints5=
|
||||
@@ -78,6 +80,7 @@ ModuleClosedNodes25=
|
||||
ModuleClosedNodes26=
|
||||
ModuleClosedNodes27=
|
||||
ModuleClosedNodes28=
|
||||
ModuleClosedNodes29=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=
|
||||
@@ -85,6 +88,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Principal,Class_Globals,211,0,C_NuevoCliente,cb_giro_SelectedIndexChanged,329,0,C_Principal,iv_abordo_Click,2594,0,C_NuevoCliente,B4XPage_Appear,87,0,B4XMainPage,B4XPage_Created,152,0,C_Principal,Subir_Click,638,0,C_Principal,JobDone,1269,0,C_Principal,e_ruta_EnterPressed,2096,3,Diseñador Visual,principal.bal,-100,3,C_Principal,cargar_Click,991,3
|
||||
NavigationStack=C_Principal,cargar_Click,939,0,C_Principal,Subir_Click,776,0,C_Principal,t1_tick,2154,0,C_Clientes,Class_Globals,0,0,C_Cliente,t1_tick,836,0,C_Cliente,B_IMP_Click,827,6,C_Cliente,imprime_preventa,1018,6,Diseñador Visual,principal.bal,-100,2,Diseñador Visual,cliente.bal,-100,1,C_Cliente,imprime_venta,1266,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,2,3,4,5,6,7,8,9,10,13
|
||||
VisibleModules=1,2,3,4,5,6,7,8,9,10,14,21,13
|
||||
|
||||
@@ -32,9 +32,12 @@ Sub Process_Globals
|
||||
Private logcat As LogCat
|
||||
Dim muestraProgreso = 0
|
||||
Dim logger As Boolean = False
|
||||
Dim MAC_IMPRESORA As String
|
||||
Dim marcaCel As String = ph.manufacturer
|
||||
Dim tabla As String
|
||||
Dim pre_viejo As Float
|
||||
Private BTAdmin As BluetoothAdmin
|
||||
Public BluetoothState As Boolean
|
||||
End Sub
|
||||
|
||||
Sub Service_Create
|
||||
@@ -43,6 +46,7 @@ Sub Service_Create
|
||||
gps.Initialize("GPS")
|
||||
s.Initialize(Me, "Subs") 'Inicializamos la clase Subs
|
||||
skmt = s.inicializaBD(File.DirInternal, "kmt.db")
|
||||
BTAdmin.Initialize("admin")
|
||||
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics") 'Para Push FirebaseMessaging
|
||||
Timer1.Initialize("Timer1", Interval * 1000)
|
||||
Timer1.Enabled = True
|
||||
@@ -54,6 +58,12 @@ Sub Service_Create
|
||||
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics") 'Para Push FirebaseMessaging
|
||||
End Sub
|
||||
|
||||
Private Sub BTAdmin_StateChanged (NewState As Int, OldState As Int)
|
||||
If logger Then Log("BT state changed: " & NewState)
|
||||
BluetoothState = NewState = BTAdmin.STATE_ON
|
||||
' StateChanged
|
||||
End Sub
|
||||
|
||||
Sub Service_Start (StartingIntent As Intent)
|
||||
Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
|
||||
Subs.revisaBD
|
||||
|
||||
Reference in New Issue
Block a user