mirror of
https://github.com/KeymonSoft/Kelloggs_v4.git
synced 2026-04-22 04:10:07 +00:00
5/12/23 - Cambios para DOE
This commit is contained in:
43
B4A/Subs.bas
43
B4A/Subs.bas
@@ -1405,12 +1405,13 @@ 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}"$)
|
||||
Log($"Borramos 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)")
|
||||
If thisC.RowCount>0 Then
|
||||
For i=0 To thisC.RowCount -1
|
||||
thisC = Starter.skmt.ExecQuery("select PE_PROID, PE_CANT, PE_CEDIS FROM PEDIDO where pe_cliente in (Select CUENTA from cuentaa) and PE_CEDIS <> 'DOE'")
|
||||
Log($"Registros = ${thisC.RowCount}"$)
|
||||
If thisC.RowCount > 0 Then
|
||||
For i = 0 To thisC.RowCount - 1
|
||||
thisC.Position=i
|
||||
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")))
|
||||
@@ -1418,8 +1419,38 @@ Sub borraPedidoClienteActual As String
|
||||
' 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("delete from pedido where pe_cliente in (Select CUENTA from cuentaa) and PE_CEDIS <> 'DOE'")
|
||||
|
||||
'la intencion es que al borrar el pedido, y queda doe o normal, no se borre el cliente de pedido_cliente
|
||||
thisC = Starter.skmt.ExecQuery($"select pe_cedis from pedido where pe_cliente in (Select CUENTA from cuentaa)"$)
|
||||
If thisC.RowCount < 1 Then Starter.skmt.ExecNonQuery("delete from pedido_cliente where pc_cliente 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
|
||||
|
||||
'Borra el pedido DOE del cliente actual.
|
||||
'Borra los registros de la tabla "pedido" y "pedido_cliente"
|
||||
'Actualiza las tablas "cat_gunaprod" o "cat_gunaprod2" y "kmt_info".
|
||||
Sub borraPedidoDOEClienteActual As String
|
||||
Log($"Borramos pedido DOE 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) and PE_CEDIS = 'DOE'")
|
||||
Log($"Registros = ${thisC.RowCount}"$)
|
||||
If thisC.RowCount > 0 Then
|
||||
For i = 0 To thisC.RowCount - 1
|
||||
thisC.Position=i
|
||||
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")))
|
||||
End If
|
||||
' 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
|
||||
thisC = Starter.skmt.ExecQuery($"select pe_cedis from pedido where pe_cliente in (Select CUENTA from cuentaa)"$)
|
||||
If thisC.RowCount < 1 Then 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) and PE_CEDIS = 'DOE'")
|
||||
Starter.skmt.ExecNonQuery("UPDATE kmt_info set gestion = 0 where CAT_CL_CODIGO In (select cuenta from cuentaa)")
|
||||
Return 1
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user