the application has stopped unexpectedly. Pease try again

jamessp

Member
Licensed User
Longtime User
I have some updates after that app is no longer running on android version 2.2 displays the following error (the application (...) has stopped unexpectedly. Pease try again) and only works in version 2.3 or higher.
How can I make it run in previous version 2.2
Thank you!
 

jamessp

Member
Licensed User
Longtime User
>>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
CheckJNI is ON


--- registering native functions ---
GC_EXPLICIT freed 114 objects / 5888 bytes in 120ms
Scanning package: /data/app/vmdl29404.tmp
GC_FOR_MALLOC freed 13430 objects / 774360 bytes in 86ms
Removing non-system package:gw.garcoweb.movel
Force stopping package gw.garcoweb.movel uid=10036
Scanning package gw.garcoweb.movel
Package gw.garcoweb.movel codePath changed from /data/app/gw.garcoweb.movel-1.apk to /data/app/gw.garcoweb.movel-2.apk; Retaining data and using new
/data/app/gw.garcoweb.movel-2.apk changed; unpacking
DexInv: --- BEGIN '/data/app/gw.garcoweb.movel-2.apk' ---
DexOpt: load 145ms, verify 1962ms, opt 35ms
DexInv: --- END '/data/app/gw.garcoweb.movel-2.apk' (success) ---
Code path for pkg : gw.garcoweb.movel changing from /data/app/gw.garcoweb.movel-1.apk to /data/app/gw.garcoweb.movel-2.apk
Resource path for pkg : gw.garcoweb.movel changing from /data/app/gw.garcoweb.movel-1.apk to /data/app/gw.garcoweb.movel-2.apk
Activities: gw.garcoweb.movel.main
Force stopping package gw.garcoweb.movel uid=10036
move /data/dalvik-cache/data@[email protected]@classes.dex -> /data/dalvik-cache/data@[email protected]@classes.dex
New package installed in /data/app/gw.garcoweb.movel-2.apk
Not granting permission android.permission.UPDATE_DEVICE_STATS to package gw.garcoweb.movel (protectionLevel=2 flags=0xbe44)
Force stopping package gw.garcoweb.movel uid=10036
GC_EXPLICIT freed 1289 objects / 72016 bytes in 46ms
GC_EXPLICIT freed 9541 objects / 546328 bytes in 189ms
unlink /data/dalvik-cache/data@[email protected]@classes.dex
no available voice recognition services found
Shutting down VM
adbd disconnected
JNI: AttachCurrentThread (from ???.???)
NOTE: attach of thread 'Binder Thread #3' failed

>>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
CheckJNI is ON
--- registering native functions ---
GC_FOR_MALLOC freed 9793 objects / 516168 bytes in 114ms
Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=gw.garcoweb.movel/.main }
Start proc gw.garcoweb.movel for activity gw.garcoweb.movel/.main: pid=374 uid=10036 gids={1015, 3003, 3002, 3001}
Shutting down VM
adbd disconnected
NOTE: attach of thread 'Binder Thread #3' failed
VFY: invalid switch start: at 957, switch offset -21339, count 45204


VFY: rejected Lgw/garcoweb/movel/main;._hc_responsesuccess (Lanywheresoftware/b4a/http/HttpClientWrapper$HttpResponeWrapper;I)Ljava/lang/String;


Verifier rejected class Lgw/garcoweb/movel/main;
Class init failed in newInstance call (Lgw/garcoweb/movel/main;)
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x4001d800)
FATAL EXCEPTION: main
java.lang.VerifyError: gw.garcoweb.movel.main
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Force finishing activity gw.garcoweb.movel/.main
Activity pause timeout for HistoryRecord{44ed4c10 gw.garcoweb.movel/.main}


Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44fb3218


Sending signal. PID: 374 SIG: 9


Process gw.garcoweb.movel (pid 374) has died.


GC_EXPLICIT freed 171 objects / 12296 bytes in 119ms


Activity destroy timeout for HistoryRecord{44ed4c10 gw.garcoweb.movel/.main}


GC_EXPLICIT freed 31 objects / 1464 bytes in 119ms




What is wrong? help!
 
Upvote 0

jamessp

Member
Licensed User
Longtime User
here this Erel!




