mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-17 18:26:11 +00:00
29/11/23 - Cambios en respaldo diario
- Se agregó´la table CAT_RMI al respaldo. - Cuando se restaura el respaldo, se suma el abordo al inventario de CAT_GUNAPROD2. - Se agregó códigp para el limite de abordo (No esta terminado)
This commit is contained in:
@@ -117,7 +117,7 @@ End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
B4XPages.GetManager.LogEvents = True
|
||||
kh.Initialize(Me, "kh")
|
||||
kh.Initialize(Me, "kh", Starter.skmt)
|
||||
#if not(DEBUG)
|
||||
Starter.logger = False
|
||||
#end if
|
||||
|
||||
@@ -284,11 +284,13 @@ Sub Class_Globals
|
||||
Dim precision As Int = 0
|
||||
Dim clienteDeudor As Boolean = False
|
||||
Dim usarGeocerca As Boolean = False
|
||||
Dim clienteId As String
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize As Object
|
||||
kh.Initialize(Me, "kh")
|
||||
kh.Initialize(Me, "kh", Starter.skmt)
|
||||
kh.RD_Init
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
@@ -318,13 +320,20 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
cuenta = c.GetString("CAT_CL_CODIGO")
|
||||
La_nombre.Text = c.GetString("CAT_CL_NOMBRE")
|
||||
NOMBRE = c.GetString("CAT_CL_NOMBRE")
|
||||
la_Calle.Text = c.GetString("CAT_CL_CALLE") & c.GetString("CAT_CL_NOEXT")
|
||||
la_col.Text = c.GetString("CAT_CL_COLONIA")
|
||||
la_edo.Text = c.GetString("CAT_CL_EDO")
|
||||
la_Calle.Text = "N/A"
|
||||
Log("|"&c.GetString("CAT_CL_CALLE")&"|")
|
||||
If c.GetString("CAT_CL_CALLE") <> Null Then la_Calle.Text = c.GetString("CAT_CL_CALLE") & c.GetString("CAT_CL_NOEXT")
|
||||
la_col.Text = "N/A"
|
||||
If c.GetString("CAT_CL_COLONIA") <> Null Then la_col.Text = c.GetString("CAT_CL_COLONIA")
|
||||
la_edo.Text = "N/A"
|
||||
If c.GetString("CAT_CL_EDO") <> Null Then la_edo.Text = c.GetString("CAT_CL_EDO")
|
||||
la_cp.Text = c.GetString("CAT_CL_CP")
|
||||
l_entre1.Text = c.GetString("CAT_CL_CALLE1")
|
||||
l_entre2.Text = c.GetString("CAT_CL_CALLE2")
|
||||
l_atiende.Text = c.GetString("CAT_CL_ATIENDE1")
|
||||
l_entre1.Text = "N/A"
|
||||
If c.GetString("CAT_CL_CALLE1") <> Null Then l_entre1.Text = c.GetString("CAT_CL_CALLE1")
|
||||
l_entre2.Text = "N/A"
|
||||
If c.GetString("CAT_CL_CALLE2") <> Null Then l_entre2.Text = c.GetString("CAT_CL_CALLE2")
|
||||
l_atiende.Text = "N/A"
|
||||
If c.GetString("CAT_CL_ATIENDE1") <> Null Then l_atiende.Text = c.GetString("CAT_CL_ATIENDE1")
|
||||
l_atiende2.Text = c.GetString("CAT_CL_ATIENTE2")
|
||||
la_saldotot.Text = c.GetString("CAT_CL_TELEFONO")
|
||||
la_saldooper.Text = c.GetString("CAT_CL_EMAIL")
|
||||
@@ -337,8 +346,10 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
If c.GetString("CAT_CL_LONG") <> Null And c.GetString("CAT_CL_LONG") <> "null" And IsNumber(c.GetString("CAT_CL_LONG")) Then LONGITUD = c.GetString("CAT_CL_LONG")
|
||||
LATITUD = 0
|
||||
If c.GetString("CAT_CL_LAT") <> Null And c.GetString("CAT_CL_LAT") <> "null" And IsNumber(c.GetString("CAT_CL_LAT")) Then LATITUD = c.GetString("CAT_CL_LAT")
|
||||
l_categoria2.text = c.GetString("CAT_CL_CATEGORIA")
|
||||
l_segmento2.text = c.GetString("CAT_CL_SEGMENTO")
|
||||
l_categoria2.text = "N/A"
|
||||
If c.GetString("CAT_CL_CATEGORIA") <> Null Then l_categoria2.text = c.GetString("CAT_CL_CATEGORIA")
|
||||
l_segmento2.text = "N/A"
|
||||
If c.GetString("CAT_CL_SEGMENTO") <> Null Then l_segmento2.text = c.GetString("CAT_CL_SEGMENTO")
|
||||
If logger Then Log($"Lon: ${LONGITUD}, Lat: ${LATITUD}"$)
|
||||
Else
|
||||
RutaBoleta=Starter.rutaV
|
||||
@@ -369,6 +380,9 @@ End Sub
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub B4XPage_Appear
|
||||
clienteId = kh.traeCliente(Starter.skmt)
|
||||
If clienteId.StartsWith("N") Then b_noVenta.Visible = False
|
||||
Log($"TOTAL VENTA: ${kh.traeTotalCliente}"$)
|
||||
B_VENTA.Visible = False
|
||||
b_noVenta.Visible = False
|
||||
' Log(Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
|
||||
@@ -430,15 +444,32 @@ Sub B4XPage_Appear
|
||||
c.Position=0
|
||||
la_cuenta.Text = c.GetString("CAT_CL_CODIGO")
|
||||
La_nombre.Text = c.GetString("CAT_CL_NOMBRE")
|
||||
la_Calle.Text = c.GetString("CAT_CL_CALLE") & " " & c.GetString("CAT_CL_NOEXT")
|
||||
la_col.Text = c.GetString("CAT_CL_COLONIA")
|
||||
la_edo.Text = c.GetString("CAT_CL_EDO")
|
||||
la_Calle.Text = "N/A"
|
||||
' Log("|"&c.GetString("CAT_CL_CALLE")&"|")
|
||||
If c.GetString("CAT_CL_CALLE") <> Null And c.GetString("CAT_CL_CALLE") <> "null" Then la_Calle.Text = c.GetString("CAT_CL_CALLE") & c.GetString("CAT_CL_NOEXT")
|
||||
la_col.Text = "N/A"
|
||||
If c.GetString("CAT_CL_COLONIA") <> Null And c.GetString("CAT_CL_COLONIA") <> "null" Then la_col.Text = c.GetString("CAT_CL_COLONIA")
|
||||
la_edo.Text = "N/A"
|
||||
If c.GetString("CAT_CL_EDO") <> Null And c.GetString("CAT_CL_EDO") <>"null" Then la_edo.Text = c.GetString("CAT_CL_EDO")
|
||||
la_cp.Text = c.GetString("CAT_CL_CP")
|
||||
l_entre1.Text = c.GetString("CAT_CL_CALLE1")
|
||||
l_entre2.Text = c.GetString("CAT_CL_CALLE2")
|
||||
l_atiende.Text = c.GetString("CAT_CL_ATIENDE1")
|
||||
l_entre1.Text = "N/A"
|
||||
If c.GetString("CAT_CL_CALLE1") <> Null And c.GetString("CAT_CL_CALLE1") <>"null" Then l_entre1.Text = c.GetString("CAT_CL_CALLE1")
|
||||
l_entre2.Text = "N/A"
|
||||
If c.GetString("CAT_CL_CALLE2") <> Null And c.GetString("CAT_CL_CALLE2") <> "null" Then l_entre2.Text = c.GetString("CAT_CL_CALLE2")
|
||||
l_atiende.Text = "N/A"
|
||||
If c.GetString("CAT_CL_ATIENDE1") <> Null And c.GetString("CAT_CL_ATIENDE1") <> "null" Then l_atiende.Text = c.GetString("CAT_CL_ATIENDE1")
|
||||
l_atiende2.Text = c.GetString("CAT_CL_ATIENTE2")
|
||||
l_total.Text = s.GetString("TOTAL_CLIE")
|
||||
|
||||
' LONGITUD = 0
|
||||
' If c.GetString("CAT_CL_LONG") <> Null And c.GetString("CAT_CL_LONG") <> "null" And IsNumber(c.GetString("CAT_CL_LONG")) Then LONGITUD = c.GetString("CAT_CL_LONG")
|
||||
' LATITUD = 0
|
||||
' If c.GetString("CAT_CL_LAT") <> Null And c.GetString("CAT_CL_LAT") <> "null" And IsNumber(c.GetString("CAT_CL_LAT")) Then LATITUD = c.GetString("CAT_CL_LAT")
|
||||
' l_categoria2.text = "N/A"
|
||||
' If c.GetString("CAT_CL_CATEGORIA") <> Null Then l_categoria2.text = c.GetString("CAT_CL_CATEGORIA")
|
||||
' l_segmento2.text = "N/A"
|
||||
' If c.GetString("CAT_CL_SEGMENTO") <> Null Then l_segmento2.text = c.GetString("CAT_CL_SEGMENTO")
|
||||
|
||||
l_total.Text = kh.traeTotalCliente
|
||||
total_cliente = s.GetString("TOTAL_CLIE")
|
||||
' Log(Subs.sumaPedido(Subs.traeCliente) & " - " & total_cliente)
|
||||
m_lat =c.GetString("CAT_CL_LAT")
|
||||
@@ -463,7 +494,7 @@ Sub B4XPage_Appear
|
||||
NOMBRE = c.GetString("CAT_CL_NOMBRE")
|
||||
' Log(l_total.text)
|
||||
If l_total.Text = Null Or l_total.Text = "null" Then
|
||||
b_noVenta.Visible = True
|
||||
If Not(clienteId.StartsWith("N")) Then b_noVenta.Visible = True
|
||||
Else
|
||||
b_noVenta.Visible = False
|
||||
If la_cuenta.Text = "0" Then
|
||||
@@ -552,6 +583,7 @@ Sub B4XPage_Appear
|
||||
Else
|
||||
Guardar.Visible = True
|
||||
End If
|
||||
If Not(l_total.Text > 0) Then Guardar.Visible = True
|
||||
' If la_cuenta.text = "0" Then Guardar.Visible = True 'Abordo
|
||||
If l_total.Text = Null Or l_total.Text = "null" Or l_total.text = "0" Then Guardar.Visible = True 'Si no hay venta entonces "Guardar" es visible.
|
||||
|
||||
@@ -844,6 +876,8 @@ Sub Guardar_Click
|
||||
' B4XPages.ShowPageAndRemovePreviousPages("Principal")
|
||||
Guardar.SendToBack
|
||||
b_inicioFinVenta.Text = "TERMINAR VENTA"
|
||||
Log("RESPLDO")
|
||||
kh.respaldoBatch
|
||||
If la_cuenta.Text <> "0" Then 'Si es ABORDO, no mostramos el boton b_inicioFinVenta y regresamos a Principal.
|
||||
b_inicioFinVenta.Visible = True
|
||||
Else
|
||||
@@ -3750,7 +3784,7 @@ Private Sub b_geopass_Click
|
||||
Log($"${Starter.DBReqServer}, ${et_geopass.Text}, ${Subs.traeAlmacen}, ${Subs.traeRuta}"$)
|
||||
et_geopass.Text = ""
|
||||
End If
|
||||
b_noVenta.Visible = True
|
||||
If Not(clienteId.StartsWith("N")) Then b_noVenta.Visible = True
|
||||
p_pideGeoPass.Visible = False
|
||||
ime.HideKeyboard
|
||||
' Log("Guardamos coords")
|
||||
|
||||
@@ -257,7 +257,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
l_ctast.Text = d.GetString("TOTAL_VISITAR")
|
||||
'l_porvisitar.Text = e.GetString("POR_VISITAR")
|
||||
End If
|
||||
kh.Initialize(Me, "kh")
|
||||
kh.Initialize(Me, "kh", Starter.skmt)
|
||||
kh.RD_Init
|
||||
P_RESUMEN.Top = 0 : P_RESUMEN.Left = 0 'Panel Resumen
|
||||
Panel5.Top = 0 : Panel5.Left = 0 ' Panel Resumen Acumualado
|
||||
@@ -285,16 +285,7 @@ Sub B4XPage_Appear
|
||||
borraClientesNuevosSinVenta
|
||||
reqManager.Initialize(Me, Starter.DBReqServer)
|
||||
' If Not(btAdmin.IsEnabled) Then btAdmin.Enable 'Si no esta prendido el BT, lo prendemos.
|
||||
If kh.RD_Init_IsInitialized Then
|
||||
kh.RD_respalda_cat_detalle_paq
|
||||
kh.RD_respalda_cat_gunaprod
|
||||
kh.RD_respalda_cat_gunaprod2
|
||||
kh.RD_respalda_kmt_info
|
||||
kh.RD_respalda_pedido
|
||||
kh.RD_respalda_promos_comp
|
||||
Else
|
||||
Log("****** RD NO INICIALIZADO ********")
|
||||
End If
|
||||
|
||||
e_ruta.Enabled = True
|
||||
Starter.rutaV = l_ruta.Text
|
||||
c = Starter.skmt.ExecQuery2("select count(*) as CUANTOS from CAT_VARIABLES WHERE CAT_VA_DESCRIPCION = ?", Array As String ("SERVER"))
|
||||
@@ -2043,6 +2034,7 @@ Sub e_ruta_EnterPressed
|
||||
End If
|
||||
c.Close
|
||||
End If
|
||||
kh.respaldoBatch
|
||||
If e_ruta.Text = "FIN DIA" And adelanteFinDia Then
|
||||
res = Msgbox2("Seguro que desea hacer el cierre? ... todos los datos se borraran","Cierre", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png")) 'ignore
|
||||
If res = DialogResponse.POSITIVE Then
|
||||
@@ -3214,7 +3206,7 @@ Sub borraClientesNuevosSinVenta 'ignore
|
||||
x.Position = 0
|
||||
For i = 0 To x.RowCount - 1
|
||||
Starter.skmt.ExecNonQuery($"delete from kmt_info where CAT_CL_CODIGO = '${x.GetString("CAT_CL_CODIGO")}'"$)
|
||||
LogColor($"Cliente nuevo "${x.GetString("CAT_CL_CODIGO")}" BORRADO!!"$, Colors.red)
|
||||
LogColor($"Cliente nuevo "${x.GetString("CAT_CL_CODIGO")}" SIN VENTA -> BORRADO!!"$, Colors.red)
|
||||
Next
|
||||
End If
|
||||
End Sub
|
||||
@@ -8,6 +8,7 @@ Sub Class_Globals
|
||||
Private Root As B4XView 'ignore
|
||||
Private xui As XUI 'ignore
|
||||
Dim ruta As String
|
||||
dim kh as kms_helperSubs
|
||||
Dim q_buscar As String
|
||||
Dim forzarBusqueda As Boolean = False
|
||||
Dim skmt As SQL
|
||||
@@ -94,10 +95,15 @@ Sub Class_Globals
|
||||
Dim list_prodsPedido As List
|
||||
Private b_rmi As Button
|
||||
Private l_mDisponible As Label
|
||||
' Dim limiteAbordo As Int = 0
|
||||
Private l_limiteAbordoDisp As Label
|
||||
Dim dispAbordo As String
|
||||
Private l_avisoAbordo As Label
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize As Object
|
||||
kh.Initialize(Me, "kh", Starter.skmt)
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
@@ -138,16 +144,32 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
LlenaProdsLL(Null, Null)
|
||||
list_prodsPedido.Initialize
|
||||
Log("list_prodsPedido.Initialize")
|
||||
p_vistaPreviaTrans.Width = Root.Width
|
||||
p_vistaPreviaTrans.Height = Root.Height
|
||||
Subs.centraPanel(p_vistaPreviaTrans, Root.Width)
|
||||
Subs.centraPanel(p_vistaPrevia, Root.Width)
|
||||
p_productos.Top = 0 : p_productos.left = 0
|
||||
Subs.centraPanel(p_rmi, Root.Width)
|
||||
' prodsMap.Initialize
|
||||
' limiteAbordo = kh.traeLimiteAbordo
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Sub B4XPage_Appear
|
||||
' Log($"LIMITE ABORDO: ${limiteAbordo}"$)
|
||||
' clv_prods_ll.Initialize(Me, "clv_prods_ll")
|
||||
' list_prodsPedido.Initialize
|
||||
' Log("list_prodsPedido.Initialize")
|
||||
clienteId = Subs.traeCliente
|
||||
If clienteId = 0 Then
|
||||
dispAbordo = NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, false)
|
||||
l_limiteAbordoDisp.Text = $"Disp Abordo: $${dispAbordo}"$
|
||||
l_limiteAbordoDisp.Visible = True
|
||||
b_rmi.Visible = False
|
||||
Else
|
||||
l_limiteAbordoDisp.Visible = False
|
||||
End If
|
||||
rutaUsuario = Subs.traeRuta
|
||||
If p_rmi.Visible Then p_rmi.Visible = False
|
||||
' l_mDisponible.Visible = False
|
||||
@@ -579,21 +601,29 @@ Sub b_prodMas_Click
|
||||
Private inv As Int = clv_prods_ll.GetValue(index).As(Map).Get("almacen")
|
||||
Log(tmpMap)
|
||||
If buttonTag = "vendido" Then
|
||||
Log("VENDIDO")
|
||||
Log($"${(laCant.Text + 1 <= inv)} And ${(Subs.totalPedido - precio > 1)}"$)
|
||||
If inv > 0 And (laCant.Text + 1 <= existencias) And (Subs.totalPedido - precio > 1) Then
|
||||
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}"$
|
||||
' laCant.Text = $"$1.0{laCant.Text+1}"$
|
||||
laCant.Text = NumberFormat2((laCant.Text + 1), 1, 0, 0, False)
|
||||
Log(clv_prods_ll.GetValue(index).As(Map))
|
||||
End If
|
||||
dispAbordo = NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False)
|
||||
If dispAbordo < 1 Then
|
||||
laCant.Text = NumberFormat2((laCant.Text - 1), 1, 0, 0, False)
|
||||
End If
|
||||
else If laCant.Text + 1 <= inv And lfila.Text = "PRODUCTOS" Then
|
||||
LogColor(inv, Colors.blue)
|
||||
laCant.Text = $"$1.0{laCant.Text + 1}"$
|
||||
' laCant.Text = $"$1.0{laCant.Text + 1}"$
|
||||
laCant.Text = NumberFormat2((laCant.Text + 1), 1, 0, 0, False)
|
||||
Log(Subs.totalPedido)
|
||||
else If lfila.Text = "RMI" And laCant.Text + 1 <= inv And (Subs.totalPedido - precio > 1) Then
|
||||
LogColor(inv, Colors.blue)
|
||||
laCant.Text = $"$1.0{laCant.Text + 1}"$
|
||||
' laCant.Text = $"$1.0{laCant.Text + 1}"$
|
||||
laCant.Text = NumberFormat2((laCant.Text + 1), 1, 0, 0, False)
|
||||
Log(Subs.totalPedido)
|
||||
else if Subs.totalPedido < 1 Then
|
||||
laCant.Text = "0"
|
||||
@@ -608,34 +638,37 @@ Sub b_prodMas_Click
|
||||
precioX = precioX * -1
|
||||
End If
|
||||
Subs.actualizaProducto(almacenX, precioX, laCant.text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
||||
cuentaProds
|
||||
If Subs.totalPedido < 1 Then
|
||||
etCantHasFocus = True
|
||||
Log("A CERO")
|
||||
laCant.Text = "0"
|
||||
et_pCant_TextChanged(100, 0)
|
||||
End If
|
||||
' Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
cuentaProds
|
||||
Log($"Total Prods: ${totalProds}, Total Compra: $$1.2{totalCompra}"$)
|
||||
End Sub
|
||||
|
||||
Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
' LogColor($"txt changed: ${Old}|${New}, hasfocus=${etCantHasFocus}"$,Colors.Magenta)
|
||||
' If Not(Old = "0" And New = "") And etCantHasFocus Then cuentaProds
|
||||
|
||||
If etCantHasFocus = True Then
|
||||
If etCantHasFocus = True Then
|
||||
Try
|
||||
' 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)
|
||||
Private existencias As String = pnl.GetView(1).Tag
|
||||
Dim laCant As B4XView = pnl.GetView(2).GetView(2)
|
||||
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")
|
||||
Log("++++++++++ " & precio)
|
||||
Log("++++++++++ " & precio)
|
||||
Dim tempTot As String = Subs.totalPedido
|
||||
Dim disp As String = 0
|
||||
If tempTot > 0 Then disp = (Subs.totalPedido / precio) - 1
|
||||
disp = NumberFormat2(disp, 1, 0, 0, False)
|
||||
If existencias = "" Then existencias = 0
|
||||
existencias = NumberFormat2(existencias, 1, 0, 0, False)
|
||||
|
||||
Log($"${laCant.text}, ${precio}, DISPONIBLES: ${disp}"$)
|
||||
Private inv As String=clv_prods_ll.GetValue(index).As(Map).Get("almacen")
|
||||
@@ -656,22 +689,22 @@ Private Sub et_pCant_TextChanged (Old As String, New As String)
|
||||
' elProd = Subs.traeProdNombre(id)
|
||||
Log("NO RMI")
|
||||
End If
|
||||
' Log($"inventario=${inv}"$)
|
||||
' Dim tmpCant As String = laCant.text
|
||||
' Log($"inventario=${inv}"$)
|
||||
' Dim tmpCant As String = laCant.text
|
||||
If laCant.Text = "" Then laCant.Text = "0"
|
||||
If laCant.Text > disp Then
|
||||
Log($"Ponemos laCant en: ${disp}"$)
|
||||
' laCant.Text = ""
|
||||
laCant.text = "0"
|
||||
' etCantHasFocus = True
|
||||
End If
|
||||
If Not(Old = "0" And New = "") And laCant.Text <> Null And laCant.Text <> "" And etCantHasFocus Then
|
||||
Subs.actualizaProducto(almacenX, precioX, laCant.Text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, B4XPages.MainPage.tipo_venta)
|
||||
cuentaProds
|
||||
If laCant.Text > existencias Then
|
||||
Log($"Ponemos laCant en: ${existencias}"$)
|
||||
' laCant.Text = ""
|
||||
laCant.text = existencias
|
||||
' etCantHasFocus = True
|
||||
End If
|
||||
' If Not(Old = "0" And New = "") And laCant.Text <> Null And laCant.Text <> "" And etCantHasFocus Then
|
||||
Subs.actualizaProducto(almacenX, precioX, laCant.Text, nombreX, id, clienteId, Subs.traeFecha, Subs.traeUsuarioDeBD, rutaUsuario, 0, Starter.tipov)
|
||||
' End If
|
||||
Catch
|
||||
Log(LastException)
|
||||
End Try
|
||||
cuentaProds
|
||||
' etCantHasFocus = False
|
||||
' laCant.text = ""
|
||||
' laCant.text = tmpCant
|
||||
@@ -689,7 +722,7 @@ End Sub
|
||||
|
||||
Sub cuentaProds
|
||||
'LogColor($"Productos de la orden: ${c_prodsX.GetString("cantProds")}, Total: ${c_prodsX.GetString("costoTotal")}"$, Colors.red)
|
||||
' Log("===========================")
|
||||
Log("===========================")
|
||||
Private c As Cursor = Starter.skmt.ExecQuery($"select sum(PE_COSTO_TOT) as total, sum(PE_CANT) as cant from PEDIDO where PE_CLIENTE = '${clienteId}'"$)
|
||||
' LogColor("TIEMPO cuentaProds =" & ((DateTime.Now-inicioContador)/1000), Colors.Red)
|
||||
' LogColor(prodsMap, Colors.Magenta)
|
||||
@@ -700,7 +733,22 @@ Sub cuentaProds
|
||||
' Log(Subs.totalPedido)
|
||||
If lfila.Text = "RMI" Then l_mDisponible.Visible = True Else l_mDisponible.Visible = False
|
||||
l_mDisponible.Text = $"Disponible: $${Subs.totalPedido}"$
|
||||
' Log($"Total Prods: ${c.GetString("cant")}, Total Compra: $$1.2{c.GetString("total")}"$)
|
||||
|
||||
Log($"${kh.traeLimiteAbordoXInventario} - ${kh.traeVenta} - ${kh.traeLimiteAbordoWeb}"$)
|
||||
Log($"LIMITE ABORDO DISPONIBLE: ${NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False)}"$)
|
||||
dispAbordo = NumberFormat2((kh.traeLimiteAbordoWeb - (kh.traeLimiteAbordoXInventario - kh.traeVenta) - kh.traeVentaAbordo), 0, 2, 2, False)
|
||||
l_limiteAbordoDisp.Text = $"Disp Abordo: $${dispAbordo}"$
|
||||
If dispAbordo < 1 Then
|
||||
b_continuar.Visible = False
|
||||
b_terminar1.Visible = False
|
||||
l_avisoAbordo.BringToFront
|
||||
l_avisoAbordo.Visible = True
|
||||
Else
|
||||
l_avisoAbordo.Visible = False
|
||||
b_continuar.Visible = True
|
||||
b_terminar1.Visible = True
|
||||
End If
|
||||
Log($"Total Prods: ${c.GetString("cant")}, Total Compra: $$1.2{c.GetString("total")}"$)
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
@@ -760,9 +808,6 @@ Sub b_terminar1_Click
|
||||
l_total2.Text = $"$1.2{totalPedido}"$
|
||||
l_cant.Text = cantPedido
|
||||
If Subs.revisaImpresa Then b_rechazar.Visible = False Else b_rechazar.Visible = True
|
||||
p_vistaPreviaTrans.Width = Root.Width
|
||||
p_vistaPreviaTrans.Height = Root.Height
|
||||
Subs.centraPanel(p_vistaPrevia, Root.Width)
|
||||
p_vistaPrevia.Visible=True
|
||||
p_vistaPreviaTrans.Visible=True
|
||||
End Sub
|
||||
@@ -857,7 +902,9 @@ Private Sub p_vistaPreviaTrans_Click
|
||||
End Sub
|
||||
|
||||
Private Sub b_rechazar_Click
|
||||
If folio <> "" Then
|
||||
Log("Rechazo de pedido")
|
||||
' Log($"Folio: ${folio}"$)
|
||||
' If folio <> "" Then
|
||||
result = Msgbox2($"Seguro que desea borrar el pedido completo?${CRLF}Haciendo clic largo sobre un producto se pueden borrar articulos por separado."$,"Rechazar Pedido", "Si", "", "No",LoadBitmap(File.DirAssets,"alert2.png")) 'ignore
|
||||
If result = DialogResponse.POSITIVE Then
|
||||
Subs.borraPedidoClienteActual
|
||||
@@ -872,9 +919,9 @@ Private Sub b_rechazar_Click
|
||||
' Log("NO Positivo")
|
||||
p_vistaPreviaTrans.Visible = False
|
||||
End If
|
||||
Else
|
||||
' Msgbox("LA VENTA YA SE TRANSMITIO, FAVOR DE LLAMAR A SOPORTE PARA ASISTENCIA","AVISO") 'ignore
|
||||
End If
|
||||
' Else
|
||||
'' Msgbox("LA VENTA YA SE TRANSMITIO, FAVOR DE LLAMAR A SOPORTE PARA ASISTENCIA","AVISO") 'ignore
|
||||
' End If
|
||||
p_vistaPreviaTrans.Visible=False
|
||||
Subs.iniciaActividad("Cliente")
|
||||
' B4XPages.ShowPage("Cliente")
|
||||
|
||||
Binary file not shown.
@@ -870,7 +870,7 @@ Version=12.5
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: Kelloggs Venta
|
||||
#VersionCode: 3000
|
||||
#VersionName: 3.11.22 PRUEBA V4
|
||||
#VersionName: 3.11.23 PRUEBA V4
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
#BridgeLogger:true
|
||||
|
||||
@@ -63,8 +63,8 @@ ModuleBreakpoints9=
|
||||
ModuleClosedNodes0=
|
||||
ModuleClosedNodes1=35
|
||||
ModuleClosedNodes10=
|
||||
ModuleClosedNodes11=1,50,51,52
|
||||
ModuleClosedNodes12=1,15,16
|
||||
ModuleClosedNodes11=50,51,52
|
||||
ModuleClosedNodes12=
|
||||
ModuleClosedNodes13=
|
||||
ModuleClosedNodes14=39,40,41,42,43,44
|
||||
ModuleClosedNodes15=
|
||||
@@ -83,7 +83,7 @@ ModuleClosedNodes26=2
|
||||
ModuleClosedNodes27=
|
||||
ModuleClosedNodes28=9,10,11
|
||||
ModuleClosedNodes29=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes3=1
|
||||
ModuleClosedNodes30=
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=
|
||||
@@ -91,6 +91,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=Visual Designer,principal.bal,-100,3,C_Nota,borra_Click,193,1,C_Nota,clv_pedidos_ItemLongClick,368,1,Main,Activity_Pause,49,0,Main,Process_Globals,21,0,C_Principal,B_OK_PAS_Click,2166,0,C_Principal,B4XPage_Created,253,0,C_Principal,cargar_Click,514,5,kms_helperSubs,Class_Globals,17,0,C_Principal,B4XPage_Appear,281,6,kms_helperSubs,RD_Init,69,0
|
||||
NavigationStack=kms_helperSubs,RD_restaura_cat_rmi,400,2,Visual Designer,cliente.bal,-100,1,C_Cliente,B4XPage_Appear,463,0,C_Principal,B4XPage_Appear,266,2,kms_helperSubs,respaldoBatch,401,0,C_Cliente,Guardar_Click,871,6,C_Principal,e_ruta_EnterPressed,2030,0,C_Principal,B4XPage_Created,252,0,C_Cliente,B4XPage_Created,301,0,C_Cliente,Initialize,285,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,28,11,24,3,29,14,12,9,21,7
|
||||
VisibleModules=1,28,11,24,3,29,14,12,9,21
|
||||
|
||||
@@ -932,7 +932,7 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre
|
||||
Private antCant As Int = 0
|
||||
If IsNumber(c.GetInt("PE_CANT")) Then antCant=c.GetInt("PE_CANT")
|
||||
Private difCant As Int = cant - antCant
|
||||
Starter.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}' "$)
|
||||
Starter.skmt.ExecNonQuery($"update pedido set pe_cant = ${cant}, pe_costo_tot = ${(cant*c.GetString("PE_COSTOU"))}, pe_tipo = '${tipoVenta}' where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' "$)
|
||||
If cedis <> "DUR" Then Starter.skmt.ExecNonQuery($"update ${traeTablaProds(tipoVenta)} set cat_gp_almacen = cat_gp_almacen - (${difCant}) where cat_gp_id = '${prodId}' "$)
|
||||
If cant = 0 Then
|
||||
LogColor($"BORRAMOS PRODUCTO - ${prodId}"$, Colors.Red)
|
||||
@@ -1269,6 +1269,7 @@ Sub revisaMaxPromosProdsFijosPorInventario(pm As Map) As Int
|
||||
If thisLog Then LogColor($"prodsFijosPiezasReq=${prodsFijosPiezas}"$, Colors.Blue)
|
||||
If thisLog Then LogColor($"invFijoXpromo=${invFijoXpromo}"$, Colors.Blue)
|
||||
If thisLog Then LogColor("Max promos de prodsFijos POR inventario = " & t.Get(0), Colors.red)
|
||||
LogColor(">>>>>> " & t.Get(0), Colors.red)
|
||||
Return t.Get(0) 'Regresamos el resultado mas pequeño.
|
||||
End Sub
|
||||
|
||||
@@ -1404,9 +1405,10 @@ End Sub
|
||||
'Borra los registros de la tabla "pedido" y "pedido_cliente"
|
||||
'Actualiza las tablas "cat_gunaprod" o "cat_gunaprod2" y "kmt_info".
|
||||
Sub borraPedidoClienteActual As String
|
||||
Log($"Boramos pedido de ${traeCliente}"$)
|
||||
Private thisC As Cursor
|
||||
' Private tablaProds As String = "cat_gunaprod2"
|
||||
thisC = Starter.skmt.ExecQuery("select PE_PROID, PE_CANT, PE_CEDIS FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")
|
||||
thisC = Starter.skmt.ExecQuery("select PE_PROID, PE_CANT, PE_CEDIS FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa)")
|
||||
If thisC.RowCount>0 Then
|
||||
For i=0 To thisC.RowCount -1
|
||||
thisC.Position=i
|
||||
@@ -1566,7 +1568,7 @@ End Sub
|
||||
'Trae la sumatoria del pedido del cliente especificado de la tabla PEDIDO.
|
||||
'A veces hace el SUM() REDONDEA el monto, con esta función no se redondea nada.
|
||||
Sub sumaPedido(cliente As String) As String 'ignore
|
||||
Dim x As Cursor = Starter.skmt.ExecQuery($"select PE_COSTO_TOT from pedido where PE_CEDIS <> PE_PROID and pe_cliente = ${cliente} and PE_CEDIS <> "DOE""$)
|
||||
Dim x As Cursor = Starter.skmt.ExecQuery($"select PE_COSTO_TOT from pedido where PE_CEDIS <> PE_PROID and pe_cliente = '${cliente}' and PE_CEDIS <> "DOE""$)
|
||||
Private total As String = 0
|
||||
For i = 0 To x.RowCount - 1
|
||||
x.Position = i
|
||||
|
||||
@@ -25,13 +25,15 @@ Sub Class_Globals
|
||||
Dim btAdmin As BluetoothAdmin
|
||||
Dim RD_fechaRestauracion As String = ""
|
||||
Private fechaRestauracion As String = ""
|
||||
Private khdb As SQL
|
||||
End Sub
|
||||
|
||||
'Inicializa la clase "kms_helperSubs".
|
||||
'Ej. kh.Initialize(Me, "kh")
|
||||
Public Sub Initialize (vCallback As Object, vEventName As String) As Object
|
||||
'Inicializa la clase "kms_helperSubs", el tercer parametro es la base de datos que se va a usar.
|
||||
'Ej. kh.Initialize(Me, "kh", skmt)
|
||||
Public Sub Initialize (vCallback As Object, vEventName As String, db As SQL) As Object
|
||||
EventName = vEventName
|
||||
CallBack = vCallback
|
||||
khdb = db
|
||||
Return Me
|
||||
End Sub
|
||||
|
||||
@@ -60,6 +62,7 @@ Sub RD_Init
|
||||
safePath = Dirp & Dir
|
||||
'Si no existe el directorio "kmts" en el raiz de la tarjeta de memoria, nos cambiamos al directorio seguro (sdcard/Android/data/kelloggs...)
|
||||
If Not(File.IsDirectory(Dirp, Dir)) Then safePath = rp.GetSafeDirDefaultExternal("kmts")
|
||||
Log($"Hay directirio: ${Dirp} ${Dir}- ${File.IsDirectory(Dirp, Dir)}"$)
|
||||
If Starter.Logger Then Log($"Safepath:${safePath}"$)
|
||||
Private name() As String = Regex.split(" ", Application.LabelName) 'Obtenemos el nombre de la app para ponerselo a la BD.
|
||||
rkmt.Initialize(safePath, $"${name(0)}.rkmt.km"$, True)
|
||||
@@ -70,6 +73,7 @@ Sub RD_Init
|
||||
If chkIfTableExists(skmt, "CAT_GUNAPROD2") Then rkmt.ExecNonQuery($"create table if not exists CAT_GUNAPROD2 (${getTableColumnList(skmt, "CAT_GUNAPROD2")}, FECHA TEXT)"$)
|
||||
If chkIfTableExists(skmt, "kmt_info") Then rkmt.ExecNonQuery($"create table if not exists kmt_info (${getTableColumnList(skmt, "kmt_info")}, FECHA TEXT)"$)
|
||||
If chkIfTableExists(skmt, "PROMOS_COMP") Then rkmt.ExecNonQuery($"create table if not exists PROMOS_COMP (${getTableColumnList(skmt, "PROMOS_COMP")}, FECHA TEXT)"$)
|
||||
If chkIfTableExists(skmt, "CAT_RMI") Then rkmt.ExecNonQuery($"create table if not exists CAT_RMI (${getTableColumnList(skmt, "CAT_RMI")}, FECHA TEXT)"$)
|
||||
DateTime.DateFormat = "yyyyMMdd"
|
||||
fechaHoy = DateTime.Date(DateTime.Now)
|
||||
If Starter.Logger Then Log("RKMTS: " & rkmt.IsInitialized)
|
||||
@@ -124,15 +128,23 @@ End Sub
|
||||
'RD - Copia la tabla PEDIDO a rkmt.db en la tarjeta del celular.
|
||||
Sub RD_respalda_pedido
|
||||
Private inicio As String = DateTime.Now
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
Private fechaHoy2 As String = DateTime.Date(DateTime.Now)
|
||||
' Log("Copiando PEDIDO ...")
|
||||
Private x As Cursor = skmt.ExecQuery("select * from PEDIDO")
|
||||
' Log(x.RowCount)
|
||||
If x.RowCount > 0 Then
|
||||
Private lasCols As String = getTableColumnListName(skmt, "PEDIDO")
|
||||
rkmt.BeginTransaction
|
||||
' rkmt.BeginTransaction
|
||||
rkmt.ExecNonQuery($"delete from PEDIDO where FECHA = '${fechaHoy}'"$)
|
||||
rkmt.ExecNonQuery($"insert into PEDIDO (${lasCols}, FECHA) select ${lasCols}, '${fechaHoy}' as FECHA from skmt1.PEDIDO where substr(pe_fecha, 1, 10) = '${fechaHoy}'"$)
|
||||
rkmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
|
||||
rkmt.EndTransaction
|
||||
rkmt.ExecNonQuery($"insert into PEDIDO (${lasCols}, FECHA) select ${lasCols}, '${fechaHoy}' as FECHA from skmt1.PEDIDO where substr(pe_fecha, 1, 10) = '${fechaHoy2}'"$)
|
||||
|
||||
' Private f As Cursor = rkmt.ExecQuery($"Select ${lasCols}, '${fechaHoy}' as FECHA from skmt1.PEDIDO where substr(pe_fecha, 1, 10) = '${fechaHoy2}'"$)
|
||||
' Log($">>>>>> registros pedido : ${f.RowCount} - ${fechaHoy}"$)
|
||||
' Private d As Cursor = skmt1.ExecQuery($"select ${lasCols}, '${fechaHoy}' as FECHA from PEDIDO where substr(pe_fecha, 1, 10) = '${fechaHoy}'"$)
|
||||
' Log(d.RowCount)
|
||||
' rkmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
|
||||
' rkmt.EndTransaction
|
||||
End If
|
||||
x.Close
|
||||
LogColor("P: " & ((DateTime.Now - inicio)/1000) & " segs", Colors.RGB(166,37,0))
|
||||
@@ -166,10 +178,10 @@ Sub RD_restaura_cat_gunaprod
|
||||
Log(fechaRestauracion)
|
||||
lasCols = lasCols.Replace(", FECHA", "") 'Quitamos la imagen del respaldo.
|
||||
Private c As Cursor = rkmt.ExecQuery($"select distinct fecha from CAT_GUNAPROD ${fechaRestauracion} order by fecha desc"$) 'where fecha <> '${fechaHoy}' 'Traemos la ultima fecha antes de hoy.
|
||||
Log(c.RowCount)
|
||||
' Log(c.RowCount)
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
Log(c.GetString("FECHA"))
|
||||
' Log(c.GetString("FECHA"))
|
||||
skmt.ExecNonQuery("delete from CAT_GUNAPROD")
|
||||
skmt.ExecNonQuery($"insert into CAT_GUNAPROD (${lasCols}) select ${lasCols} from rkmt1.CAT_GUNAPROD where fecha = '${c.GetString("FECHA")}'"$)
|
||||
Log($"insert into CAT_GUNAPROD (${lasCols}) select ${lasCols} from rkmt1.CAT_GUNAPROD where fecha = '${c.GetString("FECHA")}'"$)
|
||||
@@ -215,6 +227,29 @@ Sub RD_restaura_cat_gunaprod2
|
||||
Else
|
||||
ToastMessageShow($"No hay respaldo GP2 para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
|
||||
End If
|
||||
|
||||
'Agregamos al inventario las cantidades del abordo
|
||||
Private sqlAbordo As String = ""
|
||||
Private sqlfechaAbordo As String = ""
|
||||
If fechaRestauracion = "" Then
|
||||
sqlAbordo = "where PE_TIPO = 'ABORDO'"
|
||||
sqlfechaAbordo = $"And fecha = '${fechaHoy}'"$
|
||||
Else
|
||||
sqlAbordo = "and PE_TIPO = 'ABORDO'"
|
||||
sqlfechaAbordo = ""
|
||||
End If
|
||||
Private a As Cursor = rkmt.ExecQuery($"select * from PEDIDO ${fechaRestauracion} ${sqlAbordo} ${sqlfechaAbordo} order by fecha desc"$) 'where fecha <> '${fechaHoy}' 'Traemos la ultima fecha antes de hoy.
|
||||
Log($"select * from PEDIDO ${fechaRestauracion} ${sqlAbordo} ${sqlfechaAbordo} order by fecha desc"$)
|
||||
' Log(">>>>>>>> PEDIDOS " & a.RowCount)
|
||||
If a.RowCount > 0 Then
|
||||
For i = 0 To a.RowCount - 1
|
||||
a.Position = i
|
||||
skmt.ExecNonQuery($"update CAT_GUNAPROD2 set CAT_GP_ALMACEN = CAT_GP_ALMACEN + ${a.GetString("PE_CANT")} where CAT_GP_ID = '${a.GetString("PE_PROID")}'"$)
|
||||
Log($"update CAT_GUNAPROD2 set CAT_GP_ALMACEN = CAT_GP_ALMACEN + ${a.GetString("PE_CANT")}' where CAT_GP_ID = '${a.GetString("PE_PROID")}'"$)
|
||||
Next
|
||||
Else
|
||||
ToastMessageShow($"No hay respaldo GP2 para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
|
||||
End If
|
||||
Log("R-GP2: " & ((DateTime.Now - inicio)/1000) & " segs")
|
||||
End Sub
|
||||
|
||||
@@ -332,6 +367,57 @@ Sub RD_restaura_promos_comp
|
||||
Log("R-KMT: " & ((DateTime.Now - inicio)/1000) & " segs")
|
||||
End Sub
|
||||
|
||||
'RD - Copia la tabla cat_rmi a rkmt.db en la tarjeta del celular.
|
||||
Sub RD_respalda_cat_rmi
|
||||
Private inicio As String = DateTime.Now
|
||||
' Log("Copiando cat_rmi ...")
|
||||
Private x As Cursor = skmt.ExecQuery("select * from CAT_RMI")
|
||||
If x.RowCount > 0 Then
|
||||
Private lasCols As String = getTableColumnListName(skmt, "CAT_RMI")
|
||||
rkmt.BeginTransaction
|
||||
rkmt.ExecNonQuery($"delete from CAT_RMI where fecha = '${fechaHoy}'"$)
|
||||
rkmt.ExecNonQuery($"insert into CAT_RMI (${lasCols}, FECHA) select ${lasCols}, '${fechaHoy}' as FECHA from skmt1.CAT_RMI"$)
|
||||
rkmt.TransactionSuccessful 'Si no se pone TransactionSuccessful no se escribe NADA!!
|
||||
rkmt.EndTransaction
|
||||
End If
|
||||
x.Close
|
||||
LogColor("RMI: " & ((DateTime.Now - inicio)/1000) & " segs", Colors.RGB(166,37,0))
|
||||
End Sub
|
||||
|
||||
'RD - Copia la tabla cat_rmi de rkmt.db al celular.
|
||||
Sub RD_restaura_cat_rmi
|
||||
Private inicio As String = DateTime.Now
|
||||
' Log("Restaurando CAT_RMI ...")
|
||||
fechaRestauracion = RD_fechaRestauracionSQL(RD_fechaRestauracion)
|
||||
Private lasCols As String = getTableColumnListName(rkmt, "CAT_RMI")
|
||||
lasCols = lasCols.Replace(", FECHA", "") 'Quitamos la fecha del respaldo.
|
||||
Private c As Cursor = rkmt.ExecQuery($"select distinct fecha from CAT_RMI ${fechaRestauracion} order by fecha desc"$) 'where fecha <> '${fechaHoy}' 'Traemos la ultima fecha antes de hoy.
|
||||
' Log(c.RowCount)
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
' Log(c.GetString("FECHA"))
|
||||
skmt.ExecNonQuery("delete from CAT_RMI")
|
||||
skmt.ExecNonQuery($"insert into CAT_RMI (${lasCols}) select ${lasCols} from rkmt1.CAT_RMI where fecha = '${c.GetString("FECHA")}'"$)
|
||||
Log($"insert into CAT_RMI (${lasCols}) select ${lasCols} from rkmt1.CAT_RMI where fecha = '${c.GetString("FECHA")}'"$)
|
||||
Else
|
||||
ToastMessageShow($"No hay respaldo RMI para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
|
||||
End If
|
||||
Log("R-RMI: " & ((DateTime.Now - inicio)/1000) & " segs")
|
||||
End Sub
|
||||
|
||||
Sub respaldoBatch 'ignore
|
||||
If RD_Init_IsInitialized Then
|
||||
RD_respalda_cat_detalle_paq
|
||||
RD_respalda_cat_gunaprod
|
||||
RD_respalda_cat_gunaprod2
|
||||
RD_respalda_kmt_info
|
||||
RD_respalda_pedido
|
||||
RD_respalda_promos_comp
|
||||
RD_respalda_cat_rmi
|
||||
Else
|
||||
Log("****** RD NO INICIALIZADO ********")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'RD - Realiza un "vacuum" de la base de datos "rkmt".
|
||||
Sub RD_vacuum 'ignore
|
||||
@@ -513,7 +599,7 @@ End Sub
|
||||
Sub traeCliente(db As SQL) As String 'ignore
|
||||
Private c As Cursor
|
||||
Private cl As String
|
||||
c = skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c = db.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
cl = c.GetString("CUENTA")
|
||||
c.Close
|
||||
@@ -521,17 +607,45 @@ Sub traeCliente(db As SQL) As String 'ignore
|
||||
End Sub
|
||||
|
||||
'Regresa en un mapa el total de productos y monto del pedido del cliente actual
|
||||
'resultado = {"productos":"antidad_de_productos", "monto":"costo_total"}
|
||||
Sub traeTotalesClienteActual(db As SQL) As Map 'ignore
|
||||
'resultado = {"productos":"cantidad_de_productos", "monto":"costo_total"}
|
||||
Sub traeTotalesClienteActual As Map 'ignore
|
||||
Private m As Map
|
||||
m.Initialize
|
||||
Private c_prodsX As Cursor = skmt.ExecQuery("select ifnull(sum(PE_CANT), 0) as cantProds, ifnull(sum(PE_COSTO_TOT), 0) as costoTotal FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PRONOMBRE asc")
|
||||
Private c_prodsX As Cursor = khdb.ExecQuery("select ifnull(sum(PE_CANT), 0) as cantProds, ifnull(sum(PE_COSTO_TOT), 0) as costoTotal FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) order by PE_PRONOMBRE asc")
|
||||
c_prodsX.Position = 0
|
||||
' LogColor($"Productos de la orden: ${c_prodsX.GetString("cantProds")}, Total: ${c_prodsX.GetString("costoTotal")}"$, Colors.red)
|
||||
m = CreateMap("productos": c_prodsX.GetString("cantProds"), "monto" : c_prodsX.GetString("costoTotal"))
|
||||
Return m
|
||||
End Sub
|
||||
|
||||
'Regresa el TOTAL de la venta del cliente
|
||||
Sub traeTotalCliente As Double
|
||||
Private sumaTotal As Double
|
||||
Private cursorprueba As Cursor = khdb.ExecQuery2("select PE_COSTO_TOT from pedido where PE_CEDIS <> PE_PROID and pe_cliente in (Select CUENTA from cuentaa) AND PE_CEDIS <> ?", Array As String("DOE"))
|
||||
For i= 0 To cursorprueba.RowCount -1
|
||||
cursorprueba.Position = i
|
||||
' LogColor(cursorprueba.GetString("PE_COSTO_TOT"),Colors.Red)
|
||||
sumaTotal = sumaTotal + cursorprueba.GetString("PE_COSTO_TOT")
|
||||
sumaTotal = NumberFormat2(sumaTotal, 0, 2, 2, False)
|
||||
' Log(NumberFormat2(sumaTotal, 0, 2, 2, False))
|
||||
Next
|
||||
cursorprueba.Close
|
||||
Return sumaTotal
|
||||
End Sub
|
||||
|
||||
'Regresa la venta de la ruta desde pedido.
|
||||
Sub traeVenta As Double 'ignore
|
||||
Private sumatotal As Double = 0
|
||||
Private cursorprueba As Cursor = khdb.ExecQuery2("select PE_COSTO_TOT from pedido where PE_CEDIS <> PE_PROID and PE_CLIENTE <> 0 and PE_CEDIS <> ?", Array As String("DOE"))
|
||||
For i = 0 To cursorprueba.RowCount - 1
|
||||
cursorprueba.Position = i
|
||||
sumatotal = sumatotal + cursorprueba.GetDouble("PE_COSTO_TOT")
|
||||
' Log("Total venta: " & NumberFormat2(sumatotal, 0, 2, 2, False))
|
||||
Next
|
||||
cursorprueba.Close
|
||||
Return NumberFormat2(sumatotal, 0, 2, 2, False)
|
||||
End Sub
|
||||
|
||||
'Borra el pedido del cliente actual.
|
||||
'Borra los registros de la tabla "PEDIDO" y "PEDIDO_CLIENTE"
|
||||
'Actualiza las tablas "cat_gunaprod" y "kmt_info".
|
||||
@@ -574,6 +688,44 @@ Sub hayPedido(db As SQL) As Boolean 'ignore
|
||||
Return hay
|
||||
End Sub
|
||||
|
||||
'Regresa el limite de abordo especificado en web.
|
||||
Sub traeLimiteAbordoWeb As Double 'ignore
|
||||
Private limite As Int = 0
|
||||
Private c As Cursor = khdb.ExecQuery("select CAT_VA_VALOR from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'LIMITE'")
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
limite = c.GetString("CAT_VA_VALOR")
|
||||
End If
|
||||
c.Close
|
||||
Return limite
|
||||
End Sub
|
||||
|
||||
'Regresa el limite de abordo de acuerdo al inventario actual.
|
||||
'Se calcula multiplicando el inventario por el precio del inventario
|
||||
Sub traeLimiteAbordoXInventario As Double 'ignore
|
||||
Private limiteInicial As Double = 0
|
||||
Private c As Cursor = khdb.ExecQuery2("select sum(cat_gp_precio * cat_gp_almacen) as limiteInicial from cat_gunaprod2 where cat_gp_almacen > 0 and cat_gp_clasif <> ? ", Array As String("PROMOS"))
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
limiteInicial = c.GetDouble("limiteInicial")
|
||||
End If
|
||||
c.Close
|
||||
Return limiteInicial
|
||||
End Sub
|
||||
|
||||
'Regresa el total de la venta de abordo en la tabla pedido.
|
||||
Sub traeVentaAbordo As Double
|
||||
Log("Venta abordo")
|
||||
Private va As Double = 0
|
||||
Private c As Cursor = khdb.ExecQuery("select sum(PE_COSTO_TOT) as ventaAbordo from pedido where PE_TIPO = 'ABORDO'")
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
va = c.GetDouble("ventaAbordo")
|
||||
End If
|
||||
Log("VENTA ABORDO: " & va)
|
||||
Return va
|
||||
End Sub
|
||||
|
||||
Sub string2date(fecha As String) 'ignore
|
||||
Log(fecha)
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
@@ -613,7 +765,7 @@ Sub ticksAformatoFecha(fecha As Long, formato As String) As String 'ignore
|
||||
End Sub
|
||||
|
||||
'Revisa si la aplicación tiene permiso para acceder a las notificaciones.
|
||||
Sub CheckNotificationAccess As Boolean
|
||||
Sub CheckNotificationAccess As Boolean 'ignore
|
||||
Dim ph As Phone
|
||||
Dim nstr, pstr As String
|
||||
Dim r As Reflector
|
||||
|
||||
Reference in New Issue
Block a user