mirror of
https://github.com/KeymonSoft/Guna_Preventa_BAT.git
synced 2026-04-21 14:49:15 +00:00
VERSION PARA PACHUCA Y GUADALAJARA BAT
This commit is contained in:
55
B4A/Subs.bas
55
B4A/Subs.bas
@@ -1791,6 +1791,7 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre
|
||||
LogColor($"actualizaProducto, c=${clienteId}, p=${prodId}, nombre=${nombre}, cant=${cant}, cedis=${cedis}, tipo=${tipoVenta}"$, Colors.Magenta)
|
||||
' Private tablaProds As String = "cat_gunaprod2"
|
||||
' If tipoVenta = "ABORDO" Then tablaProds = "cat_gunaprod"
|
||||
dev = 0
|
||||
If dev = 0 Then
|
||||
Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' and PE_CEDIS <> 'DUR' AND PE_FUTURO = '${futuro}'"$)
|
||||
If c.RowCount > 0 Then
|
||||
@@ -1820,33 +1821,33 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As String, nombre
|
||||
End If
|
||||
c.Close
|
||||
Else If dev = 1 Then
|
||||
Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' and PE_CEDIS = 'DUR' AND PE_FUTURO = '${futuro}' "$)
|
||||
If c.RowCount > 0 Then
|
||||
' 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 = ${NumberFormat2((cant*c.GetString("PE_COSTOU")), 1, 2, 2, False)}, pe_folio = '${tipoVenta}' where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FUTURO = '${futuro}' "$)
|
||||
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}' AND PE_FUTURO = '${futuro}' "$)
|
||||
Log($"Borramos pe_cedis='${cedis}' and pe_proid='${prodId}' and pe_cliente='${clienteId}'"$)
|
||||
Private pe As Cursor = Starter.skmt.ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")
|
||||
pe.Position=0
|
||||
If pe.GetString("cuantosPedidos") = 0 Then
|
||||
Log("###### delete from pedido_cliente - " & traeCliente & "|" & clienteId)
|
||||
Log($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
Starter.skmt.ExecNonQuery($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
'INSERTAMOS
|
||||
' LogColor("INSERTAMOS PROD", Colors.red)
|
||||
If cant > 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta,futuro,aplicades)
|
||||
End If
|
||||
c.Close
|
||||
' Private c As Cursor=Starter.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' and PE_CEDIS = 'DUR' AND PE_FUTURO = '${futuro}' "$)
|
||||
' If c.RowCount > 0 Then
|
||||
'' 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 = ${NumberFormat2((cant*c.GetString("PE_COSTOU")), 1, 2, 2, False)}, pe_folio = '${tipoVenta}' where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FUTURO = '${futuro}' "$)
|
||||
' 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}' AND PE_FUTURO = '${futuro}' "$)
|
||||
' Log($"Borramos pe_cedis='${cedis}' and pe_proid='${prodId}' and pe_cliente='${clienteId}'"$)
|
||||
' Private pe As Cursor = Starter.skmt.ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")
|
||||
' pe.Position=0
|
||||
' If pe.GetString("cuantosPedidos") = 0 Then
|
||||
' Log("###### delete from pedido_cliente - " & traeCliente & "|" & clienteId)
|
||||
' Log($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
' Starter.skmt.ExecNonQuery($"delete from pedido_cliente where PC_CLIENTE = '${traeCliente}'"$)
|
||||
' End If
|
||||
' End If
|
||||
' Else
|
||||
' 'INSERTAMOS
|
||||
'' LogColor("INSERTAMOS PROD", Colors.red)
|
||||
' If cant > 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta,futuro,aplicades)
|
||||
' End If
|
||||
' c.Close
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user