mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-22 12:20:09 +00:00
28/10/23 - Se agrega còdigo para indicar la fecha del respaldo a restaurar.
- Si se agrega un numero negativo despues de la contraseña de la carga local, se toma el respaldo de "hoy menos x dias" para restaurar.
This commit is contained in:
@@ -679,13 +679,30 @@ End Sub
|
||||
Private Sub p_cargaLocal_Click
|
||||
End Sub
|
||||
|
||||
'Recibe la contraseña para la carga local -> "CL" + diaMes * 3 + numMes * 4
|
||||
'Ej: para el 5 de agosto serìa : CL1532
|
||||
'Si se agrega un numero despues de la contraseña, lo toma como los dia hacia atras para tomar el dìa de respaldo.
|
||||
'Ej: CL1532-2 Serìa restaurar el respaldo del dìa 3 de agosto (5-2), puede haber espacios entre la clave y el numero de dìas.
|
||||
Private Sub b_cargaLocalOk_Click
|
||||
Private pass1 As String = "CL" & (3 * DateTime.GetDayOfMonth(DateTime.now)) & (DateTime.GetMonth(DateTime.now) * 4)
|
||||
If et_cargaLocal.Text = pass1 Then
|
||||
If et_cargaLocal.Text.StartsWith(pass1) Then
|
||||
p_cargaLocal.Visible = False
|
||||
' Starter.skmt.ExecNonQuery("delete from CAT_GUNAPROD")
|
||||
' Log("OK")
|
||||
' kh.string2date("10/03/2023")
|
||||
' Log(et_cargaLocal.Text.Length > pass1.Length)
|
||||
kh.RD_fechaRestauracion = ""
|
||||
If et_cargaLocal.Text.Length > pass1.Length Then
|
||||
Private dias As String = et_cargaLocal.Text.SubString(pass1.Length).Trim
|
||||
' Log("|" & dias & "|")
|
||||
If IsNumber(dias) Then
|
||||
Dim p As Period
|
||||
p.Days = dias
|
||||
Dim nextdate As Long = DateUtils.AddPeriod(DateTime.Now, p)
|
||||
kh.RD_fechaRestauracion = nextdate
|
||||
' Log($"Next date: $Date{nextdate}"$) ' Next date: 20231018
|
||||
Else
|
||||
Log("NOT NUMBER")
|
||||
End If
|
||||
End If
|
||||
|
||||
kh.revisaRkmtAttached
|
||||
kh.RD_restaura_cat_gunaprod
|
||||
kh.RD_restaura_cat_gunaprod2
|
||||
|
||||
@@ -279,6 +279,8 @@ Sub Class_Globals
|
||||
Dim errorImpresora As Int = 0
|
||||
Private b_inicioFinVenta As Button
|
||||
Dim dentroDeGeocerca As Boolean = False
|
||||
Dim motivoNoVenta As String = ""
|
||||
Dim precision As Int = 0
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
@@ -366,7 +368,7 @@ Sub B4XPage_Appear
|
||||
' Log(Starter.rp.Check("android.permission.BLUETOOTH_CONNECT"))
|
||||
b_inicioFinVenta.Text = "INICIAR VENTA"
|
||||
b_inicioFinVenta.BringToFront
|
||||
If Not(Starter.enVenta) Then
|
||||
If Not(Starter.enVenta) And la_cuenta.Text <> "0" Then
|
||||
b_inicioFinVenta.Visible = True
|
||||
' Log("EnVenta Visible")
|
||||
Else
|
||||
@@ -393,6 +395,8 @@ Sub B4XPage_Appear
|
||||
If Not(muestraBoleta) Then Subs.panelVisibleCompleto(P_INF_GENERAL, Root)
|
||||
p_pideGeoPass.Visible = False
|
||||
' If Logger Then Log(muestraBoleta)
|
||||
usuario = Subs.traeUsuarioDeBD
|
||||
Id_Almacen = Subs.traeAlmacen
|
||||
CallSubDelayed(Tracker, "StartFLP2")
|
||||
b_ubicacion.Text = "SIN GPS"
|
||||
b_ubicacion.TextColor = Colors.Red
|
||||
@@ -430,6 +434,7 @@ Sub B4XPage_Appear
|
||||
l_atiende2.Text = c.GetString("CAT_CL_ATIENTE2")
|
||||
l_total.Text = s.GetString("TOTAL_CLIE")
|
||||
total_cliente = s.GetString("TOTAL_CLIE")
|
||||
' Log(Subs.sumaPedido(Subs.traeCliente) & " - " & total_cliente)
|
||||
m_lat =c.GetString("CAT_CL_LAT")
|
||||
m_lon =c.GetString("CAT_CL_LONG")
|
||||
CREDITO_DISPONIBLE = c.GetString("CAT_CL_BFACTURA")
|
||||
@@ -458,6 +463,7 @@ Sub B4XPage_Appear
|
||||
If la_cuenta.Text = "0" Then
|
||||
CREDITO_DISPONIBLE = 10000000
|
||||
CREDITO = 0
|
||||
b_inicioFinVenta.Visible = False
|
||||
End If
|
||||
End If
|
||||
If S1.GetString("CUANTOS") = 0 Then
|
||||
@@ -494,7 +500,7 @@ Sub B4XPage_Appear
|
||||
|
||||
la_saldotot.Text = MONTO_COMPRA
|
||||
If MONTO_COMPRA <> "0" Then
|
||||
META2 = 300 - MONTO_COMPRA
|
||||
META2 = NumberFormat2((300 - MONTO_COMPRA), 0, 4, 2, False)
|
||||
Else
|
||||
META2 = 300
|
||||
End If
|
||||
@@ -611,7 +617,7 @@ Sub B4XPage_Appear
|
||||
c2=Starter.skmt.ExecQuery2("SELECT CAT_GP_ALMACEN FROM CAT_GUNAPROD2 WHERE CAT_GP_ID = ? ", Array As String("1008094223"))
|
||||
c2.Position = 0
|
||||
If c2.GetString("CAT_GP_ALMACEN") > 0 Then
|
||||
b_whats.Visible = True
|
||||
' b_whats.Visible = True
|
||||
End If
|
||||
c2.Close
|
||||
End If
|
||||
@@ -786,9 +792,7 @@ Sub Guardar_Click
|
||||
c=Starter.skmt.ExecQuery("Select CUENTA from cuentaa")
|
||||
c.Position=0
|
||||
clie_id = c.GetString("CUENTA")
|
||||
c=Starter.skmt.ExecQuery("select USUARIO from usuarioa")
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
usuario = Subs.traeUsuarioDeBD
|
||||
If l_total.Text <> Null And l_total.Text <> "null" Then Subs.ponImpreso(clie_id) 'Solo lo marcamos com impreso si tiene venta (total > 0).
|
||||
c = Starter.skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, COUNT(*) AS CUANTOS FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position = 0
|
||||
@@ -837,7 +841,14 @@ Sub Guardar_Click
|
||||
' B4XPages.ShowPageAndRemovePreviousPages("Principal")
|
||||
Guardar.SendToBack
|
||||
b_inicioFinVenta.Text = "TERMINAR VENTA"
|
||||
If la_cuenta.Text <> "0" Then 'Si es ABORDO, no mostramos el boton b_inicioFinVenta y regresamos a Principal.
|
||||
b_inicioFinVenta.Visible = True
|
||||
Else
|
||||
b_inicioFinVenta.Visible = False
|
||||
Starter.enVenta = False
|
||||
Subs.iniciaActividad("principal")
|
||||
B4XPages.ShowPageAndRemovePreviousPages("Principal")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub NUEVO_Click
|
||||
@@ -990,8 +1001,8 @@ Sub B_IMP2_Click
|
||||
If la_cuenta.Text <> "0" And la_cuenta.Text <> "null" Then
|
||||
Starter.skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_TIPO = ? WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) ", Array As Object("VENTA"))
|
||||
Starter.skmt.ExecNonQuery("UPDATE kmt_info set IMPRESION = 1 where CAT_CL_CODIGO In (select cuenta from cuentaa)")''
|
||||
Guardar.Visible = True
|
||||
End If
|
||||
Guardar.Visible = True
|
||||
Starter.skmt.ExecNonQuery("delete from pedido3")
|
||||
Starter.skmt.ExecNonQuery("INSERT INTO PEDIDO3 (PE_PRECIO2, PE_TIPO, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, PE_COSTO_TOT, PE_COSTOU, PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_USUARIO) SELECT PE_PRECIO2, PE_TIPO, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, SUM(PE_COSTO_TOT) AS PE_COSTO_TOT, PE_COSTOU, SUM(PE_CANT) As PE_CANT, PE_PRONOMBRE, PE_PROID, PE_CLIENTE, PE_USUARIO FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa) GROUP BY PE_PRECIO2, PE_TIPO, PE_DESC, PE_COSTO_SIN, PE_RUTA, PE_CEDIS, PE_COSTOU, PE_PRONOMBRE, PE_PROID, PE_CLIENTE ")
|
||||
c=Starter.skmt.ExecQuery("select PE_PRECIO2,PE_TIPO,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 FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
@@ -1240,13 +1251,15 @@ Sub B_IMP2_Click
|
||||
s=Starter.skmt.ExecQuery2("select sum(PE_CANT) as CANTIDAD, SUM(PE_COSTO_TOT) AS TOTAL FROM PEDIDO WHERE PE_CEDIS <> PE_PROID AND PE_CEDIS = ? AND PE_CLIENTE IN (Select CUENTA from cuentaa)", Array As String("DOE"))
|
||||
s.Position = 0
|
||||
Private sTotal2 As Double
|
||||
Log(sTotal2)
|
||||
If s.GetString("TOTAL") <> Null And IsNumber(s.GETSTRING("TOTAL")) Then
|
||||
sTotal2 = s.GetString("TOTAL")
|
||||
sTotal2 = Subs.sumaPedido(Subs.traeCliente)
|
||||
Printer1.WriteString( $"Sub Total : $${NumberFormat2(sTotal2, 1, 2, 2, False)}"$ & CRLF)
|
||||
|
||||
Else
|
||||
sTotal2 = 0
|
||||
End If
|
||||
Log(sTotal2)
|
||||
Private cantidad1 As String = "0"
|
||||
If s.GetString("CANTIDAD") <> Null And IsNumber(s.GetString("CANTIDAD")) Then
|
||||
cantidad1 = s.GetString("CANTIDAD")
|
||||
@@ -1941,7 +1954,6 @@ Sub StartPrinter
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Sub B_VENTA_Click
|
||||
If la_cuenta.Text = "0" Then
|
||||
Starter.tipov = "ABORDO"
|
||||
@@ -3430,9 +3442,7 @@ Sub Bt_GuardarBoleta_Click
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
cursorBoleta=Starter.skmt.ExecQuery("select ID_ALMACEN FROM CAT_ALMACEN")
|
||||
cursorBoleta.Position=0
|
||||
Id_Almacen=cursorBoleta.GetString("ID_ALMACEN")
|
||||
' Id_Almacen = Subs.traeAlmacen
|
||||
Starter.skmt.ExecNonQuery("delete from TMP_CAT_BILLETE")
|
||||
Starter.skmt.ExecNonQuery("delete from TMP_CAT_MONEDAS")
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO TMP_CAT_BILLETE (TMP_BILLE_RUTA, TMP_BILLE_IDALMACEN, TMP_BILLE_FECHA, TMP_BILLE_MIL, TMP_BILLE_QUINIENTOS, TMP_BILLE_DOSCIENTOS, TMP_BILLE_CIEN, TMP_BILLE_CINCUENTA, TMP_BILLE_VEINTE) values (?,?,?,?,?,?,?,?,?)", Array As Object (RutaBoleta,Id_Almacen,sDate & sTime,EDT_CANMIL.Text,EDT_CANQUIN.Text,EDT_CANDOS.Text,EDT_CANCIEN.Text,EDT_CANCIN.Text,EDT_CANVEIN.Text))
|
||||
@@ -3689,15 +3699,8 @@ Private Sub b_aceptarrpomo_Click
|
||||
c.Position=0
|
||||
usuario = c.GetString("USUARIO")
|
||||
c.Close
|
||||
c=Starter.skmt.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
|
||||
If c.RowCount>0 Then
|
||||
C.Position=0
|
||||
Id_Almacen = C.GetString("ID_ALMACEN")
|
||||
End If
|
||||
c.Close
|
||||
|
||||
' Id_Almacen = Subs.traeAlmacen
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO HIST_PROMO_WHATS VALUES (?,?)", Array As Object(l_promowhats.Text, "PROMO ACEPTADA"))
|
||||
|
||||
Starter.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_TIPO,PE_PRECIO2) VALUES(?,?,?,?,?,?,?,?,?,?,?,?) ", Array As Object ("PROMODOE",0 , 0, 1, "KIT DE BIENVENIDA DON TOÑO", "PROMODOE",la_cuenta.TEXT, sDate & sTime, usuario,Starter.rutaV,Starter.tipov,0))
|
||||
Starter.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_TIPO,PE_PRECIO2) VALUES(?,?,?,?,?,?,?,?,?,?,?,?) ", Array As Object ("PROMODOE",0.01 , 0.01, 1, "CAJA CHOCO ZUCARITAS 260 GR", "1008094223",la_cuenta.TEXT, sDate & sTime, usuario,Starter.rutaV,Starter.tipov,0))
|
||||
Starter.skmt.ExecNonQuery2("update cat_gunaprod2 set cat_gp_almacen = cat_gp_almacen - ? where cat_gp_id = ? ", Array As Object("1", "1008094223"))
|
||||
@@ -3791,12 +3794,7 @@ Sub JobDone(Job As HttpJob)
|
||||
End Sub
|
||||
|
||||
Private Sub BP_DOE_A_Click
|
||||
c=Starter.skmt.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
|
||||
If c.RowCount>0 Then
|
||||
C.Position=0
|
||||
Id_Almacen = C.GetString("ID_ALMACEN")
|
||||
End If
|
||||
c.Close
|
||||
' Id_Almacen = Subs.traeAlmacen
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
@@ -3881,15 +3879,14 @@ Private Sub BP_DOE_R1_Click
|
||||
End Sub
|
||||
|
||||
Private Sub b_inicioFinVenta_Click
|
||||
Private precision As Int = 0
|
||||
If dentroDeGeocerca Then precision = 1
|
||||
If Starter.enVenta Then
|
||||
Subs.bitacora(Subs.fechanormal(DateTime.Now),usuario, Id_Almacen, ruta_tienda, "Termina Venta", la_cuenta.text, "", Subs.fechanormal(DateTime.Now), Starter.lat_gps, Starter.lon_gps, precision, "", "")
|
||||
Subs.bitacora(Subs.fechanormal(DateTime.Now), usuario, Id_Almacen, ruta_tienda, "Termina Venta", la_cuenta.text, "", Subs.fechanormal(DateTime.Now), Starter.lat_gps, Starter.lon_gps, precision, motivoNoVenta, "")
|
||||
Starter.enVenta = False
|
||||
Subs.iniciaActividad("principal")
|
||||
B4XPages.ShowPageAndRemovePreviousPages("Principal")
|
||||
Else
|
||||
Subs.bitacora(Subs.fechanormal(DateTime.Now),usuario, Id_Almacen, ruta_tienda, "Inicia Venta", la_cuenta.text, Subs.fechanormal(DateTime.Now), "", Starter.lat_gps, Starter.lon_gps, precision, "", "")
|
||||
Subs.bitacora(Subs.fechanormal(DateTime.Now),usuario, Id_Almacen, ruta_tienda, "Inicia Venta", la_cuenta.text, Subs.fechanormal(DateTime.Now), "", Starter.lat_gps, Starter.lon_gps, precision, motivoNoVenta, "")
|
||||
Starter.enVenta = True
|
||||
End If
|
||||
b_inicioFinVenta.Visible = False
|
||||
|
||||
@@ -27,6 +27,7 @@ Sub Class_Globals
|
||||
Private b_desc As Button
|
||||
Private ListView2 As ListView
|
||||
Private B_RMI As Button
|
||||
Private p_historico As Panel
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
|
||||
@@ -86,15 +86,18 @@ Sub GUARDA_Click
|
||||
Else
|
||||
motivo = "NO ESTA EL ENCARGADO"
|
||||
End If
|
||||
usuario = Subs.traeUsuarioDeBD
|
||||
If B4XPages.MainPage.cliente.IsInitialized Then
|
||||
B4XPages.MainPage.cliente.motivoNoVenta = motivo
|
||||
Subs.bitacora(Subs.fechanormal(DateTime.Now), usuario, Subs.traeAlmacen, Subs.traeRuta, "Termina Venta", Subs.traeUsuarioDeBD, "", Subs.fechanormal(DateTime.Now), Starter.lat_gps, Starter.lon_gps, B4XPages.MainPage.cliente.precision, motivo, "")
|
||||
Starter.enVenta = False
|
||||
End If
|
||||
DateTime.DateFormat = "MM/dd/yyyy"
|
||||
sDate=DateTime.Date(DateTime.Now)
|
||||
sTime=DateTime.Time(DateTime.Now)
|
||||
c=Starter.skmt.ExecQuery("select CUENTA from cuentaa")
|
||||
c.Position = 0
|
||||
cuenta = c.GetString("CUENTA")
|
||||
c=Starter.skmt.ExecQuery("select usuario from usuarioa")
|
||||
c.Position = 0
|
||||
usuario = c.GetString("USUARIO")
|
||||
c=Starter.skmt.ExecQuery("select PE_PROID,PE_CANT FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
@@ -116,10 +119,8 @@ Sub GUARDA_Click
|
||||
c.Close
|
||||
End If
|
||||
End If
|
||||
|
||||
Starter.skmt.ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
|
||||
Starter.skmt.ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)")
|
||||
|
||||
Starter.skmt.ExecNonQuery2("INSERT INTO NOVENTA (NV_CLIENTE,NV_FECHA,NV_USER,NV_MOTIVO,NV_COMM,NV_LAT,NV_LON) VALUES(?,?,?,?,?,?,?) ", Array As Object (cuenta,sDate & sTime, usuario, motivo,e_comm.text,Starter.lat_gps,Starter.lon_gps))
|
||||
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 3 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Subs.iniciaActividad("Principal")
|
||||
|
||||
@@ -198,25 +198,24 @@ End Sub
|
||||
|
||||
Sub borra_Click
|
||||
If folio = "0" Then 'Si el folio es 0 o el cliente actual es "abordo", los deja borrar. - Mod por CHV 220512 'Para que el abordo borre siempre " Or Subs.clienteActual = "0""
|
||||
result = Msgbox2("Seguro que desea borrar el pedido?","Cancelar pedido", "Si", "", "No", LoadBitmap(File.DirAssets,"alert2.png")) 'ignore
|
||||
result = Msgbox2("¿Seguro que desea borrar el pedido?","Cancelar pedido", "Si", "", "No", LoadBitmap(File.DirAssets,"alert2.png")) 'ignore
|
||||
If result = DialogResponse.POSITIVE Then
|
||||
c=Starter.skmt.ExecQuery("select PE_PROID,PE_CANT, PE_TIPO FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")
|
||||
If c.RowCount>0 Then
|
||||
For i=0 To c.RowCount -1
|
||||
c.Position=i
|
||||
TIPO = c.GetString("PE_TIPO")
|
||||
Starter.skmt.ExecNonQuery2($"update ${Subs.traeTablaProds(TIPO)} set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?"$, Array As Object(c.GetString("PE_CANT"),c.GetString("PE_PROID")))
|
||||
Next
|
||||
End If
|
||||
Starter.skmt.ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
|
||||
Starter.skmt.ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)")
|
||||
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 0 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
|
||||
' c = Starter.skmt.ExecQuery("select PE_PROID, PE_CANT, PE_TIPO, PE_CEDIS FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) ")
|
||||
' If c.RowCount>0 Then
|
||||
' For i=0 To c.RowCount -1
|
||||
' c.Position=i
|
||||
' TIPO = c.GetString("PE_TIPO")
|
||||
' If c.GetString("PE_CEDIS") <> "DUR" Then Starter.skmt.ExecNonQuery2($"update ${Subs.traeTablaProds(TIPO)} set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?"$, Array As Object(c.GetString("PE_CANT"),c.GetString("PE_PROID")))
|
||||
' Next
|
||||
' End If
|
||||
' Starter.skmt.ExecNonQuery("delete from pedido_cliente where pc_cliente in (Select CUENTA from cuentaa)")
|
||||
' Starter.skmt.ExecNonQuery("delete from pedido where pe_cliente in (Select CUENTA from cuentaa)")
|
||||
' Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 0 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Subs.borraPedidoClienteActual
|
||||
B4XPages.MainPage.productos.prodsMap.Initialize 'inicializamos mapa de productos para que noaparezcan como vendidos en la lista
|
||||
B4XPages.MainPage.promos.promosMap.Initialize
|
||||
' Log("Llamamos LlenaProdsLL")
|
||||
If B4XPages.MainPage.productos.PCLV.IsInitialized Then B4XPages.MainPage.productos.LlenaProdsLL(Null, Null)
|
||||
|
||||
B4XPage_Appear
|
||||
End If
|
||||
Else
|
||||
@@ -353,11 +352,11 @@ End Sub
|
||||
|
||||
Private Sub clv_pedidos_ItemLongClick (position As Int, Value As Object)
|
||||
Private thisLog As Boolean = False
|
||||
c=Starter.skmt.ExecQuery("select count(*) as CUANTOS from CLIENTE_IMPRESO where CI_CUENTA in (Select CUENTA from cuentaa)")
|
||||
c = Starter.skmt.ExecQuery("select count(*) as hayImpresos from CLIENTE_IMPRESO where CI_CUENTA in (Select CUENTA from cuentaa)")
|
||||
c.Position = 0
|
||||
If thisLog Then Log("lista prods="&list_prodsPedido.Get(position))
|
||||
Private m As Map = list_prodsPedido.Get(position)
|
||||
If c.GetString("CUANTOS") = 0 Then 'Si la venta no está impresa o es abordo entonces continuamos ... 'Para que el aborod borre siempre " Or Subs.clienteActual = "0""
|
||||
If c.GetString("hayImpresos") = 0 Then 'Si la venta no está impresa o es abordo entonces continuamos ... 'Para que el abordo borre siempre " Or Subs.clienteActual = "0""
|
||||
c=Starter.skmt.ExecQuery2("select count(*) as CUANTOS FROM PEDIDO WHERE PE_CEDIS = ? AND PE_CLIENTE IN (Select CUENTA from cuentaa)", Array As String("DUR"))
|
||||
c.Position = 0
|
||||
CAMBIOS = c.GetString("CUANTOS")
|
||||
@@ -374,7 +373,7 @@ Private Sub clv_pedidos_ItemLongClick (position As Int, Value As Object)
|
||||
If thisLog Then Log($"Buscamos: ${Value}, ${m.Get("cedis")}"$)
|
||||
c = Starter.skmt.ExecQuery2("select count(*) AS CUANTOS from cat_gunaprod2 where CAT_GP_ID in (select pe_cedis from pedido where pe_pronombre = ? and pe_cedis = ? and pe_cliente in (Select CUENTA from cuentaa)) and CAT_GP_CLASIF = 'PROMOS' AND CAT_GP_TIPO = 'PROMOS' AND CAT_GP_SUBTIPO = 'PROMOS'", Array As String(Value, m.Get("cedis")))
|
||||
c.Position = 0
|
||||
If c.GetString("CUANTOS") > 0 Then
|
||||
If c.GetString("CUANTOS") > 0 Then 'Si es promo, borramos la promo completa del pedido.
|
||||
If thisLog Then Log($"Borramos de PROMO ${Value}"$)
|
||||
Private pPromos As Cursor = Starter.skmt.ExecQuery($"select pe_proid, pe_cant from pedido where pe_cedis = '${m.Get("cedis")}'"$)
|
||||
For tp = 0 To pPromos.RowCount - 1
|
||||
@@ -385,7 +384,8 @@ Private Sub clv_pedidos_ItemLongClick (position As Int, Value As Object)
|
||||
Starter.skmt.ExecNonQuery2("delete from pedido where pe_cedis in (select pe_cedis from pedido where PE_CEDIS = ? and pe_pronombre = ?) and pe_cliente in (Select CUENTA from cuentaa)", Array As Object(m.Get("cedis"), Value))
|
||||
Else
|
||||
If thisLog Then Log($"SUMAMOS ${m.get("cant")} a ${m.get("prodId")} "$)
|
||||
Starter.skmt.ExecNonQuery2($"update ${Subs.traeTablaProds(Starter.tipov)} set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?"$, Array As Object(m.get("cant"), m.get("prodId")))
|
||||
'Si no es RMI, actualizamos el inventario.
|
||||
If prod.GetString("PE_CEDIS") <> "DUR" Then Starter.skmt.ExecNonQuery2($"update ${Subs.traeTablaProds(Starter.tipov)} set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?"$, Array As Object(m.get("cant"), m.get("prodId")))
|
||||
If thisLog Then Log($"BORRAMOS ${Value}, ${m.Get("cedis")}"$)
|
||||
Starter.skmt.ExecNonQuery2("delete from pedido where pe_pronombre = ? and pe_cedis = ? and pe_cant = ? and pe_cliente in (Select CUENTA from cuentaa)", Array As Object(Value, m.Get("cedis"), m.Get("cant")))
|
||||
End If
|
||||
@@ -402,12 +402,10 @@ Private Sub clv_pedidos_ItemLongClick (position As Int, Value As Object)
|
||||
c = Starter.skmt.ExecQuery("select sum(pe_costo_tot) as TOTAL_CLIE, SUM(PE_CANT) AS CANT_CLIE, count(*) as CUANTOS FROM PEDIDO WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
c.Position = 0
|
||||
If c.GetString("CUANTOS") > 0 Then
|
||||
|
||||
Log($"============== TOTAL = ${c.GetString("TOTAL_CLIE")}"$)
|
||||
If c.GetString("TOTAL_CLIE") < 1 Then
|
||||
Starter.skmt.ExecNonQuery("delete from pedido where PE_PRONOMBRE like 'CAMBIO%' and PE_CLIENTE In (select cuenta from cuentaa)"$)
|
||||
End If
|
||||
|
||||
Starter.skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
If thisLog Then LogColor($"Insertamos coordenadas en pedido: ${Starter.lon_gps}, ${Starter.lat_gps}"$, Colors.Magenta)
|
||||
Starter.skmt.ExecNonQuery2("insert into pedido_cliente(PC_CLIENTE, PC_FECHA, PC_USER, PC_NOART, PC_MONTO,PC_LON, PC_LAT) VALUES (?,?,?,?,?,?,?)", Array As Object(clie_id, sDate & sTime, usuario, c.GetString("CANT_CLIE"),c.GetString("TOTAL_CLIE"), Starter.lon_gps, Starter.lat_gps))
|
||||
|
||||
@@ -847,8 +847,6 @@ Sub cargar_Click
|
||||
inv.Visible = False
|
||||
If Starter.marcaCel <> "LGE" Then ToastMessageShow("Se Actualizarán los datos. Este proceso podria tardar hasta un minuto, gracias" , True)
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub JobDone(Job As HttpJob)
|
||||
@@ -1558,10 +1556,10 @@ Sub JobDone(Job As HttpJob)
|
||||
If RESULT.Rows.Size = 0 Then ToastMessageShow("No hay ruta para ese usuario", True)
|
||||
For Each records() As Object In RESULT.Rows
|
||||
Dim VALIDO As String = records(RESULT.Columns.Get("VALIDO"))
|
||||
Log("|"&VALIDO&"|")
|
||||
if starter.Logger then Log("|"&VALIDO&"|")
|
||||
' If Logger Then Log(records(RESULT.Columns.Get("CAT_RU_CATEGORIA")))
|
||||
Starter.rutaTipo = records(RESULT.Columns.Get("CAT_RU_CATEGORIA")) 'Traemos el tipo de ruta para que cuando sean foraneas no carguen la carta porte todos los dias.
|
||||
Log($"========= TIPO RUTA = ${Starter.rutaTipo}"$)
|
||||
If Starter.Logger Then Log($"========= TIPO RUTA = ${Starter.rutaTipo}"$)
|
||||
If VALIDO = "OK" Then
|
||||
cargar.Visible = True
|
||||
Subir.Visible = True
|
||||
@@ -2349,6 +2347,9 @@ Sub Resumen_Click
|
||||
C.Position = 0
|
||||
b.Position = 0
|
||||
L_MONTOD.Text = c.GetString("MONTO_DIA")
|
||||
L_MONTOD.Text = Subs.sumaPedido(Subs.traeCliente) 'Trae el monto sin el redondeo que a veces hace el SUM().
|
||||
' Log(Subs.sumaPedido(Subs.traeCliente) & " - " & L_MONTOD.Text)
|
||||
Subs.sumaPedido(Subs.traeCliente)
|
||||
l_cuantosc.Text = c.GetString("CLIENTES_DIA")
|
||||
l_cuantosn.Text = b.GetString("CUANTOS")
|
||||
efectiva = c.GetString("CLIENTES_DIA") / e.GetString("POR_VISITAR")
|
||||
@@ -2912,7 +2913,7 @@ End Sub
|
||||
'Descarga del servidor el PDF de la carta porte del dia de hoy y la
|
||||
'guarda en el almacenamiento externo con el nombre "cartaPorte.pdf"
|
||||
Sub descargaCartaPorte
|
||||
Log("Inicia descargaCartaPorte")
|
||||
If Starter.Logger Then Log("Inicia descargaCartaPorte")
|
||||
cartaPorteLista = False
|
||||
'Generamos el nombre del PDF de la carta porte
|
||||
DateTime.DateFormat = "ddMMyyyy"
|
||||
@@ -2934,12 +2935,12 @@ Sub descargaCartaPorte
|
||||
ProgressBarPDF.Progress = 0
|
||||
' Log("Ocultamos panel descarga")
|
||||
Subs.panelOculto(p_downloadPDF)
|
||||
Log(p_progress1.Visible)
|
||||
If Starter.Logger Then Log(p_progress1.Visible)
|
||||
End Sub
|
||||
|
||||
'Muestra el panel de descarga de la carta porte con barra de progreso
|
||||
Sub descargaCartaPorteyProgreso (urlx As String) As ResumableSub
|
||||
Log("Iniciamos descargaCartaPorteyProgreso")
|
||||
If Starter.Logger Then Log("Iniciamos descargaCartaPorteyProgreso")
|
||||
If logger Then Log("Mostramos panel descarga")
|
||||
Subs.panelVisible(p_downloadPDF, 0, 0)
|
||||
Subs.centraPanel(p_progress1, Root.Width)
|
||||
@@ -2969,24 +2970,24 @@ Sub descargaCartaPorteyProgreso (urlx As String) As ResumableSub
|
||||
Sleep(10)
|
||||
Loop
|
||||
Dim bx() As Boolean = Array As Boolean(False)
|
||||
Log("Llamamos TrackProgress")
|
||||
If Starter.Logger Then Log("Llamamos TrackProgress")
|
||||
TrackProgress(job_PDF, bx, TaskId)
|
||||
'**** Termina barra de progreso
|
||||
|
||||
Log("Iniciamos Wait for JobDone Descarga")
|
||||
Log("Mostramos panel descarga")
|
||||
If Starter.Logger Then Log("Iniciamos Wait for JobDone Descarga")
|
||||
If Starter.Logger Then Log("Mostramos panel descarga")
|
||||
Subs.panelVisible(p_downloadPDF, 0, 0)
|
||||
Wait for (job_PDF) JobDone (job_PDF As HttpJob)
|
||||
' Log("Terminamos Wait for JobDone Descarga ")
|
||||
If job_PDF.Success = False Then Log("Error PDF")
|
||||
If job_PDF.Success = True Then
|
||||
Log("Carta descargada con exito")
|
||||
Log("Ocultamos downloader")
|
||||
If Starter.Logger Then Log("Ocultamos downloader")
|
||||
cartaPorteLista = True
|
||||
' // Delete existing file
|
||||
' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
|
||||
' Wait For B4XPAges_PermissionResult (Permission As String, Result As Boolean)
|
||||
Log("Ocultamos downloader 2")
|
||||
If Starter.Logger Then Log("Ocultamos downloader 2")
|
||||
If File.Exists(File.DirInternal,"cartaPorte.pdf") Then
|
||||
' Log("Borramos carta anterior")
|
||||
File.Delete(File.DirInternal,"cartaPorte.pdf")
|
||||
|
||||
@@ -246,6 +246,7 @@ Sub B4XPage_Appear
|
||||
b_rmi.Visible = False
|
||||
l_mDisponible.Visible = True
|
||||
End If
|
||||
If B4XPages.MainPage.cliente.la_cuenta.text = "0" Then b_rmi.Visible = False
|
||||
' Log(Starter.tipov)
|
||||
End Sub
|
||||
|
||||
@@ -255,6 +256,7 @@ End Sub
|
||||
|
||||
Sub lv_catalogos_ItemClick (Position As Int, Value As Object)
|
||||
If Value = "CATALOGO" Then
|
||||
' Log("CATALOGO")
|
||||
' lfila.text = "TIPO"
|
||||
lfila.text = "PRODUCTOS"
|
||||
lv_catalogos.Visible = False
|
||||
@@ -563,7 +565,7 @@ Sub b_prodMas_Click
|
||||
etCantHasFocus = False
|
||||
Private buttonTag As String = Sender.As(Button).tag
|
||||
Dim index As Int = clv_prods_ll.GetItemFromView(Sender)
|
||||
LogColor("b_prodMas_Click", Colors.Magenta)
|
||||
' LogColor("b_prodMas_Click", Colors.Magenta)
|
||||
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)
|
||||
@@ -689,7 +691,7 @@ Sub cuentaProds
|
||||
p_botonesVenta.BringToFront
|
||||
c.Position=0
|
||||
If Subs.totalPedido > 1 And lfila.Text <> "RMI" And Starter.tipov <> "ABORDO" Then b_rmi.Visible = True Else b_rmi.Visible = False
|
||||
Log(Subs.totalPedido)
|
||||
' 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")}"$)
|
||||
@@ -901,7 +903,7 @@ Private Sub lv_prodsPedido_ItemLongClick (Position As Int, Value As Object)
|
||||
Log($"Buscamos: ${Value}, ${m.Get("cedis")}"$)
|
||||
c=Starter.skmt.ExecQuery2("select count(*) AS CUANTOS from cat_gunaprod2 where CAT_GP_ID in (select pe_cedis from pedido where pe_pronombre = ? and pe_cedis = ? and pe_cliente in (Select CUENTA from cuentaa)) and CAT_GP_CLASIF = 'PROMOS' AND CAT_GP_TIPO = 'PROMOS' AND CAT_GP_SUBTIPO = 'PROMOS'", Array As String(Value, m.Get("cedis")))
|
||||
c.Position = 0
|
||||
If c.GetString("CUANTOS") > 0 Then
|
||||
If c.GetString("CUANTOS") > 0 Then 'Si es promo, borramos la promo completa del pedido.
|
||||
Log($"Borramos de PROMO ${Value}"$)
|
||||
Private pPromos As Cursor = Starter.skmt.ExecQuery($"select pe_proid, pe_cant from pedido where pe_cedis = '${m.Get("cedis")}'"$)
|
||||
For tp = 0 To pPromos.RowCount - 1
|
||||
@@ -912,7 +914,8 @@ Private Sub lv_prodsPedido_ItemLongClick (Position As Int, Value As Object)
|
||||
Starter.skmt.ExecNonQuery2("delete from pedido where pe_cedis in (select pe_cedis from pedido where PE_CEDIS = ? and pe_pronombre = ?) and pe_cliente in (Select CUENTA from cuentaa)", Array As Object(m.Get("cedis"), Value))
|
||||
Else
|
||||
Log($"SUMAMOS ${m.get("cant")} a ${m.get("prodId")} "$)
|
||||
Starter.skmt.ExecNonQuery2($"update ${Subs.traeTablaProds(Starter.tipov)} set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?"$, Array As Object(m.get("cant"), m.get("prodId")))
|
||||
'Si no es RMI, actualizamos el inventario.
|
||||
If prod.GetString("PE_CEDIS") <> "DUR" Then Starter.skmt.ExecNonQuery2($"update ${Subs.traeTablaProds(Starter.tipov)} set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?"$, Array As Object(m.get("cant"), m.get("prodId")))
|
||||
Log($"BORRAMOS ${Value}, ${m.Get("cedis")}"$)
|
||||
Starter.skmt.ExecNonQuery2("delete from pedido where pe_pronombre = ? and pe_cedis = ? and pe_cant = ? and pe_cliente in (Select CUENTA from cuentaa)", Array As Object(Value, m.Get("cedis"), m.Get("cant")))
|
||||
End If
|
||||
@@ -1120,10 +1123,11 @@ Sub LlenaProdsLL(p As ResultSet, extra As String)
|
||||
' Log(p.IsInitialized)
|
||||
If query = "" Or query = Null Then query = "cat_gunaprod2"
|
||||
If p.IsInitialized Then
|
||||
' Log($"YA HAY RESULTSET ${p.RowCount}"$)
|
||||
Log($"YA HAY RESULTSET ${p.RowCount}"$)
|
||||
Else
|
||||
' Log("NO HAY RESULTSET")
|
||||
Dim p As ResultSet = Starter.skmt.ExecQuery($"select CAT_GP_ID, CAT_GP_NOMBRE, CAT_GP_ALMACEN, CAT_GP_PRECIO, CAT_GP_TIPOPROD from ${Subs.traeTablaProds(Starter.tipov)} where CAT_GP_PRECIO > 0 And CAT_GP_CLASIF <> 'PROMOS' order by CAT_GP_NOMBRE"$)
|
||||
Log(p.RowCount & " - " & Subs.traeTablaProds(Starter.tipov))
|
||||
End If
|
||||
|
||||
Do While p.NextRow
|
||||
|
||||
@@ -252,7 +252,7 @@ Sub b_prodMenos_Click
|
||||
End Sub
|
||||
|
||||
Sub b_prodMas_Click
|
||||
' LogColor($"prodmas clic - ${Starter.cp_running}"$,Colors.Magenta)
|
||||
LogColor($"prodmas clic "$,Colors.Magenta)
|
||||
If totalProds < prodsVarReq + tpf Then
|
||||
Dim index As Int = clv_prodsVariabes.GetItemFromView(Sender)
|
||||
Dim pnl0 As B4XView = clv_prodsVariabes.GetPanel(index)
|
||||
|
||||
@@ -35,6 +35,7 @@ Public Sub ExecuteQuery(Command As DBCommand, Limit As Int, Tag As Object)
|
||||
Dim j As HttpJob
|
||||
Dim ms As OutputStream
|
||||
Dim out2 As OutputStream = StartJob(j,ms, Tag)
|
||||
If reqsList.IsInitialized Then reqsList.Add(Tag)
|
||||
|
||||
WriteObject(Command.Name, out2)
|
||||
WriteInt(Limit, out2)
|
||||
@@ -61,6 +62,7 @@ End Sub
|
||||
|
||||
'Similar to ExecuteBatch. Sends a single command.
|
||||
Public Sub ExecuteCommand(Command As DBCommand, Tag As Object)
|
||||
If reqsList.IsInitialized Then reqsList.Add(Tag)
|
||||
ExecuteBatch(Array As DBCommand(Command), Tag)
|
||||
End Sub
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -871,7 +871,7 @@ Version=12.5
|
||||
#Region Project Attributes
|
||||
#ApplicationLabel: Kelloggs Venta
|
||||
#VersionCode: 3000
|
||||
#VersionName: 3.10.23 PRUEBA V4
|
||||
#VersionName: 3.10.25 PRUEBA V4
|
||||
#SupportedOrientations: portrait
|
||||
#CanInstallToExternalStorage: False
|
||||
#BridgeLogger:true
|
||||
|
||||
@@ -65,29 +65,29 @@ ModuleBreakpoints7=
|
||||
ModuleBreakpoints8=
|
||||
ModuleBreakpoints9=
|
||||
ModuleClosedNodes0=
|
||||
ModuleClosedNodes1=2
|
||||
ModuleClosedNodes1=
|
||||
ModuleClosedNodes10=
|
||||
ModuleClosedNodes11=
|
||||
ModuleClosedNodes12=1
|
||||
ModuleClosedNodes12=
|
||||
ModuleClosedNodes13=
|
||||
ModuleClosedNodes14=
|
||||
ModuleClosedNodes15=
|
||||
ModuleClosedNodes16=
|
||||
ModuleClosedNodes17=
|
||||
ModuleClosedNodes18=9,10,11,12,13,14,15,16,17,18
|
||||
ModuleClosedNodes18=9,10,11,12,13,15,16,17,18
|
||||
ModuleClosedNodes19=
|
||||
ModuleClosedNodes2=
|
||||
ModuleClosedNodes20=
|
||||
ModuleClosedNodes21=20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39
|
||||
ModuleClosedNodes22=
|
||||
ModuleClosedNodes23=
|
||||
ModuleClosedNodes24=9,11,13,15
|
||||
ModuleClosedNodes24=10,12,14
|
||||
ModuleClosedNodes25=
|
||||
ModuleClosedNodes26=2
|
||||
ModuleClosedNodes27=
|
||||
ModuleClosedNodes28=
|
||||
ModuleClosedNodes29=
|
||||
ModuleClosedNodes3=24
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes30=
|
||||
ModuleClosedNodes31=
|
||||
ModuleClosedNodes32=
|
||||
@@ -97,6 +97,6 @@ ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=
|
||||
ModuleClosedNodes8=
|
||||
ModuleClosedNodes9=
|
||||
NavigationStack=C_Clientes,Class_Globals,14,0,C_Cliente,Class_Globals,15,0,C_Cliente,b_mapa_Click,878,0,Visual Designer,cliente.bal,-100,6,Visual Designer,mapa.bal,-100,3,C_Mapas,Class_Globals,0,0,C_Mapas,B4XPage_Created,42,0,Visual Designer,mapas.bal,-100,6,Visual Designer,historico.bal,-100,2,C_Historico,Class_Globals,0,0
|
||||
NavigationStack=Subs,actualizaProducto,944,0,C_Cliente,B_IMP2BAK_Click,1474,0,C_Cliente,B4XPage_Appear,436,0,C_Cliente,B_IMP2_Click,988,0,kms_helperSubs,RD_restaura_kmt_info,278,3,kms_helperSubs,RD_restaura_cat_detalle_paq,240,0,kms_helperSubs,RD_restaura_cat_gunaprod,163,0,kms_helperSubs,RD_restaura_cat_gunaprod2,187,0,B4XMainPage,p_cargaLocal_Click,678,0,B4XMainPage,b_cargaLocalOk_Click,679,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=1,30,11,24,31,14,9,4,3,6,5
|
||||
VisibleModules=1,30,11,31,14,24,3,32,7,12
|
||||
|
||||
29
B4A/Subs.bas
29
B4A/Subs.bas
@@ -890,7 +890,7 @@ End Sub
|
||||
'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)
|
||||
If nombre.Length < 6 Then ToastMessageShow("(guardaProductoSinGestion) El nombre del producto no es valido " & nombre, True)
|
||||
LogColor("guardaProductoSinGestion: "&prodId&", cant="&cant&", tipo="&tipoVenta, Colors.Magenta)
|
||||
' LogColor("guardaProductoSinGestion: "&prodId&", cant="&cant&", tipo="&tipoVenta, Colors.Magenta)
|
||||
Private c As Cursor
|
||||
' Private tablaProds As String = "cat_gunaprod2"
|
||||
' If tipoVenta = "ABORDO" Then tablaProds = "cat_gunaprod"
|
||||
@@ -927,13 +927,13 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre
|
||||
' If tipoVenta = "ABORDO" Then tablaProds = "cat_gunaprod"
|
||||
Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}'"$)
|
||||
If c.RowCount > 0 Then
|
||||
LogColor("ACTUALIZAMOS PROD", Colors.Blue)
|
||||
LogColor("ACTUALIZAMOS PROD - " & traeTablaProds(tipoVenta), Colors.Blue)
|
||||
c.Position = 0
|
||||
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 ${traeTablaProds(tipoVenta)} set cat_gp_almacen = cat_gp_almacen - (${difCant}) where cat_gp_id = '${prodId}' "$)
|
||||
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)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' "$)
|
||||
@@ -944,7 +944,7 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre
|
||||
End If
|
||||
Else
|
||||
'INSERTAMOS
|
||||
LogColor("INSERTAMOS PROD", Colors.red)
|
||||
' LogColor("INSERTAMOS PROD", Colors.red)
|
||||
If cant > 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta)
|
||||
End If
|
||||
c.Close
|
||||
@@ -1398,11 +1398,11 @@ End Sub
|
||||
Sub borraPedidoClienteActual As String
|
||||
Private thisC As Cursor
|
||||
' Private tablaProds As String = "cat_gunaprod2"
|
||||
thisC=Starter.skmt.ExecQuery("select PE_PROID,PE_CANT 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
|
||||
Starter.skmt.ExecNonQuery2($"update ${traeTablaProds(Starter.tipov)} set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?"$, Array As Object(thisC.GetString("PE_CANT"),thisC.GetString("PE_PROID")))
|
||||
If thisC.GetString("PE_CEDIS") <> "DUR" Then Starter.skmt.ExecNonQuery2($"update ${traeTablaProds(Starter.tipov)} set cat_gp_almacen = cat_gp_almacen + ? where cat_gp_id = ?"$, Array As Object(thisC.GetString("PE_CANT"), thisC.GetString("PE_PROID")))
|
||||
' Starter.skmt.ExecNonQuery2("INSERT INTO INVENT_X_ENVIAR (ALMACEN , PROID , CANTIDAD ) VALUES(?,?,?) ", Array As Object (traeAlmacen, thisC.GetString("PE_PROID"),thisC.GetString("PE_CANT")* -1))
|
||||
Next
|
||||
End If
|
||||
@@ -1551,5 +1551,20 @@ End Sub
|
||||
Sub bitacora(fechab As String, usuariob As String, almacenb As String, rutab As String, eventob As String, clienteb As String, iniciob As String, finb As String, latitudb As String, longitudb As String, precision As String, motivonoventa As String, motivonovisita As String )
|
||||
Log("bitacora")
|
||||
Starter.skmt.ExecNonQuery($"INSERT INTO BITACORAGPS (fechab, usuariob , almacenb , rutab , eventob , clienteb , iniciob , finb , latitudb , longitudb , precision , motivonoventa , motivonovisita) VALUES ('${fechab}' ,'${usuariob}' , '${almacenb}' , '${rutab}' , '${eventob}' , '${clienteb}' , '${iniciob}' , '${finb}' , '${latitudb}' , '${longitudb}' , '${precision}' , '${motivonoventa}' , '${motivonovisita}')"$)
|
||||
|
||||
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""$)
|
||||
Private total As String = 0
|
||||
For i = 0 To x.RowCount - 1
|
||||
x.Position = i
|
||||
' LogColor(x.GetString("PE_COSTO_TOT"), Colors.Red)
|
||||
total = total + x.GetString("PE_COSTO_TOT")
|
||||
' total = NumberFormat2(total, 0, 2, 2, False)
|
||||
' LogColor(total, Colors.Blue)
|
||||
Next
|
||||
x.Close
|
||||
Return NumberFormat2(total, 0, 2, 2, False)
|
||||
End Sub
|
||||
@@ -98,7 +98,7 @@ Public Sub StartFLP
|
||||
If logger Then Log("StartFLP - flpStarted="&flpStarted)
|
||||
Do While FLP.IsConnected = False
|
||||
Sleep(500)
|
||||
If logger Then Log("sleeping")
|
||||
If logger Then Log("kll - sleeping")
|
||||
Loop
|
||||
' If flpStarted = False Then
|
||||
' If logger Then Log("RequestLocationUpdates")
|
||||
@@ -113,7 +113,7 @@ Public Sub StartFLP2
|
||||
If logger Then Log("StartFLP2 - flpStarted="&flpStarted)
|
||||
Do While FLP.IsConnected = False
|
||||
Sleep(500)
|
||||
If logger Then Log("sleeping")
|
||||
If logger Then Log("kll - sleeping")
|
||||
Loop
|
||||
dameUltimaUbicacionConocida 'Regresamos ultima ubicacion conocida
|
||||
FLP.RequestLocationUpdates(CreateLocationRequest2) 'Buscamos ubicacion 2 peticiones
|
||||
@@ -125,7 +125,7 @@ Public Sub StartFLPSmall
|
||||
' Log("StartFLPSmall - flpStarted="&flpStarted)
|
||||
Do While FLP.IsConnected = False
|
||||
Sleep(500)
|
||||
Log("sleeping")
|
||||
If logger Then Log("kll - sleeping")
|
||||
Loop
|
||||
dameUltimaUbicacionConocida 'Regresamos ultima ubicacion conocida
|
||||
FLP.RequestLocationUpdates(CreateLocationRequestSmallD) 'Buscamos ubicacion 2 peticiones
|
||||
|
||||
@@ -23,6 +23,8 @@ Sub Class_Globals
|
||||
' Private mesEventName As String
|
||||
Dim RD_Init_IsInitialized As Boolean = False
|
||||
Dim btAdmin As BluetoothAdmin
|
||||
Dim RD_fechaRestauracion As String = ""
|
||||
Private fechaRestauracion As String = ""
|
||||
End Sub
|
||||
|
||||
'Inicializa la clase "kms_helperSubs".
|
||||
@@ -151,9 +153,12 @@ End Sub
|
||||
Sub RD_restaura_cat_gunaprod
|
||||
Private inicio As String = DateTime.Now
|
||||
' Log("Restaurando CAT_GUNAPROD ...")
|
||||
Log($"FECHA RESTAURACION: ${RD_fechaRestauracion}"$)
|
||||
fechaRestauracion = RD_fechaRestauracionSQL(RD_fechaRestauracion)
|
||||
Private lasCols As String = getTableColumnListName(rkmt, "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 order by fecha desc"$) 'where fecha <> '${fechaHoy}' 'Traemos la ultima fecha antes de hoy.
|
||||
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)
|
||||
If c.RowCount > 0 Then
|
||||
c.Position = 0
|
||||
@@ -161,6 +166,8 @@ Sub RD_restaura_cat_gunaprod
|
||||
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")}'"$)
|
||||
Else
|
||||
ToastMessageShow($"No hay respaldo para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
|
||||
End If
|
||||
Log("R-GP: " & ((DateTime.Now - inicio)/1000) & " segs")
|
||||
End Sub
|
||||
@@ -187,9 +194,10 @@ End Sub
|
||||
Sub RD_restaura_cat_gunaprod2
|
||||
Private inicio As String = DateTime.Now
|
||||
' Log("Restaurando CAT_GUNAPROD2 ...")
|
||||
fechaRestauracion = RD_fechaRestauracionSQL(RD_fechaRestauracion)
|
||||
Private lasCols As String = getTableColumnListName(rkmt, "CAT_GUNAPROD2")
|
||||
lasCols = lasCols.Replace(", FECHA", "") 'Quitamos la fecha del respaldo.
|
||||
Private c As Cursor = rkmt.ExecQuery($"select distinct fecha from CAT_GUNAPROD2 order by fecha desc"$) 'where fecha <> '${fechaHoy}' 'Traemos la ultima fecha antes de hoy.
|
||||
Private c As Cursor = rkmt.ExecQuery($"select distinct fecha from CAT_GUNAPROD2 ${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
|
||||
@@ -197,6 +205,8 @@ Sub RD_restaura_cat_gunaprod2
|
||||
skmt.ExecNonQuery("delete from CAT_GUNAPROD2")
|
||||
skmt.ExecNonQuery($"insert into CAT_GUNAPROD2 (${lasCols}) select ${lasCols} from rkmt1.CAT_GUNAPROD2 where fecha = '${c.GetString("FECHA")}'"$)
|
||||
Log($"insert into CAT_GUNAPROD2 (${lasCols}) select ${lasCols} from rkmt1.CAT_GUNAPROD2 where fecha = '${c.GetString("FECHA")}'"$)
|
||||
Else
|
||||
ToastMessageShow($"No hay respaldo para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
|
||||
End If
|
||||
Log("R-GP2: " & ((DateTime.Now - inicio)/1000) & " segs")
|
||||
End Sub
|
||||
@@ -222,9 +232,10 @@ End Sub
|
||||
Sub RD_restaura_cat_detalle_paq
|
||||
Private inicio As String = DateTime.Now
|
||||
' Log("Restaurando CAT_DETALLES_PAQ ...")
|
||||
fechaRestauracion = RD_fechaRestauracionSQL(RD_fechaRestauracion)
|
||||
Private lasCols As String = getTableColumnListName(rkmt, "CAT_DETALLES_PAQ")
|
||||
lasCols = lasCols.Replace(", FECHA", "") 'Quitamos la fecha del respaldo.
|
||||
Private c As Cursor = rkmt.ExecQuery($"select distinct fecha from CAT_DETALLES_PAQ order by fecha desc"$) 'where fecha <> '${fechaHoy}' 'Traemos la ultima fecha antes de hoy.
|
||||
Private c As Cursor = rkmt.ExecQuery($"select distinct fecha from CAT_DETALLES_PAQ ${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
|
||||
@@ -232,6 +243,8 @@ Sub RD_restaura_cat_detalle_paq
|
||||
skmt.ExecNonQuery("delete from CAT_DETALLES_PAQ")
|
||||
skmt.ExecNonQuery($"insert into CAT_DETALLES_PAQ (${lasCols}) select ${lasCols} from rkmt1.CAT_DETALLES_PAQ where fecha = '${c.GetString("FECHA")}'"$)
|
||||
Log($"insert into CAT_DETALLES_PAQ (${lasCols}) select ${lasCols} from rkmt1.CAT_DETALLES_PAQ where fecha = '${c.GetString("FECHA")}'"$)
|
||||
Else
|
||||
ToastMessageShow($"No hay respaldo para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
|
||||
End If
|
||||
Log("R-DP: " & ((DateTime.Now - inicio)/1000) & " segs")
|
||||
End Sub
|
||||
@@ -257,9 +270,10 @@ End Sub
|
||||
Sub RD_restaura_kmt_info
|
||||
Private inicio As String = DateTime.Now
|
||||
' Log("Restaurando KMT_INFO ...")
|
||||
fechaRestauracion = RD_fechaRestauracionSQL(RD_fechaRestauracion)
|
||||
Private lasCols As String = getTableColumnListName(rkmt, "kmt_info")
|
||||
lasCols = lasCols.Replace(", FECHA", "") 'Quitamos la fecha del respaldo.
|
||||
Private c As Cursor = rkmt.ExecQuery($"select distinct fecha from kmt_info order by fecha desc"$) 'where fecha <> '${fechaHoy}' 'Traemos la ultima fecha antes de hoy.
|
||||
Private c As Cursor = rkmt.ExecQuery($"select distinct fecha from kmt_info ${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
|
||||
@@ -267,6 +281,8 @@ Sub RD_restaura_kmt_info
|
||||
skmt.ExecNonQuery("delete from kmt_info")
|
||||
skmt.ExecNonQuery($"insert into kmt_info (${lasCols}) select ${lasCols} from rkmt1.kmt_info where fecha = '${c.GetString("FECHA")}'"$)
|
||||
Log($"insert into kmt_info (${lasCols}) select ${lasCols} from rkmt1.kmt_info where fecha = '${c.GetString("FECHA")}'"$)
|
||||
Else
|
||||
ToastMessageShow($"No hay respaldo para la fecha ${fechaRestauracion.SubString(fechaRestauracion.Length - 10)}"$, True)
|
||||
End If
|
||||
Log("R-KMT: " & ((DateTime.Now - inicio)/1000) & " segs")
|
||||
End Sub
|
||||
@@ -277,6 +293,13 @@ Sub RD_vacuum 'ignore
|
||||
rkmt.ExecNonQuery("vacuum;")
|
||||
End Sub
|
||||
|
||||
'Regresa el SQL para la especificar la fecha de restauracion.
|
||||
Sub RD_fechaRestauracionSQL(fecha As String) As String
|
||||
Private fechaSQL As String = ""
|
||||
If fecha <> "" And IsNumber(fecha) Then fechaSQL = $"where fecha = '${ticksAformatoFecha(fecha, "yyyyMMdd")}'"$
|
||||
Return fechaSQL
|
||||
End Sub
|
||||
|
||||
'Agrega una columna a la tabla especificada.
|
||||
'Hay que indicar el "tipo" de la columna (TEXT, INTEGER, ETC)
|
||||
'Ej. agregaColumna(DB, "TABLA", "COLUMNA", "TIPO")
|
||||
@@ -530,6 +553,19 @@ Sub logJobDoneResultados(resultado As DBResult) 'ignore
|
||||
Next
|
||||
End Sub
|
||||
|
||||
'Regresa los tick en el formato de fecha especificado.
|
||||
'Ej. ticksAformatoFecha(dateTime.now, "yyyymmdd")
|
||||
'Regresa 20231018
|
||||
Sub ticksAformatoFecha(fecha As Long, formato As String) As String 'ignore
|
||||
' Log(fecha)
|
||||
Private OrigFormat As String = DateTime.DateFormat 'save orig date format
|
||||
DateTime.DateFormat = formato
|
||||
Private nuevaFecha As String=DateTime.Date(fecha)
|
||||
DateTime.DateFormat = OrigFormat 'return to orig date format
|
||||
' Log(nuevaFecha)
|
||||
Return nuevaFecha
|
||||
End Sub
|
||||
|
||||
'Revisa si la aplicación tiene permiso para acceder a las notificaciones.
|
||||
Sub CheckNotificationAccess As Boolean
|
||||
Dim ph As Phone
|
||||
|
||||
Reference in New Issue
Block a user