VERSION PARA PACHUCA Y GUADALAJARA BAT

This commit is contained in:
cvaldes1201
2026-04-20 22:08:58 -06:00
parent 6cbcd3e592
commit a79ff713b7
512 changed files with 75715 additions and 46613 deletions

View File

@@ -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