mirror of
https://github.com/KeymonSoft/Marquez.git
synced 2026-04-17 21:06:15 +00:00
VERSION CASI FINAL
This commit is contained in:
@@ -180,9 +180,15 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS NOVENTA (NV_CLIENTE TEXT, NV_FECHA TEXT, NV_USER TEXT, NV_MOTIVO TEXT, NV_COMM TEXT, NV_LAT TEXT, NV_LON TEXT)")
|
||||
skmt.ExecNonQuery("CREATE TABLE IF NOT EXISTS PICK_CIEGO (PC_ID_PROD TEXT, PC_NOM_PROD TEXT, PC_CANT TEXT, PC_ALMACEN TEXT, PC_RUTA TEXT, PC_FECHA TEXT)")
|
||||
Subs.agregaColumna("PEDIDO", "PE_ENVIO_OK", "INT")
|
||||
Subs.agregaColumna("PEDIDO", "PE_CANTC", "TEXT")
|
||||
Subs.agregaColumna("PEDIDO", "PE_BCAJAS", "TEXT")
|
||||
Subs.agregaColumna("NOVENTA", "NV_ENVIO_OK", "INT")
|
||||
Subs.agregaColumna("kmt_info", "CAT_CL_BCREDITO", "TEXT")
|
||||
Subs.agregaColumna("kmt_info", "CAT_CL_LIMITECREDITO", "TEXT")
|
||||
Subs.agregaColumna("CAT_GUNAPROD", "CAT_DP_CONVERSION1", "TEXT")
|
||||
Subs.agregaColumna("CAT_GUNAPROD2", "CAT_DP_CONVERSION1", "TEXT")
|
||||
Subs.agregaColumna("CAT_GUNAPROD2", "CAT_DP_PRECIO4", "TEXT")
|
||||
Subs.agregaColumna("CAT_GUNAPROD", "CAT_DP_PRECIO4", "TEXT")
|
||||
c=skmt.ExecQuery("select COUNT(*) AS CUANTOS from HIST_STAY_OUT ")
|
||||
C.Position = 0
|
||||
If c.GetString("CUANTOS") = 0 Then
|
||||
|
||||
@@ -416,6 +416,29 @@ Sub B4XPage_Appear
|
||||
|
||||
pre_act = Subs.traeTotalClientepreventaparacredito
|
||||
|
||||
'SELECT CAT_CL_BCREDITO, CAT_CL_CODIGO, Ifnull(SALDO_PENDIENTE,0) FROM KMT_INFO INNER JOIN ABONOSP ON CAT_CL_CODIGO = CLIENTE WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)
|
||||
|
||||
Private credi2 As Cursor = B4XPages.MainPage.skmt.ExecQuery("SELECT CAT_CL_BCREDITO, CAT_CL_CODIGO, Ifnull(SALDO_PENDIENTE,0) As SALDO_PENDIENTE FROM KMT_INFO INNER JOIN ABONOSP ON CAT_CL_CODIGO = CLIENTE WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)")
|
||||
If credi2.RowCount > 0 Then
|
||||
credi2.Position = 0
|
||||
If credi2.GetString ("CAT_CL_BCREDITO") = "1" Then
|
||||
Log(2)
|
||||
Private credi3 As Cursor = B4XPages.MainPage.skmt.ExecQuery("SELECT a_abono, CAT_CL_CODIGO FROM KMT_INFO INNER JOIN ABONOS ON CAT_CL_CODIGO = a_cliente WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)")
|
||||
If credi3.RowCount > 0 Then
|
||||
credi3.Position = 0
|
||||
If credi2.GetString ("SALDO_PENDIENTE") <> credi3.GetString ("a_abono") Then
|
||||
MsgboxAsync("La venta sera en efectivo porque el pago del pagare en menor al total de la deuda.","Atención")
|
||||
Else If credi2.GetString ("SALDO_PENDIENTE") = credi3.GetString ("a_abono") Then
|
||||
End If
|
||||
Else
|
||||
MsgboxAsync("La venta sera en efectivo por que hay un pagare pendiente de pago","Atención")
|
||||
End If
|
||||
credi3.Close
|
||||
Else
|
||||
Log(1)
|
||||
End If
|
||||
End If
|
||||
credi2.Close
|
||||
End Sub
|
||||
|
||||
Sub GPS_LocationChanged (Location1 As Location)
|
||||
@@ -592,7 +615,7 @@ Sub Guardar_Click
|
||||
GuardaVenta
|
||||
End If
|
||||
Else
|
||||
Dim credi2 As Cursor = B4XPages.MainPage.skmt.ExecQuery("SELECT CAT_CL_BCREDITO, a_abono, SALDO_PENDIENTE FROM KMT_INFO INNER JOIN ABONOSP ON CAT_CL_CODIGO = CLIENTE INNER JOIN ABONOS ON CAT_CL_CODIGO = a_cliente WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)")
|
||||
Private credi2 As Cursor = B4XPages.MainPage.skmt.ExecQuery("SELECT CAT_CL_BCREDITO, a_abono, SALDO_PENDIENTE FROM KMT_INFO INNER JOIN ABONOSP ON CAT_CL_CODIGO = CLIENTE INNER JOIN ABONOS ON CAT_CL_CODIGO = a_cliente WHERE CAT_CL_CODIGO IN (SELECT CUENTA FROM CUENTAA)")
|
||||
If credi2.RowCount > 0 Then
|
||||
credi2.Position = 0
|
||||
If credi2.GetString ("CAT_CL_BCREDITO") = "1" And credi2.GetString ("a_abono")=credi2.GetString ("SALDO_PENDIENTE") Then
|
||||
|
||||
@@ -1617,9 +1617,11 @@ Sub JobDone(Job As HttpJob)
|
||||
' Dim CAT_GP_DEV As String = records(RESULT.Columns.Get("CAT_GP_DEV"))
|
||||
Dim CAT_GP_TIPOPROD As Int = records(RESULT.Columns.Get("CAT_GP_TIPOPROD"))
|
||||
Dim CAT_GP_INICIATIVA As Int = records(RESULT.Columns.Get("CAT_GP_INICIATIVA"))
|
||||
Dim CAT_DP_PRECIO4 As Int = records(RESULT.Columns.Get("CAT_DP_PRECIO4"))
|
||||
Dim CAT_DP_CONVERSION1 As Int = records(RESULT.Columns.Get("CAT_DP_CONVERSION1"))
|
||||
' CAT_GP_INICIATIVA = 5
|
||||
' skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_DEV) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_DEV))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD,CAT_GP_INICIATIVA) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD, CAT_GP_INICIATIVA))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD,CAT_GP_INICIATIVA,CAT_DP_PRECIO4,CAT_DP_CONVERSION1) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD, CAT_GP_INICIATIVA,CAT_DP_PRECIO4,CAT_DP_CONVERSION1))
|
||||
Next
|
||||
Listo2=1
|
||||
If PB2.Progress = 0 Then
|
||||
@@ -1663,7 +1665,7 @@ Sub JobDone(Job As HttpJob)
|
||||
Dim CAT_GP_INICIATIVA As Int = records(RESULT.Columns.Get("CAT_GP_INICIATIVA"))
|
||||
' CAT_GP_INICIATIVA = 5
|
||||
' skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_DEV) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_DEV))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD2(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD,CAT_GP_INICIATIVA) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD, CAT_GP_INICIATIVA))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO CAT_GUNAPROD2(CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG,CAT_GP_ALMACEN,CAT_GP_TIPOPROD,CAT_GP_INICIATIVA,CAT_DP_PRECIO4,CAT_DP_CONVERSION1) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", Array As Object (CAT_GP_ID,CAT_GP_NOMBRE,CAT_GP_IMP1,CAT_GP_IMP2,CAT_GP_PRECIO,CAT_GP_CLASIF,CAT_GP_STS,CAT_GP_TIPO,CAT_GP_SUBTIPO,CAT_GP_IMG, CAT_GP_ALMACEN,CAT_GP_TIPOPROD, CAT_GP_INICIATIVA,0,1))
|
||||
Next
|
||||
Listo2=1
|
||||
If PB2.Progress = 0 Then
|
||||
|
||||
@@ -85,6 +85,14 @@ Sub Class_Globals
|
||||
Dim vamoaver As List
|
||||
Dim j3 As Cursor
|
||||
Dim invTotal As Int
|
||||
Private et_pCantc As EditText
|
||||
Private b_prodMenosc As Button
|
||||
Private b_prodMasc As Button
|
||||
Dim totalcajasmaspiezas As Int
|
||||
Dim cajas As Int
|
||||
Dim piezas As Int
|
||||
|
||||
Private p_botMasMenc As Panel
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -516,6 +524,7 @@ Sub CreateListItem(Text As String, precioU As String, inv As Int, Width As Int,
|
||||
End Sub
|
||||
|
||||
Sub b_prodMenos_Click
|
||||
totalcajasmaspiezas = 0
|
||||
etCantHasFocus = False
|
||||
Root.RequestFocus
|
||||
' LogColor("b_prodMenos_Click", Colors.Magenta)
|
||||
@@ -523,24 +532,39 @@ Sub b_prodMenos_Click
|
||||
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim laCant2 As B4XView = pnl.GetView(3).GetView(2)
|
||||
Dim panelbotonesc As B4XView = pnl.GetView(3)
|
||||
Dim lProdX As B4XView = pnl.GetView(1)
|
||||
Dim panelcajas As B4XView = pnl.GetView(3)
|
||||
Dim panelpiezas As B4XView = pnl.GetView(2)
|
||||
' Log($"precio|stock:${laCant.tag}"$)
|
||||
If laCant.Text = "" Then laCant.Text = 0
|
||||
' Log("lacant.text="&laCant.text)
|
||||
laCant.Text = $"${NumberFormat2(laCant.Text-1,0,0,0,False)}"$
|
||||
If laCant.Text < 0 Then laCant.Text = 0
|
||||
Private tmpMap As Map = clv_prods_ll.GetValue(index).As(Map)
|
||||
Private tmpMap1 As Map = clv_prods_ll.GetValue(index).As(Map)
|
||||
Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
|
||||
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
|
||||
Private tmpMap As Map = CreateMap("precio":precio, "cant":laCant.Text, "almacen":Subs.traeAlmacen)
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
Log(tmpMap)
|
||||
LogColor(tmpMap1,Colors.Magenta)
|
||||
' prodsMap.Put(id, tmpMap)
|
||||
If laCant.Text = 0 Then prodsMap.Remove(id)
|
||||
|
||||
If laCant.Text = 0 Then
|
||||
panelcajas.Visible = True
|
||||
Else If laCant.Text > 0 Then
|
||||
panelcajas.Visible = False
|
||||
End If
|
||||
' If laCant2.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
' totalcajasmaspiezas = laCant.Text
|
||||
' End If
|
||||
LogColor("prodsMap="&prodsMap, Colors.blue)
|
||||
' (Subs.traeAlmacen, p1.Get("precio"), p1.Get("cant"), pn, p, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
|
||||
Log($"${Subs.traeAlmacen}, ${precio}, ${laCant.text}, ${Subs.traeProdNombre(id)}, ${id}, ${clienteId}"$)
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, precio, laCant.text, Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, precio, laCant.Text, Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta,0,0)
|
||||
cuentaProds
|
||||
LogColor("prodsMap="&prodsMap, Colors.blue)
|
||||
Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
@@ -557,11 +581,18 @@ Sub b_prodMenos_Click
|
||||
' Log(lProdX.Text)
|
||||
End If
|
||||
If Subs.totalPedido < 1 Then laCant.Text = "0"
|
||||
invTotal = laCant.Text + Subs.traeinventario(id)
|
||||
invTotal = totalcajasmaspiezas + Subs.traeinventario(id)
|
||||
'aqui si lo comentamos aparece la parte de cajas
|
||||
If tmpMap1.Get("conversion") = "1" Or tmpMap1.Get("precio_caja") = "0" Then
|
||||
Log("invisible")
|
||||
panelbotonesc.Visible = False
|
||||
End If
|
||||
'fin aparecer parte de cajas
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
End Sub
|
||||
|
||||
Sub b_prodMas_Click
|
||||
totalcajasmaspiezas = 0
|
||||
etCantHasFocus = False
|
||||
Root.RequestFocus
|
||||
' LogColor("b_prodMas_Click", Colors.Magenta)
|
||||
@@ -570,6 +601,9 @@ Sub b_prodMas_Click
|
||||
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim panelcajas As B4XView = pnl.GetView(3)
|
||||
Dim panelpiezas As B4XView = pnl.GetView(2)
|
||||
Dim laCant2 As B4XView = pnl.GetView(3).GetView(2)
|
||||
Dim lProdX As B4XView = pnl.GetView(1)
|
||||
|
||||
' Private tmpMap As Map = clv_prods_ll.GetValue(index).As(Map)
|
||||
@@ -595,7 +629,7 @@ Sub b_prodMas_Click
|
||||
' Log((Subs.totalPedido - precio > 1))
|
||||
' Log((Subs.totalPedido))
|
||||
' Log(precio)
|
||||
|
||||
LogColor(laCant.Text,Colors.Red)
|
||||
|
||||
If Subs.traeinventario(id) > 0 And (laCant.Text <= (laCant.Text + Subs.traeinventario(id))) Then 'And (Subs.totalPedido - precio > 1)
|
||||
' Log(clv_prods_ll.GetValue(index).As(Map))
|
||||
@@ -608,9 +642,19 @@ Sub b_prodMas_Click
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
' Subs.actualizaProducto(Subs.traeAlmacen, laCant.text, id, clienteId)
|
||||
|
||||
|
||||
If laCant.Text > 0 Then
|
||||
panelcajas.Visible = False
|
||||
Else If laCant.Text = 0 Then
|
||||
panelcajas.Visible = True
|
||||
End If
|
||||
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, precio, laCant.text, Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
|
||||
LogColor(laCant.Text,Colors.Red)
|
||||
' If laCant2.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
' totalcajasmaspiezas = laCant.Text
|
||||
' End If
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, precio, laCant.Text, Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta,0,0)
|
||||
cuentaProds
|
||||
' Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
If 1 = 1 Then
|
||||
@@ -625,7 +669,7 @@ Sub b_prodMas_Click
|
||||
If 2 = 2 Then lProdX.Text = cs.Color(Colors.red).append(nombreX).pop.Append(CRLF).Append("Existencias: " & invActualizado).Color(0xFF017F01).Append($" $${NumberFormat2(precio, 1, 2, 2, False)}"$).Popall
|
||||
' Log(lProdX.Text)
|
||||
End If
|
||||
invTotal = laCant.Text + Subs.traeinventario(id)
|
||||
invTotal = totalcajasmaspiezas + Subs.traeinventario(id)
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
End Sub
|
||||
|
||||
@@ -636,18 +680,24 @@ Private Sub et_pCant_FocusChanged (HasFocus As Boolean)
|
||||
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim laCant2 As B4XView = pnl.GetView(3).GetView(2)
|
||||
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
|
||||
If laCant.Text = "" Then laCant.Text = "0"
|
||||
etCantHasFocus = HasFocus
|
||||
|
||||
invTotal = laCant.Text + Subs.traeinventario(id)
|
||||
LogColor(laCant.Text,Colors.Red)
|
||||
If laCant2.IsInitialized Then
|
||||
totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
Else
|
||||
totalcajasmaspiezas = laCant.Text
|
||||
End If
|
||||
invTotal = totalcajasmaspiezas + Subs.traeinventario(id)
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
|
||||
cuentaProds
|
||||
End Sub
|
||||
|
||||
Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
Log(etCantHasFocus)
|
||||
' Log(etCantHasFocus)
|
||||
' Log("InvTotal: " & invTotal)
|
||||
If etCantHasFocus = True Then
|
||||
LogColor($"txt changed: ${Old}|${New}, hasfocus=${etCantHasFocus}"$,Colors.Magenta)
|
||||
@@ -655,13 +705,15 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim laCant2 As B4XView = pnl.GetView(3).GetView(2)
|
||||
Dim lProdX As B4XView = pnl.GetView(1)
|
||||
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
|
||||
Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
|
||||
Private inv As String=clv_prods_ll.GetValue(index).As(Map).Get("almacen")
|
||||
Private inv As String=Subs.traeinventario(id)
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
|
||||
Dim panelcajas As B4XView = pnl.GetView(3)
|
||||
Dim panelpiezas As B4XView = pnl.GetView(2)
|
||||
|
||||
|
||||
If(New = "" Or New = Null Or New = "-") Then New = 0
|
||||
@@ -673,9 +725,22 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
|
||||
If New = "" Then New = 0
|
||||
If laCant.Text = "" Then laCant.Text = 0
|
||||
LogColor(laCant.Text,Colors.Red)
|
||||
|
||||
If New > 0 Then
|
||||
panelcajas.Visible = False
|
||||
Else If New = 0 Then
|
||||
panelcajas.Visible = True
|
||||
End If
|
||||
|
||||
' If laCant2.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
' totalcajasmaspiezas = laCant.Text
|
||||
' End If
|
||||
If Not(Old = "0" And New = "") And laCant.Text <> Null And laCant.Text <> "" And etCantHasFocus Then
|
||||
Log("actualizamos producto")
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, precio, laCant.text, Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, precio, laCant.Text, Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta,0,0)
|
||||
cuentaProds
|
||||
End If
|
||||
|
||||
@@ -788,14 +853,14 @@ End Sub
|
||||
Private Sub b_continuar_Click
|
||||
Log("b_continuar_Click")
|
||||
cuentaProds
|
||||
Private p1 As Map
|
||||
' Private p1 As Map
|
||||
Log($"prodsMap=${prodsMap}"$)
|
||||
For Each p As String In prodsMap.Keys
|
||||
p1 = prodsMap.Get(p)
|
||||
Log(p & "|" & p1)
|
||||
Private pn As String = Subs.traeProdNombre(p)
|
||||
Subs.guardaProductoSinGestion(Subs.traeAlmacen, p1.Get("precio"), p1.Get("cant"), pn, p, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
|
||||
Next
|
||||
' For Each p As String In prodsMap.Keys
|
||||
' p1 = prodsMap.Get(p)
|
||||
' Log(p & "|" & p1)
|
||||
' Private pn As String = Subs.traeProdNombre(p)
|
||||
' Subs.guardaProductoSinGestion(Subs.traeAlmacen, p1.Get("precio"), p1.Get("cant"), pn, p, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
|
||||
' Next
|
||||
Log("promos-inv, prods-inv, cat-vis")
|
||||
lv_promos.Visible = False
|
||||
clv_prods_ll.AsView.Visible = False
|
||||
@@ -1009,21 +1074,29 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
|
||||
' Log(listaRenglones)
|
||||
If Pnl.NumberOfViews = 0 Then 'Add each item/layout to the list/main layout
|
||||
Pnl.LoadLayout("proditem")
|
||||
' Pnl.Color = Colors.Cyan
|
||||
p_prods.Width = Root.Width * 0.92
|
||||
p_botMasMen.Left = p_prods.Width - (p_botMasMen.Width + 5)
|
||||
p_prods.Height = 62dip
|
||||
b_prodMenos.Height = 50dip
|
||||
b_prodMas.Height = 50dip
|
||||
et_pCant.Height = 51dip
|
||||
l_pCant.Height = 44dip
|
||||
l_pCant.Top = l_pCant.Top + 8
|
||||
Pnl.Height = p_prods.Height
|
||||
p_botMasMenc.Left = p_prods.Width - (p_botMasMen.Width + 5)
|
||||
p_prods.Height = 134dip
|
||||
' b_prodMenos.Height = 50dip
|
||||
' b_prodMas.Height = 50dip
|
||||
' et_pCant.Height = 51dip
|
||||
' l_pCant.Height = 44dip
|
||||
' l_pCant.Top = l_pCant.Top + 8
|
||||
' Pnl.Height = p_prods.Height
|
||||
' Pnl.Height = 300dip
|
||||
Pnl.SetLayoutAnimated(0,0,0,Pnl.Width,145dip)
|
||||
Private cs As CSBuilder
|
||||
cs.Initialize
|
||||
l_prodX.SetTextSizeAnimated(0, 13)
|
||||
|
||||
|
||||
|
||||
If clv_prods_ll.GetValue(i).As(Map).Get("cant") <> Null And clv_prods_ll.GetValue(i).As(Map).Get("cant") > 0 Then
|
||||
p_prods.Color=0xFFE2EEFF
|
||||
et_pCant.TextColor=Colors.Red
|
||||
et_pCantc.TextColor=Colors.Red
|
||||
If Subs.pedidoGuardado Then
|
||||
Log("YA SE GUARDO")
|
||||
et_pCant.Enabled = False
|
||||
@@ -1033,8 +1106,28 @@ Private Sub clv_prods_ll_VisibleRangeChanged (FirstIndex As Int, LastIndex As In
|
||||
End If
|
||||
|
||||
Private precio As String=NumberFormat2(clv_prods_ll.GetValue(i).As(Map).Get("precio").As(Double),1,2,2,False)
|
||||
If clv_prods_ll.GetValue(i).As(Map).Get("cant") <> Null Then et_pCant.Text = clv_prods_ll.GetValue(i).As(Map).Get("cant")
|
||||
' Log(clv_prods_ll.GetValue(i).As(Map))
|
||||
|
||||
If clv_prods_ll.GetValue(i).As(Map).Get("b_caja").As(String) = "0" Then
|
||||
If clv_prods_ll.GetValue(i).As(Map).Get("cant") <> Null Then et_pCant.Text = clv_prods_ll.GetValue(i).As(Map).Get("cant")
|
||||
p_botMasMen.Visible = True
|
||||
p_botMasMenc.Visible = False
|
||||
Else If clv_prods_ll.GetValue(i).As(Map).Get("b_caja").As(String) = "1" Then
|
||||
If clv_prods_ll.GetValue(i).As(Map).Get("cant") <> Null Then et_pCantc.Text = clv_prods_ll.GetValue(i).As(Map).Get("cant")
|
||||
p_botMasMen.Visible = False
|
||||
p_botMasMenc.Visible = True
|
||||
' Log("visible verdadero")
|
||||
Else IF clv_prods_ll.GetValue(i).As(Map).Get("b_caja").As(String) = "null" Then
|
||||
p_botMasMen.Visible = True
|
||||
p_botMasMenc.Visible = True
|
||||
' Log("visible verdadero")
|
||||
End If
|
||||
l_prodX.Text = cs.Color(Colors.red).append(clv_prods_ll.GetValue(i).As(Map).Get("prod")).pop.append(CRLF).Append("Existencias: " & clv_prods_ll.GetValue(i).As(Map).Get("almacen")).Color(0xFF017F01).Append($" $${precio}"$).Popall
|
||||
'aqui si lo comentamos aparece la parte de cajas
|
||||
If clv_prods_ll.GetValue(i).As(Map).Get("conversion") = "1" Or clv_prods_ll.GetValue(i).As(Map).Get("precio_caja") = "0" Then
|
||||
p_botMasMenc.Visible = False
|
||||
End If
|
||||
'fin aparecer parte de cajas
|
||||
End If
|
||||
' Log($"${i}, ${FirstIndex}, ${LastIndex}, ${Pnl.NumberOfViews}. ${clv_prods_ll.Size}"$)
|
||||
Else 'Not visible
|
||||
@@ -1085,11 +1178,15 @@ Sub LlenaProdsLL(p As ResultSet)
|
||||
If hayPedido Then 'Si hay pedido obtenemos las cantidades de los productos para agregarlos al CLV.
|
||||
Dim cantsMap As Map
|
||||
cantsMap.Initialize
|
||||
Dim pe As ResultSet = B4XPages.MainPage.skmt.ExecQuery($"select PE_PROID, PE_CANT from PEDIDO where PE_CLIENTE = '${clienteId}' and PE_CEDIS = '${Subs.traeAlmacen}' and PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
Dim pe As ResultSet = B4XPages.MainPage.skmt.ExecQuery($"select PE_PROID, PE_CANT, PE_CANTC, PE_BCAJAS from PEDIDO where PE_CLIENTE = '${clienteId}' and PE_CEDIS = '${Subs.traeAlmacen}' and PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
' LogColor("Ponemos productos de pedido anterior: "&pe.RowCount, Colors.red)
|
||||
Do While pe.NextRow
|
||||
Private cant As Int = 0
|
||||
cantsMap.put(pe.GetString("PE_PROID"), pe.GetString("PE_CANT"))
|
||||
If pe.GetString("PE_BCAJAS") = 0 Then
|
||||
cantsMap.put(pe.GetString("PE_PROID"), pe.GetString("PE_CANT"))
|
||||
Else If pe.GetString("PE_BCAJAS") = 1 Then
|
||||
cantsMap.put(pe.GetString("PE_PROID"), pe.GetString("PE_CANTC"))
|
||||
End If
|
||||
Loop
|
||||
pe.Close
|
||||
End If
|
||||
@@ -1100,13 +1197,15 @@ Sub LlenaProdsLL(p As ResultSet)
|
||||
' Log("NO HAY RESULSET")
|
||||
LogColor(Starter.tabla,Colors.blue)
|
||||
' Dim p As ResultSet = B4XPages.MainPage.skmt.ExecQuery($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD from ${Starter.tabla} where CAT_GP_PRECIO > 0 And CAT_GP_ALMACEN > 0 And CAT_GP_CLASIF <> 'PROMOS' order by CAT_GP_NOMBRE"$)
|
||||
Dim p As ResultSet = B4XPages.MainPage.skmt.ExecQuery($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD from ${Starter.tabla} where CAT_GP_PRECIO > 0 And CAT_GP_ALMACEN > 0 And CAT_GP_CLASIF <> 'PROMOS' union all select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD from ${Starter.tabla} where CAT_GP_PRECIO > 0 And CAT_GP_ALMACEN = 0 And CAT_GP_CLASIF <> 'PROMOS' and cat_gp_id in (select pe_proid from pedido where pe_cliente in (select cuenta from cuentaa)) order by 2"$)
|
||||
|
||||
Dim p As ResultSet = B4XPages.MainPage.skmt.ExecQuery($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD, CAT_DP_CONVERSION1, CAT_DP_PRECIO4, PE_BCAJAS from ${Starter.tabla} LEFT JOIN PEDIDO ON CAT_GP_ID = PE_PROID where CAT_GP_PRECIO > 0 And CAT_GP_ALMACEN > 0 And CAT_GP_CLASIF <> 'PROMOS' union all select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD, CAT_DP_CONVERSION1, CAT_DP_PRECIO4 , PE_BCAJAS from ${Starter.tabla} LEFT JOIN PEDIDO ON CAT_GP_ID = PE_PROID where CAT_GP_PRECIO > 0 And CAT_GP_ALMACEN = 0 And CAT_GP_CLASIF <> 'PROMOS' and cat_gp_id in (select pe_proid from pedido where pe_cliente in (select cuenta from cuentaa)) order by 2"$)
|
||||
|
||||
End If
|
||||
|
||||
Do While p.NextRow
|
||||
Private cant As Int = 0
|
||||
If hayPedido And cantsMap.ContainsKey(p.GetString("CAT_GP_ID")) Then cant = cantsMap.Get(p.GetString("CAT_GP_ID"))
|
||||
Dim tempMap As Map = CreateMap("prod":p.GetString("CAT_GP_NOMBRE"), "precio":p.GetString("CAT_GP_PRECIO"), "almacen":p.GetString("CAT_GP_ALMACEN"), "id":p.GetString("CAT_GP_ID"), "cant":cant)
|
||||
Dim tempMap As Map = CreateMap("prod":p.GetString("CAT_GP_NOMBRE"), "precio":p.GetString("CAT_GP_PRECIO"), "almacen":p.GetString("CAT_GP_ALMACEN"), "id":p.GetString("CAT_GP_ID"), "cant":cant, "conversion":p.GetString("CAT_DP_CONVERSION1"), "precio_caja":p.GetString("CAT_DP_PRECIO4"), "b_caja":p.GetString("PE_BCAJAS"))
|
||||
listaProds.Add(tempMap)
|
||||
Loop
|
||||
p.Close
|
||||
@@ -1128,7 +1227,8 @@ LogColor(Starter.tabla,Colors.blue)
|
||||
Private cont As Int = 0
|
||||
For pr0=0 To listaProdsConCant.Size - 1 'Agregamos los productos con cantidad previa.
|
||||
Private Pnl As B4XView = xui.CreatePanel("")
|
||||
Pnl.SetLayoutAnimated(0, 0, 0, clv_prods_ll.AsView.Width, 63dip)
|
||||
' Pnl.SetLayoutAnimated(0, 0, 0, clv_prods_ll.AsView.Width, 300dip)
|
||||
Pnl.SetLayoutAnimated(0, 0, 0, clv_prods_ll.AsView.Width, 135dip)
|
||||
clv_prods_ll.Add(Pnl, listaProdsConCant.Get(pr0))
|
||||
listaHints.Add(listaProdsConCant.get(pr0).As(Map).Get("prod"))
|
||||
cont = cont + 1
|
||||
@@ -1138,7 +1238,7 @@ LogColor(Starter.tabla,Colors.blue)
|
||||
For pr=0 To listaProds.Size-1
|
||||
If listaProdsConCantIndex.IndexOf(pr) = -1 Then
|
||||
Private Pnl As B4XView = xui.CreatePanel("")
|
||||
Pnl.SetLayoutAnimated(0, 0, 0, clv_prods_ll.AsView.Width, 63dip)
|
||||
Pnl.SetLayoutAnimated(0, 0, 0, clv_prods_ll.AsView.Width, 135dip)
|
||||
clv_prods_ll.Add(Pnl, listaProds.Get(pr))
|
||||
listaHints.Add(listaProds.get(pr).As(Map).Get("prod"))
|
||||
cont = cont + 1
|
||||
@@ -1161,4 +1261,254 @@ End Sub
|
||||
Sub PCLV_HintRequested(Index As Int) As Object
|
||||
Dim word As String = listaHints.get(Index)
|
||||
Return word
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Sub b_prodMenosc_Click
|
||||
totalcajasmaspiezas = 0
|
||||
etCantHasFocus = False
|
||||
Root.RequestFocus
|
||||
' LogColor("b_prodMenos_Click", Colors.Magenta)
|
||||
Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
|
||||
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim laCant2 As B4XView = pnl.GetView(3).GetView(2)
|
||||
Dim lProdX As B4XView = pnl.GetView(1)
|
||||
Dim panelcajas As B4XView = pnl.GetView(3)
|
||||
Dim panelpiezas As B4XView = pnl.GetView(2)
|
||||
' Log($"precio|stock:${laCant.tag}"$)
|
||||
If laCant2.Text = "" Then laCant2.Text = 0
|
||||
' Log("lacant.text="&laCant.text)
|
||||
laCant2.Text = $"${NumberFormat2(laCant2.Text-1,0,0,0,False)}"$
|
||||
If laCant2.Text < 0 Then laCant2.Text = 0
|
||||
Private tmpMap As Map = clv_prods_ll.GetValue(index).As(Map)
|
||||
Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
|
||||
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
|
||||
Private tmpMap As Map = CreateMap("precio":precio, "cant":laCant2.Text, "almacen":Subs.traeAlmacen)
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
Log(tmpMap)
|
||||
' prodsMap.Put(id, tmpMap)
|
||||
If laCant2.Text = 0 Then prodsMap.Remove(id)
|
||||
If laCant2.Text = 0 Then
|
||||
panelpiezas.Visible = True
|
||||
Else If laCant2.Text > 0 Then
|
||||
panelpiezas.Visible = False
|
||||
End If
|
||||
' If laCant.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
' totalcajasmaspiezas = laCant2.Text
|
||||
' End If
|
||||
LogColor("prodsMap="&prodsMap, Colors.blue)
|
||||
c = Starter.skmt.ExecQuery2("SELECT CAT_DP_PRECIO4, CAT_DP_CONVERSION1 FROM CAT_GUNAPROD WHERE CAT_GP_ID = ?",Array As String(id))
|
||||
c.Position = 0
|
||||
|
||||
' (Subs.traeAlmacen, p1.Get("precio"), p1.Get("cant"), pn, p, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
|
||||
Log($"${Subs.traeAlmacen}, ${precio}, ${laCant2.text}, ${Subs.traeProdNombre(id)}, ${id}, ${clienteId}"$)
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, c.GetString("CAT_DP_PRECIO4"),(laCant2.Text * c.GetString("CAT_DP_CONVERSION1")), Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta,laCant2.Text,1)
|
||||
cuentaProds
|
||||
LogColor("prodsMap="&prodsMap, Colors.blue)
|
||||
Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
If 1 = 1 Then
|
||||
Private cs As CSBuilder
|
||||
cs.Initialize
|
||||
Private o As Cursor = Starter.skmt.ExecQuery($"select CAT_GP_ALMACEN from ${Starter.tabla} where CAT_GP_ID = '${id}'"$)
|
||||
Private invActualizado As String = "0"
|
||||
If o.RowCount > 0 Then
|
||||
o.Position = 0
|
||||
invActualizado = o.GetString("CAT_GP_ALMACEN")
|
||||
End If
|
||||
If 2 = 2 Then lProdX.Text = cs.Color(Colors.red).append(nombreX).pop.Append(CRLF).Append("Existencias: " & invActualizado).Color(0xFF017F01).Append($" $${NumberFormat2(precio, 1, 2, 2, False)}"$).Popall
|
||||
' Log(lProdX.Text)
|
||||
End If
|
||||
If Subs.totalPedido < 1 Then laCant2.Text = "0"
|
||||
invTotal = totalcajasmaspiezas + Subs.traeinventario(id)
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
Sub b_prodMasc_Click
|
||||
etCantHasFocus = False
|
||||
Root.RequestFocus
|
||||
' LogColor("b_prodMas_Click", Colors.Magenta)
|
||||
|
||||
Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
|
||||
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim laCant2 As B4XView = pnl.GetView(3).GetView(2)
|
||||
Dim lProdX As B4XView = pnl.GetView(1)
|
||||
Dim panelcajas As B4XView = pnl.GetView(3)
|
||||
Dim panelpiezas As B4XView = pnl.GetView(2)
|
||||
' Private tmpMap As Map = clv_prods_ll.GetValue(index).As(Map)
|
||||
Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
|
||||
Private inv As String=clv_prods_ll.GetValue(index).As(Map).Get("almacen")
|
||||
Private existencias As String = clv_prods_ll.GetValue(index).As(Map).Get("almacen")
|
||||
Log($"Existencias: ${existencias}"$)
|
||||
If laCant2.Text = "" Then laCant2.Text = 0
|
||||
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
|
||||
' If laCant.Text + 1 <= inv Then
|
||||
'' Log(NumberFormat2(laCant.Text+1,0,0,0,False))
|
||||
' laCant.Text = $"${NumberFormat2(laCant.Text+1,0,0,0,False)}"$
|
||||
'' Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
|
||||
' Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
|
||||
'' Private tmpMap As Map = CreateMap("precio":precio, "cant":laCant.Text, "almacen":Subs.traeAlmacen)
|
||||
'' Log(tmpMap)
|
||||
'' prodsMap.Put(id, tmpMap)
|
||||
'' LogColor(prodsMap, Colors.blue)
|
||||
' End If
|
||||
' Log("Cantidad + exis " & (laCant.Text + existencias))
|
||||
' Log( (laCant.Text + 1 <= (laCant.Text + existencias)))
|
||||
' Log("inventario "&Subs.traeinventario(id))
|
||||
' Log((Subs.totalPedido - precio > 1))
|
||||
' Log((Subs.totalPedido))
|
||||
' Log(precio)
|
||||
|
||||
|
||||
If Subs.traeinventario(id) > 0 And (laCant2.Text <= (laCant2.Text + Subs.traeinventario(id))) Then 'And (Subs.totalPedido - precio > 1)
|
||||
' Log(clv_prods_ll.GetValue(index).As(Map))
|
||||
clv_prods_ll.GetValue(index).As(Map).Put("almacen", (inv - 1))
|
||||
inv = inv - 1
|
||||
' laCant.Text = $"$1.0{laCant.Text+1}"$
|
||||
laCant2.Text = NumberFormat2((laCant2.Text + 1), 1, 0, 0, False)
|
||||
' Log(clv_prods_ll.GetValue(index).As(Map))
|
||||
End If
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
' Subs.actualizaProducto(Subs.traeAlmacen, laCant.text, id, clienteId)
|
||||
|
||||
If laCant2.Text > 0 Then
|
||||
panelpiezas.Visible = False
|
||||
Else If laCant2.Text = 0 Then
|
||||
panelpiezas.Visible = True
|
||||
End If
|
||||
|
||||
' LogColor(laCant.Text,Colors.Red)
|
||||
' If laCant.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
' totalcajasmaspiezas = laCant2.Text
|
||||
' End If
|
||||
c = Starter.skmt.ExecQuery2("SELECT CAT_DP_PRECIO4, CAT_DP_CONVERSION1 FROM CAT_GUNAPROD WHERE CAT_GP_ID = ?",Array As String(id))
|
||||
c.Position = 0
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, c.GetString("CAT_DP_PRECIO4"),(laCant2.Text * c.GetString("CAT_DP_CONVERSION1")), Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta,laCant2.Text,1)
|
||||
cuentaProds
|
||||
' Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
If 1 = 1 Then
|
||||
Private cs As CSBuilder
|
||||
cs.Initialize
|
||||
Private o As Cursor = Starter.skmt.ExecQuery($"select CAT_GP_ALMACEN from ${Starter.tabla} where CAT_GP_ID = '${id}'"$)
|
||||
Private invActualizado As String = "0"
|
||||
If o.RowCount > 0 Then
|
||||
o.Position = 0
|
||||
invActualizado = o.GetString("CAT_GP_ALMACEN")
|
||||
End If
|
||||
If 2 = 2 Then lProdX.Text = cs.Color(Colors.red).append(nombreX).pop.Append(CRLF).Append("Existencias: " & invActualizado).Color(0xFF017F01).Append($" $${NumberFormat2(precio, 1, 2, 2, False)}"$).Popall
|
||||
' Log(lProdX.Text)
|
||||
End If
|
||||
invTotal = totalcajasmaspiezas + Subs.traeinventario(id)
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
Private Sub et_pCantc_FocusChanged (HasFocus As Boolean)
|
||||
LogColor($"focus changed=${HasFocus}"$, Colors.Magenta)
|
||||
If et_pCantc.Text = "" Then et_pCantc.Text = "0"
|
||||
Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
|
||||
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim laCant2 As B4XView = pnl.GetView(3).GetView(2)
|
||||
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
|
||||
If laCant2.Text = "" Then laCant2.Text = "0"
|
||||
etCantHasFocus = HasFocus
|
||||
' LogColor(laCant.Text,Colors.Red)
|
||||
' If laCant.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
' totalcajasmaspiezas = laCant2.Text
|
||||
' End If
|
||||
invTotal = totalcajasmaspiezas + Subs.traeinventario(id)
|
||||
' LogColor("InvTotal PRODMAS: " & invTotal, Colors.Red)
|
||||
|
||||
cuentaProds
|
||||
End Sub
|
||||
|
||||
Private Sub et_pCantc_TextChanged (Old As String, New As String)
|
||||
Log(etCantHasFocus)
|
||||
' Log("InvTotal: " & invTotal)
|
||||
If etCantHasFocus = True Then
|
||||
LogColor($"txt changed: ${Old}|${New}, hasfocus=${etCantHasFocus}"$,Colors.Magenta)
|
||||
Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
|
||||
Dim pnl0 As B4XView = clv_prods_ll.GetPanel(index)
|
||||
Dim pnl As B4XView = pnl0.GetView(0)
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
Dim laCant2 As B4XView = pnl.GetView(3).GetView(2)
|
||||
Dim lProdX As B4XView = pnl.GetView(1)
|
||||
Private id As String=clv_prods_ll.GetValue(index).As(Map).Get("id")
|
||||
Private precio As String=clv_prods_ll.GetValue(index).As(Map).Get("precio")
|
||||
Private inv As String=clv_prods_ll.GetValue(index).As(Map).Get("almacen")
|
||||
Private inv As String=Subs.traeinventario(id)
|
||||
Private nombreX As String = Subs.traeProdNombre(id)
|
||||
Dim panelcajas As B4XView = pnl.GetView(3)
|
||||
Dim panelpiezas As B4XView = pnl.GetView(2)
|
||||
|
||||
|
||||
If(New = "" Or New = Null Or New = "-") Then New = 0
|
||||
' If New < 0 Then New = 0
|
||||
If(New > invTotal) Then
|
||||
Sender.As(EditText).text = invTotal
|
||||
End If
|
||||
' Log($"inventario=${inv}"$)
|
||||
|
||||
If New = "" Then New = 0
|
||||
If laCant2.Text = "" Then laCant2.Text = 0
|
||||
LogColor(laCant.Text,Colors.Red)
|
||||
|
||||
If New > 0 Then
|
||||
panelpiezas.Visible = False
|
||||
Else If New = 0 Then
|
||||
panelpiezas.Visible = True
|
||||
End If
|
||||
|
||||
' If laCant.IsInitialized Then
|
||||
' totalcajasmaspiezas = laCant.Text + laCant2.Text
|
||||
' Else
|
||||
' totalcajasmaspiezas = laCant2.Text
|
||||
' End If
|
||||
c = Starter.skmt.ExecQuery2("SELECT CAT_DP_PRECIO4, CAT_DP_CONVERSION1 FROM CAT_GUNAPROD WHERE CAT_GP_ID = ?",Array As String(id))
|
||||
c.Position = 0
|
||||
If Not(Old = "0" And New = "") And laCant2.Text <> Null And laCant2.Text <> "" And etCantHasFocus Then
|
||||
Log("actualizamos producto")
|
||||
Subs.actualizaProducto(Subs.traeAlmacen, c.GetString("CAT_DP_PRECIO4"),(laCant2.Text * c.GetString("CAT_DP_CONVERSION1")), Subs.traeProdNombre(id), id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta,laCant2.Text,1)
|
||||
cuentaProds
|
||||
End If
|
||||
c.Close
|
||||
' If New <> "" And New.SubString2(0,0) = "0" Then
|
||||
' New.SubString(1)
|
||||
' End If
|
||||
' If New <> "" And New.SubString(1) <> "" Then
|
||||
' Log(New.SubString(1))
|
||||
' New = New.SubString(1)
|
||||
' laCant.Text = New.SubString(1)
|
||||
' Log(laCant.Text)
|
||||
' End If
|
||||
|
||||
If 1 = 1 Then
|
||||
Private cs As CSBuilder
|
||||
cs.Initialize
|
||||
Private o As Cursor = Starter.skmt.ExecQuery($"select CAT_GP_ALMACEN from ${Starter.tabla} where CAT_GP_ID = '${id}'"$)
|
||||
Private invActualizado As String = "0"
|
||||
' If o.RowCount > 0 Then
|
||||
o.Position = 0
|
||||
invActualizado = Subs.traeinventario(id)
|
||||
Log(Subs.traeinventario(id))
|
||||
' End If
|
||||
|
||||
If New = "" Then New = 0
|
||||
lProdX.Text = cs.Color(Colors.red).append(nombreX).pop.Append(CRLF).Append("Existencias: " & (Subs.traeinventario(id))).Color(0xFF017F01).Append($" $${NumberFormat2(precio, 1, 2, 2, False)}"$).Popall
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
@@ -262,7 +262,7 @@ End Sub
|
||||
Sub CreateListItem(Text As String, precioU As String, inv As Int, Width As Int, Height As Int, img As Bitmap, prodId As String) As Panel 'ignore
|
||||
Dim p As B4XView = xui.CreatePanel("")
|
||||
p.SetLayoutAnimated(0, 0, 0, Width, Height)
|
||||
p.LoadLayout("prodItem")
|
||||
p.LoadLayout("prodItem1")
|
||||
l_prodX.TextSize = 15
|
||||
l_prodX.Text = Text
|
||||
l_prodX.TextSize = 15
|
||||
@@ -535,11 +535,11 @@ Private Sub b_terminar1_Click
|
||||
Log("====================================================================")
|
||||
For t = 0 To prodsIds.Size - 1 'Guardamos los productos fijos de la promocion en pedido.
|
||||
Private pn As String = Subs.traeProdNombre(prodsIds.Get(t))
|
||||
If prodsCants.Get(t) > 0 Then Subs.guardaProductoSinGestion(estaPromo, prodsPrecios.Get(t), prodsCants.Get(t), pn, prodsIds.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||
If prodsCants.Get(t) > 0 Then Subs.guardaProductoSinGestion(estaPromo, prodsPrecios.Get(t), prodsCants.Get(t), pn, prodsIds.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta,0,0)
|
||||
Next
|
||||
For t = 0 To prodsIds2.Size - 1 'Guardamos los productos variables de la promocion en pedido.
|
||||
Private pn As String = Subs.traeProdNombre(prodsIds2.Get(t))
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios2.Get(t), prodsCants2.Get(t), pn, prodsIds2.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios2.Get(t), prodsCants2.Get(t), pn, prodsIds2.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta,0,0)
|
||||
Next
|
||||
' Log(B4XPages.MainPage.productos.prodsMap)
|
||||
' For o=0 To prodsIds.Size - 1 'Ponemos los productos fijos en el mapa de la compra.
|
||||
@@ -564,11 +564,11 @@ Private Sub b_continuar_Click
|
||||
Log("====================================================================")
|
||||
For t = 0 To prodsIds.Size - 1 'Guardamos los productos fijos de la promocion en pedido.
|
||||
Private pn As String = Subs.traeProdNombre(prodsIds.Get(t))
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios.Get(t), prodsCants.Get(t), pn, prodsIds.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios.Get(t), prodsCants.Get(t), pn, prodsIds.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta,0,0)
|
||||
Next
|
||||
For t = 0 To prodsIds2.Size - 1 'Guardamos los productos variables de la promocion en pedido.
|
||||
Private pn As String = Subs.traeProdNombre(prodsIds2.Get(t))
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios2.Get(t), prodsCants2.Get(t), pn, prodsIds2.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta)
|
||||
Subs.guardaProductoSinGestion(estaPromo, prodsPrecios2.Get(t), prodsCants2.Get(t), pn, prodsIds2.Get(t), Subs.traeCliente, Subs.traeFecha, Subs.traeUsuarioDeBD, Subs.traeRuta, 0, B4XPages.MainPage.tipo_venta,0,0)
|
||||
Next
|
||||
' Log(B4XPages.MainPage.productos.prodsMap)
|
||||
' For o=0 To prodsIds.Size - 1 'Ponemos los productos fijos en el mapa de la compra.
|
||||
|
||||
@@ -37,6 +37,8 @@ Public Sub Initialize As Object
|
||||
rkmt.Initialize(safePath,$"${name(0)}.rkmt.km"$, True)
|
||||
skmt.Initialize(File.DirInternal,"kmt.db", False)
|
||||
rkmt.ExecNonQuery($"create table if not exists pedidos (pe_folio NUMERIC, pe_desc NUMERIC, pe_costo_sin TEXT, pe_ruta TEXT, pe_cedis TEXT, pe_costo_tot NUMERIC, pe_costou NUMERIC, pe_cant NUMERIC, pe_pronombre TEXT, pe_proid TEXT, pe_cliente TEXT, pe_fecha TEXT, pe_usuario TEXT)"$)
|
||||
agregaColumna2(rkmt,"pedidos","pe_cantc","text")
|
||||
agregaColumna2(rkmt,"pedidos","pe_bcajas","text")
|
||||
Try 'Intentamos usar "pragma_table_info" para revisar si existe la columna en la tabla
|
||||
Private c As Cursor = rkmt.ExecQuery($"SELECT COUNT(*) AS fCol FROM pragma_table_info('pedidos') WHERE name='pe_envio_ok'"$)
|
||||
c.Position = 0
|
||||
@@ -85,7 +87,7 @@ Sub respaldaPedido
|
||||
Log("copiando pedidos ...")
|
||||
rkmt.BeginTransaction
|
||||
rkmt.ExecNonQuery($"delete from pedidos where substr(pe_fecha, 1, 10) = '${fechaHoy}'"$)
|
||||
rkmt.ExecNonQuery($"insert into pedidos (pe_folio, pe_desc, pe_costo_sin, pe_ruta, pe_cedis, pe_costo_tot, pe_costou, pe_cant, pe_pronombre, pe_proid, pe_cliente, pe_fecha, pe_usuario, pe_envio_ok) select * from skmt1.pedido where substr(pe_fecha, 1, 10) = '${fechaHoy}'"$)
|
||||
rkmt.ExecNonQuery($"insert into pedidos (pe_folio, pe_desc, pe_costo_sin, pe_ruta, pe_cedis, pe_costo_tot, pe_costou, pe_cant, pe_pronombre, pe_proid, pe_cliente, pe_fecha, pe_usuario, pe_envio_ok,pe_cantc,pe_bcajas) select * from skmt1.pedido where substr(pe_fecha, 1, 10) = '${fechaHoy}'"$)
|
||||
rkmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
|
||||
rkmt.EndTransaction
|
||||
' Log(((DateTime.Now - inicio)/1000) & " segs")
|
||||
@@ -145,4 +147,22 @@ Sub agregaColumna(tabla As String, columna As String, tipo As String) 'ignore
|
||||
Log(LastException)
|
||||
End Try
|
||||
End Try
|
||||
End Sub
|
||||
End Sub
|
||||
|
||||
Sub agregaColumna2(db As SQL, tabla As String, columna As String, tipo As String) 'ignore
|
||||
Try 'Intentamos usar "pragma_table_info" para revisar si existe la columna en la tabla
|
||||
Private c As Cursor = db.ExecQuery($"SELECT COUNT(*) AS fCol FROM pragma_table_info('${tabla}') WHERE name='${columna}'"$)
|
||||
c.Position = 0
|
||||
If c.GetString("fCol") = 0 Then 'Si no esta la columna la agregamos
|
||||
db.ExecNonQuery($"ALTER TABLE ${tabla} ADD COLUMN ${columna} ${tipo}"$)
|
||||
Log($"Columna "${columna} ${tipo}", agregada a "${tabla}"."$)
|
||||
End If
|
||||
Catch 'Si no funciona "pragma_table_info" lo hacemos con try/catch
|
||||
Try
|
||||
db.ExecNonQuery($"ALTER TABLE ${tabla} ADD COLUMN ${columna} ${tipo}"$)
|
||||
Log($"Columna "${columna} ${tipo}", agregada a "${tabla}".."$)
|
||||
Catch
|
||||
Log(LastException)
|
||||
End Try
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
BIN
B4A/Files/panel_pick_ciego.bal
Normal file
BIN
B4A/Files/panel_pick_ciego.bal
Normal file
Binary file not shown.
Binary file not shown.
BIN
B4A/Files/proditem1.bal
Normal file
BIN
B4A/Files/proditem1.bal
Normal file
Binary file not shown.
Binary file not shown.
@@ -35,27 +35,28 @@ File39=planfia_logo.png
|
||||
File4=anterior.jpg
|
||||
File40=principal.bal
|
||||
File41=proditem.bal
|
||||
File42=proditem2.bal
|
||||
File43=productos.bal
|
||||
File44=promociones.bal
|
||||
File45=resdia.bal
|
||||
File46=ResDia.jpg
|
||||
File47=resdia20.png
|
||||
File48=resumendia.jpg
|
||||
File49=salma.jpg
|
||||
File42=proditem1.bal
|
||||
File43=proditem2.bal
|
||||
File44=productos.bal
|
||||
File45=promociones.bal
|
||||
File46=resdia.bal
|
||||
File47=ResDia.jpg
|
||||
File48=resdia20.png
|
||||
File49=resumendia.jpg
|
||||
File5=bus-ar.png
|
||||
File50=salma.png
|
||||
File51=scrollpromos.bal
|
||||
File52=senial.jpg
|
||||
File53=sync.png
|
||||
File54=tache_rojo.png
|
||||
File55=Ticket dia.jpg
|
||||
File56=ticketdia20.jpg
|
||||
File57=ticketdia20.png
|
||||
File58=ticketsdia.bal
|
||||
File59=Tiendita.jpg
|
||||
File50=salma.jpg
|
||||
File51=salma.png
|
||||
File52=scrollpromos.bal
|
||||
File53=senial.jpg
|
||||
File54=sync.png
|
||||
File55=tache_rojo.png
|
||||
File56=Ticket dia.jpg
|
||||
File57=ticketdia20.jpg
|
||||
File58=ticketdia20.png
|
||||
File59=ticketsdia.bal
|
||||
File6=carrito.png
|
||||
File60=verde.png
|
||||
File60=Tiendita.jpg
|
||||
File61=verde.png
|
||||
File7=celltitle.bal
|
||||
File8=cliente.bal
|
||||
File9=clientes.bal
|
||||
@@ -116,6 +117,7 @@ FileGroup58=Default Group
|
||||
FileGroup59=Default Group
|
||||
FileGroup6=Default Group
|
||||
FileGroup60=Default Group
|
||||
FileGroup61=Default Group
|
||||
FileGroup7=Default Group
|
||||
FileGroup8=Default Group
|
||||
FileGroup9=Default Group
|
||||
@@ -184,7 +186,7 @@ Module6=C_Cuestionario
|
||||
Module7=C_Historico
|
||||
Module8=C_Mapas
|
||||
Module9=C_Nota
|
||||
NumberOfFiles=60
|
||||
NumberOfFiles=61
|
||||
NumberOfLibraries=34
|
||||
NumberOfModules=29
|
||||
Version=12.8
|
||||
@@ -192,7 +194,7 @@ Version=12.8
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: Marquez
|
||||
#VersionCode: 1
|
||||
#VersionName: 4.06.01
|
||||
#VersionName: 4.06.22
|
||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
|
||||
@@ -88,6 +88,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Cuestionario,Initialize,21,0,B4XMainPage,B4XPage_Created,185,0,C_Principal,Initialize,222,0,C_Principal,B4XPage_Appear,549,0,C_Principal,CreateListItem,620,0,C_Principal,Class_Globals,214,4,Diseñador Visual,PANEL_PICK_CIEGO.bal,-100,4,Diseñador Visual,principal.bal,-100,6,C_Principal,Subir_Click,599,6,C_Principal,ET_PICK_CIEGO_TextChanged,555,0,C_Principal,B_PC_ENV_Click,590,6,C_Productos,B4XPage_Appear,226,0
|
||||
NavigationStack=C_Productos,l_prodx_click,1058,0,Diseñador Visual,proditem.bal,-100,6,Diseñador Visual,proditem1.bal,-100,1,Diseñador Visual,folioabono.bal,-100,1,C_Productos,clv_prods_ll_VisibleRangeChanged,1092,6,C_Promos,CreateListItem,258,0,C_Productos,LlenaProdsLL,1202,6,B4XMainPage,B4XPage_Created,182,0,C_Productos,cuentaProds,776,0,C_Principal,JobDone,1661,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,2,3,4,7,8,9,10,13,14,6
|
||||
VisibleModules=1,2,3,4,7,8,9,10,13,14,28,15,16
|
||||
|
||||
10
B4A/Subs.bas
10
B4A/Subs.bas
@@ -767,10 +767,10 @@ End Sub
|
||||
'Inserta un producto en la tabla "pedido" y "pedido_cliente" y actualiza "cat_gunaprod".
|
||||
'NO ACTUALIZA LA BANDERA DE GESTION EN LA TABLA "kmt_info".
|
||||
'Si "gestion=2" entonces el sistema considera que el pedido ya se guardó y ya no se debe modificar.
|
||||
Sub guardaProductoSinGestion(cedis As String, costoU As String, cant As String, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
|
||||
Sub guardaProductoSinGestion(cedis As String, costoU As String, cant As String, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String, cantc As String, bcajas As String)
|
||||
' LogColor("guardaProducto: "&prodId&", cant="&cant, Colors.Magenta)
|
||||
Private c As Cursor
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA,PE_COSTO_SIN,PE_FOLIO,PE_ENVIO_OK) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,0) ", Array As Object (cedis, (cant * costoU), costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO PEDIDO (PE_CEDIS,PE_COSTO_TOT,PE_COSTOU,PE_CANT,PE_PRONOMBRE,PE_PROID,PE_CLIENTE,PE_FECHA,PE_USUARIO,PE_RUTA,PE_COSTO_SIN,PE_FOLIO,PE_ENVIO_OK,PE_CANTC,PE_BCAJAS) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,0,?,?) ", Array As Object (cedis, (cant * costoU), costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta,cantc,bcajas))
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2($"update ${Starter.tabla} set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? "$, Array As Object(cant, prodId))
|
||||
c=B4XPages.MainPage.skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, SUM(PE_COSTO_SIN) AS TOTAL_CLIE_SIN FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position=0
|
||||
@@ -778,7 +778,7 @@ Sub guardaProductoSinGestion(cedis As String, costoU As String, cant As String,
|
||||
B4XPages.MainPage.skmt.ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT,PC_ALMACEN,PC_RUTA,PC_COSTO_SIN) VALUES (?,?,?,?,?,?,?,?,?,?)", Array As Object(clienteId, fecha, usuario, c.GetString("CANT_CLIE"), c.GetString("TOTAL_CLIE"), B4XPages.MainPage.lon_gps, B4XPages.MainPage.lat_gps, cedis, c.GetString("TOTAL_CLIE_SIN")))
|
||||
End Sub
|
||||
|
||||
Sub actualizaProducto(cedis As String, costoU As String, cant As Int, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
|
||||
Sub actualizaProducto(cedis As String, costoU As String, cant As Int, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String, cantc As String, bcajas As String)
|
||||
Private c As Cursor=B4XPages.MainPage.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
' Log($"ROWCOUNT: ${c.RowCount}, ${cant}"$)
|
||||
LogColor($"actualizaProducto, c=${clienteId}, p=${prodId}, nombre=${nombre}, cant=${cant}, cedis=${cedis}, tipo=${tipoVenta}"$, Colors.Magenta)
|
||||
@@ -788,7 +788,7 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As Int, nombre As
|
||||
Private antCant As Int = 0
|
||||
If IsNumber(c.GetInt("PE_CANT")) Then antCant=c.GetInt("PE_CANT")
|
||||
Private difCant As Int = cant - antCant
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update pedido set pe_cant = ${cant}, pe_costo_tot = ${(cant*c.GetString("PE_COSTOU"))} where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update pedido set pe_cant = ${cant}, pe_costo_tot = ${(cant*c.GetString("PE_COSTOU"))}, PE_CANTC = ${cantc}, PE_BCAJAS = ${bcajas} where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update ${Starter.tabla} set cat_gp_almacen = cat_gp_almacen - (${difCant}) where cat_gp_id = '${prodId}' "$)
|
||||
' Log($"CANT=${cant}"$)
|
||||
If cant = 0 Then
|
||||
@@ -800,7 +800,7 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As Int, nombre As
|
||||
End If
|
||||
Else
|
||||
'INSERTAMOS
|
||||
If cant <> 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta)
|
||||
If cant <> 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta,cantc,bcajas)
|
||||
End If
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user