mirror of
https://github.com/KeymonSoft/Guna_Preventa_BAT.git
synced 2026-04-18 05:09:19 +00:00
154 lines
5.4 KiB
QBasic
154 lines
5.4 KiB
QBasic
B4A=true
|
|
Group=Default Group
|
|
ModulesStructureVersion=1
|
|
Type=Class
|
|
Version=12.8
|
|
@EndOfDesignText@
|
|
Sub Class_Globals
|
|
Private Root As B4XView 'ignore
|
|
Private xui As XUI 'ignore
|
|
Dim c As Cursor
|
|
Private la_cuenta As Label
|
|
Private La_nombre As Label
|
|
Private la_Calle As Label
|
|
Private la_col As Label
|
|
Private l_entre1 As Label
|
|
Private l_entre2 As Label
|
|
Private l_atiende As Label
|
|
Private Label19 As Label
|
|
Private l_animal As Label
|
|
Private l_limite As Label
|
|
Private l_tipocliente As Label
|
|
Private la_saldotot As Label
|
|
Private Label22 As Label
|
|
Private l_credito As Label
|
|
Private ImageView4 As ImageView
|
|
Private Guardar As Button
|
|
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("Vista_todoslosclientes")
|
|
End Sub
|
|
|
|
Sub HIST_Click
|
|
B4XPages.ShowPage("historicobattodos")
|
|
End Sub
|
|
|
|
Sub B4XPage_Appear
|
|
Log("Entramos")
|
|
c = Starter.skmt.ExecQuery ($"select * from CAT_CATCLIENTESTODOS where CAT_CL_CODIGO in (Select CUENTA from cuentaa)"$)
|
|
If c.RowCount > 0 Then
|
|
c.Position=0
|
|
Log(c.GetString("CAT_CL_NOMBRE"))
|
|
la_cuenta.Text=c.GetString("CAT_CL_CODIGO")
|
|
La_nombre.Text=c.GetString("CAT_CL_NOMBRE")
|
|
la_Calle.Text=c.GetString("CAT_CL_CALLE")
|
|
la_col.Text=c.GetString("CAT_CL_COLONIA")
|
|
l_entre1.Text=c.GetString("CAT_CL_CALLE1")
|
|
l_entre2.Text=c.GetString("CAT_CL_CALLE2")
|
|
l_atiende.Text=c.GetString("CAT_CL_ATIENDE1")
|
|
Label19.Text = c.GetString("CAT_CL_TELEFONO")
|
|
|
|
l_tipocliente.Text = Subs.traeTipoCliente
|
|
|
|
Dim fotomostrar As Cursor = Starter.skmt.ExecQuery("SELECT FOTO FROM FOTOS where CLIENTE IN (SELECT CUENTA FROM CUENTAA)")
|
|
If fotomostrar.RowCount > 0 Then
|
|
|
|
fotomostrar.Position = 0
|
|
Private fotomostrarfinal() As Byte = fotomostrar.GetBlob("FOTO")
|
|
Dim InputStream1 As InputStream
|
|
InputStream1.InitializeFromBytesArray(fotomostrarfinal, 0, fotomostrarfinal.Length)
|
|
Dim Bitmap1 As Bitmap
|
|
Bitmap1.Initialize2(InputStream1)
|
|
InputStream1.Close
|
|
ImageView4.Bitmap = Bitmap1
|
|
Log("aqui si hay foto")
|
|
Else
|
|
ImageView4.Bitmap = LoadBitmap(File.DirAssets,"images.png")
|
|
Log("aqui no hay foto")
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
Dim coloressaldo As Cursor=B4XPages.MainPage.skmt.ExecQuery("select IFNULL(CAT_CL_CLASIFICADOR3,0) AS CAT_CL_CLASIFICADOR3, IFNULL(CAT_CL_CLASIFICADOR4,0) AS CAT_CL_CLASIFICADOR4, IFNULL(CAT_CL_CLASIFICADOR2,'') AS CAT_CL_CLASIFICADOR2 from CAT_CATCLIENTESTODOS where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
|
coloressaldo.Position = 0
|
|
|
|
l_animal.Text = coloressaldo.GetString("CAT_CL_CLASIFICADOR2")
|
|
If coloressaldo.GetString("CAT_CL_CLASIFICADOR2") = "Chimpancé KIN" Then
|
|
l_animal.Color = Colors.RGB(84,255,172)
|
|
Label22.Color = Colors.RGB(84,255,172)
|
|
Else If coloressaldo.GetString("CAT_CL_CLASIFICADOR2") = "Delfín Niky" Then
|
|
l_animal.Color = Colors.RGB(84,255,245)
|
|
Label22.Color = Colors.RGB(84,255,245)
|
|
Else If coloressaldo.GetString("CAT_CL_CLASIFICADOR2") = "Tortuga KOPI" Then
|
|
l_animal.Color = Colors.RGB(255,123,84)
|
|
Label22.Color = Colors.RGB(255,123,84)
|
|
Else If coloressaldo.GetString("CAT_CL_CLASIFICADOR2") = "Lechuza MON" Then
|
|
l_animal.Color = Colors.RGB(255,250,140)
|
|
Label22.Color = Colors.RGB(255,250,140)
|
|
Else
|
|
l_animal.Color = Colors.Transparent
|
|
Label22.Color = Colors.Transparent
|
|
End If
|
|
|
|
c = B4XPages.MainPage.skmt.ExecQuery("select IFNULL(CAT_CL_BCREDITO,0) AS CAT_CL_BCREDITO, CAT_CL_LIMITECREDITO from CAT_CATCLIENTESTODOS where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
|
c.Position = 0
|
|
If c.GetInt("CAT_CL_BCREDITO") = 1 Then
|
|
|
|
Dim pagarepen As Cursor = B4XPages.MainPage.skmt.ExecQuery("select FECHA, SALDO_PENDIENTE FROM ABONOSP WHERE CLIENTE IN (SELECT CUENTA FROM CUENTAA)")
|
|
If pagarepen.RowCount > 0 Then
|
|
pagarepen.Position = 0
|
|
DateTime.DateFormat="dd/MM/yyyy"
|
|
Dim FechaInicio As String = pagarepen.GetString("FECHA") ' Formato: dd/MM/yyyy
|
|
' Dim FechaHoy As String = DateTime.Date(DateTime.Now) ' Fecha actual en formato dd/MM/yyyy
|
|
Log(pagarepen.GetString("FECHA"))
|
|
' Convertir las fechas a milisegundos (desde 01/01/1970)
|
|
Dim TicksInicio As Long = DateTime.DateParse(FechaInicio)
|
|
Dim TicksHoy As Long = DateTime.DateParse(DateTime.Date(DateTime.Now))
|
|
|
|
' Calcular diferencia en días
|
|
Dim DiferenciaDias As Int = (TicksHoy - TicksInicio) / DateTime.TicksPerDay
|
|
|
|
' Mostrar resultado
|
|
Log($"Días transcurridos: ${DiferenciaDias}"$)
|
|
|
|
Dim c4 As Cursor=B4XPages.MainPage.skmt.ExecQuery("select IFNULL(CAT_CL_DIASCREDITO,0) AS CAT_CL_DIASCREDITO from kmt_info3 where CAT_CL_CODIGO In (Select cuenta from cuentaa)")
|
|
c4.Position = 0
|
|
|
|
' If DiferenciaDias <= c4.GetInt("CAT_CL_DIASCREDITO") + 1 Then
|
|
'' l_credito.Color = Colors.Green
|
|
'' l_limite.Color = Colors.Green
|
|
' Else If DiferenciaDias > c4.GetInt("CAT_CL_DIASCREDITO") + 1 Then
|
|
' l_credito.Color = Colors.Red
|
|
' l_limite.Color = Colors.Red
|
|
' End If
|
|
Else
|
|
' l_credito.Color = Colors.Transparent
|
|
' l_limite.Color = Colors.Transparent
|
|
End If
|
|
l_credito.Visible = True
|
|
l_limite.Visible = True
|
|
l_limite.Text = c.GetInt("CAT_CL_LIMITECREDITO")
|
|
Else If c.GetInt("CAT_CL_BCREDITO") = 0 Then
|
|
l_credito.Visible = False
|
|
l_limite.Visible = False
|
|
End If
|
|
End Sub
|
|
|
|
|
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
|
|
|
Private Sub Guardar_Click
|
|
B4XPages.ShowPage("Principal")
|
|
End Sub |