Files
Guna_Reparto_S_IMP/B4A/C_Detalle_Promo.bas
cvaldes1201 f21eee06f3 6.01.10 S/I
2026-03-10 10:44:32 -06:00

113 lines
3.2 KiB
QBasic

B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=12.2
@EndOfDesignText@
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
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
'You can add more parameters here.
Public Sub Initialize As Object
Return Me
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
'load the layout to Root
Root.LoadLayout("detalle_promo")
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
End Sub
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Sub B4XPage_Appear
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)
B4XPages.ShowPage("")
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)
B4XPages.ShowPage("")
'Return True
End If
' Returning False signals the system to handle the key
Return False
End Sub