mirror of
https://github.com/KeymonSoft/ADM.git
synced 2026-04-17 19:36:18 +00:00
- VERSION 5.08.22
- Cambios para que desde clienets y mapa aparezcan losbotones de inicio y fin venta
This commit is contained in:
@@ -57,6 +57,28 @@ Sub Globals
|
||||
Dim GoogleMapEXTRA As GoogleMapsExtras
|
||||
Dim CODIGO As String
|
||||
Private SEMANA As String
|
||||
Private p_transparenciaIniciaInicioFinVenta As Panel
|
||||
Private b_inicioVenta As Button
|
||||
Private b_finVenta As Button
|
||||
Private p_inicioFinVenta As Panel
|
||||
Private p_guardarPeso As Panel
|
||||
Private et_guardarPeso As EditText
|
||||
Private b_guardarPeso As Button
|
||||
Private p_botonesGuardarPeso As Panel
|
||||
Private b_noVenta As Button
|
||||
Private p_noVenta As Panel
|
||||
Private b_cancelaNoVenta As Button
|
||||
Private b_guardaNoVenta As Button
|
||||
Private p_botonesNoVenta As Panel
|
||||
Private Panel5 As Panel
|
||||
Private et_comentarioNoVenta As EditText
|
||||
Private r_opcion4 As RadioButton
|
||||
Private r_opcion3 As RadioButton
|
||||
Private r_opcion2 As RadioButton
|
||||
Private r_opcion1 As RadioButton
|
||||
Private l_NoVenta As Label
|
||||
Dim motivo As String
|
||||
Private l_venta As Label
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
@@ -64,6 +86,12 @@ Sub Activity_Create(FirstTime As Boolean)
|
||||
' If File.ExternalWritable Then
|
||||
' ruta = File.DirDefaultExternal
|
||||
' Else
|
||||
p_transparenciaIniciaInicioFinVenta.top = 0 : p_transparenciaIniciaInicioFinVenta.Left = 0
|
||||
p_transparenciaIniciaInicioFinVenta.Height = Activity.Height : p_transparenciaIniciaInicioFinVenta.Width = Activity.Width
|
||||
Subs.centraPanel(p_inicioFinVenta, Activity.Width)
|
||||
p_guardarPeso.Top = p_inicioFinVenta.top : p_guardarPeso.left = p_inicioFinVenta.left
|
||||
Subs.centraPanel(p_noVenta, Activity.Width)
|
||||
|
||||
ruta = File.DirInternal
|
||||
' End If
|
||||
If File.Exists(ruta, "kmt.db") = False Then
|
||||
@@ -120,6 +148,7 @@ Sub Activity_Create(FirstTime As Boolean)
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
Log("MAPA_RUTAS RESUME")
|
||||
Starter.rp.Check(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION)
|
||||
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
||||
If Result Then
|
||||
@@ -137,13 +166,29 @@ Sub Activity_Resume
|
||||
azul = 1
|
||||
rojo = 0
|
||||
todos = 0
|
||||
If Subs.nosQuedamosEnVenta Then
|
||||
Dim enVentaUsuario As String = ""
|
||||
Dim enVentaPagina As String = ""
|
||||
Private ev As Cursor = Starter.skmt.ExecQuery("select * from cat_variables where cat_va_descripcion = 'EN_VENTA_USUARIO' or cat_va_descripcion = 'EN_VENTA_PAGINA'")
|
||||
If ev.RowCount > 0 Then
|
||||
For i = 0 To ev.RowCount - 1
|
||||
ev.Position = i
|
||||
If ev.GetString("CAT_VA_DESCRIPCION") = "EN_VENTA_USUARIO" Then
|
||||
enVentaUsuario = ev.GetString("CAT_VA_VALOR")
|
||||
Else If ev.GetString("CAT_VA_DESCRIPCION") = "EN_VENTA_PAGINA" Then
|
||||
enVentaPagina = ev.GetString("CAT_VA_VALOR")
|
||||
End If
|
||||
Next
|
||||
ventaIniciada
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub MapFragment1_Ready
|
||||
Log("ENTRANDO MapFragment1_Ready")
|
||||
' Log("ENTRANDO MapFragment1_Ready")
|
||||
gmap = MapFragment1.GetMap
|
||||
gmap.IsInitialized
|
||||
'todos= 1
|
||||
' todos = 1
|
||||
'permisos
|
||||
|
||||
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
|
||||
@@ -154,7 +199,7 @@ Sub MapFragment1_Ready
|
||||
JavaMapsObject = gmap.GetUiSettings
|
||||
JavaMapsObject.RunMethod("setMapToolbarEnabled", Array As Object(True))
|
||||
'''''''----------------------------MARKER AZUL - POR VISITAR
|
||||
If azul = 1 Or todos = 1 Then
|
||||
If azul = 1 Or todos = 1 Then
|
||||
c.IsInitialized
|
||||
c=skmt.ExecQuery("select CAT_CL_CODIGO,CAT_CL_NOMBRE,CAT_CL_LAT,CAT_CL_LONG from kmt_info where gestion = 0 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 and CAT_CL_LAT <> ' ' and CAT_CL_LONG <> ' ' and CAT_CL_CODIGO <> 0 and CAT_CL_CODIGO <> 1")
|
||||
' skmt.Initialize(ruta,"kmt.db", True)
|
||||
@@ -181,7 +226,7 @@ Sub MapFragment1_Ready
|
||||
If MARK_AZUL.IsInitialized Then LIST_AZUL.Add(MARK_AZUL)
|
||||
End If
|
||||
'''''''----------------------------MARKER VERDE - VENTA
|
||||
If verde = 1 Or todos = 1 Then
|
||||
If verde = 1 Or todos = 1 Then
|
||||
c2.IsInitialized
|
||||
c2=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT from kmt_info where gestion = 2 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 and CAT_CL_CODIGO <> 0 and CAT_CL_CODIGO <> 1 UNION select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT from kmt_info2 where gestion = 2 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 and CAT_CL_CODIGO <> 0 and CAT_CL_CODIGO <> 1")
|
||||
Log($"============== Resultados = ${c2.RowCount}"$)
|
||||
@@ -198,7 +243,7 @@ Sub MapFragment1_Ready
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
If verde = 1 Or todos = 1 Then
|
||||
If verde = 1 Or todos = 1 Then
|
||||
c2.IsInitialized
|
||||
c2=skmt.ExecQuery("select CAT_CL_CODIGO, CAT_CL_NOMBRE,CAT_CL_LONG,CAT_CL_LAT from kmt_info where gestion = 2 and CAT_CL_LAT is not null and CAT_CL_LONG is not null and CAT_CL_LAT <> 0 and CAT_CL_LONG <> 0 and CAT_CL_CODIGO <> 0 and CAT_CL_CODIGO <> 1")
|
||||
Log($"============== Resultados = ${c2.RowCount}"$)
|
||||
@@ -257,8 +302,9 @@ Sub MapFragment1_Ready
|
||||
' If MARK_VERDE.Visible Or MARK_ROJO.Visible Then
|
||||
' MARK_CEDIS.Remove
|
||||
' End If
|
||||
' Log("Centramos camara " & LatitudRu & ", " & LongitudRU)
|
||||
Dim aa As CameraPosition
|
||||
aa.Initialize(LatitudRu,LongitudRU,15)''' RECOMENDABLE CAMBIAR A 10 PARA QUE SE VEAN MAS MARCADORES
|
||||
aa.Initialize(LatitudRu, LongitudRU, 15) ''' RECOMENDABLE CAMBIAR A 10 PARA QUE SE VEAN MAS MARCADORES
|
||||
gmap.AnimateCamera(aa)
|
||||
|
||||
'''''---------------------- ESTO ES PARA LOS CLICK EN LAS VENTANAS D INFORMACION-----------
|
||||
@@ -267,18 +313,32 @@ Sub MapFragment1_Ready
|
||||
GoogleMapEXTRA.SetOnInfoWindowClickListener(gmap, OnInfoWindowClickListener1)
|
||||
|
||||
End Sub
|
||||
'
|
||||
|
||||
''''-------------------------- PRUEBA CON MARKER _CLICK
|
||||
|
||||
|
||||
Sub OnInfoWindowClickListener1_click(Marker1 As Marker)
|
||||
Log("Tooltip clicked")
|
||||
skmt.ExecNonQuery("delete from CUENTAA")
|
||||
skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?) ", Array As Object(Marker1.Title))
|
||||
Activity.Finish
|
||||
' Activity.Finish
|
||||
Starter.pre_viejo = Subs.traeTotalClientepreventaparacredito
|
||||
B4XPages.ShowPage("Cliente")
|
||||
l_venta.Text = "Presiona el boton de ""Iniciar"" para inicar la venta"
|
||||
b_inicioVenta.Enabled = True
|
||||
b_finVenta.Enabled = False
|
||||
p_transparenciaIniciaInicioFinVenta.Visible = True
|
||||
' B4XPages.ShowPage("Cliente")
|
||||
End Sub
|
||||
|
||||
Sub ventaIniciada
|
||||
Log("Tooltip clicked")
|
||||
' skmt.ExecNonQuery("delete from CUENTAA")
|
||||
' skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?) ", Array As Object(Marker1.Title))
|
||||
' Activity.Finish
|
||||
Starter.pre_viejo = Subs.traeTotalClientepreventaparacredito
|
||||
b_inicioVenta.Enabled = False
|
||||
b_finVenta.Enabled = True
|
||||
p_transparenciaIniciaInicioFinVenta.Visible = True
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Parametro As Location)
|
||||
MARK_CEDIS.IsInitialized
|
||||
@@ -305,15 +365,13 @@ Sub Activity_Pause (UserClosed As Boolean)
|
||||
GPS.Stop
|
||||
End Sub
|
||||
|
||||
|
||||
Sub B_TODOS_Click
|
||||
todos =1
|
||||
verde = 0
|
||||
azul = 0
|
||||
rojo = 0
|
||||
|
||||
gmap.Clear
|
||||
MapFragment1_Ready
|
||||
|
||||
End Sub
|
||||
|
||||
Sub B_VERDE_Click
|
||||
@@ -323,7 +381,6 @@ Sub B_VERDE_Click
|
||||
todos = 0
|
||||
gmap.Clear
|
||||
MapFragment1_Ready
|
||||
|
||||
End Sub
|
||||
|
||||
Sub B_ROJO_Click
|
||||
@@ -332,9 +389,7 @@ Sub B_ROJO_Click
|
||||
azul = 0
|
||||
todos = 0
|
||||
gmap.Clear
|
||||
|
||||
MapFragment1_Ready
|
||||
|
||||
End Sub
|
||||
|
||||
Sub B_AZUL_Click
|
||||
@@ -343,7 +398,127 @@ Sub B_AZUL_Click
|
||||
rojo = 0
|
||||
todos = 0
|
||||
gmap.Clear
|
||||
|
||||
MapFragment1_Ready
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub b_inicioVenta_Click
|
||||
b_inicioVenta.Enabled = False
|
||||
et_guardarPeso.Text = ""
|
||||
r_opcion1.Checked = True
|
||||
r_opcion2.Checked = False
|
||||
r_opcion3.Checked = False
|
||||
r_opcion4.Checked = False
|
||||
b_finVenta.Enabled = True
|
||||
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta, "Inicia Venta", Subs.traeCliente, Subs.fechanormal(DateTime.Now), "", Starter.lat_gps, Starter.lon_gps, "2", "", "", "")
|
||||
Starter.enVenta = True
|
||||
Subs.enVenta(1, "MAPA")
|
||||
l_venta.Text = "Ve a tu app de venta y cuando termines regresa aqui y presiona el botón para ingresar ""Peso"" o ""No Venta"""
|
||||
LogColor($">>>>>> INICIA VENTA: ${Starter.enVenta} - ${Subs.traeCliente}"$, Colors.red)
|
||||
End Sub
|
||||
|
||||
Private Sub b_finVenta_Click
|
||||
p_guardarPeso.Visible = True
|
||||
' b_inicioVenta.Enabled = True
|
||||
' b_finVenta.Enabled = False
|
||||
End Sub
|
||||
|
||||
Private Sub p_transparenciaIniciaInicioFinVenta_Click
|
||||
Log("Fondo clicked")
|
||||
If b_finVenta.Enabled = False Then
|
||||
p_transparenciaIniciaInicioFinVenta.Visible = False
|
||||
Else
|
||||
ToastMessageShow($"Es necesario presionar "Terminar" para poder continuar"$, True)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Activity_KeyPress (key As Int) As Boolean
|
||||
' BACK key pressed
|
||||
If key=KeyCodes.KEYCODE_BACK Then
|
||||
' I want to capture the key here so I return True
|
||||
'StartActivity(Main)
|
||||
If p_transparenciaIniciaInicioFinVenta.Visible = True Then
|
||||
If b_finVenta.Enabled = False Then
|
||||
p_transparenciaIniciaInicioFinVenta.Visible = False
|
||||
Else
|
||||
ToastMessageShow($"Es necesario presionar "Terminar" para poder continuar"$, True)
|
||||
End If
|
||||
Return True ' Ya no hace nada aparte de ocultar el panel.
|
||||
End If
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
' Returning False signals the system to handle the key
|
||||
' Return True
|
||||
End Sub
|
||||
|
||||
Private Sub b_guardarPeso_Click
|
||||
If et_guardarPeso.Text <> "" And et_guardarPeso.Text <> "0" And IsNumber(et_guardarPeso.Text) Then
|
||||
Private peso As Double = et_guardarPeso.Text
|
||||
et_guardarPeso.Text = peso
|
||||
|
||||
Subs.guardaPeso("VENTA", Subs.traeAlmacen, Subs.traeRuta2(Subs.traeCliente), Subs.traeUsuarioDeBD, Subs.traeCliente, peso, "", "")
|
||||
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta, "Termina Venta", Subs.traeCliente, "", Subs.fechanormal(DateTime.Now), Starter.lat_gps, Starter.lon_gps, 2, "", "", $"Venta:${et_guardarPeso.text}"$)
|
||||
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Starter.enVenta = False
|
||||
Subs.enVenta(0, "")
|
||||
|
||||
p_guardarPeso.Visible = False
|
||||
p_transparenciaIniciaInicioFinVenta.Visible = False
|
||||
b_inicioVenta.Enabled = True
|
||||
b_finVenta.Enabled = False
|
||||
End If
|
||||
gmap.Clear
|
||||
todos = 1
|
||||
MapFragment1_Ready
|
||||
End Sub
|
||||
|
||||
Private Sub p_guardarPeso_Click
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub et_guardarPeso_TextChanged (Old As String, New As String)
|
||||
If Old <> New And IsNumber(New.trim) And New.trim <> "0" Then
|
||||
b_guardarPeso.Enabled = True
|
||||
Else
|
||||
b_guardarPeso.Enabled = False
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub b_noVenta_Click
|
||||
p_noVenta.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub b_guardaNoVenta_Click
|
||||
If r_opcion1.Checked Then
|
||||
motivo = "CERRADO"
|
||||
Else If r_opcion2.Checked Then
|
||||
motivo = "NO COMPRA"
|
||||
Else If r_opcion3.Checked Then
|
||||
motivo = "CON PRODUCTO"
|
||||
Else
|
||||
motivo = "NO ESTA EL ENCARGADO"
|
||||
End If
|
||||
DateTime.DateFormat="yy-MM-dd HH:mm:ss"
|
||||
Dim fecha As String=DateTime.Date(DateTime.Now)
|
||||
|
||||
Subs.guardaPeso("NO VENTA", Subs.traeAlmacen, Subs.traeRuta2(Subs.traeCliente), Subs.traeUsuarioDeBD, Subs.traeCliente, "0", motivo, et_comentarioNoVenta.text)
|
||||
Subs.bitacora(Subs.fechanormal(DateTime.Now), Subs.traeUsuarioDeBD, Subs.traeAlmacen, Subs.traeRuta, "No Venta", Subs.traeCliente, "", Subs.fechanormal(DateTime.Now), Starter.lat_gps, Starter.lon_gps, 2, motivo, et_comentarioNoVenta.text, $"Venta:${et_guardarPeso.text}"$)
|
||||
Starter.enVenta = False
|
||||
Subs.enVenta(0, "")
|
||||
|
||||
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
p_noVenta.Visible = False
|
||||
p_guardarPeso.Visible = False
|
||||
p_transparenciaIniciaInicioFinVenta.Visible = False
|
||||
gmap.Clear
|
||||
todos = 1
|
||||
MapFragment1_Ready
|
||||
End Sub
|
||||
|
||||
Private Sub b_cancelaNoVenta_Click
|
||||
p_noVenta.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Sub p_inicioFinVenta_Click
|
||||
|
||||
End Sub
|
||||
Reference in New Issue
Block a user