mirror of
https://github.com/KeymonSoft/Intmex_Multiventa.git
synced 2026-04-17 12:56:08 +00:00
- VERSION 5.05.29
- Se corrigio que en los productos fijos de las promos solo tomaba en cuenta la cantidad de el primer producto fijo, y si el segundo llevaba otra cantidad, le ponia la cantidad del primero.
This commit is contained in:
118
B4A/C_Promos.bas
118
B4A/C_Promos.bas
@@ -287,6 +287,8 @@ Private Sub B4XPage_Appear
|
||||
lblVariablesRequeridas2.Text = "0"
|
||||
lblVariablesRequeridas3.Text = "0"
|
||||
|
||||
lblSumaTotal.Text = "0"
|
||||
|
||||
productosFijos = 0
|
||||
variablesRequeridas1= 0
|
||||
variablesRequeridas2= 0
|
||||
@@ -327,10 +329,8 @@ End Sub
|
||||
|
||||
Private Sub ObtenerFijos(promo As String)
|
||||
Dim cursorProductosFijos As Cursor = Starter.skmt.ExecQuery($"SELECT CAT_DP_PZAS FROM CAT_DETALLES_PAQ WHERE CAT_DP_ID = '${promo}' AND CAT_DP_TIPO = '0'"$)
|
||||
|
||||
If cursorProductosFijos.RowCount > 0 Then
|
||||
cursorProductosFijos.Position = 0
|
||||
|
||||
If cursorProductosFijos.GetInt("CAT_DP_PZAS") <> 0 And cursorProductosFijos.GetString("CAT_DP_PZAS") <> " " Then
|
||||
productosFijos = cursorProductosFijos.GetInt("CAT_DP_PZAS")
|
||||
Else
|
||||
@@ -338,11 +338,9 @@ Private Sub ObtenerFijos(promo As String)
|
||||
etLimiteSuma_Sub_pnl1.Visible = False
|
||||
pnlFijos.Visible = False
|
||||
End If
|
||||
|
||||
Else
|
||||
productosFijos = 0
|
||||
End If
|
||||
|
||||
productosFijos_Iniciales = productosFijos
|
||||
End Sub
|
||||
|
||||
@@ -408,35 +406,35 @@ Sub muestraPromo(promo As String, cliente As String)
|
||||
Log("|" &lblNomPromo.text&"|")
|
||||
ObtenerVariablesRequeridas(promo)
|
||||
ObtenerFijos(promo)
|
||||
|
||||
|
||||
Log(etLimiteSuma_Sub_pnl2.Text)
|
||||
|
||||
|
||||
If pnlFijos.IsInitialized Then pnlFijos.RemoveAllViews
|
||||
If pnlVariables1.IsInitialized Then pnlVariables1.RemoveAllViews
|
||||
If pnlVariables2.IsInitialized Then pnlVariables2.RemoveAllViews
|
||||
If pnlVariables3.IsInitialized Then pnlVariables3.RemoveAllViews
|
||||
|
||||
|
||||
Dim nombrePromo As String = lblNomPromo.Text
|
||||
Dim nomPromo() As String = Regex.Split("\r\n|\n", nombrePromo)
|
||||
Log("Esto es nombre promo? <<<<<<<<<<<|" & nomPromo(1) & "|")
|
||||
Encabezado = nomPromo(1)
|
||||
Log("Esto es encabezado? |" & Encabezado)
|
||||
|
||||
|
||||
' Dim promoText As String = lblNomPromo.Text.Trim()
|
||||
' Dim idPromo() As String = Regex.Split(":", promoText)
|
||||
' Log("Esto es idPromo? | <<<<<<<<<<<<<<<<<<|" & idPromo(1).Trim() & "|")
|
||||
|
||||
|
||||
If productosFijos > 0 Then
|
||||
pnlFijos.Visible = True
|
||||
lblFijosRequeridos.Visible = True
|
||||
lblFijosRequeridos.Text = $"Productos Fijos: '${productosFijos}'"$
|
||||
lblFijosRequeridos.Left = 0
|
||||
lblFijosRequeridos.Width = Root.Width
|
||||
Dim cursorProdFijo As Cursor = Starter.skmt.ExecQuery($"SELECT CAT_GP_NOMBRE, CAT_GP_ALMACEN, 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"$)
|
||||
If cursorProdFijo.RowCount > 0 Then
|
||||
For i = 0 To cursorProdFijo.RowCount - 1
|
||||
cursorProdFijo.Position = i
|
||||
GenerarFijos(cursorProdFijo.GetString("CAT_GP_NOMBRE"), cursorProdFijo.GetString("CAT_GP_ALMACEN"), cursorProdFijo.GetString("CAT_DP_PRECIO"), cursorProdFijo.GetString("CAT_DP_IDPROD"), i)
|
||||
GenerarFijos(cursorProdFijo.GetString("CAT_GP_NOMBRE"), cursorProdFijo.GetString("CAT_DP_PZAS"), cursorProdFijo.GetString("CAT_DP_PRECIO"), cursorProdFijo.GetString("CAT_DP_IDPROD"), i, promo)
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
@@ -560,28 +558,28 @@ Private Sub btnSumaPromo_Click
|
||||
' etVar1HasFocus = False
|
||||
' etVar2HasFocus = False
|
||||
' etVar3HasFocus = False
|
||||
|
||||
|
||||
Dim currentValue As Int = lblSumPromo.Text.As(Int)
|
||||
Dim maxValue As Int = lblMaxPromo.Text.As(Int)
|
||||
Log("Esto es currentValue: " & currentValue)
|
||||
Log("Esto es maxValue: " & maxValue)
|
||||
|
||||
|
||||
If currentValue < maxValue Then
|
||||
|
||||
|
||||
Log("Esto es currentValue despues del if: " & currentValue)
|
||||
Log("Esto es maxValue despues del if: " & maxValue)
|
||||
currentValue = currentValue + 1
|
||||
Log("Esto es una suma: " & (currentValue + 1))
|
||||
End If
|
||||
|
||||
|
||||
lblSumPromo.Text = currentValue
|
||||
|
||||
|
||||
' Actualizar las variables requeridas
|
||||
productosFijos = productosFijos_Iniciales * currentValue
|
||||
variablesRequeridas1 = variablesRequeridas1_Inicial * currentValue
|
||||
variablesRequeridas2 = variablesRequeridas2_Inicial * currentValue
|
||||
variablesRequeridas3 = variablesRequeridas3_Inicial * currentValue
|
||||
|
||||
|
||||
' Reiniciar las sumas totales
|
||||
sumaVar1Tot = 0
|
||||
sumaVar2Tot = 0
|
||||
@@ -630,11 +628,9 @@ Private Sub btnVars1Mas_Click
|
||||
' etVar3HasFocus = False
|
||||
Log("Iniciamos boton mas")
|
||||
Log("Variables requeridas = " & variablesRequeridas1)
|
||||
|
||||
Log(sumaVar1Tot.As(Int) > variablesRequeridas1.As(Int))
|
||||
If sumaVar1Tot.As(Int) >= variablesRequeridas1.As(Int) Then
|
||||
Log("Entramos al primer if")
|
||||
|
||||
Log("Entramos al primer if")
|
||||
ToastMessageShow("No se pueden agregar más productos, ya se alcanzó el máximo.", True)
|
||||
Return
|
||||
End If
|
||||
@@ -773,20 +769,32 @@ Private Sub btnVars3Menos_Click
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub GenerarFijos(nombreProd As String, inventario As String, precio As String, idProducto As String, numberOfViews As Int)
|
||||
Private Sub GenerarFijos(nombreProd As String, inventario As String, precio As String, idProducto As String, numberOfViews As Int, estaPromoA As String)
|
||||
If Not(pnlFijos.IsInitialized) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
Log($", ${idProducto}, ${nombreProd}, ${inventario}, ${precio}"$)
|
||||
|
||||
Private estePrecio As String = precio
|
||||
|
||||
Dim pnlProducto As Panel
|
||||
pnlProducto.Initialize("pnlProducto")
|
||||
pnlProducto.SetLayout(0, 0, pnlFijos.Width, 70dip)
|
||||
|
||||
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}'"$)
|
||||
If pzs.RowCount > 0 Then
|
||||
pzs.Position = 0
|
||||
Log("============================== " & pzs.GetString("CAT_DP_PZAS"))
|
||||
cantidad = pzs.GetString("CAT_DP_PZAS")
|
||||
End If
|
||||
|
||||
|
||||
Dim lblNombre As Label
|
||||
lblNombre.Initialize("lblNombre")
|
||||
lblNombre.Text = nombreProd & CRLF & "Hay " & inventario & " $" & NumberFormat2(estePrecio,1,2,2,True)
|
||||
lblNombre.Text = nombreProd & CRLF & "Cant: " & cantidad & " $" & NumberFormat2(estePrecio,1,2,2,True)
|
||||
lblNombre.Tag = idProducto
|
||||
lblNombre.TextSize = 12
|
||||
lblNombre.TextColor = xui.Color_Black
|
||||
@@ -797,6 +805,20 @@ Private Sub GenerarFijos(nombreProd As String, inventario As String, precio As S
|
||||
|
||||
pnlFijos.AddView(pnlProducto, 0, numberOfViews * 70dip, pnlFijos.Width, 70dip)
|
||||
pnlFijos.Height = (numberOfViews * 70dip) + 70dip
|
||||
|
||||
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}'"$)
|
||||
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")
|
||||
SumarFijos
|
||||
pzs.Close
|
||||
|
||||
AjustarScroll
|
||||
End Sub
|
||||
@@ -1165,10 +1187,9 @@ End Sub
|
||||
'End Sub
|
||||
|
||||
Private Sub RecalcularSumas
|
||||
lblSumaTotal.Text = SumarFijos + SumarVariables1 + SumarVariables2 + SumarVariables3
|
||||
|
||||
lblSumaTotal.Text = NumberFormat2((SumarFijos + SumarVariables1 + SumarVariables2 + SumarVariables3), 1, 0, 0, False)
|
||||
Log($"${lblFijosRequeridos.Text} + ${SumarVariables1} + ${SumarVariables2}"$)
|
||||
ActualizarTotalValor
|
||||
|
||||
ActualizarVisibilidadBtnGuardaPromo
|
||||
End Sub
|
||||
|
||||
@@ -1217,7 +1238,6 @@ Private Sub AjustarScroll
|
||||
End Sub
|
||||
|
||||
Private Sub btnGuardaPromo_Click
|
||||
|
||||
Subs.guardaProductoSinGestion(estaPromo, 0, lblSumPromo.Text, Encabezado, estaPromo, Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||
' Log("Esto es encabezado>>>>>>>>>>" & Encabezado)
|
||||
If productosFijos > 0 Then
|
||||
@@ -1230,7 +1250,13 @@ Private Sub btnGuardaPromo_Click
|
||||
Dim nombreProducto As String = lblNombre.Text
|
||||
Private idProducto As String = lblNombre.tag
|
||||
Dim nomProd() As String = Regex.Split("\r\n|\n", nombreProducto)
|
||||
Log("Esto es el nombre dle producto? <<<<<<<<<<<<<<<<<<<<<<<|" &nomProd(1) & "|")
|
||||
Log("Esto es el nombre del producto? <<<<<<<<<<<<<<<<<<<<<<<|" &nomProd(1) & "|")
|
||||
Private pzs As Cursor = Starter.skmt.ExecQuery($"select CAT_DP_PZAS from cat_detalles_paq where cat_dp_idprod = '${idProducto}' and cat_dp_id = '${estaPromo}'"$)
|
||||
If pzs.RowCount > 0 Then
|
||||
pzs.Position = 0
|
||||
Log("============================== " & pzs.GetString("CAT_DP_PZAS"))
|
||||
cantidad = pzs.GetString("CAT_DP_PZAS")
|
||||
End If
|
||||
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)
|
||||
End If
|
||||
@@ -1238,7 +1264,6 @@ Private Sub btnGuardaPromo_Click
|
||||
Else
|
||||
Log("No hay productos fijos para guardar.")
|
||||
End If
|
||||
|
||||
If variablesRequeridas1 > 0 Then
|
||||
Log("Guardando productos variables (Grupo 1)...")
|
||||
For i = 0 To pnlVariables1.NumberOfViews - 1
|
||||
@@ -1465,13 +1490,15 @@ Private Sub VerificarCondicionesParabtnGuardaPromo As Boolean
|
||||
End Sub
|
||||
|
||||
Private Sub SumarFijos As Int
|
||||
Dim totalFijos As Int = 0
|
||||
|
||||
If pnlFijos.IsInitialized Then
|
||||
totalFijos = totalFijos + productosFijos
|
||||
Private fijos As String = 0
|
||||
Private s() As String = Regex.Split(" ", lblFijosRequeridos.Text)
|
||||
Log(lblFijosRequeridos.Text)
|
||||
Log("xxxxx " & s.Length)
|
||||
If s.Length > 1 And s.Length < 4 Then
|
||||
fijos = Regex.Split(" ", lblFijosRequeridos.Text)(2)
|
||||
End If
|
||||
|
||||
Return totalFijos
|
||||
' Log("------------>>> " & fijos)
|
||||
Return fijos
|
||||
End Sub
|
||||
|
||||
Private Sub SumarVariables1 As Int
|
||||
@@ -1529,13 +1556,26 @@ End Sub
|
||||
Private Sub CalcularTotalValor As Float
|
||||
Dim total As Float = 0
|
||||
|
||||
If pnlFijos.IsInitialized And productosFijos > 0 Then
|
||||
For i = 0 To pnlFijos.NumberOfViews - 1
|
||||
Dim pnlProducto As Panel = pnlFijos.GetView(i)
|
||||
Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
||||
total = total + (precioProducto * productosFijos)
|
||||
' If pnlFijos.IsInitialized And productosFijos > 0 Then
|
||||
' For i = 0 To pnlFijos.NumberOfViews - 1
|
||||
' Dim pnlProducto As Panel = pnlFijos.GetView(i)
|
||||
' Dim precioProducto As Float = pnlProducto.Tag.As(Float)
|
||||
'
|
||||
' Log($"---------->>> ${precioProducto}, ${Regex.Split(" ", lblFijosRequeridos.text)(2)}"$)
|
||||
'
|
||||
' total = total + (precioProducto * Regex.Split(" ", lblFijosRequeridos.text)(2))
|
||||
' Next
|
||||
' End If
|
||||
Private tot As Cursor = Starter.skmt.ExecQuery($"select (cat_dp_precio * cat_dp_pzas) as total from cat_detalles_paq where cat_dp_tipo = '0' and cat_dp_id = '${estaPromo}'"$)
|
||||
Private x As String = 0
|
||||
If tot.RowCount > 0 Then
|
||||
For i = 0 To tot.RowCount - 1
|
||||
tot.Position = i
|
||||
x = x + tot.GetString("total")
|
||||
Next
|
||||
total = x
|
||||
End If
|
||||
' Log("=====================>>>> " & x)
|
||||
|
||||
If pnlVariables1.IsInitialized Then
|
||||
For i = 0 To pnlVariables1.NumberOfViews - 1
|
||||
|
||||
@@ -159,12 +159,12 @@ Module9=C_Nota
|
||||
NumberOfFiles=46
|
||||
NumberOfLibraries=33
|
||||
NumberOfModules=30
|
||||
Version=13.1
|
||||
Version=12.8
|
||||
@EndOfDesignText@
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: Intmex
|
||||
#VersionCode: 1
|
||||
#VersionName: 5.05.25
|
||||
#VersionName: 5.05.29
|
||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
|
||||
@@ -81,7 +81,7 @@ ModuleClosedNodes24=
|
||||
ModuleClosedNodes25=2
|
||||
ModuleClosedNodes26=
|
||||
ModuleClosedNodes27=1
|
||||
ModuleClosedNodes28=3,7,8,9,11,12
|
||||
ModuleClosedNodes28=
|
||||
ModuleClosedNodes29=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes30=
|
||||
@@ -91,6 +91,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=Subs,guardaProductoSinGestion,764,0,C_Promos,btnGuardaPromo_Click,1214,6,C_Promos,btnContinuar_Click,1308,4,C_Productos,b_continuar_Click,793,0,C_Productos,l_prodX_LongClick,808,0,C_Nota,B4XPage_Appear,100,0,C_Productos,b_aceptar_Click,901,0,C_Productos,lv_prodsPedido_ItemLongClick,904,0,C_Nota,borra_Click,157,0,C_Nota,ListView1_ItemLongClick,170,5,Main,Activity_ActionBarHomeClick,37,0
|
||||
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
|
||||
SelectedBuild=0
|
||||
VisibleModules=28,2,13,20,14,9,4,29,27,17,15
|
||||
VisibleModules=28,2,13,20,14,29,17,15
|
||||
|
||||
Reference in New Issue
Block a user