19/10/23 - Se agregó bitacora a entrada y salida de cliente

This commit is contained in:
2023-10-19 14:18:17 -06:00
parent 39b92d3a73
commit 7fba23f398
8 changed files with 89 additions and 48 deletions

View File

@@ -59,7 +59,7 @@ Sub Class_Globals
Dim la_col As Label
Dim la_cp As Label
Dim la_zona As Label
Dim gest As Button
' Dim gest As Button
Dim la_saldotot As Label
Dim la_saldooper As Label
Dim b_noVenta As Button
@@ -74,9 +74,9 @@ Sub Class_Globals
Dim l_entre2 As Label
Dim l_atiende As Label
Dim l_atiende2 As Label
Dim DATOS As Button
' Dim DATOS As Button
Dim Guardar As Button
Dim NUEVO As Button
' Dim NUEVO As Button
Dim l_total As Label
Dim c2 As Cursor
Dim S2 As Cursor
@@ -87,7 +87,7 @@ Sub Class_Globals
Private META As String
Private META2 As String
Private VERIFICA As String
Private L_QR As Label
' Private L_QR As Label
Private BT_QR As Button
Private qr As QRCode
Dim sc As Zxing_scanner
@@ -101,7 +101,7 @@ Sub Class_Globals
Dim sucursal As String
Dim FACTURA As String
Dim CREDITO As String
Private b_factura As Button
' Private b_factura As Button
Dim perfil As String
Private CH_TA As CheckBox
Private CH_TC As CheckBox
@@ -110,7 +110,7 @@ Sub Class_Globals
Private E_CUANTOS_E As EditText
Private B_GUARDAR As Button
Private TIPOEX As String
Private B_EXIBI As Button
' Private B_EXIBI As Button
Private Panel1 As Panel
Dim t3 As Timer
'--***---- BOLETA DE LIQUIDACION
@@ -277,6 +277,8 @@ Sub Class_Globals
Private BP_DOE_R1 As Button
Dim RMI_VALOR As String
Dim errorImpresora As Int = 0
Private b_inicioFinVenta As Button
dim dentroDeGeocerca as Boolean = False
End Sub
'You can add more parameters here.
@@ -361,11 +363,19 @@ End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub B4XPage_Appear
Log(Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
' Log(Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
b_inicioFinVenta.Text = "INICIAR VENTA"
b_inicioFinVenta.BringToFront
If Not(Starter.enVenta) Then
b_inicioFinVenta.Visible = True
' Log("EnVenta Visible")
Else
' Log("EnVenta NO Visible")
b_inicioFinVenta.Visible = False
End If
reqManager.Initialize(Me, Starter.DBReqServer)
' Log(Subs.traeUltimaActividadBD)
Subs.panelVisibleCompleto(P_INF_GENERAL, Root)
' P_INF_GENERAL.Height = Root.Height
' P_INF_GENERAL.Width = Root.Width
c=Starter.skmt.ExecQuery2("select CAT_VA_VALOR from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("MACIMP"))
@@ -379,7 +389,8 @@ Sub B4XPage_Appear
Starter.MAC_IMPRESORA = MAC_IMPRESORA
et_geopass.Text = ""
If Subs.traeUltimaActividadBD <> "Cliente" Then Subs.iniciaActividad(Subs.traeUltimaActividadBD)
If Not(muestraBoleta) Then P_INF_GENERAL.Visible = True
Log($"MUESTRA BOLETA ${muestraBoleta}"$)
If Not(muestraBoleta) Then Subs.panelVisibleCompleto(P_INF_GENERAL, Root)
p_pideGeoPass.Visible = False
' If Logger Then Log(muestraBoleta)
CallSubDelayed(Tracker, "StartFLP2")
@@ -394,7 +405,7 @@ Sub B4XPage_Appear
End If
If muestraBoleta Then LLAMA_BOLETA
BT_QR.Enabled = False
b_factura.Visible = False
' b_factura.Visible = False
Panel_INV_A.Visible = False
CREDITO_DISPONIBLE =0
If Starter.boleta = 0 Then
@@ -457,17 +468,17 @@ Sub B4XPage_Appear
If CREDITO = "1" Then
Msgbox("ALTO","A este cliente no se le puede vender ya que tienen adeudo en su crédito") 'ignore
B_VENTA.Visible = False
gest.Visible = False
' gest.Visible = False
Else
B_VENTA.Visible = True
gest.Visible = True
' gest.Visible = True
End If
' Msgbox(c.GetString("CAT_CL_NUM_SERIEFISICO"),"AVISO")
If c.GetString("CAT_CL_NUM_SERIEFISICO") = "0" Then
L_QR.Visible = True
Else
L_QR.Visible = False
End If
' If c.GetString("CAT_CL_NUM_SERIEFISICO") = "0" Then
' L_QR.Visible = True
' Else
' L_QR.Visible = False
' End If
S2=Starter.skmt.ExecQuery("select count(*) AS CUANTOS from HIST_VENTAS WHERE HVD_CLIENTE IN (Select CUENTA from cuentaa)")
S2.Position =0
CUANTOS = S2.GetString("CUANTOS")
@@ -493,7 +504,7 @@ Sub B4XPage_Appear
la_saldooper.Text = META2
c=Starter.skmt.ExecQuery("SELECT COUNT(*) AS CUANTOS FROM HIST_CLIENTE_CANT_PROMOS WHERE HCCP_CLIENTE IN (Select cuenta from cuentaa)")
c.Position =0
If c.GetString("CUANTOS") > 0 Then
If c.GetString("CUANTOS") > 0 Then
C1=Starter.skmt.ExecQuery("SELECT HCCP_PROMO FROM HIST_CLIENTE_CANT_PROMOS WHERE HCCP_CLIENTE IN (Select cuenta from cuentaa) ")
C1.Position = 0
C3=Starter.skmt.ExecQuery2("SELECT COUNT(*) AS CUANTOS FROM CAT_GUNAPROD2 WHERE CAT_GP_ID = ? ", Array As String(C1.GetString("HCCP_PROMO")))
@@ -502,10 +513,10 @@ Sub B4XPage_Appear
If C3.GetString("CUANTOS") > 0 Then
c2=Starter.skmt.ExecQuery2("SELECT CAT_GP_NOMBRE FROM CAT_GUNAPROD2 WHERE CAT_GP_ID = ? ", Array As String(C1.GetString("HCCP_PROMO")))
c2.Position = 0
MsgboxAsync("El cliente tiene derecho a una promo especial "& c2.GetString("CAT_GP_NOMBRE"),"Aviso") 'ignore
If Not(Subs.hayPedido) Then MsgboxAsync("El cliente tiene derecho a una promo especial "& c2.GetString("CAT_GP_NOMBRE"),"Aviso") 'ignore
c2.Close
Else
MsgboxAsync("El cliente tiene derecho a una promo especial ","Aviso") 'ignore
If Not(Subs.hayPedido) Then MsgboxAsync("El cliente tiene derecho a una promo especial ","Aviso") 'ignore
End If
End If
C3.Close
@@ -521,7 +532,7 @@ Sub B4XPage_Appear
Else
Cuestionario
End If
Log("IMPRESO:" & Subs.revisaImpresa)
Log("IMPRESO: " & Subs.revisaImpresa)
If YA_IMPRIMIO2 = 0 Then
Guardar.Visible = False
Else
@@ -545,7 +556,7 @@ Sub B4XPage_Appear
End If
If l_total.Text <> Null And mPromoEspecial.Get("montoPromo") <> Null And l_total.text >= mPromoEspecial.Get("montoPromo") Then
If logger Then Log("Promo Autorizada")
res = Msgbox2("Pomocion '" & mPromoEspecial.Get("descrPromo") & "' disponible.\nSi se otorga la promoción ya NO será posible modificar la venta.", "PROMO DISPONIBLE", "Si", "", "No", Null) 'ignore
res = Msgbox2("Promocion '" & mPromoEspecial.Get("descrPromo") & "' disponible.\nSi se otorga la promoción ya NO será posible modificar la venta.", "PROMO DISPONIBLE", "Si", "", "No", Null) 'ignore
If res = DialogResponse.POSITIVE Then
If logger Then Log("Promocion aceptada.")
If logger Then Log($"${mPromoEspecial.Get("idProd")}, ${mPromoEspecial.Get("idPromo")}, ${mPromoEspecial.Get("cantProd")}, ${mPromoEspecial.Get("nombreProd")}, ${mPromoEspecial.Get("descrPromo")}, ${la_cuenta.Text}, ${usuario}, ${ruta_tienda}"$)
@@ -619,7 +630,6 @@ Sub B4XPage_Appear
' Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation)
End If
muestraBoleta = False
' Log(Subs.revisaImpresa)
If l_total.text <> "null" And l_total.text <> "" And l_total.text <> Null Then
B_IMP2.Enabled = True
@@ -678,7 +688,13 @@ Sub GPS_LocationChanged (Location1 As Location)
End If
laDist= Location1.DistanceTo(ubicacionTienda)
l_ubicacion2.Text = $"Dist: $1.0{laDist} mts."$
If laDist > 300 Then l_ubicacion2.TextColor = Colors.Red Else l_ubicacion2.TextColor = Colors.Black
If laDist > 300 Then
l_ubicacion2.TextColor = Colors.Red
dentroDeGeocerca = False
Else
l_ubicacion2.TextColor = Colors.Black
dentroDeGeocerca = True
End If
'''' GEO CERCA
'''' esto es para la geocerca validar tambien el las variables del whats y del no venta que las borra si existe venta
@@ -696,7 +712,7 @@ Sub GPS_LocationChanged (Location1 As Location)
Dim distance As Long
distance = l1.DistanceTo(l2) ' resultado en metros
gest.Visible = True
' gest.Visible = True
' gps_boton_doe ="1"
' LogColor($"Distancia actual: ${distance}"$, Colors.Blue)
If distance <= 5000000 Or usuario = "KMTSKLL1" Or la_cuenta.Text = "0" Then
@@ -718,7 +734,7 @@ End Sub
Sub gest_Click
Starter.tipov = "PREVENTA"
Subs.iniciaActividad("Productos")
' Subs.iniciaActividad("Productos")
End Sub
Sub b_noVenta_Click
@@ -728,6 +744,7 @@ End Sub
Private Sub B4XPage_CloseRequest As ResumableSub
' BACK key pressed
'Return True to close, False to cancel
muestraBoleta = False
If PNL_TOTALES.Visible Then
PNL_TOTALES.Visible = False
P_BOLETA.Visible = False
@@ -816,12 +833,15 @@ Sub Guardar_Click
B4XPages.MainPage.productos.reiniciarlistaProds = True
B4XPages.MainPage.productos.prodsMap.Initialize
B4XPages.MainPage.promos.promosMap.Initialize
Subs.iniciaActividad("principal")
B4XPages.ShowPageAndRemovePreviousPages("Principal")
' Subs.iniciaActividad("principal")
' B4XPages.ShowPageAndRemovePreviousPages("Principal")
Guardar.SendToBack
b_inicioFinVenta.Text = "TERMINAR VENTA"
b_inicioFinVenta.Visible = True
End Sub
Sub NUEVO_Click
Subs.iniciaActividad("nuevocliente")
' Subs.iniciaActividad("nuevocliente")
End Sub
Sub HIST_Click
@@ -2126,9 +2146,9 @@ Sub B_GUARDAR_Click
ELSE If CH_TD.Checked = True Then
TIPOEX = "TIPO D"
End If
Panel1.Visible = False
B_EXIBI.Visible = True
b_factura.Visible = True
' Panel1.Visible = False
' B_EXIBI.Visible = True
' b_factura.Visible = True
HIST.Visible = True
c=Starter.skmt.ExecQuery("select CUENTA from cuentaa")
c.Position = 0
@@ -2137,10 +2157,10 @@ Sub B_GUARDAR_Click
End Sub
Sub B_EXIBI_Click
Panel1.Visible = True
B_EXIBI.Visible = False
b_factura.Visible = False
HIST.Visible = False
' Panel1.Visible = True
' B_EXIBI.Visible = False
' b_factura.Visible = False
' HIST.Visible = False
End Sub
'''''''''''''''''''''''''''''''''''''' BOLETA DE LIQUIDACION
@@ -2678,6 +2698,7 @@ Sub LBL_REGRESA_Click
End Sub
Sub B_Regresar_Click
muestraBoleta = False
' StartActivity("SELECCION")
Subs.iniciaActividad("principal")
' B4XPages.ShowPage("Principal")
@@ -2692,7 +2713,6 @@ Sub B_Regresar_Click
P_INF_GENERAL.Visible=True
If logger Then Log("Panel general="&P_INF_GENERAL.Visible)
LBL_REGRESA.Visible=False
End Sub
Sub IMG_IMPRESORA_Click
@@ -3406,6 +3426,7 @@ Sub B_CERRAR_I_Click
End Sub
Sub Bt_GuardarBoleta_Click
muestraBoleta = False
DateTime.DateFormat = "MM/dd/yyyy"
sDate=DateTime.Date(DateTime.Now)
sTime=DateTime.Time(DateTime.Now)
@@ -3419,6 +3440,7 @@ Sub Bt_GuardarBoleta_Click
' If Logger Then Log($"${RutaBoleta},${Id_Almacen},${EDT_CANMIL.Text},${EDT_CANQUIN.Text},${EDT_CANDOS.Text},${EDT_CANCIEN.Text},${EDT_CANCIN.Text},${EDT_CANVEIN.Text}"$)
' If Logger Then Log($"${RutaBoleta},${Id_Almacen},${EDT_CANVEINTE.Text},${EDT_CANDIEZ.Text},${EDT_CANCI.Text},${EDT_CANDO.Text},${EDT_CANUN.Text},${EDT_CANCEN.Text}"$)
Msgbox("Datos Guardados ","Listo") 'ignore
Subs.bitacora(usuario, Id_Almacen, ruta_tienda, "Llega a almacen", la_cuenta.text, Subs.fechanormal(DateTime.Now), "", Starter.lat_gps, Starter.lon_gps, "2", "", "")
End Sub
Sub B_E_NEXT_Click
@@ -3856,4 +3878,19 @@ Private Sub BP_DOE_R1_Click
' Starter.skmt.ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
Starter.skmt.ExecNonQuery("delete from pedido_DOE where pe_cliente in (Select CUENTA from cuentaa)")
p_doe.Visible = False
End Sub
Private Sub b_inicioFinVenta_Click
Private precision As Int = 0
If dentroDeGeocerca Then precision = 1
If Starter.enVenta Then
Subs.bitacora(usuario, Id_Almacen, ruta_tienda, "Termina Venta", la_cuenta.text, "", Subs.fechanormal(DateTime.Now), Starter.lat_gps, Starter.lon_gps, precision, "", "")
Starter.enVenta = False
Subs.iniciaActividad("principal")
B4XPages.ShowPageAndRemovePreviousPages("Principal")
Else
Subs.bitacora(usuario, Id_Almacen, ruta_tienda, "Inicia Venta", la_cuenta.text, Subs.fechanormal(DateTime.Now), "", Starter.lat_gps, Starter.lon_gps, precision, "", "")
Starter.enVenta = True
End If
b_inicioFinVenta.Visible = False
End Sub