Files
Intmex_Multiventa/B4A/C_NuevoCliente.bas
Jose Alberto Guerra Ugalde e40988de1c - VERSION 5.12.3
-Se agregaron las marcas por usuario.
2025-12-04 16:38:44 -06:00

618 lines
21 KiB
QBasic

B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=11.5
@EndOfDesignText@
'Sub Class_Globals
' Private Root As B4XView 'ignore
' Private xui As XUI 'ignore
'
' Dim g As GPS
' Dim ruta As String
' Dim c As Cursor
'
' Dim CANCELA As Button
' Dim GUARDA As Button
' Dim cuenta As String
' Dim usuario As String
' Dim sDate,sTime As String
' Dim no_cliente As String
' Dim no_ruta As String
'
' Dim r_4 As RadioButton
' Dim E_NOMBRE As EditText
' Dim tgl As Toggle
' Private l_sinUbicacion As Label
' Private p_nuevoCliente As Panel
' Private Label1 As Label
' Private p_botones As Panel
'End Sub
'
''You can add more parameters here.
'Public Sub Initialize As Object
' 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
' Root.LoadLayout("nuevocliente")
' ruta = File.DirInternal
' If File.Exists(ruta, "kmt.db") = False Then
' File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
' End If
'' skmt.Initialize(ruta,"kmt.db", True)
'End Sub
'
''You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
'
'Sub B4XPage_Appear
' E_NOMBRE.Text = ""
' If Not(Starter.gps.GPSEnabled) Then
' ToastMessageShow("Es necesario tener el GPS encendido", True)
' StartActivity(Starter.gps.LocationSettingsIntent)
' End If
' GUARDA.Visible = False
' Subs.panelVisible(p_nuevoCliente, 0, 0)
' p_nuevoCliente.Height = Root.Height
' p_nuevoCliente.Width = Root.Width
' Subs.centraEtiqueta(Label1, Root.Width)
' Subs.centraEtiqueta(l_sinUbicacion, Root.Width)
' Subs.centraPanel(p_botones, Root.Width)
' E_NOMBRE.Left = Round(Root.Width/2)-(E_NOMBRE.Width/2)
' If B4XPages.MainPage.lat_gps <> "0.0" Then
' GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
' l_sinUbicacion.Visible = False
' End If
'End Sub
'
'Sub GPS_LocationChanged (Location1 As Location)
' If B4XPages.MainPage.lat_gps <> "0.0" Then
' GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
' l_sinUbicacion.Visible = False
' End If
'End Sub
'
'Sub CANCELA_Click
' B4XPages.ShowPage("Principal")
'End Sub
'
'Sub GUARDA_Click
' If E_NOMBRE.Text = "" Then
' ToastMessageShow("Se tiene que nombrar la tienda para continuar" , True)
' Else
' DateTime.DateFormat = "MM/dd/yyyy"
' DateTime.Timeformat = "HHmmss"
' sDate=DateTime.Date(DateTime.Now)
' sTime=DateTime.Time(DateTime.Now)
' Log($" //////////// Date: ${sDate} - Time: ${sTime} ////////////////"$)
' 'Aqui creamos manualmete la hora con el separador de los 2 puntos porque en algunas versiones de android no respeta el formato "Timeformat = 'HH:mm:ss'"
' Private hora As String = sTime.SubString2(0,2)
' Private mins As String = sTime.SubString2(2,4)
' Private segs As String = sTime.SubString(4)
' sTime = hora&":"&mins&":"&segs
' Log("////////////// sTime: "&sTime&" ////////////////")
' c=B4XPages.MainPage.skmt.ExecQuery("select CAT_CL_RUTA FROM kmt_info")
' c.Position=0
' no_ruta= c.GetString("CAT_CL_RUTA")
' no_cliente= "N" & sTime & no_ruta
' Log("++ ++ no_cliente = "&no_cliente)
' c.Close
' B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO kmt_info(CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_MTOCOMPRA,CAT_CL_NUM_SERIEFISICO, gestion) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,0,0) ",Array As Object (no_cliente,no_ruta, E_NOMBRE.Text,"null","null","null","null","null","null","null","null","null","null","null","null","null",B4XPages.MainPage.lon_gps,B4XPages.MainPage.lat_gps))
' B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_STAY_STORE(HSS_CODIGO, HSS_IN , HSS_OUT , HSS_TOT) VALUES (?,0,0,0)", Array As Object (no_cliente))
' B4XPages.MainPage.skmt.ExecNonQuery("delete from CUENTAA")
' B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(no_cliente))
' B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CLIENTE_NUEVO(CN_ID_CLIENTE, CN_NOMBRE) VALUES (?,?)", Array As Object(no_cliente, E_NOMBRE.Text))
' B4XPages.ShowPage("Cliente")
' End If
'End Sub
'
'
'Private Sub p_nuevoCliente_Click
'
'End Sub
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Dim g As GPS
Dim ruta As String
Dim c As Cursor
Dim CANCELA As Button
Dim GUARDA As Button
Dim cuenta As String
Dim usuario As String
Dim sDate,sTime As String
Dim sDate2,sTime2 As String
Dim no_cliente As String
Dim no_ruta As String
Dim lista_punta As List
Dim r_4 As RadioButton
Dim E_NOMBRE As EditText
Dim tgl As Toggle
Private l_sinUbicacion As Label
Private p_nuevoCliente As Panel
Private Label1 As Label
Private p_botones As Panel
Private p_cam As Panel
Private p_camara As Panel
Private b_foto_inci As Button
' Private camEx2 As CameraExClass2
Dim frontCamera As Boolean = False
Dim fototomada As String = "0"
Dim ALMACEN As String
Private et_direccion As EditText
Private Label2 As Label
Dim lat As Double = 0
Dim lon As Double = 0
Private b_ubicacion As Label
Private Label3 As Label
Private cb_giro As B4XComboBox
Dim giros As String
Private L_Atiende As Label
Private ET_Atiende As EditText
Private Label5 As Label
Private et_colonia As EditText
Private et_telefono As EditText
Private et_cp As EditText
Private Label6 As Label
Dim cuantosNuevos As Int
Private p_transparenteCN As Panel
Private p_clientesNuevos As Panel
Private b_clienteNuevo As Button
Private l_textoCN As Label
End Sub
'You can add more parameters here.
Public Sub Initialize As Object
Return Me
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
' B4XPages.SetTitle(Me, $"${Subs.capitalizar(B4XPages.GetPageId(Me))} - ${Application.VersionName}"$)
Root = Root1
'load the layout to Root
Root.LoadLayout("nuevocliente")
ruta = File.DirInternal
If File.Exists(ruta, "kmt.db") = False Then
File.Copy(File.DirAssets, "kmt.db", ruta, "kmt.db")
End If
' skmt.Initialize(ruta,"kmt.db", True)
' p_camara.Height = Root.Height
' p_camara.Width = Root.Width
' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
' Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
' If Result Then
'' camEx2.Initialize(p_cam, frontCamera, Me, "Camera1")
'' frontCamera = camEx2.Front
' Log("inicializamos Camara")
' Else
' ToastMessageShow("Sin permisos de camara!!!", True)
' End If
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
If Result Then
Log("Con permisos para escritura")
Else
ToastMessageShow("Sin permisos de escritura!!!", True)
End If
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_READ_EXTERNAL_STORAGE)
Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
If Result Then
Log("Con permisos para escritura")
Else
ToastMessageShow("Sin permisos de lectura!!!", True)
End If
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub B4XPage_Appear
p_transparenteCN.Top = 0 : p_transparenteCN.Left = 0
p_transparenteCN.Width = Root.Width : p_transparenteCN.Height = Root.Height
et_direccion.Text = ""
E_NOMBRE.Text = ""
ET_Atiende.Text = ""
et_colonia.Text = ""
et_telefono.Text = ""
et_cp.Text = ""
If Not(Starter.gps.GPSEnabled) Then
ToastMessageShow("Es necesario tener el GPS encendido", True)
StartActivity(Starter.gps.LocationSettingsIntent)
End If
GUARDA.Visible = False
Subs.panelVisible(p_nuevoCliente, 0, 0)
p_nuevoCliente.Height = Root.Height
p_nuevoCliente.Width = Root.Width
Subs.centraEtiqueta(Label1, Root.Width)
Subs.centraEtiqueta(Label5, Root.Width)
Subs.centraEtiqueta(Label6, Root.Width)
Subs.centraEtiqueta(Label2, Root.Width)
Subs.centraEtiqueta(Label3, Root.Width)
Subs.centraEtiqueta(l_sinUbicacion, Root.Width)
Subs.centraEtiqueta(b_ubicacion, Root.Width)
Subs.centraPanel(p_botones, Root.Width)
E_NOMBRE.Left = Round(Root.Width/2)-(E_NOMBRE.Width/2)
et_cp.Left = Round(Root.Width/2)-(E_NOMBRE.Width/2)
et_colonia.Left = Round(Root.Width/2)-(et_colonia.Width/2)
et_direccion.Left = Round(Root.Width/2)-(et_direccion.Width/2)
If B4XPages.MainPage.lat_gps <> "0.0" Then
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
l_sinUbicacion.Visible = True
End If
cuantosNuevos = 0
Subs.centraPanel(p_clientesNuevos, Root.Width)
c = Starter.skmt.ExecQuery("select count(cat_cl_codigo) as cuantos from kmt_info where cat_cl_codigo like 'N%'")
If c.RowCount > 0 Then
c.Position = 0
cuantosNuevos = c.GetInt("cuantos")
End If
c.Close
Dim permitidos As Int = 0
c = Starter.skmt.ExecQuery("select ACTIVO from cn")
If c.RowCount > 0 Then
c.Position = 0
permitidos = c.GetInt("ACTIVO")
End If
c.Close
Log($"Permitidos: ${permitidos}, Actuales: ${cuantosNuevos}"$)
Log((permitidos > 0) & "|" & (permitidos > cuantosNuevos))
' If permitidos <> 0 Then ' Si permitidos es CERO entonces SIN LIMITE de clientes nuevos.
l_textoCN.Text = "Llegó al límite de clientes nuevos, ya no es posible agregar mas clientes."
If permitidos = 0 Then l_textoCN.Text = "No tienes permitido dar de alta clientes nuevos."
If permitidos > cuantosNuevos Then
p_transparenteCN.Visible = False
Else
p_transparenteCN.BringToFront
p_transparenteCN.Visible = True
End If
' End If
CallSubDelayed(Tracker, "Track")
CallSubDelayed(Tracker, "StartFLPSmall")
If Tracker.FLP.IsInitialized And Tracker.FLP.GetLastKnownLocation.IsInitialized Then 'Si tenemos "UltimaUbicaccionConocida" la usamos.
B4XPages.MainPage.lat_gps = Tracker.FLP.GetLastKnownLocation.Latitude
B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude
' Log($"Tenemos UUC: ${Tracker.FLP.GetLastKnownLocation.Latitude},${Tracker.FLP.GetLastKnownLocation.Longitude}"$)
GPS_LocationChanged(Tracker.FLP.GetLastKnownLocation)
End If
' lista_punta.Initialize
' Dim pol As Cursor = Starter.skmt.ExecQuery("SELECT LAT, LONG FROM POLIGONO")
' If pol.RowCount > 0 Then
'
' For poli = 0 To pol.RowCount -1
' pol.Position = poli
' Dim coords As LatLng
' coords.Initialize(pol.GetString("LAT"), pol.GetString("LONG"))
' lista_punta.Add(coords)
' Next
' End If
If Not(Starter.GPS.GPSEnabled) Then
ToastMessageShow("Debe Activar el GPS del Equipo.", True)
StartActivity(Starter.GPS.LocationSettingsIntent)
Else
Starter.GPS.Start(0, 0)
' If Starter.ubicacionActual.Latitude <> 0 Then GPS_LocationChanged(Starter.ubicacionActual)
End If
CallSubDelayed(Tracker, "StartFLPSmall")
c = Starter.skmt.ExecQuery("SELECT GIRO FROM CAT_GIRO order by 1")
Dim Items As List
Items.Initialize
Items.Add("SELECCIONA UNA OPCIÓN")
If c.RowCount > 0 Then
For i = 0 To c.RowCount-1
c.Position = i
Items.Add(c.GetString("GIRO"))
Next
cb_giro.SetItems(Items)
End If
giros = "SELECCIONA UNA OPCIÓN"
c.Close
End Sub
Sub GPS_LocationChanged (Location1 As Location)
If B4XPages.MainPage.lat_gps <> "0.0" Then
GUARDA.Visible = True 'Si hay ubicaccion, mostramos el boton de guardar.
l_sinUbicacion.Visible = True
lat = Location1.Latitude
lon = Location1.Longitude
l_sinUbicacion.Text = ("Latitud: " & lat & ", Longotud: "& lon)
End If
b_ubicacion.TextSize = 13
b_ubicacion.Text = $"Precisión GPS $1.0{Location1.Accuracy} m"$
If Location1.Accuracy > 200 Then
b_ubicacion.TextColor = Colors.Red
b_ubicacion.TextSize = 16
b_ubicacion.Text = $"Mala señal $1.0{Location1.Accuracy} m"$
End If
End Sub
'Sub InicializarGPSPreciso
' Dim gps1 As GPS
' gps1.Initialize("GPS")
'
' ' Usar Criteria para alta precisión
' Dim cr As Criteria
' cr.Accuracy = cr.ACCURACY_FINE
' cr.PowerRequirement = cr.POWER_HIGH
'
' gps1.Start(0, 0) ' Máxima frecuencia de actualización
'End Sub
Sub CANCELA_Click
B4XPages.ShowPage("Principal")
CallSubDelayed(Tracker, "StartFLP")
End Sub
Sub PointInPolygon(point As LatLng, polygon As List) As Boolean
Dim x As Double = point.Longitude
Dim y As Double = point.Latitude
Dim inside As Boolean = False
For i = 0 To polygon.Size - 1
Dim j As Int = (i + 1) Mod polygon.Size
Dim p1_1 As LatLng = polygon.Get(i)
Dim p2_1 As LatLng = polygon.Get(j)
Dim xi As Double = p1_1.Longitude
Dim yi As Double = p1_1.Latitude
Dim xj As Double = p2_1.Longitude
Dim yj As Double = p2_1.Latitude
Dim intersect As Boolean = ((yi > y) <> (yj > y)) And (x < (xj - xi) * (y - yi) / (yj - yi) + xi)
If intersect Then
inside = Not(inside)
End If
Next
Return inside
End Sub
Sub GUARDA_Click
' Dim mPoint As LatLng
' mPoint.Initialize(B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps)
'
'' If lista_punta.Size > 0 Then
'' Dim dentro As Boolean = PointInPolygon(mPoint, lista_punta)
''
'' If dentro Then
' ToastMessageShow("El punto está DENTRO del polígono", True)
B4XPages.ShowPage("NuevoCliente")
' Verifica si el nombre de la tienda está vacío
If E_NOMBRE.Text = "" Then
MsgboxAsync("Por favor captura el nombre de la Tienda","Atención")
' Verifica si la dirección tiene más de 3 caracteres
Else If et_direccion.Text.Length > 3 Then
' Verifica si la latitud es diferente de 0
If lat <> 0 Then
' Verifica si el giro del cliente está seleccionado
If giros <> "SELECCIONA UNA OPCIÓN" Or cb_giro.SelectedItem <> "SELECCIONA UNA OPCIÓN" Then
' Verifica si el encargado que atiende el negocio está capturado
If ET_Atiende.Text <> "" Then
If et_telefono.Text <> "" Then
If et_colonia.Text <> "" Then
If et_cp.Text <> "" Then
DateTime.DateFormat = "MM/dd/yyyy"
DateTime.Timeformat = "HHmmss"
sDate = DateTime.Date(DateTime.Now)
sTime = DateTime.Time(DateTime.Now)
Log($" //////////// Date: ${sDate} - Time: ${sTime} ////////////////"$)
' Aquí creamos manualmente la hora con el separador de los 2 puntos porque en algunas versiones de Android no respeta el formato "Timeformat = 'HH:mm:ss'"
Private hora As String = sTime.SubString2(0,2)
Private mins As String = sTime.SubString2(2,4)
Private segs As String = sTime.SubString(4)
sTime = hora & ":" & mins & ":" & segs
Dim Fechacliente() As String = Regex.Split("/",sDate)
Log("////////////// sTime: "&sTime&" ////////////////")
c = Starter.skmt.ExecQuery("select CAT_CL_RUTA FROM kmt_info")
c.Position = 0
no_ruta = c.GetString("CAT_CL_RUTA")
no_cliente = "N" & sTime & no_ruta
Log("++ ++ no_cliente = "&no_cliente)
c.Close
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_STAY_STORE(HSS_CODIGO, HSS_IN , HSS_OUT , HSS_TOT) VALUES (?,0,0,0)", Array As Object (no_cliente))
Starter.skmt.ExecNonQuery("delete from CUENTAA")
Starter.skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(no_cliente))
c = Starter.skmt.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
If c.RowCount > 0 Then
c.Position = 0
ALMACEN = c.GetString("ID_ALMACEN")
End If
c.Close
c = Starter.skmt.ExecQuery("select usuario from usuarioa")
c.Position = 0
usuario = c.GetString("USUARIO")
c.Close
' Starter.skmt.ExecNonQuery2("INSERT INTO HIST_FOTO_CLIENTE(CODIGO, ALMACEN, RUTA) VALUES(?,?,?)", Array As Object(no_cliente, ALMACEN, no_ruta))
' Starter.skmt.ExecNonQuery2("INSERT INTO NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_LAT,NV_LON,NV_NOMBRE,NV_DIRECCION) VALUES(?,?,?,?,?,?,?,?) ", Array As Object (no_cliente,sDate & sTime, usuario, "NUEVO CLIENTE", lat, lon, E_NOMBRE.Text,et_direccion.Text))
DateTime.DateFormat = "dd/MM/yyyy"
DateTime.Timeformat = "HH:mm:ss"
sDate2 = DateTime.Date(DateTime.Now)
sTime2 = DateTime.Time(DateTime.Now)
Log("AQUI")
Starter.skmt.ExecNonQuery2("INSERT INTO kmt_info(CAT_CL_CODIGO,CAT_CL_RUTA,CAT_CL_NOMBRE,CAT_CL_ATIENDE1,CAT_CL_ATIENTE2,CAT_CL_TELEFONO,CAT_CL_EMAIL,CAT_CL_CALLE,CAT_CL_NOEXT,CAT_CL_NOINT,CAT_CL_CALLE1,CAT_CL_CALLE2,CAT_CL_COLONIA,CAT_CL_MUNI,CAT_CL_EDO,CAT_CL_CP,CAT_CL_LONG,CAT_CL_LAT,CAT_CL_MTOCOMPRA,CAT_CL_NUM_SERIEFISICO, gestion, CAT_CL_GIRO,CAT_CL_CP) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,0,0,?,?) ", Array As Object (no_cliente,no_ruta, E_NOMBRE.Text,"null","null","null","null","null","null","null","null","null","null","null","null","null",B4XPages.MainPage.lon_gps,B4XPages.MainPage.lat_gps, cb_giro.SelectedItem,et_cp.Text))
Starter.skmt.ExecNonQuery2("INSERT INTO CLIENTES_NUEVOS(CN_ID, CN_FECHA, CN_USER, CN_LAT, CN_LON, CN_NOMBRE, CN_DIRECCION, CN_ALMACEN, CN_RUTA, CN_GIRO, CN_SOLICITA,CN_COLONIA, CN_TELEFONO,CN_CP) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As String(no_cliente, sDate2 &" "&sTime2, usuario, lat, lon, E_NOMBRE.Text, et_direccion.Text, ALMACEN, no_ruta, cb_giro.SelectedItem, ET_Atiende.Text,et_colonia.Text,et_telefono.Text,et_cp.Text))
' fototomada = "0"
B4XPages.ShowPage("Cliente")
CallSubDelayed(Tracker, "StartFLP")
Else
MsgboxAsync("Por favor, debe capturar el C.P. el negocio.","Atención")
End If
Else
MsgboxAsync("Por favor, debe capturar la colonia el negocio.","Atención")
End If
Else
MsgboxAsync("Por favor, debe capturar el telefono.","Atención")
End If
Else
' Mensaje de advertencia si ET_Atiende.Text está vacío
MsgboxAsync("Por favor, debe capturar al encargado que atiende el negocio.","Atención")
End If
Else
MsgboxAsync("Por favor captura el giro del cliente","Atención")
End If
Else
MsgboxAsync("Por favor revisa que tengas señal GPS","Atención")
End If
Else
MsgboxAsync("Por favor captura la dirección del cliente","Atención")
End If
' Else
' ToastMessageShow("El punto está FUERA del polígono", True)
' End If
' End If
End Sub
Private Sub p_nuevoCliente_Click
End Sub
'Private Sub b_foto_inci_Click
' camEx2.TakePicture
' p_camara.Visible = False
'' StopCamera2
'End Sub
'
'Private Sub InitializeCamera2
' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
' Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
' If Result Then
' camEx2.Initialize(p_cam, frontCamera, Me, "Camera1")
' frontCamera = camEx2.Front
' Log("inicializamos Camara")
' Else
' ToastMessageShow("Sin permisos de camara!!!", True)
' End If
' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
' Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
' If Result Then
' Log("con permisos para escritura")
' Else
' ToastMessageShow("Sin permisos de escritura!!!", True)
' End If
'
' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_READ_EXTERNAL_STORAGE)
' Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
' If Result Then
' Log("con permisos para escritura")
' Else
' ToastMessageShow("Sin permisos de lectura!!!", True)
' End If
'End Sub
'
'Sub Camera1_Ready (Success As Boolean)
' Log("Camara ready")
' If Success Then
' camEx2.SetJpegQuality(90)
' camEx2.SetContinuousAutoFocus
' camEx2.CommitParameters
' camEx2.StartPreview
' Log(camEx2.GetPreviewSize)
' Else
' ToastMessageShow("Cannot open camera.", True)
' Log("Cannot open camera")
' End If
'End Sub
'
'Sub Camera1_PictureTaken (Data()As Byte)
' Log("tome foto")
' Dim filename As String = fototomada
' Dim Dirp As String = File.DirInternal
' Dim Dir As String
' Dim Dir2 As String
' Try
' File.MakeDir(Dirp,"/promotoriakmts")
' Dir = "/promotoriakmts"
' Log("creado en promotoria " & Dirp & Dir)
' Catch
' Dir = ""
' Log("creado en raiz")
' End Try
'
' Try
' File.MakeDir(Dirp & Dir,"/reduccion")
' Dir2 = "/reduccion"
' Log("creado en promotoria " & Dirp & Dir & Dir2)
' Catch
' Dir = ""
' Log("creado en raiz")
' End Try
'
' camEx2.SavePictureToFile(Data, Dirp&Dir, filename)
' camEx2.StartPreview 'restart preview
' ToastMessageShow("Picture saved." & CRLF & "File size: " & File.Size(Dir, filename) & Dir &"," & filename, True)
' Log("Picture saved." & CRLF & "File size: " & File.Size(Dir, filename) & Dir &"," & filename)
' p_camara.Visible = False
' StopCamera2
'
'End Sub
'
'Private Sub StopCamera2
'' Capturing = False
' If camEx2.IsInitialized Then
' camEx2.Release
' End If
'End Sub
'
'
'Private Sub B_FOTO_Click
' DateTime.DateFormat="ddMMyyyyHHmmss"
' InitializeCamera2
' Subs.panelVisible(p_camara, 0, 0)
' fototomada = DateTime.Now & "_cliente.jpg"
'End Sub
Private Sub cb_giro_SelectedIndexChanged (Index As Int)
giros = cb_giro.SelectedItem
End Sub
Private Sub et_cp_TextChanged (Old As String, New As String)
If New.Length > 5 Then
et_cp.Text = Old
Else If New.Length > 1 And New.Length <= 5 Then
If New.Contains(Chr(10)) Or New.Contains(Chr(13)) Or New.Contains(Chr(34)) Then
et_cp.Text = Old
End If
End If
End Sub
Private Sub et_telefono_TextChanged (Old As String, New As String)
If New.Length > 10 Then
et_telefono.Text = Old
Else If New.Length > 1 And New.Length <= 10 Then
If New.Contains(Chr(10)) Or New.Contains(Chr(13)) Or New.Contains(Chr(34)) Then
et_telefono.Text = Old
End If
End If
End Sub
Private Sub b_clienteNuevo_Click
B4XPages.ShowPage("Principal")
p_transparenteCN.Visible = False
End Sub
Private Sub p_transparenteCN_Click
End Sub