- VERSION 4.11.13

- El respaldo diario ahora respalda tambien CAT_VARIABLES.
- Al restaurar el respaldo, nos manda un mensaje con la fecha del respaldo que se va a restaurar.
This commit is contained in:
Jose Alberto Guerra Ugalde
2024-11-14 15:38:42 -06:00
parent d2de3ef658
commit 3da89e861d
5 changed files with 155 additions and 42 deletions

View File

@@ -336,6 +336,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
Else
ToastMessageShow("Sin permisos para GPS", True)
End If
Log("***********************************************")
MES1.Initialize(Me, "MES1")
' Log("SDK: " & device.SdkVersion)
' Get the device SDK version
@@ -363,7 +364,10 @@ Private Sub B4XPage_Created (Root1 As B4XView)
Wait For MES_StorageAvailable
End If
End If
Log(MES1.IsInitialized)
Log(MES1.HasPermission)
Log("***********************************************")
MES1.Initialize(Me, "MES1")
' Log("Permisos BT: " & rp.Check("android.permission.BLUETOOTH_CONNECT"))
' Log("REVISAMOS PERMISOS DE BT")
' rp.CheckAndRequest("android.permission.BLUETOOTH_CONNECT")
@@ -375,10 +379,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
End Sub
Sub B4XPage_Appear
If MES1.IsInitialized Then
LogColor(MES1.HasPermission, Colors.Magenta)
If MES1.HasPermission Then kh.revisaSiExisteRespaldo
End If
Log(">>>>>> INICIAMOS MAIN PAGE <<<<<<<<<")
kh.RD_Init
kh.SetButtonTintList(cb_geocerca, Colors.LightGray, Colors.RGB(43, 154, 211))
kh.SetButtonTintList(cb_cartaPorte, Colors.LightGray, Colors.RGB(43, 154, 211))
@@ -446,6 +447,12 @@ Sub B4XPage_Appear
cmd.Name = "select_fecha"
' cmd.Parameters = Array As Object(Null)
reqManager.ExecuteQuery(cmd , 0, "fecha")
Log("############### APPEAR PAGE ####################")
Log(MES1.IsInitialized)
If MES1.IsInitialized Then
LogColor("Permisos de almacenamiento: " & MES1.HasPermission, Colors.Magenta)
If MES1.HasPermission Then kh.revisaSiExisteRespaldo
End If
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
@@ -739,7 +746,7 @@ Private Sub p_cargaLocal_Click
End Sub
'Recibe la contraseña para la carga local -> "CL" + diaMes * 3 + numMes * 4
'Ej: para el 5 de agosto serìa : CL1532
'Ej: Si por ejemplo, hoy es 5 de agosto, ponemos : CL1532
'Si se agrega un numero despues de la contraseña, lo toma como los dia hacia atras para tomar el dìa de respaldo.
'Ej: CL1532-2 Serìa restaurar el respaldo del dìa 3 de agosto (5-2), puede haber espacios entre la clave y el numero de dìas.
Private Sub b_cargaLocalOk_Click
@@ -748,9 +755,10 @@ Private Sub b_cargaLocalOk_Click
p_cargaLocal.Visible = False
' Log(et_cargaLocal.Text.Length > pass1.Length)
' RD_fechaRestauracion - Si esta en blanco, la fecha de restauracion es HOY, si no, es la especificada en "ticks".
kh.RD_fechaRestauracion = ""
' kh.RD_fechaRestauracion = DateTime.now 'Se va a restaurar el respaldo de la fecha de HOY
' Si a la contraseña se le agrega un -1 o -2, aqui se procesa para saber de cuantos dias antes traemos el respaldo.
If et_cargaLocal.Text.Length > pass1.Length Then
Private dias As String = et_cargaLocal.Text.SubString(pass1.Length).Trim
' Log("|" & dias & "|")
@@ -759,18 +767,26 @@ Private Sub b_cargaLocalOk_Click
p.Days = dias
Dim nextdate As Long = DateUtils.AddPeriod(DateTime.Now, p)
kh.RD_fechaRestauracion = nextdate
Log($"Next date: $Date{nextdate}"$) ' Next date: 20231018
Log($"Restauramos respaldo de fecha: $Date{nextdate}"$)
Else
Log("NOT NUMBER")
End If
End If
DateTime.DateFormat = "YYYY-MMM-dd"
Private fechaRes As String = DateTime.Date(DateTime.now)
If kh.RD_fechaRestauracion <> "" Then fechaRes = DateTime.Date(kh.RD_fechaRestauracion)
Msgbox($"Se va a restaurar el respaldo de la fecha: ${fechaRes}"$, "AVISO")
kh.revisaRkmtAttached
kh.RD_restaura_cat_gunaprod
kh.RD_restaura_cat_variables
kh.RD_restaura_cat_gunaprod2
kh.RD_restaura_cat_detalle_paq
kh.RD_restaura_kmt_info
kh.RD_restaura_promos_comp
kh.RD_restaura_kmt_info
ime.HideKeyboard
' DateTime.DateFormat = "yyyyMMdd"
' Starter.skmt.ExecNonQuery($"update USUARIOA set fecha = '${DateTime.Date(DateTime.Now)}'"$)
@@ -890,18 +906,18 @@ Sub CreateCommand(Name As String, Parameters() As Object) As DBCommand
End Sub
Sub GetFecha
' Dim req As DBRequestManager = CreateRequest
' Dim cmd As DBCommand = CreateCommand("select_fecha", Array(Null))
' Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
' If j.Success Then
' req.HandleJobAsync(j, "req")
' Wait For (req) req_Result(res As DBResult)
' 'work with result
' req.PrintTable(res)
' Else
' Log("ERROR: " & j.ErrorMessage)
' End If
' j.Release
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("select_fecha", Array(Null))
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJob(j)
Wait For (req) req_Result(res As DBResult)
'work with result
req.PrintTable(res)
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
End Sub
Private Sub ImageView1_LongClick