mirror of
https://github.com/KeymonSoft/Intmex_Multiventa.git
synced 2026-04-17 21:06:08 +00:00
- VERSION 4.08.14.V-P
- Se agregó codigo en "Productos" para que si se cierra la venta del cliente, y luego se regresa a ponerle mas producto, el nuevo producto entre en un segundo "ticket", o un tercer o cuarto ticket, se guarda a info en la columna PE_TICEK y se manda a web.
This commit is contained in:
46
B4A/Subs.bas
46
B4A/Subs.bas
@@ -779,12 +779,12 @@ Sub guardaProductoSinGestion(cedis As String, costoU As String, cant As String,
|
||||
End Sub
|
||||
|
||||
Sub actualizaProducto(cedis As String, costoU As String, cant As Int, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
|
||||
Private c As Cursor=B4XPages.MainPage.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
Private c As Cursor = B4XPages.MainPage.skmt.ExecQuery($"select * from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
' Log($"ROWCOUNT: ${c.RowCount}, ${cant}"$)
|
||||
LogColor($"actualizaProducto, c=${clienteId}, p=${prodId}, nombre=${nombre}, cant=${cant}, cedis=${cedis}, tipo=${tipoVenta}"$, Colors.Magenta)
|
||||
|
||||
If c.RowCount > 0 Then
|
||||
c.Position=0
|
||||
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
|
||||
@@ -795,7 +795,7 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As Int, nombre As
|
||||
Log("BORRAMOS PROD")
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"delete from pedido where pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
Private pe As Cursor = B4XPages.MainPage.skmt.ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_cliente In (select cuenta from cuentaa)")
|
||||
pe.Position=0
|
||||
pe.Position = 0
|
||||
If pe.GetString("cuantosPedidos") = 0 Then B4XPages.MainPage.skmt.ExecNonQuery("delete from pedido_cliente where PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
End If
|
||||
Else
|
||||
@@ -805,6 +805,33 @@ Sub actualizaProducto(cedis As String, costoU As String, cant As Int, nombre As
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
Sub actualizaProductoConTicket(cedis As String, costoU As String, cant As Int, nombre As String, prodId As String, clienteId As String, fecha As String, usuario As String, rutaV As String, precioSin As String, tipoVenta As String)
|
||||
Private c As Cursor = B4XPages.MainPage.skmt.ExecQuery($"select * from pedido where pe_ticket is null and pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
' Log($"ROWCOUNT: ${c.RowCount}, ${cant}"$)
|
||||
LogColor($"actualizaProducto, c=${clienteId}, p=${prodId}, nombre=${nombre}, cant=${cant}, cedis=${cedis}, tipo=${tipoVenta}"$, Colors.Magenta)
|
||||
|
||||
If c.RowCount > 0 Then
|
||||
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
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update pedido set pe_cant = ${cant}, pe_costo_tot = ${(cant*c.GetString("PE_COSTOU"))} where pe_ticket is null and pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"update ${Starter.tabla} set cat_gp_almacen = cat_gp_almacen - (${difCant}) where cat_gp_id = '${prodId}' "$)
|
||||
' Log($"CANT=${cant}"$)
|
||||
If cant = 0 Then
|
||||
Log("BORRAMOS PROD")
|
||||
B4XPages.MainPage.skmt.ExecNonQuery($"delete from pedido where pe_ticket is null and pe_cedis = '${cedis}' and pe_proid = '${prodId}' and pe_cliente = '${clienteId}' AND PE_FOLIO = '${B4XPages.MainPage.tipo_venta}'"$)
|
||||
Private pe As Cursor = B4XPages.MainPage.skmt.ExecQuery("select count(pe_cliente) as cuantosPedidos from pedido where pe_ticket is null and pe_cliente In (select cuenta from cuentaa)")
|
||||
pe.Position = 0
|
||||
If pe.GetString("cuantosPedidos") = 0 Then B4XPages.MainPage.skmt.ExecNonQuery("delete from pedido_cliente where pe_ticket is null and PC_CLIENTE In (select cuenta from cuentaa)")
|
||||
End If
|
||||
Else
|
||||
'INSERTAMOS
|
||||
If cant <> 0 Then guardaProductoSinGestion(cedis, costoU, cant, nombre, prodId, clienteId, fecha, usuario, rutaV, precioSin, tipoVenta)
|
||||
End If
|
||||
c.Close
|
||||
End Sub
|
||||
|
||||
Sub traeTotalCliente As Double
|
||||
Private sumaTotal As Double
|
||||
Private cursorprueba As Cursor = B4XPages.MainPage.skmt.ExecQuery("Select PE_COSTO_TOT from pedido where PE_CLIENTE <> 0 ")
|
||||
@@ -1404,8 +1431,7 @@ Sub pedidoGuardado As Boolean
|
||||
Private g As Cursor = B4XPages.MainPage.skmt.ExecQuery("select gestion from kmt_info where CAT_CL_CODIGO in (Select CUENTA from cuentaa)")
|
||||
If g.RowCount > 0 Then
|
||||
g.Position=0
|
||||
If g.GetString("gestion") = "2" or g.GetString("gestion") = "3" Then guardado = True
|
||||
|
||||
If g.GetString("gestion") = "2" Or g.GetString("gestion") = "3" Then guardado = True
|
||||
End If
|
||||
' Log($"Guardado=${guardado}"$)
|
||||
Return guardado
|
||||
@@ -1470,4 +1496,14 @@ Sub traeinventario(id As String) As String
|
||||
End If
|
||||
c.Close
|
||||
Return inventario
|
||||
End Sub
|
||||
|
||||
'Trae el ticket consecutivo del cliente especificado
|
||||
Sub traeTicketConsecutivo(idCliente As String) As Int
|
||||
Private sigTicket As Int = 1
|
||||
Private c As ResultSet = Starter.skmt.ExecQuery($"select ifnull(pe_ticket, 0) as pe_ticket from pedido where PE_CLIENTE = '${idCliente}' order by pe_ticket desc limit 1"$)
|
||||
Do While c.NextRow
|
||||
sigTicket = c.GetInt("pe_ticket")
|
||||
Loop
|
||||
Return sigTicket + 1
|
||||
End Sub
|
||||
Reference in New Issue
Block a user