mirror of
https://github.com/KeymonSoft/Intmex_Multiventa.git
synced 2026-04-17 21:06:08 +00:00
Version: 5.05.30
Se reviso el apartado de promos, se valido el total de productos fijos y de variables, se reviso el precio total de promociones, se revisaron los apartados de nota y el envio de informacion.
This commit is contained in:
@@ -247,6 +247,7 @@ End Sub
|
|||||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||||
|
|
||||||
Sub B4XPage_Appear
|
Sub B4XPage_Appear
|
||||||
|
p_pedidoExistente.Visible = False
|
||||||
reqManager.Initialize(Me, Starter.DBReqServer)
|
reqManager.Initialize(Me, Starter.DBReqServer)
|
||||||
b_pedidoExistente.Visible = False
|
b_pedidoExistente.Visible = False
|
||||||
LA_GPS.TextColor = Colors.Red
|
LA_GPS.TextColor = Colors.Red
|
||||||
|
|||||||
288
B4A/C_Promos.bas
288
B4A/C_Promos.bas
@@ -65,6 +65,8 @@ Sub Class_Globals
|
|||||||
' Dim etVar1HasFocus As Boolean = False
|
' Dim etVar1HasFocus As Boolean = False
|
||||||
' Dim etVar2HasFocus As Boolean = False
|
' Dim etVar2HasFocus As Boolean = False
|
||||||
' Dim etVar3HasFocus As Boolean = False
|
' Dim etVar3HasFocus As Boolean = False
|
||||||
|
|
||||||
|
' Dim lblNombre As Label
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub Initialize As Object
|
Public Sub Initialize As Object
|
||||||
@@ -317,6 +319,8 @@ Private Sub B4XPage_Appear
|
|||||||
ObtenerFijos(estaPromo)
|
ObtenerFijos(estaPromo)
|
||||||
|
|
||||||
ActualizarTotalValor
|
ActualizarTotalValor
|
||||||
|
CalcularTotalVariables
|
||||||
|
CalcularTotalFijos
|
||||||
|
|
||||||
lblSumaTotal.Text = SumarFijos + SumarVariables1 +SumarVariables2 + SumarVariables3
|
lblSumaTotal.Text = SumarFijos + SumarVariables1 +SumarVariables2 + SumarVariables3
|
||||||
|
|
||||||
@@ -427,7 +431,19 @@ Sub muestraPromo(promo As String, cliente As String)
|
|||||||
If productosFijos > 0 Then
|
If productosFijos > 0 Then
|
||||||
pnlFijos.Visible = True
|
pnlFijos.Visible = True
|
||||||
lblFijosRequeridos.Visible = True
|
lblFijosRequeridos.Visible = True
|
||||||
lblFijosRequeridos.Text = $"Productos Fijos: '${productosFijos}'"$
|
|
||||||
|
Private pzs2 As Cursor = Starter.skmt.ExecQuery($"select sum(CAT_DP_PZAS) as suma from cat_detalles_paq where cat_dp_tipo = '0' and cat_dp_id = '${estaPromo}'"$)
|
||||||
|
If pzs2.RowCount > 0 Then
|
||||||
|
' For i = 0 To pzs2.RowCount - 1
|
||||||
|
pzs2.Position = 0
|
||||||
|
Log(pzs2.GetString("suma"))
|
||||||
|
' totalCant = totalCant + pzs2.GetString("CAT_DP_PZAS")
|
||||||
|
' Log(totalCant)
|
||||||
|
' Next
|
||||||
|
End If
|
||||||
|
lblFijosRequeridos.Text = "Productos fijos: " & (pzs2.GetString("suma") * lblSumPromo.Text)
|
||||||
|
Log("Aqui deberia mostrar la cantidad de fijos: " & pzs2.GetString("suma"))
|
||||||
|
|
||||||
lblFijosRequeridos.Left = 0
|
lblFijosRequeridos.Left = 0
|
||||||
lblFijosRequeridos.Width = Root.Width
|
lblFijosRequeridos.Width = Root.Width
|
||||||
Dim cursorProdFijo As Cursor = Starter.skmt.ExecQuery($"SELECT CAT_GP_NOMBRE, CAT_DP_PZAS, CAT_DP_PRECIO, CAT_DP_ID, CAT_DP_IDPROD, CAT_DP_TIPO FROM CAT_DETALLES_PAQ INNER JOIN CAT_GUNAPROD ON CAT_DP_IDPROD = CAT_GP_ID WHERE CAT_DP_ID = '${promo}' AND CAT_DP_TIPO = 0"$)
|
Dim cursorProdFijo As Cursor = Starter.skmt.ExecQuery($"SELECT CAT_GP_NOMBRE, CAT_DP_PZAS, CAT_DP_PRECIO, CAT_DP_ID, CAT_DP_IDPROD, CAT_DP_TIPO FROM CAT_DETALLES_PAQ INNER JOIN CAT_GUNAPROD ON CAT_DP_IDPROD = CAT_GP_ID WHERE CAT_DP_ID = '${promo}' AND CAT_DP_TIPO = 0"$)
|
||||||
@@ -545,31 +561,68 @@ Private Sub btnMenosPromo_Click
|
|||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
lblFijosRequeridos.Text = $"Productos Fijos: '${productosFijos}'"$
|
' Obtener la suma de productos fijos y multiplicar por currentValue
|
||||||
|
Private pzs2 As Cursor = Starter.skmt.ExecQuery($"select sum(CAT_DP_PZAS) as suma from cat_detalles_paq where cat_dp_tipo = '0' and cat_dp_id = '${estaPromo}'"$)
|
||||||
|
If pzs2.RowCount > 0 Then
|
||||||
|
pzs2.Position = 0
|
||||||
|
Dim sumaPzas As Int = pzs2.GetInt("suma")
|
||||||
|
lblFijosRequeridos.Text = "Productos fijos: " & (sumaPzas * currentValue) ' Multiplicar por currentValue
|
||||||
|
End If
|
||||||
|
|
||||||
lblVariablesRequeridas1.Text = $"Primeros Variables Requeridos: '${variablesRequeridas1}'"$
|
lblVariablesRequeridas1.Text = $"Primeros Variables Requeridos: '${variablesRequeridas1}'"$
|
||||||
lblVariablesRequeridas2.Text = $"Segundos Variables Requeridos: '${variablesRequeridas2}'"$
|
lblVariablesRequeridas2.Text = $"Segundos Variables Requeridos: '${variablesRequeridas2}'"$
|
||||||
lblVariablesRequeridas3.Text = $"Tercer Variables Requeridas: '${variablesRequeridas3}'"$
|
lblVariablesRequeridas3.Text = $"Tercer Variables Requeridas: '${variablesRequeridas3}'"$
|
||||||
|
|
||||||
RecalcularSumas
|
RecalcularSumas
|
||||||
|
Log("Esto recalcula la reta:<<<<<<<<<<<<< " & RecalcularSumas)
|
||||||
ActualizarVisibilidadBtnGuardaPromo
|
ActualizarVisibilidadBtnGuardaPromo
|
||||||
|
CalcularTotalVariables
|
||||||
|
CalcularTotalFijos
|
||||||
|
'Este for hace que la cantidad de la etiqueta de los fijos cambie con el menos
|
||||||
|
For i = 0 To pnlFijos.NumberOfViews - 1
|
||||||
|
Dim pnlProducto As Panel = pnlFijos.GetView(i)
|
||||||
|
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
||||||
|
Dim cantidad As Int = 0
|
||||||
|
Dim lblNombre As Label = pnlProducto.GetView(0)
|
||||||
|
Dim nombreProducto As String = lblNombre.Text
|
||||||
|
' Log(">>>>>>>>>>>>>Esto es nombre: " & nombreProducto & " <<<<<<<<<<<<<<<")
|
||||||
|
' Log("Precio: " & precioProducto)
|
||||||
|
' Log("Cantidad: " & cantidad)
|
||||||
|
Private idProducto As String = lblNombre.tag
|
||||||
|
|
||||||
|
Dim cursorProductosFijos As Cursor = Starter.skmt.ExecQuery($"SELECT CAT_DP_PZAS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = '${estaPromo}' AND CAT_DP_TIPO = '0' and cat_dp_idprod = '${idProducto}'"$)
|
||||||
|
If cursorProductosFijos.RowCount > 0 Then
|
||||||
|
cursorProductosFijos.Position = 0
|
||||||
|
cantidad = cursorProductosFijos.GetString("CAT_DP_PZAS")
|
||||||
|
End If
|
||||||
|
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
||||||
|
' Log("Esto es el nombre del producto? <<<<<<<<<<<<<<<<<<<<<<<|" &nomProd(0) & "|>>>>>>>>>>>>>>>>>>>>><<")
|
||||||
|
lblNombre.Text = nomProd(0) & CRLF & "Cant: " & (cantidad * lblSumPromo.Text)& " $" & NumberFormat2(precioProducto,1,2,2,True)
|
||||||
|
Next
|
||||||
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnSumaPromo_Click
|
Private Sub btnSumaPromo_Click
|
||||||
|
Log("Aqui entro al clikear")
|
||||||
|
|
||||||
' etVar1HasFocus = False
|
' etVar1HasFocus = False
|
||||||
' etVar2HasFocus = False
|
' etVar2HasFocus = False
|
||||||
' etVar3HasFocus = False
|
' etVar3HasFocus = False
|
||||||
|
|
||||||
Dim currentValue As Int = lblSumPromo.Text.As(Int)
|
Dim currentValue As Int = lblSumPromo.Text.As(Int)
|
||||||
Dim maxValue As Int = lblMaxPromo.Text.As(Int)
|
Dim maxValue As Int = lblMaxPromo.Text.As(Int)
|
||||||
|
Log("Esto es MaxValue: " & maxValue & "<<<<<<<<<<<<<<<<<<<<<<")
|
||||||
Log("Esto es currentValue: " & currentValue)
|
Log("Esto es currentValue: " & currentValue)
|
||||||
Log("Esto es maxValue: " & maxValue)
|
Log("Esto es maxValue: " & maxValue)
|
||||||
|
Log("Esto es estaPromo: " & estaPromo)
|
||||||
|
|
||||||
If currentValue < maxValue Then
|
If currentValue < maxValue Then
|
||||||
|
|
||||||
Log("Esto es currentValue despues del if: " & currentValue)
|
Log("Esto es currentValue despues del if: " & currentValue)
|
||||||
Log("Esto es maxValue despues del if: " & maxValue)
|
Log("Esto es maxValue despues del if: " & maxValue)
|
||||||
currentValue = currentValue + 1
|
currentValue = currentValue + 1
|
||||||
Log("Esto es una suma: " & (currentValue + 1))
|
Log("Esto es una suma de mi label?: " & (currentValue))
|
||||||
End If
|
End If
|
||||||
|
|
||||||
lblSumPromo.Text = currentValue
|
lblSumPromo.Text = currentValue
|
||||||
@@ -611,14 +664,46 @@ Private Sub btnSumaPromo_Click
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' Actualizar las etiquetas
|
' Actualizar las etiquetas
|
||||||
lblFijosRequeridos.Text = $"Productos Fijos: '${productosFijos}'"$
|
|
||||||
|
' Obtener la suma de productos fijos y multiplicar por currentValue
|
||||||
|
Private pzs2 As Cursor = Starter.skmt.ExecQuery($"select sum(CAT_DP_PZAS) as suma from cat_detalles_paq where cat_dp_tipo = '0' and cat_dp_id = '${estaPromo}'"$)
|
||||||
|
If pzs2.RowCount > 0 Then
|
||||||
|
pzs2.Position = 0
|
||||||
|
Dim sumaPzas As Int = pzs2.GetInt("suma")
|
||||||
|
lblFijosRequeridos.Text = "Productos fijos: " & (sumaPzas * currentValue) ' Multiplicar por currentValue
|
||||||
|
End If
|
||||||
|
|
||||||
lblVariablesRequeridas1.Text = $"Primeros Variables Requeridos: '${variablesRequeridas1}'"$
|
lblVariablesRequeridas1.Text = $"Primeros Variables Requeridos: '${variablesRequeridas1}'"$
|
||||||
lblVariablesRequeridas2.Text = $"Segundos Variables Requeridos: '${variablesRequeridas2}'"$
|
lblVariablesRequeridas2.Text = $"Segundos Variables Requeridos: '${variablesRequeridas2}'"$
|
||||||
lblVariablesRequeridas3.Text = $"Tercer Variables Requeridas: '${variablesRequeridas3}'"$
|
lblVariablesRequeridas3.Text = $"Tercer Variables Requeridas: '${variablesRequeridas3}'"$
|
||||||
|
'Este for cambia la cantidad en la etiqueta de los fijos
|
||||||
|
For i = 0 To pnlFijos.NumberOfViews - 1
|
||||||
|
Dim pnlProducto As Panel = pnlFijos.GetView(i)
|
||||||
|
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
||||||
|
Dim cantidad As Int = 0
|
||||||
|
Dim lblNombre As Label = pnlProducto.GetView(0)
|
||||||
|
Dim nombreProducto As String = lblNombre.Text
|
||||||
|
' Log(">>>>>>>>>>>>>Esto es nombre: " & nombreProducto & " <<<<<<<<<<<<<<<")
|
||||||
|
' Log("Precio: " & precioProducto)
|
||||||
|
' Log("Cantidad: " & cantidad)
|
||||||
|
Private idProducto As String = lblNombre.tag
|
||||||
|
|
||||||
|
Dim cursorProductosFijos As Cursor = Starter.skmt.ExecQuery($"SELECT CAT_DP_PZAS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = '${estaPromo}' AND CAT_DP_TIPO = '0' and cat_dp_idprod = '${idProducto}'"$)
|
||||||
|
If cursorProductosFijos.RowCount > 0 Then
|
||||||
|
cursorProductosFijos.Position = 0
|
||||||
|
cantidad = cursorProductosFijos.GetString("CAT_DP_PZAS")
|
||||||
|
End If
|
||||||
|
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
||||||
|
' Log("Esto es el nombre del producto? <<<<<<<<<<<<<<<<<<<<<<<|" &nomProd(0) & "|>>>>>>>>>>>>>>>>>>>>><<")
|
||||||
|
lblNombre.Text = nomProd(0) & CRLF & "Cant: " & (cantidad * lblSumPromo.Text)& " $" & NumberFormat2(precioProducto,1,2,2,True)
|
||||||
|
Next
|
||||||
|
|
||||||
' Recalcular sumas y actualizar la interfaz
|
' Recalcular sumas y actualizar la interfaz
|
||||||
RecalcularSumas
|
RecalcularSumas
|
||||||
|
Log("Esto recalcula la suma:<<<<<<<<<<<<< " & RecalcularSumas)
|
||||||
ActualizarVisibilidadBtnGuardaPromo
|
ActualizarVisibilidadBtnGuardaPromo
|
||||||
|
CalcularTotalVariables
|
||||||
|
CalcularTotalFijos
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub btnVars1Mas_Click
|
Private Sub btnVars1Mas_Click
|
||||||
@@ -774,7 +859,7 @@ Private Sub GenerarFijos(nombreProd As String, inventario As String, precio As S
|
|||||||
Return
|
Return
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Log($", ${idProducto}, ${nombreProd}, ${inventario}, ${precio}"$)
|
Log($"${idProducto}, ${nombreProd}, ${inventario}, ${precio}"$)
|
||||||
|
|
||||||
Private estePrecio As String = precio
|
Private estePrecio As String = precio
|
||||||
|
|
||||||
@@ -782,19 +867,20 @@ Private Sub GenerarFijos(nombreProd As String, inventario As String, precio As S
|
|||||||
pnlProducto.Initialize("pnlProducto")
|
pnlProducto.Initialize("pnlProducto")
|
||||||
pnlProducto.SetLayout(0, 0, pnlFijos.Width, 70dip)
|
pnlProducto.SetLayout(0, 0, pnlFijos.Width, 70dip)
|
||||||
|
|
||||||
|
Private estePrecio As String = precio
|
||||||
Private cantidad As Int = 0
|
Private cantidad As Int = 0
|
||||||
|
|
||||||
Private pzs As Cursor = Starter.skmt.ExecQuery($"select CAT_DP_PZAS from cat_detalles_paq where cat_dp_idprod = '${idProducto}' and cat_dp_id = '${estaPromoA}'"$)
|
Private pzs As Cursor = Starter.skmt.ExecQuery($"select CAT_DP_PZAS from cat_detalles_paq where cat_dp_idprod = '${idProducto}' and cat_dp_id = '${estaPromoA}'"$)
|
||||||
If pzs.RowCount > 0 Then
|
If pzs.RowCount > 0 Then
|
||||||
pzs.Position = 0
|
pzs.Position = 0
|
||||||
Log("============================== " & pzs.GetString("CAT_DP_PZAS"))
|
Log("============================== " & pzs.GetString("CAT_DP_PZAS"))
|
||||||
cantidad = pzs.GetString("CAT_DP_PZAS")
|
cantidad = pzs.GetString("CAT_DP_PZAS") * lblSumPromo.Text.As(Int) ' Multiplicamos por el número de promos
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
Dim lblNombre As Label
|
Dim lblNombre As Label
|
||||||
lblNombre.Initialize("lblNombre")
|
lblNombre.Initialize("lblNombre")
|
||||||
lblNombre.Text = nombreProd & CRLF & "Cant: " & cantidad & " $" & NumberFormat2(estePrecio,1,2,2,True)
|
|
||||||
|
lblNombre.Text = nombreProd & CRLF & "Cant: " & (cantidad * lblSumPromo.Text)& " $" & NumberFormat2(estePrecio,1,2,2,True)
|
||||||
lblNombre.Tag = idProducto
|
lblNombre.Tag = idProducto
|
||||||
lblNombre.TextSize = 12
|
lblNombre.TextSize = 12
|
||||||
lblNombre.TextColor = xui.Color_Black
|
lblNombre.TextColor = xui.Color_Black
|
||||||
@@ -806,7 +892,7 @@ Private Sub GenerarFijos(nombreProd As String, inventario As String, precio As S
|
|||||||
pnlFijos.AddView(pnlProducto, 0, numberOfViews * 70dip, pnlFijos.Width, 70dip)
|
pnlFijos.AddView(pnlProducto, 0, numberOfViews * 70dip, pnlFijos.Width, 70dip)
|
||||||
pnlFijos.Height = (numberOfViews * 70dip) + 70dip
|
pnlFijos.Height = (numberOfViews * 70dip) + 70dip
|
||||||
|
|
||||||
Private totalCant As Int = 0
|
' Private totalCant As Int = 0
|
||||||
Private pzs2 As Cursor = Starter.skmt.ExecQuery($"select sum(CAT_DP_PZAS) as suma from cat_detalles_paq where cat_dp_tipo = '0' and cat_dp_id = '${estaPromoA}'"$)
|
Private pzs2 As Cursor = Starter.skmt.ExecQuery($"select sum(CAT_DP_PZAS) as suma from cat_detalles_paq where cat_dp_tipo = '0' and cat_dp_id = '${estaPromoA}'"$)
|
||||||
If pzs2.RowCount > 0 Then
|
If pzs2.RowCount > 0 Then
|
||||||
' For i = 0 To pzs2.RowCount - 1
|
' For i = 0 To pzs2.RowCount - 1
|
||||||
@@ -816,7 +902,7 @@ Private Sub GenerarFijos(nombreProd As String, inventario As String, precio As S
|
|||||||
' Log(totalCant)
|
' Log(totalCant)
|
||||||
' Next
|
' Next
|
||||||
End If
|
End If
|
||||||
lblFijosRequeridos.Text = "Productos fijos: " & pzs2.GetString("suma")
|
lblFijosRequeridos.Text = "Productos fijos: " & (pzs2.GetString("suma") * lblSumPromo.Text)
|
||||||
SumarFijos
|
SumarFijos
|
||||||
pzs.Close
|
pzs.Close
|
||||||
|
|
||||||
@@ -1257,6 +1343,14 @@ Private Sub btnGuardaPromo_Click
|
|||||||
Log("============================== " & pzs.GetString("CAT_DP_PZAS"))
|
Log("============================== " & pzs.GetString("CAT_DP_PZAS"))
|
||||||
cantidad = pzs.GetString("CAT_DP_PZAS")
|
cantidad = pzs.GetString("CAT_DP_PZAS")
|
||||||
End If
|
End If
|
||||||
|
Dim cursorProductosFijos As Cursor = Starter.skmt.ExecQuery($"SELECT CAT_DP_PZAS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = '${estaPromo}' AND CAT_DP_TIPO = '0' and cat_dp_idprod = '${idProducto}'"$)
|
||||||
|
|
||||||
|
If cursorProductosFijos.RowCount > 0 Then
|
||||||
|
cursorProductosFijos.Position = 0
|
||||||
|
cantidad = cursorProductosFijos.GetString("CAT_DP_PZAS") * lblSumPromo.Text
|
||||||
|
End If
|
||||||
|
Log("Esto debe ser cantidad: " & cantidad)
|
||||||
|
|
||||||
If cantidad > 0 Then
|
If cantidad > 0 Then
|
||||||
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||||
End If
|
End If
|
||||||
@@ -1343,10 +1437,22 @@ Private Sub btnContinuar_Click
|
|||||||
For i = 0 To pnlFijos.NumberOfViews - 1
|
For i = 0 To pnlFijos.NumberOfViews - 1
|
||||||
Dim pnlProducto As Panel = pnlFijos.GetView(i)
|
Dim pnlProducto As Panel = pnlFijos.GetView(i)
|
||||||
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
||||||
Dim cantidad As Int = productosFijos
|
Dim cantidad As Int = 0
|
||||||
Dim lblNombre As Label = pnlProducto.GetView(0)
|
|
||||||
Dim nombreProducto As String = lblNombre.Text
|
Dim lblNombre2 As Label = pnlProducto.GetView(0)
|
||||||
Private idProducto As String = lblNombre.tag
|
Dim nombreProducto As String = lblNombre2.Text
|
||||||
|
Private idProducto As String = lblNombre2.tag
|
||||||
|
|
||||||
|
'Este for hace que la cantidad de la etiqueta de los fijos cambie con el menos
|
||||||
|
|
||||||
|
Dim cursorProductosFijos As Cursor = Starter.skmt.ExecQuery($"SELECT CAT_DP_PZAS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = '${estaPromo}' AND CAT_DP_TIPO = '0' and cat_dp_idprod = '${idProducto}'"$)
|
||||||
|
If cursorProductosFijos.RowCount > 0 Then
|
||||||
|
cursorProductosFijos.Position = 0
|
||||||
|
cantidad = cursorProductosFijos.GetString("CAT_DP_PZAS") * lblSumPromo.Text
|
||||||
|
End If
|
||||||
|
Log("Esto debe ser cantidad: " & cantidad)
|
||||||
|
|
||||||
|
|
||||||
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
||||||
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||||
Log("" & estaPromo & "" & precioProducto & "" & cantidad & "" & nomProd(0) & "" & idProducto & "" & Subs.traeCliente & "" & Subs.traeFecha & "" & Subs.traeUsuarioDeBD & "" & Subs.traeRuta & "" & 0 & "" & B4XPages.MainPage.tipo_venta)
|
Log("" & estaPromo & "" & precioProducto & "" & cantidad & "" & nomProd(0) & "" & idProducto & "" & Subs.traeCliente & "" & Subs.traeFecha & "" & Subs.traeUsuarioDeBD & "" & Subs.traeRuta & "" & 0 & "" & B4XPages.MainPage.tipo_venta)
|
||||||
@@ -1361,9 +1467,9 @@ Private Sub btnContinuar_Click
|
|||||||
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
||||||
Dim lblValueVar1 As Label = pnlProducto.GetView(2)
|
Dim lblValueVar1 As Label = pnlProducto.GetView(2)
|
||||||
Dim cantidad As Int = lblValueVar1.Text.As(Int)
|
Dim cantidad As Int = lblValueVar1.Text.As(Int)
|
||||||
Dim lblNombre As Label = pnlProducto.GetView(0)
|
Dim lblNombre3 As Label = pnlProducto.GetView(0)
|
||||||
Dim nombreProducto As String = lblNombre.Text
|
Dim nombreProducto As String = lblNombre3.Text
|
||||||
Private idProducto As String = lblNombre.tag
|
Private idProducto As String = lblNombre3.tag
|
||||||
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
||||||
If cantidad > 0 Then
|
If cantidad > 0 Then
|
||||||
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||||
@@ -1379,9 +1485,9 @@ Private Sub btnContinuar_Click
|
|||||||
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
||||||
Dim lblValueVar2 As Label = pnlProducto.GetView(2)
|
Dim lblValueVar2 As Label = pnlProducto.GetView(2)
|
||||||
Dim cantidad As Int = lblValueVar2.Text.As(Int)
|
Dim cantidad As Int = lblValueVar2.Text.As(Int)
|
||||||
Dim lblNombre As Label = pnlProducto.GetView(0)
|
Dim lblNombre4 As Label = pnlProducto.GetView(0)
|
||||||
Dim nombreProducto As String = lblNombre.Text
|
Dim nombreProducto As String = lblNombre4.Text
|
||||||
Private idProducto As String = lblNombre.tag
|
Private idProducto As String = lblNombre4.tag
|
||||||
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
||||||
If cantidad > 0 Then
|
If cantidad > 0 Then
|
||||||
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||||
@@ -1397,9 +1503,9 @@ Private Sub btnContinuar_Click
|
|||||||
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
||||||
Dim lblValueVar3 As Label = pnlProducto.GetView(2)
|
Dim lblValueVar3 As Label = pnlProducto.GetView(2)
|
||||||
Dim cantidad As Int = lblValueVar3.Text.As(Int)
|
Dim cantidad As Int = lblValueVar3.Text.As(Int)
|
||||||
Dim lblNombre As Label = pnlProducto.GetView(0)
|
Dim lblNombre5 As Label = pnlProducto.GetView(0)
|
||||||
Dim nombreProducto As String = lblNombre.Text
|
Dim nombreProducto As String = lblNombre5.Text
|
||||||
Private idProducto As String = lblNombre.tag
|
Private idProducto As String = lblNombre5.tag
|
||||||
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
||||||
If cantidad > 0 Then
|
If cantidad > 0 Then
|
||||||
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
Subs.guardaProductoSinGestion(estaPromo, precioProducto, cantidad, nomProd(0), idProducto, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||||
@@ -1490,14 +1596,23 @@ Private Sub VerificarCondicionesParabtnGuardaPromo As Boolean
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub SumarFijos As Int
|
Private Sub SumarFijos As Int
|
||||||
Private fijos As String = 0
|
' Log("Aqui entro cuando?<<<<<<<<<<<<<<<<<<<<<<<<<<")
|
||||||
Private s() As String = Regex.Split(" ", lblFijosRequeridos.Text)
|
Private fijos As Int = 0
|
||||||
Log(lblFijosRequeridos.Text)
|
Private textoOriginal As String = lblFijosRequeridos.Text.Trim
|
||||||
Log("xxxxx " & s.Length)
|
' Log("Que es este texto? : <<<<<<<<<<<<<<<<<<<<<<<<<<" & textoOriginal)
|
||||||
If s.Length > 1 And s.Length < 4 Then
|
If textoOriginal.Length > 0 Then
|
||||||
fijos = Regex.Split(" ", lblFijosRequeridos.Text)(2)
|
Private partes() As String = Regex.Split(" ", textoOriginal)
|
||||||
|
|
||||||
|
If partes.Length > 2 Then
|
||||||
|
Private posibleNumero As String = partes(2).Trim.Replace("'", "")
|
||||||
|
|
||||||
|
If posibleNumero.Length > 0 And IsNumber(posibleNumero) Then
|
||||||
|
fijos = posibleNumero
|
||||||
|
End If
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
' Log("------------>>> " & fijos)
|
|
||||||
|
Log("Estos son los fijos: " & fijos)
|
||||||
Return fijos
|
Return fijos
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -1573,6 +1688,7 @@ Private Sub CalcularTotalValor As Float
|
|||||||
tot.Position = i
|
tot.Position = i
|
||||||
x = x + tot.GetString("total")
|
x = x + tot.GetString("total")
|
||||||
Next
|
Next
|
||||||
|
Log("Que valor tiene x? ------------><<<<<" & x)
|
||||||
total = x
|
total = x
|
||||||
End If
|
End If
|
||||||
' Log("=====================>>>> " & x)
|
' Log("=====================>>>> " & x)
|
||||||
@@ -1612,8 +1728,114 @@ Private Sub CalcularTotalValor As Float
|
|||||||
Return total
|
Return total
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub ActualizarTotalValor
|
'Private Sub ActualizarTotalValor
|
||||||
Dim total As Float = CalcularTotalValor
|
'
|
||||||
lblTotalValor.Text = NumberFormat(total, 1, 2)
|
'
|
||||||
|
' Dim total As Float = CalcularTotalValor * lblSumPromo.Text
|
||||||
|
' lblTotalValor.Text = NumberFormat(total, 1, 2)
|
||||||
|
' Log("Esto es calcular valor: -------------------->" & CalcularTotalValor)
|
||||||
|
' Log("En que momento hago esto?: -------------------->" & lblTotalValor.Text)
|
||||||
|
'End Sub
|
||||||
|
|
||||||
|
private Sub ActualizarTotalValor
|
||||||
|
Private soloFijos As Cursor = Starter.skmt.ExecQuery($"select CAT_DP_ID from cat_detalles_paq where cat_dp_tipo = '0' and cat_dp_id = '${estaPromo}'"$)
|
||||||
|
|
||||||
|
Dim totalFijos As Float = 0
|
||||||
|
Dim totalVariables As Float = 0
|
||||||
|
|
||||||
|
If soloFijos.RowCount > 0 Then
|
||||||
|
' Calcular fijos
|
||||||
|
totalFijos = CalcularTotalFijos ' Necesitarías una función específica para fijos
|
||||||
|
Log("Total de fijos: " & totalFijos & "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
|
||||||
|
|
||||||
|
' Calcular variables por separado
|
||||||
|
totalVariables = CalcularTotalVariables ' Función específica para variables
|
||||||
|
Else
|
||||||
|
' Solo hay variables
|
||||||
|
totalVariables = CalcularTotalValor
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim totalGeneral As Float = totalFijos + totalVariables
|
||||||
|
lblTotalValor.Text = NumberFormat(totalGeneral, 1, 2)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CalcularTotalFijos As Float
|
||||||
|
Dim total As Float = 0
|
||||||
|
|
||||||
|
' Consulta para obtener solo los productos fijos (tipo '0')
|
||||||
|
Dim cursorFijos As Cursor = Starter.skmt.ExecQuery("SELECT cat_dp_precio as precio FROM cat_detalles_paq WHERE cat_dp_tipo = '0' AND cat_dp_id = '" & estaPromo & "'")
|
||||||
|
|
||||||
|
If cursorFijos.RowCount > 0 Then
|
||||||
|
For i = 0 To cursorFijos.RowCount - 1
|
||||||
|
cursorFijos.Position = i
|
||||||
|
Dim precio As String = cursorFijos.GetString("precio")
|
||||||
|
|
||||||
|
Private pzs2 As Cursor = Starter.skmt.ExecQuery($"select sum(CAT_DP_PZAS) as suma from cat_detalles_paq where cat_dp_tipo = '0' and cat_dp_id = '${estaPromo}'"$)
|
||||||
|
If pzs2.RowCount > 0 Then
|
||||||
|
pzs2.Position = 0
|
||||||
|
' Log(pzs2.GetString("suma") & "En este ejemplo debe ser un 7 <<<<<<<<<<<<<<<<<<<<")
|
||||||
|
End If
|
||||||
|
lblFijosRequeridos.Text = "Productos fijos: " & (pzs2.GetString("suma") * lblSumPromo.Text)
|
||||||
|
|
||||||
|
total = (precio * pzs2.GetString("suma") * lblSumPromo.Text)
|
||||||
|
' Log("Esto es por lo que debe multiplicarse: " & pzs2.GetString("suma") & "Esto es precio: " & precio)
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
cursorFijos.Close
|
||||||
|
|
||||||
|
Return total
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CalcularTotalVariables As Float
|
||||||
|
Dim total As Float = 0
|
||||||
|
Dim precioVar1 As Float = 0
|
||||||
|
Dim precioVar2 As Float = 0
|
||||||
|
Dim precioVar3 As Float = 0
|
||||||
|
|
||||||
|
' Consulta para obtener los productos variables (tipo '1', '2' o '3')
|
||||||
|
Dim cursorVariables As Cursor = Starter.skmt.ExecQuery("SELECT cat_dp_precio as precio, cat_dp_tipo as tipo FROM cat_detalles_paq WHERE cat_dp_tipo <> '0' AND cat_dp_id = '" & estaPromo & "'")
|
||||||
|
|
||||||
|
If cursorVariables.RowCount > 0 Then
|
||||||
|
' Primero: Recopilamos los precios por tipo
|
||||||
|
For i = 0 To cursorVariables.RowCount - 1
|
||||||
|
cursorVariables.Position = i
|
||||||
|
Dim precio As String = cursorVariables.GetString("precio")
|
||||||
|
Dim tipoVariable As String = cursorVariables.GetString("tipo")
|
||||||
|
|
||||||
|
Select tipoVariable
|
||||||
|
Case "1"
|
||||||
|
precioVar1 = precio
|
||||||
|
Case "2"
|
||||||
|
precioVar2 = precio
|
||||||
|
Case "3"
|
||||||
|
precioVar3 = precio
|
||||||
|
End Select
|
||||||
|
Next
|
||||||
|
|
||||||
|
' Segundo: Aplicamos las cantidades una sola vez
|
||||||
|
Dim cantidadVar1 As Int = SumarVariables1
|
||||||
|
Dim cantidadVar2 As Int = SumarVariables2
|
||||||
|
Dim cantidadVar3 As Int = SumarVariables3
|
||||||
|
|
||||||
|
If cantidadVar1 > 0 Then
|
||||||
|
total = total + (precioVar1 * cantidadVar1)
|
||||||
|
Log("Precio Var1: " & precioVar1 & " x " & cantidadVar1 & " = " & (precioVar1 * cantidadVar1))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If cantidadVar2 > 0 Then
|
||||||
|
total = total + (precioVar2 * cantidadVar2)
|
||||||
|
Log("Precio Var2: " & precioVar2 & " x " & cantidadVar2 & " = " & (precioVar2 * cantidadVar2))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If cantidadVar3 > 0 Then
|
||||||
|
total = total + (precioVar3 * cantidadVar3)
|
||||||
|
Log("Precio Var3: " & precioVar3 & " x " & cantidadVar3 & " = " & (precioVar3 * cantidadVar3))
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
cursorVariables.Close
|
||||||
|
|
||||||
|
Log("Total final de variables: " & total)
|
||||||
|
Return total
|
||||||
|
End Sub
|
||||||
@@ -159,12 +159,12 @@ Module9=C_Nota
|
|||||||
NumberOfFiles=46
|
NumberOfFiles=46
|
||||||
NumberOfLibraries=33
|
NumberOfLibraries=33
|
||||||
NumberOfModules=30
|
NumberOfModules=30
|
||||||
Version=12.8
|
Version=13
|
||||||
@EndOfDesignText@
|
@EndOfDesignText@
|
||||||
#Region Project Attributes
|
#Region Project Attributes
|
||||||
#ApplicationLabel: Intmex
|
#ApplicationLabel: Intmex
|
||||||
#VersionCode: 1
|
#VersionCode: 1
|
||||||
#VersionName: 5.05.29
|
#VersionName: 5.05.30
|
||||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||||
#SupportedOrientations: portrait
|
#SupportedOrientations: portrait
|
||||||
#CanInstallToExternalStorage: False
|
#CanInstallToExternalStorage: False
|
||||||
|
|||||||
@@ -91,6 +91,6 @@ ModuleClosedNodes6=
|
|||||||
ModuleClosedNodes7=
|
ModuleClosedNodes7=
|
||||||
ModuleClosedNodes8=
|
ModuleClosedNodes8=
|
||||||
ModuleClosedNodes9=
|
ModuleClosedNodes9=
|
||||||
NavigationStack=C_Promos,GenerarVariables3,1179,0,C_Promos,RecalcularSumas,1183,6,C_Promos,B4XPage_Created,147,0,C_Promos,ActualizarTotalValor,1591,0,C_Promos,muestraPromo,430,0,C_Promos,Class_Globals,35,0,C_Promos,GenerarFijos,790,0,C_Promos,SumarFijos,1490,6,C_Promos,VerificarCondicionesParabtnGuardaPromo,1477,0,C_Promos,CalcularTotalValor,1550,6
|
NavigationStack=C_Promos,CalcularTotalFijos,1706,6,C_Promos,Class_Globals,62,0,C_Promos,GenerarFijos,844,4,C_Promos,muestraPromo,506,0,C_Promos,btnMenosPromo_Click,511,6,C_Promos,btnGuardaPromo_Click,1343,0,Diseñador Visual,cliente.bal,-100,3,C_Promos,btnContinuar_Click,1446,6,C_Cliente,Class_Globals,155,0,C_Cliente,B4XPage_Appear,242,3,C_Cliente,B_GUARDA_C_Click,1032,0
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=28,2,13,20,14,29,17,15
|
VisibleModules=28,2,13,20,14,29,17,15,9,4
|
||||||
|
|||||||
Reference in New Issue
Block a user