mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-19 19:19:14 +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:
55
B4A/Subs.bas
55
B4A/Subs.bas
@@ -67,7 +67,7 @@ Sub fechaKMT(fecha As String) As String 'ignore
|
||||
Dim OrigFormat As String = DateTime.DateFormat 'save orig date format
|
||||
DateTime.DateFormat="yyMMddHHmmss"
|
||||
Dim nuevaFecha As String=DateTime.Date(fecha)
|
||||
DateTime.DateFormat=OrigFormat 'return to orig date format
|
||||
DateTime.DateFormat = OrigFormat 'return to orig date format
|
||||
' if starter.logger then Log(nuevaFecha)
|
||||
Return nuevaFecha
|
||||
End Sub
|
||||
@@ -104,9 +104,9 @@ End Sub
|
||||
Sub guardaInfoEnArchivo(coords As String) 'ignore
|
||||
' Cambiamos el formato de la hora
|
||||
Dim OrigFormat As String=DateTime.DateFormat 'save orig date format
|
||||
DateTime.DateFormat="MMM-dd HH:mm:ss"
|
||||
DateTime.DateFormat = "MMM-dd HH:mm:ss"
|
||||
Dim lastUpdate As String=DateTime.Date(DateTime.Now)
|
||||
DateTime.DateFormat=OrigFormat 'return to orig date format
|
||||
DateTime.DateFormat = OrigFormat 'return to orig date format
|
||||
|
||||
Dim ubic As String = coords&","&lastUpdate
|
||||
Dim out As OutputStream = File.OpenOutput(File.DirInternal, "gps.txt", True)
|
||||
@@ -273,9 +273,9 @@ End Sub
|
||||
'Regresa la fecha y hora de hoy a las 00:00 en el formato "yyMMddHHMMSS"
|
||||
Sub fechaInicioHoy As String 'ignore
|
||||
Dim OrigFormat As String = DateTime.DateFormat 'save orig date format
|
||||
DateTime.DateFormat="yyMMdd"
|
||||
DateTime.DateFormat = "yyMMdd"
|
||||
Private h As String = DateTime.Date(DateTime.Now)&"000000"
|
||||
DateTime.DateFormat=OrigFormat 'return to orig date format
|
||||
DateTime.DateFormat = OrigFormat 'return to orig date format
|
||||
If Starter.logger Then Log("Hoy="&h)
|
||||
Return h
|
||||
End Sub
|
||||
@@ -498,7 +498,7 @@ Sub fechaKMT2Ticks(fKMT As String) As Long 'ignore
|
||||
DateTime.TimeFormat="HHmmss"
|
||||
Private ticks As Long = DateTime.DateTimeParse(parteFecha,parteHora)
|
||||
' Log(" +++ +++ pFecha:"&parteFecha&" | pHora:"&parteHora)
|
||||
DateTime.DateFormat=OrigFormat 'return to original date format
|
||||
DateTime.DateFormat = OrigFormat 'return to original date format
|
||||
Return ticks
|
||||
Else
|
||||
Log("Formato de fecha incorrecto, debe de ser 'yyMMddHHmmss', no '"&fKMT&"' largo="&fKMT.Length)
|
||||
@@ -778,7 +778,7 @@ End Sub
|
||||
Sub traeAlmacen As String 'ignore
|
||||
Private c As Cursor
|
||||
Private a As String
|
||||
c=Starter.skmt.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
|
||||
c = Starter.skmt.ExecQuery("select ID_ALMACEN from CAT_ALMACEN")
|
||||
c.Position = 0
|
||||
a = C.GetString("ID_ALMACEN")
|
||||
c.Close
|
||||
@@ -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"
|
||||
@@ -915,7 +915,7 @@ Sub guardaProductoSin(cedis As String, costoTot As String, costoU As String, can
|
||||
c.Position=0
|
||||
Starter.skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
Starter.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, sDate & sTime, usuario, c.GetString("CANT_CLIE"),c.GetString("TOTAL_CLIE"), Starter.lon_gps, Starter.lat_gps, cedis, rutaV, c.GetString("TOTAL_CLIE_SIN")))
|
||||
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 2 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
c.Close
|
||||
ToastMessageShow("guardaProdSin", False)
|
||||
End Sub
|
||||
@@ -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)
|
||||
c.Position=0
|
||||
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,17 +1398,17 @@ 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
|
||||
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)")
|
||||
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 0 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Return 1
|
||||
End Sub
|
||||
|
||||
@@ -1523,7 +1523,7 @@ Sub agrupador()
|
||||
Starter.skmt.ExecNonQuery2("UPDATE PEDIDO3 SET PE_FOLIO = ? WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)", Array As Object(YA_IMPRIMIO))
|
||||
Starter.skmt.ExecNonQuery("delete from pedido WHERE PE_CLIENTE IN (Select CUENTA from cuentaa)")
|
||||
Starter.skmt.ExecNonQuery("INSERT INTO PEDIDO SELECT * FROM PEDIDO3")
|
||||
Starter.skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_FECHA = ? where PE_CLIENTE IN (Select CUENTA from cuentaa) and PE_FECHA IS NULL", Array As Object(traeFecha))
|
||||
Starter.skmt.ExecNonQuery2("UPDATE PEDIDO SET PE_FECHA = ? where PE_CLIENTE IN (Select CUENTA from cuentaa) and PE_FECHA IS NULL", Array As Object(traeFecha))
|
||||
End Sub
|
||||
|
||||
Sub esPromo(promoId) As Boolean
|
||||
@@ -1539,9 +1539,9 @@ End Sub
|
||||
Sub fechanormal(fecha As String) As String 'ignore
|
||||
' Log(fecha)
|
||||
Dim OrigFormat As String = DateTime.DateFormat 'save orig date format
|
||||
DateTime.DateFormat="yyyy/MM/dd HH:mm:ss"
|
||||
DateTime.DateFormat = "yyyy/MM/dd HH:mm:ss"
|
||||
Dim nuevaFecha As String=DateTime.Date(fecha)
|
||||
DateTime.DateFormat=OrigFormat 'return to orig date format
|
||||
DateTime.DateFormat = OrigFormat 'return to orig date format
|
||||
' Log(nuevaFecha)
|
||||
Return nuevaFecha
|
||||
End Sub
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user