B4X:
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)   
   'ProgressDialogShow("Atualizando Sistema Aguarde...!")
    Dim res As String
    res = Response.GetString("UTF8")
   Log(res)
    Dim parser As JSONParser
    parser.Initialize(res)
    Select TaskId
      'CASE PARA A ATUALIZAÇÃO DA TABELA DE PRODUTOS
        Case COUNTRIES_LIST
         Try
            Try
               n.Cancel(1)
            Catch
               Log(LastException.Message)
            End Try
            'FAZ A DELEÇÃO PARA INSERIR NOVOS PRODUTOS
            DeletaProd
               'INICIA O PRECESSO DE LEITURA DO REGISTRO
            
               Dim countries As List
            Try
                  countries = parser.NextArray 'returns a list with maps
            Catch
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST", "")
               Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
            End Try
            'Log("Quatidade de Produtos Encotrados: " & countries.Size )
            'BARRA DE PROGRESSO
            Dim maximo As Double 
            maximo = 74 /countries.Size
            atual_progresso = maximo
               For i = 0 To countries.Size - 1
                   Dim m As Map
                   m = countries.Get(i)
                   'Estamos usando um tipo personalizado chamado TwoLines  (declarado em Globals Sub).
                   Dim tl As TwoLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
               Try
                      tl.id = m.Get("id")
                      tl.codigo = m.Get("codigo")
                  tl.descricao = m.Get("descricao")
                  tl.grupo = m.Get("grupo")
                  tl.subgrupo = m.Get("subgrupo")
                  tl.valor_venda = m.Get("valor_venda")
                  tl.und_venda = m.Get("und_venda")
                  tl.idloja = m.Get("idloja")
                  tl.ordem = m.Get("ordem")
                  tl.montagem = m.Get("montagem")
                  tl.pizza = m.Get("pizza")
                  tl.borda = m.Get("borda")
                  tl.combo = m.Get("combo")
               Catch
                  EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST", "")
               End Try
                  
               
               
               'tl.ordem = "0"
               
               'INICIA AS AÇÕES DE BANCO DE DADOS
               SQL1.BeginTransaction               
               Try
                  'INICIA A INSERÇÃO AO BANCO DE DADOS
                  SQL1.ExecNonQuery("INSERT INTO gw_produto VALUES('" & tl.id & "', '" & tl.codigo & "', '" & tl.descricao & "', '" & tl.grupo & "', '" & tl.subgrupo & "', '" & tl.valor_venda & "', '" & tl.und_venda & "', '" & tl.idloja & "', '"& tl.ordem & "', '" & tl.montagem &"', '"& tl.pizza & "', '" & tl.borda &"','" & tl.combo & "')")
                  'ProgressDialogShow(tl)
                  SQL1.TransactionSuccessful
               Catch
                  ToastMessageShow("Erro na Atualização de Produtos", False)
               End Try
               SQL1.EndTransaction 'FINALIZA A CONEXÃO
               
               DoEvents
               pb.Progress = atual_progresso
               DoEvents
               
               atual_progresso = atual_progresso + maximo
               Next
               'ProgressDialogHide
            'CHAMA A FUNÇÃO DE ATULIZAÇÃO DE USUÁRIOS
            ExecuteRemoteQuery("SELECT gw_usuarios.id, gw_usuarios.codigo, gw_usuarios.nome, gw_usuarios.sobrenome, gw_usuarios.perfil, gw_usuarios.senha, gw_usuarios.desabilitado, gw_usuarios.excluido, gw_perfil.cancelar_comanda, gw_perfil.transferir_comanda, gw_perfil.sem_servico  FROM gw_usuarios, gw_perfil WHERE gw_usuarios.excluido = 0 AND gw_usuarios.perfil = gw_perfil.perfil AND gw_usuarios.idloja = "& id_loja &" GROUP BY gw_usuarios.codigo", COUNTRIES_LIST2)
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST", "Erro na Atualização de Produtos")
         End Try
         
      Case COUNTRIES_LIST2
         Try
            'FAZ A DELEÇÃO PARA INSERIR NOVOS USUÁRIOS
            DeletaUser
            lblInfoProgress.Text = "Atualizando Usuários..."
               'INICIA O PRECESSO DE LEITURA DO REGISTRO
               Dim countries As List
            
               Try
                  countries = parser.NextArray 'returns a list with maps
            Catch
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST2", "")
               Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
            End Try
            
            'Log("Quatidade de Usuários Encotrados: " & countries.Size )
            'BARRA DE PROGRESSO
            Dim maximo As Double 
            maximo = 15 /countries.Size
            Log("Quantidade : " & countries.Size)
            
               For i = 0 To countries.Size - 1
                   Dim m As Map
                   m = countries.Get(i)
                   'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
                   Dim tl2 As oneLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
                   tl2.id = m.Get("id")
                   tl2.codigo = m.Get("codigo")
               tl2.Nome = m.Get("nome")
               tl2.sobrenome = m.Get("sobrenome")
               tl2.perfil = m.Get("perfil")
               tl2.Senha = m.Get("senha")
               'tl2.senha = "123"
               tl2.desabilitado = m.Get("desabilitado")
               tl2.excluido = m.Get("excluido")
               tl2.transferencia_mesa = m.Get("transferir_comanda")
               tl2.excluir_produto_venda = m.Get("cancelar_comanda")
               tl2.sem_servico = m.Get("sem_servico")
               
               'INICIA AS AÇÕES DE BANCO DE DADOS
               SQL1.BeginTransaction               
               Try
                  'INICIA A INSERÇÃO AO BANCO DE DADOS
                  SQL1.ExecNonQuery("INSERT INTO gw_usuarios VALUES('" & tl2.id & "', '" & tl2.codigo & "', '" & tl2.Nome & "', '" & tl2.sobrenome & "', '" & tl2.perfil & "', '" & tl2.Senha & "', '" & tl2.desabilitado & "', '" & tl2.excluido & "', '" & tl2.excluir_produto_venda & "', '" & tl2.transferencia_mesa & "', '" & tl2.sem_servico & "')")
                  'ProgressDialogShow(tl2)
                  SQL1.TransactionSuccessful
               Catch
                  ToastMessageShow("Erro na Atulização de Usuários", True)
               End Try
               SQL1.EndTransaction 
               'FINALIZA A CONEXÃO   
               DoEvents
               pb.Progress = atual_progresso
               DoEvents
               atual_progresso = atual_progresso + maximo
               Next
            'ToastMessageShow("Sistema Atulizado", True)
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST2", "Erro na Atulização de Usuários")
         End Try
         ExecuteRemoteQuery("SELECT * FROM gw_cadobs WHERE idloja = "& id_loja &" AND excluido = 0  ORDER BY id", COUNTRIES_LIST6)
         
      Case COUNTRIES_LIST3
         'ToastMessageShow("Vericando Mesa", True)
         Dim countries As List
         Dim status_matricula As Int: status_matricula = 0
         Dim statusmesa As Int
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
                Dim tl20 As twelveLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl20.fechada                   = m.Get("fechada")
            tl20.idclientecontrole_clube       = m.Get("idclientecontrole_clube")
            tl20.numeromatriculacontrole_clube    = m.Get("numeromatriculacontrole_clube")
            tl20.nomeclientecontrole_clube       = m.Get("nomeclientecontrole_clube")
            Try
               status_matricula               = tl20.numeromatriculacontrole_clube
            Catch
               status_matricula = 0
            End Try
         
            Next
         If countries.Size >= 1 Then
            statusmesa =  tl20.fechada
         End If
         
         If FechandoPed = 0 Then
         
            If statusmesa = 1 Then
               ProgressDialogHide
               Msgbox2("Número de Controle Fechada(o)! Solicite ao caixa a Abertura!","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
               
            Else 
            
               
               If status_matricula <> 0 AND ControleClube = 1 Then
                  Dim Resposta As Int
                  Resposta = Msgbox2("Confirma o nome do Cliente? Nome: " & tl20.nomeclientecontrole_clube,"GW", "Sim", "", "Não", LoadBitmap(File.DirAssets, "circle.png"))
                  If Resposta = DialogResponse.POSITIVE Then 'Caso a resposta seje positiva contyinua
                     ProgressDialogHide
                     RemoverFormulario
                     CarregaCategorias
                     
                  Else 'Caso não exista pede o número de matricula
                     ProgressDialogHide
                     Dim logo_circulo As Bitmap
                     logo_circulo = LoadBitmap(File.DirAssets, "circle.png")   
                     Dim MatriculaCli As String
                     Msg.Input = ""
                     Msg.InputType = Msg.INPUT_TYPE_PHONE 
                     MatriculaCli = Msg.Show("N° da Matricula", "Identificação", "Consultar", "Cancelar", "", logo_circulo)
                     
                     If MatriculaCli = -1 Then
                        MatriculaCli = Msg.Input
                        If MatriculaCli = 0 OR MatriculaCli = "0" Then
                           Msgbox2("Número da matricula Inválida","GW", "OK", "", "", LoadBitmap(File.DirAssets, "circle.png"))
                        Else
                           If IsNumber(MatriculaCli) = True Then
                              ProgressDialogShow("Verificando Matricula")
                              VerificaMatricula(MatriculaCli)
                           Else
                              Msgbox2("Número da matricula Inválida","GW", "OK", "", "", LoadBitmap(File.DirAssets, "circle.png"))
                           End If
                        End If
                        
                     Else
                        ProgressDialogHide
                     End If
                     
                     
                  End If
               Else If ControleClube = 1 Then
               
                  ProgressDialogHide                  
                  Dim logo_circulo As Bitmap
                  logo_circulo = LoadBitmap(File.DirAssets, "circle.png")   
                  Dim MatriculaCli As String
                  Msg.InputType = Msg.INPUT_TYPE_PHONE
                  Msg.Input = ""
                  MatriculaCli = Msg.Show("N° da Matricula", "Identificação", "Consultar", "Cancelar", "", logo_circulo)
                  
                  If MatriculaCli = -1 Then
                     MatriculaCli = Msg.Input
                     If MatriculaCli = 0 OR MatriculaCli = "0" Then
                        Msgbox2("Número da matricula Inválida","GW", "OK", "", "", LoadBitmap(File.DirAssets, "circle.png"))
                     Else
                        If IsNumber(MatriculaCli) = True Then
                           ProgressDialogShow("Verificando Matricula")
                           VerificaMatricula(MatriculaCli)
                        Else
                           Msgbox2("Número da matricula Inválida","GW", "OK", "", "", LoadBitmap(File.DirAssets, "circle.png"))
                        End If
                        
                     End If
                  Else
                     ProgressDialogHide
                  End If
               Else
                  ProgressDialogHide
                  RemoverFormulario
                  CarregaCategorias
               End If
            End If
         Else 
         
            If statusmesa = 1 Then
               ProgressDialogHide
               Msgbox2("Número de Controle Fechada(o)! Solicite ao caixa a Abertura!","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
               FechandoPed = 0
               Return False
            Else
               FechandoPed = 0
               FinalizarPedido2
            End If
            
         End If
      
      Case COUNTRIES_LIST4
      
         
            'add the countries to the ListView
            Dim countries As List
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST4", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         QtdGrupo =  countries.Size
         QtdRow = QtdGrupo / 3
         QtdRow = QtdRow + 1
         Dim i As Int
         Dim A As Int
         Dim Cont As Int
         Dim linha As Int
         linha = 0
         Cont = 0
         scvMain.Initialize(500)
         Activity.AddView(scvMain, 0, 0, 100%x, 83%y)
      '   Activity.LoadLayout("ScrollViewNLayouts")
         For i=0 To QtdRow-1
                        
            Dim pnltest As Panel
            Dim btnTest As Button
            Dim btnTest2 As Button
            Dim btnTest3 As Button
            
            Activity.LoadLayout("voltarGrupo")
            BotaoCategorias
            pnltest.Initialize("pnlTest")
      '      pnltest.LoadLayout("Layout")
            scvMain.Panel.AddView(pnltest,0,50dip+i*PanelHeight,100%x,PanelHeight)
            pnltest.Tag=i
            
            
            pnltest.Color = Colors.ARGB (76, 128, 128, 128)
            
            'TITULO DA TELA COM DESCRIÇÃO DA MESA E QUANTIDADE DE PRODUTO
            If ModTrabConfig = "MESA" Then
               Activity.Title = "Mesa: " & NumMesa & " Qtd de Prod. "& QtdProMesa
            Else
               If NumMesa = "0" Then
                  Activity.Title = " Cartão: " & NumCartao & " Qtd de Prod. "& QtdProMesa
               Else
                  Activity.Title = "Mesa: " & NumMesa & " Cartão: " & NumCartao & " Qtd de Prod. "& QtdProMesa
               End If
            End If
            
                  
            Cont = 0
            For A = linha To countries.Size - 1   
               Dim m As Map
               m = countries.Get(A)
               'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
               Dim tl7 As fourLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
               tl7.subgrupo = m.Get("subgrupo")
            
               Cont = Cont + 1
               If  Cont <= 1 AND Cont <= QtdGrupo Then
                  btnTest3.Initialize("btnTest3")
                  pnltest.AddView(btnTest3,0dip, 8dip, 105dip, 45dip)
                  btnTest3.Tag=tl7.subgrupo
                  btnTest3.Text=""&tl7.subgrupo
                  btnTest3.TextSize = 12
               End If
            Next
            
            linha = linha + 1
            Cont = 0
            For A = linha To countries.Size - 1   
               Dim m As Map
               m = countries.Get(A)
               'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
               Dim tl5 As fourLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
               tl5.subgrupo = m.Get("subgrupo")
               
               Cont = Cont + 1
               If  Cont <= 1 AND Cont <= QtdGrupo Then
                  btnTest2.Initialize("btnTest2")
                  pnltest.AddView(btnTest2,106dip, 8dip, 105dip, 45dip)
                  btnTest2.Tag=tl5.subgrupo
                  btnTest2.Text = ""&tl5.subgrupo
                  btnTest2.TextSize = 12
               End If
            Next
            
            linha = linha + 1
            Cont = 0
            For A = linha To countries.Size - 1
               Dim m As Map
               m = countries.Get(A)
               'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
               Dim tl6 As fourLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
               tl6.subgrupo = m.Get("subgrupo")
               
               Cont = Cont + 1
               If  Cont <= 1 AND Cont <= QtdGrupo Then
                  btnTest.Initialize("btnTest")
                  pnltest.AddView(btnTest,214dip, 8dip, 105dip, 45dip)
                  btnTest.Tag=tl6.subgrupo
                  btnTest.Text=""&tl6.subgrupo
                  btnTest.TextSize = 12
               End If
            Next
            linha = linha + 1
         Next
         scvMain.Panel.height=(QtdRow + 10)*PanelHeight
      
         
         Case COUNTRIES_LIST5
            RemoverFormulario
            
         
            'add the countries to the ListView
            Dim countries As List
            Try
                  countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
            Catch
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST5", "")
               Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
            End Try
            QtdProd =  countries.Size
            'QtdGrupo =  50
            QtdRow = QtdProd / 3
            QtdRow = QtdRow + 1
            Dim i As Int
            Dim A As Int
            Dim Cont As Int
            Dim linha As Int
            linha = 0
            Cont = 0
            scvMain.Initialize(500)
            Activity.AddView(scvMain, 0, 0, 100%x, 45%y)
            Activity.LoadLayout("VoltarPro")
            BotaoTelaProdutos
         '   Activity.LoadLayout("ScrollViewNLayouts")
            For i=0 To QtdRow-1
                           
               Dim pnltest As Panel
               Dim btnProd1 As Button
               Dim btnProd2 As Button
               Dim btnProd3 As Button
               
               pnltest.Initialize("pnlTest")
         '      pnltest.LoadLayout("Layout")
               scvMain.Panel.AddView(pnltest,0,15dip+i*PanelHeight,100%x,PanelHeight)
               pnltest.Tag=i
               
               pnltest.Color = Colors.ARGB (76, 128, 128, 128)
               
               'TITULO DA TELA COM DESCRIÇÃO DA MESA E QUANTIDADE DE PRODUTO
               If ModTrabConfig = "MESA" Then
                  Activity.Title = "Mesa: " & NumMesa & " Qtd de Prod. "& QtdProMesa
               Else
                  If NumMesa = "0" Then
                     Activity.Title = " Cartão: " & NumCartao & " Qtd de Prod. "& QtdProMesa
                  Else
                     Activity.Title = "Mesa: " & NumMesa & " Cartão: " & NumCartao & " Qtd de Prod. "& QtdProMesa
                  End If
               End If
                     
               Cont = 0
               For A = linha To countries.Size - 1   
                  Dim m As Map
                  m = countries.Get(A)
                  'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
                  Dim tl8 As fiveLines
                  'RECEBE O VALORES DOS CAMPOS DA TABELA
                  tl8.produt = m.Get("descricao")
                  If tl8.produt <> Null Then 
                     Cont = Cont + 1
                     If  Cont <= 1 AND Cont <= QtdGrupo Then
                        btnProd1.Initialize("btnProd1")
                        pnltest.AddView(btnProd1,0dip, 8dip, 105dip, 45dip)
                        btnProd1.Tag=tl8.produt
                        btnProd1.Text=""&tl8.produt
                        btnProd1.TextSize = 12
                     End If
                  End If
               Next
               
               linha = linha + 1
               Cont = 0
               For A = linha To countries.Size - 1   
                  Dim m As Map
                  m = countries.Get(A)
                  'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
                  Dim tl9 As fiveLines
                  'RECEBE O VALORES DOS CAMPOS DA TABELA
                  tl9.produt = m.Get("descricao")
                  If tl9.produt <> Null Then 
                     Cont = Cont + 1
                     If  Cont <= 1 AND Cont <= QtdGrupo Then
                        btnProd2.Initialize("btnProd2")
                        pnltest.AddView(btnProd2,106dip, 8dip, 105dip, 45dip)
                        btnProd2.Tag=tl9.produt
                        btnProd2.Text = tl9.produt
                        btnProd2.TextSize = 12
                     End If
                  End If
               Next
               
               linha = linha + 1
               Cont = 0
               For A = linha To countries.Size - 1
                  Dim m As Map
                  m = countries.Get(A)
                  'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
                  Dim tl10 As fiveLines
                  'RECEBE O VALORES DOS CAMPOS DA TABELA
                  tl10.produt = m.Get("descricao")
                  If tl10.produt <> Null Then 
                     Cont = Cont + 1
                     If  Cont <= 1 AND Cont <= QtdGrupo Then
                        btnProd3.Initialize("btnProd3")
                        pnltest.AddView(btnProd3,214dip, 8dip, 105dip, 45dip)
                        btnProd3.Tag=tl10.produt
                        btnProd3.Text=""&tl10.produt
                        btnProd3.TextSize = 12
                     End If
                  End If
               Next
               linha = linha + 1
            Next
            scvMain.Panel.height=(QtdRow + 10)*PanelHeight
            ListaProdutos
            
      Case COUNTRIES_LIST6
         Try
            'FAZ A DELEÇÃO PARA INSERIR OBSERVAÇÕES
            DeletaObs
            lblInfoProgress.Text = "Atualizando Observações..."
               'INICIA O PRECESSO DE LEITURA DO REGISTRO
               Dim countries As List
               Try
                  countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
            Catch
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST6", "")
               Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
            End Try
            'Log("Quatidade de Usuários Encotrados: " & countries.Size )
            'BARRA DE PROGRESSO
            Dim maximo As Double 
            maximo = 6 /countries.Size
            Log("Quantidade : " & countries.Size)
            
               For i = 0 To countries.Size - 1
                   Dim m As Map
                   m = countries.Get(i)
                   'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                   Dim tl11 As sixLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
                   tl11.id = m.Get("id")
                   tl11.idloja = m.Get("idloja")
               tl11.subgrupo = m.Get("subgrupo")
               tl11.obs = m.Get("obs")
               tl11.excluido = m.Get("excluido")
               tl11.datahora = m.Get("datahora")
               tl11.numero_caixa = m.Get("numero_caixa")
               tl11.codigo_operador = m.Get("codigo_operador")
               tl11.nome_operador = m.Get("nome_operador")
               'INICIA AS AÇÕES DE BANCO DE DADOS
               SQL1.BeginTransaction               
               Try
                  'INICIA A INSERÇÃO AO BANCO DE DADOS
                  SQL1.ExecNonQuery("INSERT INTO gw_cadobs VALUES('" & tl11.id & "', '" & tl11.idloja & "', '" & tl11.subgrupo & "', '" & tl11.obs & "', '" & tl11.excluido & "', '" & tl11.datahora & "', '" & tl11.numero_caixa & "', '" & tl11.codigo_operador & "', '" & tl11.nome_operador & "')")
                  'ProgressDialogShow(tl2)
                  SQL1.TransactionSuccessful
               Catch
                  ToastMessageShow("Erro na Atulização de Observações", True)
               End Try
               SQL1.EndTransaction 
               'FINALIZA A CONEXÃO
               DoEvents
               pb.Progress = atual_progresso
               DoEvents
               atual_progresso = atual_progresso + maximo
               
               Next
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST6", "Erro na Atulização de Observações")
         End Try
         ExecuteRemoteQuery("SELECT * FROM gw_montagem_produto WHERE idloja = "& id_loja &" AND excluido = 0", COUNTRIES_LIST13)

      Case COUNTRIES_LIST7
         RemoverFormulario
          ScrollView9.Initialize(0)
         pnl = ScrollView9.Panel
         Activity.AddView(ScrollView9, 0, 10%y, 100%x, 47%y)
         lstChecks.Initialize
   
         pnl.Color = Colors.ARGB (35, 128, 128, 128)
         
         
         'FAZ A MONTAGEM DA TABELA DE CONFERENCIA
         
            'INICIA O PRECESSO DE LEITURA DO REGISTRO
            Dim countries As List
         Dim x As Int 
         x = 1
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST7", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         
         'TITULO DA TELA COM DESCRIÇÃO DA MESA E QUANTIDADE DE PRODUTO
         Dim qtd_itens As Int
         qtd_itens = countries.Size
         
         If qtd_itens >= 1 Then
         
            If Activity.Width >= 700 Then
               height9 = 70dip
            Else
               height9 = 40dip
            End If
            
            
            ProgressDialogShow("Carregando Lista de Produtos")
            'Wait(1)
            For i = 0 To countries.Size - 1
               Dim m As Map
               m = countries.Get(i)
               'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
               Dim tl12 As SevenLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
               tl12.descricao_conf    = m.Get("descricao_produto")
               tl12.unitario_conf       = m.Get("unitario")
               tl12.pizza             = m.Get("pizza")
               tl12.pizzamaster       = m.Get("pizza_master")
               tl12.acrescimo          = m.Get("acrescimo")
               tl12.qtd_conf          = m.Get("qtd")
               tl12.total_conf       = m.Get("total")
               tl12.Npedido          = m.Get("numero_pedido")
               tl12.id             = m.Get("id")
               numPeditocad          =  tl12.Npedido
               
               ValTotalCombo          = ValTotalCombo + tl12.total_conf
               
               
               'LABEL DA DESCRIÇÃO DO PRODUTO
               Dim lbl0 As CheckBox
               lbl0.Initialize("")
               lbl0.Text = tl12.descricao_conf
               'lbl0.TextSize = 12
               lbl0.Typeface = Typeface.DEFAULT_BOLD
               lbl0.TextColor = Colors.Black
               lbl0.Tag = tl12.id
               
               If Activity.Width >= 700 Then
                  lbl0.TextSize = CalculaFonteLista(10%y, 15%x, tl12.descricao_conf, 25)
               Else
                  lbl0.TextSize = CalculaFonteLista(10%y, 15%x, tl12.descricao_conf, 15)
               End If
                  
               
               'Log("Fonte Antes=> " & lbl0.TextSize)
               'lbl0.TextSize = CalculaFonte(height9, 50%x, lbl0.Text, 13, 0)
               'Log("Fonte Depois=> " & lbl0.TextSize)
               lstChecks.Add(lbl0)
               
               
               If tl12.pizzamaster = 0 Then
               
                  'LABEL DO VALOR UNITÁRIO DO PRODUTO
                  Dim lbl1 As Label
                  Dim valorUnitario As Double 
                  lbl1.Initialize("") 
                  valorUnitario  = tl12.unitario_conf
                  'FormataValorReal(1100.45)
                  lbl1.Text = FormataValorReal(valorUnitario)
                  lbl1.Gravity = Gravity.CENTER_VERTICAL 
                  lbl1.Gravity = Gravity.RIGHT
                  'lbl1.TextSize = 14
                  lbl1.Typeface = Typeface.DEFAULT_BOLD
                  lbl1.TextColor = Colors.Black
               Else

                  'Label Do VALOR UNITÁRIO Do PRODUTO
                  Dim lbl1 As Label
                  Dim valorUnitario As Double 
                  lbl1.Initialize("") 
                  valorUnitario  = tl12.unitario_conf
                  'FormataValorReal(1100.45)
                  lbl1.Text = ""
                  lbl1.Gravity = Gravity.CENTER_VERTICAL 
                  lbl1.Gravity = Gravity.RIGHT
                  'lbl1.TextSize = 14
                  lbl1.Typeface = Typeface.DEFAULT_BOLD
                  lbl1.TextColor = Colors.Black
               
               End If
               If Activity.Width >= 700 Then
                  lbl1.TextSize = CalculaFonteLista(10%y, 15%x, tl12.unitario_conf, 25)
               Else
                  lbl1.TextSize = CalculaFonteLista(10%y, 15%x, tl12.unitario_conf, 15)
               End If
               
               'LABEL DA QUATIDADE DE PRODUTO
               Dim lbl2 As Label
               lbl2.Initialize("")
               If tl12.pizzamaster = 0 Then
                  lbl2.Text = NumberFormat2(tl12.qtd_conf, 1, 3, 3, False)
               Else
                  If tl12.qtd_conf = "0.250" Then
                     lbl2.Text = "1/4"
                  Else If tl12.qtd_conf = "0.500" Then
                     lbl2.Text = "1/2"
                  Else If tl12.qtd_conf = "0.333" Then
                     lbl2.Text = "1/3"
                  Else If tl12.qtd_conf = "0.334" Then
                     lbl2.Text = "1/3"
                  Else
                     lbl2.Text = NumberFormat2(tl12.qtd_conf, 1, 3, 3, False)
                  End If
               End If
               lbl2.Gravity = Gravity.CENTER_VERTICAL
               lbl2.Gravity = Gravity.RIGHT
               lbl2.TextSize = 14
               lbl2.Typeface = Typeface.DEFAULT_BOLD
               lbl2.TextColor = Colors.Black
               
               If Activity.Width >= 700 Then
                  lbl2.TextSize = CalculaFonteLista(10%y, 15%x, tl12.qtd_conf, 25)
               Else
                  lbl2.TextSize = CalculaFonteLista(10%y, 15%x, tl12.qtd_conf, 15)
               End If
               
               
               
               If tl12.pizzamaster = 0 Then
                  'LABEL DO VALOR TOTAL DO PRODUTO
                  Dim lbl3 As Label
                  lbl3.Initialize("")
                  lbl3.Text = FormataValorReal(tl12.total_conf)
                  lbl3.Gravity = Gravity.CENTER_VERTICAL
                  lbl3.Gravity = Gravity.RIGHT
                  lbl3.TextSize = 14
                  lbl3.Typeface = Typeface.DEFAULT_BOLD
                  lbl3.TextColor = Colors.Black
               
               Else
               
                  If tl12.pizza = 1 Then
                  
                     Dim lbl3 As Label
                     Dim ValorComAcresc As Double
                     ValorComAcresc = tl12.total_conf + tl12.acrescimo
                     lbl3.Initialize("")
                     lbl3.Text = FormataValorReal(ValorComAcresc)
                     lbl3.Gravity = Gravity.CENTER_VERTICAL
                     lbl3.Gravity = Gravity.RIGHT
                     lbl3.TextSize = 14
                     lbl3.Typeface = Typeface.DEFAULT_BOLD
                     lbl3.TextColor = Colors.Black
                  
                  Else 
                  
                     Dim lbl3 As Label
                     lbl3.Initialize("")
                     lbl3.Text = ""
                     lbl3.Gravity = Gravity.CENTER_VERTICAL
                     lbl3.Gravity = Gravity.RIGHT
                     lbl3.TextSize = 14
                     lbl3.Typeface = Typeface.DEFAULT_BOLD
                     lbl3.TextColor = Colors.Black
                  
                  End If                     
               End If
               
               If Activity.Width >= 700 Then
                  lbl3.TextSize = CalculaFonteLista(10%y, 15%x, tl12.qtd_conf, 25)
               Else
                  lbl3.TextSize = CalculaFonteLista(10%y, 15%x, tl12.qtd_conf, 15)
               End If
               
               pnl.AddView(lbl0, 3%x, height9 * (x - 1), 50%x, height9)
               pnl.AddView(lbl1, 50%x, height9 * (x - 1), 16%x, height9)
               pnl.AddView(lbl2, 65%x, height9 * (x - 1), 16%x, height9)
               pnl.AddView(lbl3, 78%x, height9 * (x - 1), 16%x, height9)
               
               
                        
               x = x + 1 
            Next
            pnl.height = lstChecks.Size * height9
            'ProgressDialogHide
            'ToastMessageShow("Sistema Atulizado", True)
            Activity.LoadLayout("conferencia")
            If Agrupamento = "Agrupado" Then
               SpnAgrupar.Add("Agrupado")
               SpnAgrupar.Add("Desagrupado")
            Else If Agrupamento = "Desagrupado" Then
               SpnAgrupar.Add("Desagrupado")
               SpnAgrupar.Add("Agrupado")
            End If
            TelaConfeProdutos
            If ModTrabConfig = "MESA" Then
               Activity.Title = "Conferência da Mesa: " & NumMesaConf
            Else
               Activity.Title = "Conferência do Cartão: " & NumMesaConf
            End If
            'Log(ValTotalCombo)
            ExecuteRemoteQuery("SELECT SUM(total) AS total, SUM(servico) AS servico FROM gw_mov_mesas WHERE mesa = '"& NumMesaConf &"' AND excluido = 0 AND baixa = 0", COUNTRIES_LIST8)
         Else
            RemoverFormulario
            Activity.LoadLayout("tecladoconf")
            Activity.LoadLayout("mesa2")
            TelaMesaConferenca
            ProgressDialogHide
            CurrentEdit = txtMesaConf
            ToastMessageShow("Não existe Pedido na Mesa "& NumMesaConf, True)
            
         End If
         
      Case COUNTRIES_LIST8
         
         'FAZ A MONTAGEM DA TABELA DE CONFERENCIA
         
            'INICIA O PRECESSO DE LEITURA DO REGISTRO
            Dim countries As List
         
         
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST8", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
            
            For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                Dim tl13 As EightLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl13.TotalProd       = m.Get("total")
            ValTotal          = tl13.TotalProd
                tl13.TotalServ       = m.Get("servico")
            'valServico          = tl13.TotalServ
            If cobrar_servico = 1 Then
               valor_servico = valor_servico * 0.01
            Else
               valor_servico = 0
            End If
            valServico          = ValTotal * valor_servico 'Define o valor do serviço
            
            Next
         valLiquido = ValTotal + valServico
         
'         lblTotalProd.Text = FormataValorReal(ValTotal)
'         lblTotalServ.Text = FormataValorReal(valServico)
'         lblTotalLiq.Text = FormataValorReal(valLiquido)
         ExecuteRemoteQuery("SELECT valor FROM gw_desconto_produto WHERE numero_pedido = '"& numPeditocad &"' AND excluido = 0", COUNTRIES_LIST9)
         
      Case COUNTRIES_LIST9
         
         'FAZ A MONTAGEM DA TABELA DE CONFERENCIA
         
            'INICIA O PRECESSO DE LEITURA DO REGISTRO
            Dim countries As List
         
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST9", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
            
            For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                Dim tl14 As NineLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl14.Desconto = m.Get("valor")
            valDesconto = tl14.Desconto
            
            Next
         valLiquido = (ValTotal + valServico) - valDesconto
         
         lblTotalProd.Text = FormataValorReal(ValTotal)
         lblTotalServ.Text = FormataValorReal(valServico)
         lblTotalLiq.Text = FormataValorReal(valLiquido)
         If valDesconto > 0 Then 
            lblTotalDesc.Text = FormataValorReal(valDesconto)
         End If
         ProgressDialogHide
      Case COUNTRIES_LIST10
         
         'FAZ A CONTAGEM DE NÚMERO DE LICENÇA DO CLIENTE
         
            'INICIA O PRECESSO DE LEITURA DO REGISTRO
            Dim countries As List
         
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST10", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
            
            For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                Dim tl15 As TenLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl15.QtdLicenca = m.Get("qtd")
            tl15.idloja = m.Get("idloja")
            tl15.NumCaixaBanco = m.Get("numero_caixa")
            id_loja = tl15.idloja
            NumCaixaAtual = tl15.NumCaixaBanco
            
            If ParamTelaAutenc = 1 Then
               numTable = num_tablet
            End If
            
            If numTable > tl15.QtdLicenca Then
               ProgressDialogHide
               Msgbox2("Número de Licença Inválida!","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
               Autenticador = 1
               If ParamTelaAutenc = 1 Then
                  DoEvents
                  ProgressDialogShow("Saindo do sistema...")
                  DoEvents
                  RemoverFormulario
                  CurrentEdit = txtCodigo
                  txtCodigo = Null 
                  txtSenha = Null
                  nome_user = Null
                  sobrenome = Null
                  Cod_user = 0

                  Activity.LoadLayout("teclado")
                  Activity.LoadLayout("login")
                  Activity.Title = "Acesso ao Sistema GW  -  Ver.: " & VersionNo
                  TelaLogin
                  CarregaSetores
                  dadosLojaConfig
                  lblNumComanda.Text = num_tablet
                  CurrentEdit = txtCodigo
                  ParamTelaAutenc = 0
                  ProgressDialogHide
               End If
               Return False
            Else
               Autenticador = 0
               If ParamTelaAutenc <> 1 Then
                  ProgressDialogHide
                  GravaNumLoja(id_loja, NumCaixaAtual)
                  RemoverFormulario
                  Activity.LoadLayout("teclado")
                  Activity.LoadLayout("login")
                  Activity.Title = "Acesso ao Sistema GW  -  Ver.: " & VersionNo
                  TelaLogin
                  CarregaSetores
                  dadosLojaConfig
                  lblNumComanda.Text = num_tablet
                  CurrentEdit = txtCodigo
                  lblNumComanda.Text = num_tablet
                  CriandoTabelas
                  VerificaBanco
                  AltenticacaoLince(numTable, NumCaixaAtual)
               End If
               ParamTelaAutenc = 0
            End If
            Next
         ProgressDialogHide
         
      Case COUNTRIES_LIST11
         
            Dim countries As List
         
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST11", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         
          For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                Dim tl16 As ElevenLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl16.Idmac = m.Get("identificacao")
            
            If EndMac <> tl16.Idmac Then
               ProgressDialogHide
               RemoverFormulario
               'Activity.LoadLayout("formIp")
               'TelaConfiguracao
               Activity.LoadLayout("configuracao")
               Layout_Configuracao
               
               ToastMessageShow("Número de Licença Inválida!", True)
               Ip_Salvo_banco 'FUNÇÃO DE VERIFICAÇÃO DE IF GRAVADO
               
               If ip_banco <> "" Then
                  txtIpServer.Text = ip_banco
               End If
               
               If num_tablet <> "" Then
                  txtNumTablet.Text = num_tablet
               End If
               
               If wifi_padrao <> "" Then
                  SpnRede.Add(wifi_padrao)
               End If
               
               If SenhaRede <> "" Then
                  txtSenhaRede.Text = SenhaRede
               End If
               
            End If
            Next
            
            
      'PROCEDIMENTO PARA VERIFICAÇÃO DE MSG
      Case COUNTRIES_LIST12
         
            Dim countries As List
         
         Try
         
               Try
                  countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
            Catch
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST12", "")
               Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
            End Try
            
             For i = 0 To countries.Size - 1
                   Dim m As Map
                   m = countries.Get(i)
                   'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                   Dim tl21 As ThirteenLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
               tl21.idmsg = m.Get("id")
                   tl21.msgComp = m.Get("msg")
               tl21.OpeMsg = m.Get("operador_envio")
               n.Initialize
               n.Icon = "icon"
               n.SetInfo("Mensagem Disponível", "Mensagem do Operador " & tl21.OpeMsg, "") 
               'Change Main (above) to "" if this code is in the main module.
               n.Vibrate = True
               n.Sound = True
               n.Light = True 
               n.Notify(1)
               'Beep
               '*FUNÇÃO DE BEEP VER. 1.3
               If FuncSon = 1 Then
                  beepers(2).Beep 'Beep volume alto
               End If
               'Msgbox("Mensagem do Operador: "& & CRLF & , "Gw")
               Msgbox2("Op: " & tl21.OpeMsg & CRLF & CRLF  & tl21.msgComp,"GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
               n.Cancel(1)
               
               EditaMsgLida(tl21.idmsg)
               Next
         Catch
            Msgbox2("Erro ao Receber Mensagem!", "GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         'ATUALIZAÇÃO DE PRODUTO DE MONTAGEMS
      Case COUNTRIES_LIST13
         Try
            'FAZ A DELEÇÃO PARA INSERIR MONTAGENS
            DeletaMontagem
            lblInfoProgress.Text = "Atualizando Montagem..."
               'INICIA O PRECESSO DE LEITURA DO REGISTRO
               Dim countries As List
               Try
                  countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
            Catch
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST13", "")
               Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
            End Try
            'BARRA DE PROGRESSO
            Dim maximo As Double 
            maximo = 1 /countries.Size
            Log("Quantidade : " & countries.Size)
            
               For i = 0 To countries.Size - 1
                   Dim m As Map
                   m = countries.Get(i)
                   'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                   Dim tl17 As FourteenLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
                   tl17.id = m.Get("id")
                   tl17.numero_caixa = m.Get("numero_caixa")
               tl17.datahora = m.Get("datahora")
               tl17.codigo_operador = m.Get("codigo_operador")
               tl17.nome_operador = m.Get("nome_operador")
               tl17.excluido = m.Get("excluido")
               tl17.codigo_produto = m.Get("codigo_produto")
               tl17.subgrupo = m.Get("subgrupo")
               tl17.idloja = m.Get("idloja")
               'INICIA AS AÇÕES DE BANCO DE DADOS
               SQL1.BeginTransaction               
               Try
                  'INICIA A INSERÇÃO AO BANCO DE DADOS
                  SQL1.ExecNonQuery("INSERT INTO gw_montagem_produto VALUES('" & tl17.id & "', '" & tl17.numero_caixa & "', '" & tl17.datahora & "', '" & tl17.codigo_operador & "', '" & tl17.nome_operador & "', '" & tl17.excluido & "', '" & tl17.codigo_produto & "', '" & tl17.subgrupo & "', '" & tl17.idloja & "')")
                  'ProgressDialogShow(tl2)
                  SQL1.TransactionSuccessful
               Catch
                  ToastMessageShow("Erro na Atulização de Montagens", True)
               End Try
               SQL1.EndTransaction 
               'FINALIZA A CONEXÃO
               DoEvents
               pb.Progress = atual_progresso
               DoEvents
               atual_progresso = atual_progresso + maximo
               
               Next
            
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST13", "Erro na Atulização de Montagens")
         End Try
         ExecuteRemoteQuery("SELECT * FROM gw_setores_comanda WHERE idloja = " & id_loja & " AND excluido = 0", COUNTRIES_LIST14)
            
         
         'ATUALIZAÇÃO DOS SETORES DE IMPRESSÃO
      Case COUNTRIES_LIST14
         Try
            'FAZ A DELEÇÃO PARA INSERIR SETORES
            DeletaSetores
            lblInfoProgress.Text = "Atualizando Setores de Impressão..."
               'INICIA O PRECESSO DE LEITURA DO REGISTRO
               Dim countries As List
               Try
                  countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
            Catch
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST14", "")
               Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
            End Try
            'BARRA DE PROGRESSO
            Dim maximo As Double 
            maximo = 1 /countries.Size
            Log("Quantidade : " & countries.Size)
            
               For i = 0 To countries.Size - 1
                   Dim m As Map
                   m = countries.Get(i)
                   'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                   Dim tl18 As FiveteenLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
                   tl18.id = m.Get("id")
                   tl18.idloja = m.Get("idloja")
               tl18.Setor = m.Get("setor")
               tl18.datahora = m.Get("datahora")
               tl18.codigo_operador = m.Get("codigo_operador")
               tl18.nome_operador = m.Get("nome_operador")
               tl18.excluido = m.Get("excluido")
               'INICIA AS AÇÕES DE BANCO DE DADOS
               SQL1.BeginTransaction               
               Try
                  'INICIA A INSERÇÃO AO BANCO DE DADOS
                  SQL1.ExecNonQuery("INSERT INTO gw_setores_comanda VALUES('" & tl18.id & "', '" & tl18.idloja & "', '" & tl18.Setor & "', '" & tl18.datahora & "', '" & tl18.codigo_operador & "', '" & tl18.nome_operador & "', '" & tl18.excluido & "', 0)")
                  'ProgressDialogShow(tl2)
                  SQL1.TransactionSuccessful
               Catch
                  ToastMessageShow("Erro na Atulização de Setor de Impressão", True)
               End Try
               SQL1.EndTransaction 
               'FINALIZA A CONEXÃO
               DoEvents
               pb.Progress = atual_progresso
               DoEvents
               
               atual_progresso = atual_progresso + maximo
               
               Next
            
            CarregaSetores
         Catch
            EnviaLogErro(LastException.Message, "sub TesteErro", "")
         End Try
         ExecuteRemoteQuery("SELECT id, subgrupo, qtd, codigo_master FROM gw_combo WHERE idloja = " & id_loja & " AND excluido = 0", COUNTRIES_LIST19)
         
      Case COUNTRIES_LIST15
         'ToastMessageShow("Vericando Mesa", True)
         Dim countries As List
         Dim statusmesa As Int
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST15", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
                Dim tl22 As sixteenLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl22.fechada = m.Get("fechada")
         
            Next
         If countries.Size >= 1 Then
            statusmesa =  tl22.fechada
         End If
         
         If statusmesa = 1 Then
            ProgressDialogHide
            Msgbox2("Mesa Fechada! Solicite ao caixa a Abertura! ou Escolha outra Mesa", "GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         Else 
            ProgressDialogHide
            TranfMesa(QtdProdTranf, MesaTranf)
         End If


continues ...
 
Upvote 0

jamessp

Member
Licensed User
Longtime User
continuação do hc_ResponseSuccess



B4X:
Case COUNTRIES_LIST16
         'ToastMessageShow("Vericando Mesa", True)
         Dim countries As List
         Dim statusmesa As Int
         Dim produtopizza, produtocombo As Int 
         produtopizza =0
         produtocombo =0
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST16", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
                Dim tl23 As SeventeenLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl23.fechada    = m.Get("fechada")
            tl23.pizza       = m.Get("pizza_master")
            tl23.combo       = m.Get("combo")
            produtopizza = tl23.pizza 
            produtocombo   = tl23.combo
            'Log(tl23.combo)
            Next
         If countries.Size >= 1 Then
            statusmesa =  tl23.fechada
         End If
         
         If statusmesa = 1 Then
            ProgressDialogHide
            ToastMessageShow("Mesa Fechada! Solicite ao caixa a Abertura!", True)
         Else 
            'ProgressDialogHide
            'RemoverFormulario
            'VERIFICA DE EXISTE PIZZA NA MESA SELECIONADA
            If produtopizza  > 0 Then
               Agrupamento = "Desagrupado"
               'SpnAgrupar.Visible = False
            End If
            
            If produtocombo  > 0 Then
               Agrupamento = "Desagrupado"
               'SpnAgrupar.Visible = False
            End If
            
            If Agrupamento = "Desagrupado" Then
               ExecuteRemoteQuery("SELECT id, descricao_produto, SUM(qtd)  AS qtd, SUM(total) AS total, unitario, numero_pedido, pizza, pizza_master, acrescimo FROM gw_mov_mesas WHERE mesa = '"& NumMesaConf &"' AND excluido = 0 AND baixa = 0 GROUP BY id ORDER BY pizza_master, descricao_produto", COUNTRIES_LIST7)
            Else If Agrupamento = "Agrupado" Then
               ExecuteRemoteQuery("SELECT id, descricao_produto, SUM(qtd)  AS qtd, SUM(total) AS total, unitario, numero_pedido, pizza, pizza_master, acrescimo FROM gw_mov_mesas WHERE mesa = '"& NumMesaConf &"' AND excluido = 0 AND baixa = 0 GROUP BY descricao_produto ORDER BY id", COUNTRIES_LIST7)
            End If
         End If
         
      Case COUNTRIES_LIST17
         'ToastMessageShow("Vericando Mesa", True)
         Dim countries As List
         Dim statuscartao As Int
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST17", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado oneLines  (declarado em Globals Sub).
                Dim tl24 As EighteenLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl24.fechada = m.Get("fechada")
         
            Next
         If countries.Size >= 1 Then
            statuscartao =  tl24.fechada
         End If
         
         If statuscartao = 1 Then
            ProgressDialogHide
            ToastMessageShow("Cartão Fechado! Solicite ao caixa a Abertura!", True)
         Else 
            'ProgressDialogHide
            If NumMesa = "0" Then
               Activity.Title = " Cartão: " & NumCartao & " Qtd de Prod. "& QtdProMesa
            Else
               Activity.Title = "Mesa: " & NumMesa & " Cartão: " & NumCartao & " Qtd de Prod. "& QtdProMesa
            End If
            fundoModal.RemoveView
            panelKeyboard.RemoveView
            ProgressDialogHide
            'ListaProdutos
         End If
      
      Case COUNTRIES_LIST19
         Try
            'FAZ A DELEÇÃO PARA INSERIR NOVOS USUÁRIOS
            DeletaCombo
            lblInfoProgress.Text = "Atualizando Combo..."
               'INICIA O PRECESSO DE LEITURA DO REGISTRO
               Dim countries As List
               Try
                  countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
            Catch
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST19", "")
               Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
            End Try
            'BARRA DE PROGRESSO
            Dim maximo As Double 
            maximo = 1 /countries.Size
            Log("Quantidade : " & countries.Size)
            
               For i = 0 To countries.Size - 1
                   Dim m As Map
                   m = countries.Get(i)
                   'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                   Dim tl26 As twentyLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
                   tl26.id = m.Get("id")
               tl26.subgrupo = m.Get("subgrupo")
               tl26.Qtd = m.Get("qtd")
               tl26.codigo_master = m.Get("codigo_master")
               'INICIA AS AÇÕES DE BANCO DE DADOS
               SQL1.BeginTransaction               
               Try
                  'INICIA A INSERÇÃO AO BANCO DE DADOS
                  SQL1.ExecNonQuery("INSERT INTO gw_combo VALUES('" & tl26.id & "', '" & tl26.subgrupo & "', '" & tl26.Qtd & "', '" & tl26.codigo_master & "')")
                  'ProgressDialogShow(tl2)
                  SQL1.TransactionSuccessful
               Catch
                  ToastMessageShow("Erro na Atulização de Combos", True)
                  EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST19", "Erro na Atulização de Combos")
               End Try
               SQL1.EndTransaction 
               'FINALIZA A CONEXÃO
               
               DoEvents
               pb.Progress = atual_progresso
               DoEvents
               
               atual_progresso = atual_progresso + maximo
               
               Next
         Catch
            EnviaLogErro(LastException.Message, "sub TesteErro", "")
         End Try
         ExecuteRemoteQuery("SELECT id, sub_master, sub_opcional, codigo FROM gw_combo_opcional WHERE idloja = " & id_loja & " AND excluido = 0", COUNTRIES_LIST20)

      Case COUNTRIES_LIST20
         Try
            'FAZ A DELEÇÃO PARA INSERIR NOVOS USUÁRIOS
            DeletaComboOpcional
            lblInfoProgress.Text = "Atualizando Combo Opcionais..."
               'INICIA O PRECESSO DE LEITURA DO REGISTRO
               Dim countries As List
               Try
                  countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
            Catch
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST20", "")
               Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
            End Try
            'BARRA DE PROGRESSO
            Dim maximo As Double 
            maximo = 1 /countries.Size
            Log("Quantidade : " & countries.Size)
               For i = 0 To countries.Size - 1
                   Dim m As Map
                   m = countries.Get(i)
                   'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                   Dim tl27 As twentyoneLines
               'RECEBE O VALORES DOS CAMPOS DA TABELA
                   tl27.id = m.Get("id")
               tl27.sub_master = m.Get("sub_master")
               tl27.sub_opcional = m.Get("sub_opcional")
               tl27.codigo = m.Get("codigo")
               'INICIA AS AÇÕES DE BANCO DE DADOS
               SQL1.BeginTransaction               
               Try
                  'INICIA A INSERÇÃO AO BANCO DE DADOS
                  SQL1.ExecNonQuery("INSERT INTO gw_combo_opcional VALUES('" & tl27.id & "', '" & tl27.sub_master & "', '" & tl27.sub_opcional & "', '" & tl27.codigo & "')")
                  'ProgressDialogShow(tl2)
                  SQL1.TransactionSuccessful
               Catch
                  ToastMessageShow("Erro na Atulização de Combo Opcionais", True)
                  EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST20", "Erro na Atulização de Combo Opcionais")
               End Try
               SQL1.EndTransaction 
               'FINALIZA A CONEXÃO
               
               DoEvents
               pb.Progress = atual_progresso
               DoEvents
               
               atual_progresso = atual_progresso + maximo
               
               Next
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST20", "Erro na Atulização de Combo Opcionais")
         End Try
         ProgressDialogHide
         ToastMessageShow("Sistema Atualizado", True)
         'If LocalAtualizacao = 1 Then
            pb.RemoveView
            PainelProgress.RemoveView
            lblInfoProgress.Visible = False
            LocalAtualizacao = 0
            Return False
         'End If
         CarregaSetores
         
         If Activity.NumberOfViews = numForm3 Then
            pb.RemoveView
            PainelProgress.RemoveView
            lblInfoProgress.Visible = False
         End If
         'ExecuteRemoteQuery("SELECT * FROM gw_setores_comanda WHERE idloja = " & id_loja & " AND excluido = 0", COUNTRIES_LIST14)
      
      'Case de Busca de valor da pizza para verificar qual pizza tem o maior valor
      'e definir a pizza master para não aver erro no script php
      Case COUNTRIES_LIST21
      
         Dim countries As List
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST21", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         'BARRA DE PROGRESSO
         For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                Dim tl28 As twentyTwoLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl28.codigo = m.Get("codigo")
            tl28.valor_venda = m.Get("valor_venda")
            Log(tl28.codigo)
            Log(tl28.valor_venda)
            
            
            'INICIA A ALTERAÇÃO DO PEDIDO PIZZA   
            SQL1.BeginTransaction               
            Try
               'INICIA A INSERÇÃO AO BANCO DE DADOS
               SQL1.ExecNonQuery("UPDATE gw_mesa_temp SET pizzamaster = 0 WHERE sequencia = "& SequenciaPed &" and pizza = 1")
               'ProgressDialogShow(tl)
               SQL1.TransactionSuccessful
            Catch
               ToastMessageShow("Erro ao inserir Obs", False)
            End Try
            SQL1.EndTransaction 'FINALIZA A CONEXÃO
            
            
            Dim CursorId_pi As Cursor
            Dim id_pro_pizza_master As Int
            CursorId_pi = SQL1.ExecQuery("SELECT id FROM gw_mesa_temp where pizzamaster = 0 and sequencia = "& SequenciaPed &" and pizza = 1 AND codigo_produto = "& tl28.codigo &" LIMIT 1")
            For i = 0 To CursorId_pi.RowCount - 1
               CursorId_pi.Position = i
               id_pro_pizza_master =  CursorId_pi.GetString("id")
            Next
                     
            
            
            
            
            
            'INICIA A ALTERAÇÃO DO PEDIDO PIZZA   
            SQL1.BeginTransaction               
            Try
               'INICIA A INSERÇÃO AO BANCO DE DADOS
               SQL1.ExecNonQuery("UPDATE gw_mesa_temp SET pizzamaster = 1 WHERE sequencia = "& SequenciaPed &" and pizza = 1 and codigo_produto = "& tl28.codigo &" and id = "& id_pro_pizza_master &"")
               'ProgressDialogShow(tl)
               SQL1.TransactionSuccessful
            Catch
               ToastMessageShow("Erro ao inserir Obs", False)
            End Try
            SQL1.EndTransaction 'FINALIZA A CONEXÃO
         Next
         
         RemoverFormulario
         CarregaCategorias
         
      Case COUNTRIES_LIST22
      
         Dim countries As List
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST22", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         'BARRA DE PROGRESSO
         For i = 0 To countries.Size - 1
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                Dim tl29 As twentyTreeLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl29.cobrar_servico    = m.Get("cobrar_servico")
            tl29.valor_servico       = m.Get("valor_servico")
            tl29.Fantasia          = m.Get("fantasia")
            Nome_Fantasia          = tl29.Fantasia
            
            
            'INICIA A ALTERAÇÃO DO PEDIDO PIZZA   
            SQL1.BeginTransaction               
            Try
               'INICIA A INSERÇÃO AO BANCO DE DADOS
               SQL1.ExecNonQuery("UPDATE gw_configuracao SET cobrar_servico = '"& tl29.cobrar_servico &"', valor_servico = '"& tl29.valor_servico &"', fantasia = '"& tl29.Fantasia &"' WHERE id = 1")
               'ProgressDialogShow(tl)
               SQL1.TransactionSuccessful
            Catch
               ToastMessageShow("Erro ao Atualizar Configurações", False)
               EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST22", "Erro ao Atualizar Configurações")
            End Try
            SQL1.EndTransaction 'FINALIZA A CONEXÃO

         Next
         
      Case COUNTRIES_LIST23
      
         Dim countries As List
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST22", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         'BARRA DE PROGRESSO
         
         If Activity.NumberOfViews = numForm3 Then
            scvMain.RemoveView
         End If
         
         Dim PanelNb As Int         : PanelNb=8
         Dim PanelHeight As Int   : PanelHeight=12%y
         
         QtdGrupo =  countries.Size
         'QtdGrupo =  50
         QtdRow = QtdGrupo / 3
         QtdMesa = QtdGrupo
         QtdRow = QtdRow + 1
         'Dim LocalList(QtdRow) As String
         Dim i As Int
         Dim A As Int
         Dim b As Int
         Dim Cont As Int
         Dim linha As Int
         linha = 0
         Cont = QtdGrupo - 3
         scvMain.Initialize(500)
         scvMain.Color = Colors.ARGB (0, 0, 0, 0)
         pnlMesas.AddView(scvMain,  0.8%x, 0.5%y, 96.5%x, 25%y)
'         pnlMesas.AddView(
         '   Activity.LoadLayout("ScrollViewNLayouts")   
         
         numForm3 = Activity.NumberOfViews
         Dim tam, aumento, font As Int   
         tam = 10                  
         b = 0
         DoEvents
         ProgressDialogShow("Carregando Mesas/Cartão Agrarde...") 'Exibe uma pensage de load
         Dim Atura_anterior As Int
         Atura_anterior = 3dip+0*PanelHeight
         'lblMesaAberta.TextSize = CalculaFonte( 10%y, 15%x, lblMapasProd.Text, 25, 1)
         Dim Qtd_mesas_abertas As Int :Qtd_mesas_abertas = 0
         Dim Qtd_mesas_fechada As Int :Qtd_mesas_fechada = 0
         Dim Qtd_mesas_cartao As Int :Qtd_mesas_cartao = 0
         
         lblMesaCartao.TextSize = CalculaFonte(lblMesaCartao.height,  lblMesaCartao.Width , lblMesaCartao.Text, 25, 2)
         lblMesaAberta.TextSize = CalculaFonte(lblMesaAberta.height,  lblMesaAberta.Width , lblMesaAberta.Text, 25, 2)
         lblMesafechada.TextSize = CalculaFonte(lblMesafechada.height,  lblMesafechada.Width , lblMesafechada.Text, 25, 2)
         
         For i = 0 To QtdGrupo - 1
            DoEvents
                Dim t As Map
            Dim m As Map
            t = countries.Get(i)
                'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                Dim tl30 As twentyFourLines            
            Dim pnltest As Panel
            
            tl30.fechada    = t.Get("fechada")
            If tl30.fechada = 0 Then
               Qtd_mesas_abertas = Qtd_mesas_abertas + 1
            Else
               Qtd_mesas_fechada = Qtd_mesas_fechada + 1
            End If
            Qtd_mesas_cartao = Qtd_mesas_cartao + 1
            
            lblQtdMesasAberta.Text     = Qtd_mesas_abertas
            lblQtdMesasfechada.Text    = Qtd_mesas_fechada
            lblQtdMesasCartao.Text       = Qtd_mesas_cartao
            
            Dim MesaPendente, MesaPendente2, MesaPendente3, MesaPendente4 As Button
            pnltest.Initialize("pnlTest")
            scvMain.Panel.AddView(pnltest,0.5%x,Atura_anterior,97%x,PanelHeight)
            'scvMain.Panel.AddView(
            pnltest.Tag=i
            Atura_anterior = Atura_anterior + pnltest.height
            
            pnltest.Color = Colors.ARGB (70, 128, 128, 128)
            
            tam = 3%x
            aumento = 23%x 'declaração do espaço entre os botões
            font = 5%y 'Declaração do tamanho da font
            Cont = 0
            
            'BOTÃO 1
            For A = linha To countries.Size - 1
               Dim mesa As Int 
               Dim fechada As Int
               
               DoEvents
               m = countries.Get(A)
               tl30.mesa       = m.Get("mesa")
               tl30.fechada    = m.Get("fechada")
               tl30.numero_pedido = m.Get("numero_pedido")
               mesa = tl30.mesa
               fechada = tl30.fechada
               
               
               Cont = Cont + 1
               If Cont <= 1 AND Cont <= QtdGrupo Then
                  MesaPendente.Initialize("MesaPendente")
                  pnltest.AddView(MesaPendente,tam, 2%x, 30%x, 15%y)
                  'pnltest.AddView(
                  MesaPendente.Width = 20%x
                  MesaPendente.height = 10%y
                  MesaPendente.Text = mesa
                  MesaPendente.Tag = tl30.numero_pedido & "," & mesa 
                  'MesaPendente.TextSize = font
                  MesaPendente.TextSize = CalculaFonte(MesaPendente.height, MesaPendente.Width, mesa, 31, 2)

                  Dim sld As StateListDrawable
                  'initialize statelistdrawable
                  sld.Initialize
   
                  If fechada = 0 Then
                     MesaPendente.Background = mesa_aberta
                  Else
                     MesaPendente.Background = mesa_fechada
                  End If

                  MesaPendente.Typeface = Typeface.DEFAULT_BOLD
                  tam = tam + aumento
               End If
            Next
            linha = linha + 1
            Cont = 0
            
            
            
            'BOTÃO 2
            For A = linha To countries.Size - 1
               DoEvents
               m = countries.Get(A)
               tl30.mesa       = m.Get("mesa")
               tl30.fechada    = m.Get("fechada")
               tl30.numero_pedido = m.Get("numero_pedido")
               mesa = tl30.mesa
               fechada = tl30.fechada
               
               Cont = Cont + 1
               If Cont <= 1 AND Cont <= QtdGrupo Then
                  MesaPendente2.Initialize("MesaPendente2")
                  pnltest.AddView(MesaPendente2,tam, 2%x, 11%x, 15%y)
                  'pnltest.AddView
                  MesaPendente2.Width = 20%x
                  MesaPendente2.height = 10%y
                  MesaPendente2.Text = mesa
                  MesaPendente2.Tag = tl30.numero_pedido & "," & mesa 
                  'MesaPendente2.TextSize = font
                  MesaPendente2.TextSize = CalculaFonte(MesaPendente2.height, MesaPendente2.Width, mesa, 31, 2)
                  MesaPendente2.Typeface = Typeface.DEFAULT_BOLD
                  
                  'Ateração da cor do fundo do botão
                  Dim sld2 As StateListDrawable
                  'initialize statelistdrawable
                  sld2.Initialize

                  If fechada = 0 Then
                     MesaPendente2.Background = mesa_aberta
                  Else
                     MesaPendente2.Background = mesa_fechada
                  End If
   
                  tam = tam + aumento
               End If
            Next
            linha = linha + 1
            Cont = 0
            
            
            
            'BOTÃO 3
            For A = linha To countries.Size - 1
               DoEvents
               m = countries.Get(A)
               tl30.mesa       = m.Get("mesa")
               tl30.fechada    = m.Get("fechada")
               tl30.numero_pedido = m.Get("numero_pedido")
               mesa = tl30.mesa
               fechada = tl30.fechada
               
               Cont = Cont + 1
               If Cont <= 1 AND Cont <= QtdGrupo Then
                  MesaPendente3.Initialize("MesaPendente3")
                  pnltest.AddView(MesaPendente3,tam, 2%x, 11%x, 15%y)
                  'pnltest.AddView
                  MesaPendente3.Width = 20%x
                  MesaPendente3.height = 10%y
                  MesaPendente3.Text = mesa
                  MesaPendente3.Tag = tl30.numero_pedido & "," & mesa 
                  'MesaPendente3.TextOn=mesa
                  'MesaPendente3.TextSize = font
                  MesaPendente3.TextSize = CalculaFonte(MesaPendente3.height, MesaPendente3.Width, mesa, 31, 2)
                  MesaPendente3.Typeface = Typeface.DEFAULT_BOLD
                  
                  
                  If fechada = 0 Then
                     MesaPendente3.Background = mesa_aberta
                  Else
                     MesaPendente3.Background = mesa_fechada
                  End If
   
                  
                  tam = tam + aumento
               End If
            Next
            linha = linha + 1
            Cont = 0
            
            
            
            
            'BOTÃO 4
            For A = linha To countries.Size - 1
               DoEvents
               m = countries.Get(A)
               tl30.mesa       = m.Get("mesa")
               tl30.fechada    = m.Get("fechada")
               tl30.numero_pedido = m.Get("numero_pedido")
               mesa = tl30.mesa
               fechada = tl30.fechada
               
               Cont = Cont + 1
               If Cont <= 1 AND Cont <= QtdGrupo Then
                  MesaPendente4.Initialize("MesaPendente4")
                  pnltest.AddView(MesaPendente4,tam, 2%x, 11%x, 15%y)
                  'pnltest.AddView
                  MesaPendente4.Width = 20%x
                  MesaPendente4.height = 10%y
                  MesaPendente4.Text = mesa
                  MesaPendente4.Tag = tl30.numero_pedido & "," & mesa 
                  'MesaPendente4.TextSize = font
                  MesaPendente4.TextSize = CalculaFonte(MesaPendente4.height, MesaPendente4.Width, mesa, 31, 2)
                  MesaPendente4.Typeface = Typeface.DEFAULT_BOLD
                  
                  
                  If fechada = 0 Then
                     MesaPendente4.Background = mesa_aberta
                  Else
                     MesaPendente4.Background = mesa_fechada
                  End If
   
                  
                  tam = tam + aumento
               End If
            Next
            linha = linha + 1
            Cont = 0
            
            
            
         Next
         
         lblQtdMesasAberta.TextSize = CalculaFonte(lblQtdMesasAberta.height,  lblQtdMesasAberta.Width , lblQtdMesasAberta.Text, 25, 2)
         lblQtdMesasfechada.TextSize = CalculaFonte(lblQtdMesasfechada.height,  lblQtdMesasfechada.Width , lblQtdMesasfechada.Text, 25, 2)
         lblQtdMesasCartao.TextSize = CalculaFonte(lblQtdMesasCartao.height,  lblQtdMesasCartao.Width , lblQtdMesasCartao.Text, 25, 2)
         
         
         scvMain.Panel.height=(QtdRow + 1)*PanelHeight   
         ProgressDialogHide
         
         
         
         
         Case COUNTRIES_LIST24 'função para carregar lista de produtos
      
         Dim countries As List
            Try
               countries = parser.NextArray 'Retorna o número de linha que foi encontrado no SQL
         Catch
            EnviaLogErro(LastException.Message, "Case COUNTRIES_LIST22", "")
            Msgbox2("Erro ao Receber os Dados Verifique Sua Rede","GW", "Ok", "", "", LoadBitmap(File.DirAssets, "circle.png"))
         End Try
         
         Log(numForm4)
         If numForm4 <> 100 Then
            scvMain2.RemoveView
         End If
         
         Dim PanelNb As Int         : PanelNb=8
         Dim PanelHeight As Int   : PanelHeight=8%y
         
         QtdGrupo =  countries.Size
         'QtdGrupo =  50
         QtdRow = QtdGrupo / 3
         QtdMesa = QtdGrupo
         QtdRow = QtdRow + 1
         'Dim LocalList(QtdRow) As String
         Dim i As Int
         Dim A As Int
         Dim Cont, AlturaPnl_pro As Int
         Cont = QtdGrupo - 3
         scvMain2.Initialize(500)
         
         scvMain2.Color = Colors.ARGB (0, 0, 0, 0)
         pnlProdutos.AddView(scvMain2,  0.8%x, 7%y, 96.5%x, 39%y)
'         pnlMesas.AddView(
         
         numForm4 = Activity.NumberOfViews
         Log(numForm4)
         Dim tam, aumento As Int   
         tam = 10                  
         b = 1
         DoEvents
         Dim Atura_anterior As Int
         Atura_anterior = 3dip+0*PanelHeight
         Dim height As Int
         height2 = 8%y
         height = 8%y
         For i = 0 To countries.Size - 1
            DoEvents   
            
            pnl = scvMain2.Panel
            Dim pnllistapro As Panel
            Dim lblDesc_pro As Label
            Dim lblQtd_pro As Label
            Dim lblUni_pro As Label
            Dim lblTot_pro As Label
            Dim lblOperador_pro As Label
            Dim lblData_pro As Label
            Dim valorUnitario As Double 
            Dim valorTotal As Double 
            
            pnllistapro.Initialize("pnllistapro")
            
            
                Dim m As Map
                m = countries.Get(i)
                'Estamos usando um tipo personalizado chamado sixLines  (declarado em Globals Sub).
                Dim tl31 As twentyFiveLines
            'RECEBE O VALORES DOS CAMPOS DA TABELA
                tl31.descricao_produto    = m.Get("descricao_produto")
            tl31.unitario          = m.Get("unitario")
            tl31.Qtd             = m.Get("qtd")
            tl31.total             = m.Get("total")
            tl31.nome_atendente    = m.Get("nome_atendente")
            tl31.datahora          = m.Get("datahora")
            
            
            lblDesc_pro.Initialize("")
            lblDesc_pro.Text = tl31.descricao_produto
            lblDesc_pro.TextColor = Colors.Black
            lblDesc_pro.Typeface = Typeface.DEFAULT_BOLD
            lblDesc_pro.Gravity = Gravity.CENTER_VERTICAL
            
            
            lblQtd_pro.Initialize("lblQtd_pro")
            lblQtd_pro.Text = NumberFormat2(tl31.Qtd, 1, 3, 3, False)
            lblQtd_pro.TextColor = Colors.Black
            lblQtd_pro.Typeface = Typeface.DEFAULT_BOLD
            lblQtd_pro.Gravity = Gravity.CENTER_VERTICAL
         
            valorUnitario = tl31.unitario
            lblUni_pro.Initialize("lblUni_pro")
            lblUni_pro.Text = FormataValorReal(valorUnitario)
            lblUni_pro.TextColor = Colors.Black
            lblUni_pro.Typeface = Typeface.DEFAULT_BOLD
            lblUni_pro.Gravity = Gravity.CENTER_VERTICAL
            
            
            valorTotal = tl31.total
            lblTot_pro.Initialize("lblTot_pro")
            lblTot_pro.Text = FormataValorReal(valorTotal)
            lblTot_pro.TextColor = Colors.Black
            lblTot_pro.Typeface = Typeface.DEFAULT_BOLD
            lblTot_pro.Gravity = Gravity.CENTER_VERTICAL
            
            
            
            lblOperador_pro.Initialize("lblOperador_pro")
            lblOperador_pro.Text = "Operador: " & tl31.nome_atendente
            lblOperador_pro.TextColor = Colors.Black
            'lblOperador_pro.Typeface = Typeface.DEFAULT_BOLD
            lblOperador_pro.Gravity = Gravity.CENTER_VERTICAL
            
            Dim Data_pro As String 
            'DateTime.DateFormat = "dd/MM/yyyy HH:mm:ss"
            'Dim t2 As Long: t2 = DateTime.DateParse(tl31.datahora)
            'Data_pro = DateTime.Date(t2)
            Data_pro = FormataDataHora(tl31.datahora)
            lblData_pro.Initialize("lblData_pro")
            lblData_pro.Text = " Data: " & Data_pro
            lblData_pro.TextColor = Colors.Black
            'lblData_pro.Typeface = Typeface.DEFAULT_BOLD
            lblData_pro.Gravity = Gravity.CENTER_VERTICAL
            
            
            'Log(Activity.Width)
            
            If Activity.Width >= 700 Then
               lblDesc_pro.TextSize = CalculaFonteLista(height2, 50%x, tl31.descricao_produto, 25)
               lblQtd_pro.TextSize = CalculaFonteLista(height2, 10%x, tl31.Qtd, 25)
               lblUni_pro.TextSize = CalculaFonteLista(height2, 10%x, tl31.unitario, 25)
               lblTot_pro.TextSize = CalculaFonteLista(height2, 10%x, tl31.total, 25)
               lblOperador_pro.TextSize = CalculaFonteLista(height2, 60%x, tl31.nome_atendente, 15)
               lblData_pro.TextSize = CalculaFonteLista(height2, 40%x, tl31.datahora, 15)
            Else
               lblDesc_pro.TextSize = CalculaFonteLista(height2, 50%x, tl31.descricao_produto, 12)
               lblQtd_pro.TextSize = CalculaFonteLista(height2, 10%x, tl31.Qtd, 12)
               lblUni_pro.TextSize = CalculaFonteLista(height2, 10%x, tl31.unitario, 12)
               lblTot_pro.TextSize = CalculaFonteLista(height2, 10%x, tl31.total, 12)
               lblOperador_pro.TextSize = CalculaFonteLista(height2, 100%x, tl31.nome_atendente, 9)
               lblData_pro.TextSize = CalculaFonteLista(height2, 40%x, tl31.datahora, 9)
            End If
            
            'VERIFICA SE O NÚMERO É PAR OU IMPAR
            pnl.AddView(lblDesc_pro, 4%x, height2 * (b - 1), 50%x, height)
            pnl.AddView(lblQtd_pro, 53%x, height2 * (b - 1), 10%x, height2)
            pnl.AddView(lblUni_pro, 65%x, height2 * (b - 1), 10%x, height2)
            pnl.AddView(lblTot_pro, 80%x, height2 * (b - 1), 11%x, height2)
            pnl.AddView(lblOperador_pro, 4%x, height2 * (b - 0.7), 60%x, height2)
            pnl.AddView(lblData_pro, 40%x, height2 * (b - 0.7), 40%x, height2)
            b = b + 1
            
            AlturaPnl_pro = AlturaPnl_pro + height2
         Next
         
         pnl.height = AlturaPnl_pro
         
         '
         
         ProgressDialogHide
         
    End Select
    Response.Release
End Sub
 
Last edited:
Upvote 0

jamessp

Member
Licensed User
Longtime User
Thanks guys, the problem was solved
I created another Dim hc2 The HttpClient
and separated the case.

problem Solved!
 
Upvote 0
Top