mirror of
https://github.com/KeymonSoft/kms_helperSubs.git
synced 2026-04-17 21:06:17 +00:00
26/9/23 - Commit inicial.
This commit is contained in:
@@ -14,16 +14,58 @@ Sub Class_Globals
|
||||
Dim safePath As String
|
||||
Dim fechaHoy As String
|
||||
Dim skmtAttached As Boolean = False
|
||||
Dim MES1 As ManageExternalStorage
|
||||
Dim device As Phone
|
||||
Dim rp As RuntimePermissions
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize (vCallback As Object, vEventName As String) As Object
|
||||
EventName = vEventName
|
||||
CallBack = vCallback
|
||||
obtenPermisosAlmacenamientoExterno
|
||||
dbInit
|
||||
' Log("************************** " & safePath)
|
||||
If MES1.HasPermission Then initRKMT
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
'Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
' Root = Root1
|
||||
' 'load the layout to Root
|
||||
'End Sub
|
||||
|
||||
'Obtenemos permisos de escritura para el almacenamiento externo.
|
||||
Sub obtenPermisosAlmacenamientoExterno
|
||||
' Log("Permisos MES")
|
||||
MES1.Initialize(Me, "MES1")
|
||||
' get the device SDK version
|
||||
Dim SdkVersion As Int = device.SdkVersion
|
||||
' Choose which permission to request in order to access external storgage
|
||||
If SdkVersion < 30 Then
|
||||
' Log("SDK = " & SdkVersion & " : Requesting WRITE_EXTERNAL_STORAGE permission")
|
||||
Dim rp As RuntimePermissions
|
||||
rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE) ' Implicit read capability if granted
|
||||
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
||||
' Log($"PERMISSION_WRITE_EXTERNAL_STORAGE = ${Result}"$)
|
||||
Else
|
||||
' Log("SDK = " & SdkVersion & " : Requesting MANAGE_EXTERNAL_STORAGE permission")
|
||||
' Log("On Entry MANAGE_EXTERNAL_STORAGE = " & MES1.HasPermission)
|
||||
If Not(MES1.HasPermission) Then
|
||||
MsgboxAsync("This app requires access to all files, please enable the option", "Manage All Files")
|
||||
Wait For Msgbox_Result(Res As Int)
|
||||
' Log("Getting permission")
|
||||
MES1.GetPermission
|
||||
Wait For MES1_StorageAvailable
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Inicializamos la base de datos de respaldoDiario.
|
||||
Sub initRKMT
|
||||
Dim Dirp As String = File.DirRootExternal
|
||||
Dim Dir As String
|
||||
' Dim Dir2 As String
|
||||
Try
|
||||
File.MakeDir(Dirp,"/kmts")
|
||||
Dir = "/kmts"
|
||||
@@ -37,7 +79,7 @@ Public Sub Initialize (vCallback As Object, vEventName As String) As Object
|
||||
skmt.Initialize(File.DirInternal,"kmt.db", False)
|
||||
' rkmt.ExecNonQuery($"create table if not exists pedidos (pe_folio NUMERIC, pe_desc NUMERIC, pe_costo_sin TEXT, pe_ruta TEXT, pe_cedis TEXT, pe_costo_tot NUMERIC, pe_costou NUMERIC, pe_cant NUMERIC, pe_pronombre TEXT, pe_proid TEXT, pe_cliente TEXT, pe_fecha TEXT, pe_usuario TEXT, pe_envio_ok TEXT)"$)
|
||||
' rkmt.ExecNonQuery($"create table if not exists inventarios (cat_gp_iniciativa TEXT, cat_gp_tipoprod TEXT, cat_gp_dev TEXT, cat_gp_almacen NUMERIC, cat_gp_id TEXT, cat_gp_nombre TEXT, cat_gp_imp1 TEXT, cat_gp_imp2 TEXT, cat_gp_precio TEXT, cat_gp_clasif TEXT, cat_gp_sts TEXT, cat_gp_tipo TEXT, cat_gp_subtipo TEXT, cat_gp_tipoprod2 TEXT, fecha TEXT)"$)
|
||||
'' rkmt.ExecNonQuery($"create table if not exists inventarios2 (cat_gp_iniciativa TEXT, cat_gp_tipoprod TEXT, cat_gp_dev TEXT, cat_gp_almacen NUMERIC, cat_gp_id TEXT, cat_gp_nombre TEXT, cat_gp_imp1 TEXT, cat_gp_imp2 TEXT, cat_gp_precio TEXT, cat_gp_clasif TEXT, cat_gp_sts TEXT, cat_gp_tipo TEXT, cat_gp_subtipo TEXT, cat_gp_tipoprod2 TEXT, fecha TEXT)"$)
|
||||
'' rkmt.ExecNonQuery($"create table if not exists inventarios2 (cat_gp_iniciativa TEXT, cat_gp_tipoprod TEXT, cat_gp_dev TEXT, cat_gp_almacen NUMERIC, cat_gp_id TEXT, cat_gp_nombre TEXT, cat_gp_imp1 TEXT, cat_gp_imp2 TEXT, cat_gp_precio TEXT, cat_gp_clasif TEXT, cat_gp_sts TEXT, cat_gp_tipo TEXT, cat_gp_subtipo TEXT, cat_gp_tipoprod2 TEXT, fecha TEXT)"$)
|
||||
' rkmt.ExecNonQuery($"create table if not exists paquetes (cat_dp_precio_simptos TEXT, cat_dp_precio TEXT, cat_dp_almacen TEXT, cat_dp_id TEXT, cat_dp_idprod TEXT, cat_dp_tipo TEXT, cat_dp_pzas TEXT, cat_dp_usuario TEXT, cat_dp_fecha TEXT, cat_dp_regalo TEXT, cat_dp_clasif TEXT, fecha TEXT)"$)
|
||||
If chkIfTableExists(skmt, "PEDIDO") Then rkmt.ExecNonQuery($"create table if not exists PEDIDO (${getTableColumnList(skmt, "PEDIDO")}, FECHA TEXT)"$)
|
||||
If chkIfTableExists(skmt, "CAT_DETALLES_PAQ") Then rkmt.ExecNonQuery($"create table if not exists CAT_DETALLES_PAQ (${getTableColumnList(skmt, "CAT_DETALLES_PAQ")}, FECHA TEXT)"$)
|
||||
@@ -46,15 +88,8 @@ Public Sub Initialize (vCallback As Object, vEventName As String) As Object
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
fechaHoy = DateTime.Date(DateTime.Now)
|
||||
revisaSkmtAttached
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
'Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
' Root = Root1
|
||||
' 'load the layout to Root
|
||||
'End Sub
|
||||
|
||||
'Revisa si esta montada "kmt.db" como "skmt1" y si no, la monta
|
||||
'Para que "rkmt" vea a "skmt", es necesario montarla (attach).
|
||||
Sub revisaSkmtAttached
|
||||
|
||||
Reference in New Issue
Block a user