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 ListView1 As ListView
	Dim b_noventa As Button
	Private p_principal As Panel
End Sub

'You can add more parameters here.
Public Sub Initialize As Object
	Return Me
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
	Root = Root1
	'load the layout to Root
	Root.LoadLayout("buscar")
	c=Starter.skmt.ExecQuery("select REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT FROM REPARTO")
	ListView1.Clear
	If c.RowCount>0 Then
		For i=0 To c.RowCount -1
			c.Position=i
			Dim label1 As Label
			label1 = ListView1.TwoLinesLayout.Label
			label1.TextSize = 10
			label1.TextColor = Colors.Black
 			Dim label2 As Label
			label2 = ListView1.TwoLinesLayout.SecondLabel
			label2.TextSize = 10
			label2.TextColor = Colors.Blue
			ListView1.AddTwoLines(c.GetString("REP_CLIENTE"),c.GetString("REP_PRONOMBRE") &"   Cantidad #"& c.GetString("REP_CANT")& " SubTotal $"& c.GetString("REP_COSTO_TOT"))
		Next
	End If
	c.Close
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Sub B4XPage_Appear
	p_principal.Width = Root.Width
	p_principal.Height = Root.Height
	Subs.centraPanel(p_principal, Root.Width)
	
	c=Starter.skmt.ExecQuery("select REP_CLIENTE, REP_PRONOMBRE, REP_CANT, REP_COSTO_TOT FROM REPARTO")
	ListView1.Clear
	  
	If c.RowCount>0 Then
		For i=0 To c.RowCount -1
			c.Position=i
			Dim label1 As Label
			label1 = ListView1.TwoLinesLayout.Label
			label1.TextSize = 10
			label1.TextColor = Colors.Black
			Dim label2 As Label
			label2 = ListView1.TwoLinesLayout.SecondLabel
			label2.TextSize = 10
			label2.TextColor = Colors.Blue
			ListView1.AddTwoLines(c.GetString("REP_CLIENTE"),c.GetString("REP_PRONOMBRE") &"   Cantidad #"& c.GetString("REP_CANT")& " SubTotal $"& c.GetString("REP_COSTO_TOT"))
		Next
	End If
	c.Close
End Sub

Sub Regresar_Click
	B4XPages.ShowPage("Cliente")
End Sub

Private Sub B4XPage_CloseRequest As ResumableSub
	' BACK key pressed
	' I want to capture the key here so I return True
	B4XPages.ShowPage("Principal")
	'Return True
	' Returning False signals the system to handle the key
	Return False
End Sub

Sub ListView1_ItemLongClick (Position As Int, Value As Object)
	Starter.skmt.ExecNonQuery("delete from CUENTAA")
	Starter.skmt.ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)", Array As Object(Value))
	B4XPages.ShowPage("Cliente")
End Sub

Sub b_noventa_Click
	c=Starter.skmt.ExecQuery("select NV_CLIENTE,NV_MOTIVO,NV_COMM FROM NOVENTA ORDER BY NV_CLIENTE asc")
	ListView1.Clear
	  
	If c.RowCount>0 Then
		For i=0 To c.RowCount -1
			c.Position=i
			Dim label1 As Label
			label1 = ListView1.TwoLinesLayout.Label
			label1.TextSize = 10
			label1.TextColor = Colors.Black
			Dim label2 As Label
			label2 = ListView1.TwoLinesLayout.SecondLabel
			label2.TextSize = 10
			label2.TextColor = Colors.Blue
			ListView1.AddTwoLines(c.GetString("NV_CLIENTE"),"Motivo #"& c.GetString("NV_MOTIVO")& " Comentario $"& c.GetString("NV_COMM"))
		Next
	End If
End Sub