B4A=true Group=Default Group ModulesStructureVersion=1 Type=Activity Version=7.01 @EndOfDesignText@ #Region Activity Attributes #FullScreen: False #IncludeTitle: True #End Region Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules. ' Dim skmt As SQL End Sub Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim c As Cursor ' Dim ruta As String Dim Regresar As Button Dim b As Cursor Dim regalo As String Dim ListView1 As ListView Dim L_CANT As Label Dim L_TOTAL As Label Dim borra As Button Dim Existe As String End Sub Sub Activity_Create(FirstTime As Boolean) ' ruta = Main.ruta Activity.LoadLayout("detalle_promo") ' se crea o no el archivo de la base de ddatos de kmt 'NOTAS SI SE MODIFICA LA ESTRUCTURA SE QUITA EL IF Y SE VA DIRECTO A LA SENTENCIA FILE.COPY PARA QUE 'TOME LA NUEVA ESTRUCTURA ES MUY IMPORTANTE TENER EL IF DE LO CONTRARIO SOLO LO ESCRIBE UNA VEZ Y LO BORRA 'SI SE REGRESA A ESTE ACTIVIDAD. ' If File.Exists(Starter.ruta, "kmt.db") = False Then ' File.Copy(File.DirAssets, "kmt.db", Starter.ruta, "kmt.db") ' End If ' skmt.Initialize(Starter.ruta,"kmt.db", True) c=Starter.skmt.ExecQuery("select CAT_DP_IDPROD, CAT_DP_PZAS, CAT_DP_PRECIO FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID)") ListView1.Clear Subs.SetDivider(ListView1, Colors.LightGray, 2) If c.RowCount>0 Then For i=0 To c.RowCount -1 c.Position=i b=Starter.skmt.ExecQuery2("select CAT_GP_NOMBRE from cat_gunaprod where CAT_GP_ID = ?", Array As String(C.GetString("CAT_DP_IDPROD"))) B.Position =0 Dim label1 As Label label1 = ListView1.TwoLinesLayout.Label label1.TextSize = 10 label1.TextColor = Colors.White Dim label2 As Label label2 = ListView1.TwoLinesLayout.SecondLabel label2.TextSize = 10 label2.TextColor = Colors.White If c.GetString("CAT_DP_PRECIO") = 0 Then regalo = "SI" Else regalo = "NO" End If ListView1.AddTwoLines(B.GetString("CAT_GP_NOMBRE"),"Cantidad # "& c.GetString("CAT_DP_PZAS")& " REGALO "& regalo) b.Close Next c.Close End If 'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT") 'ListView1.AddTwoLines(c.GetString("pr_cd_nombre"),c.GetString("pr_cd_colonia")) ' Next 'End If End Sub Sub Activity_Resume Starter.skmt.Initialize(Starter.ruta,"kmt.db", True) c=Starter.skmt.ExecQuery("select CAT_DP_IDPROD, CAT_DP_PZAS, CAT_DP_PRECIO FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID IN (Select PROIDID from PROIDID)") ListView1.Clear Subs.SetDivider(ListView1, Colors.LightGray, 2) If c.RowCount>0 Then For i=0 To c.RowCount -1 c.Position=i b=Starter.skmt.ExecQuery2("select CAT_GP_NOMBRE from cat_gunaprod where CAT_GP_ID = ?", Array As String(C.GetString("CAT_DP_IDPROD"))) B.Position =0 Dim label1 As Label label1 = ListView1.TwoLinesLayout.Label label1.TextSize = 10 label1.TextColor = Colors.White Dim label2 As Label label2 = ListView1.TwoLinesLayout.SecondLabel label2.TextSize = 10 label2.TextColor = Colors.White If c.GetString("CAT_DP_PRECIO") = 0 Then regalo = "SI" Else regalo = "NO" End If ListView1.AddTwoLines(B.GetString("CAT_GP_NOMBRE"),"Cantidad # "& c.GetString("CAT_DP_PZAS")& " REGALO "& regalo) b.Close Next c.Close End If 'la_no_ird.Text = c.GetString("PR_CF_SALDO_ACORT") End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub Regresar_Click StartActivity(pedidos) End Sub Sub Activity_KeyPress (key As Int) As Boolean ' BACK key pressed If key=KeyCodes.KEYCODE_BACK Then ' I want to capture the key here so I return True StartActivity(pedidos) 'Return True End If ' Returning False signals the system to handle the key Return False End Sub