SMS - 2024.01.08 Ventas actualizar CveMedico CveProcedimientio remision pedido, correiones EntregaAlamcen y OS
This commit is contained in:
@@ -5,7 +5,7 @@ Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.IO
|
||||
Imports Extensiones
|
||||
|
||||
Imports Microsoft.Owin.Security.Provider
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Inventarios_EntregaAlmacen
|
||||
@@ -4269,27 +4269,36 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
|
||||
Respuesta = ObjOS.UpdateOrdenesServiciosEstatus(CveOSEstatusFinalizada, UsuarioActual.CveUsuario, CveOSCerrar)
|
||||
|
||||
Dim cancelarPeido As Boolean = CancelarPedido(TransaccionSql, CveMovimientoGenerado, Respuesta)
|
||||
|
||||
If Respuesta Then
|
||||
|
||||
Dim ObjInventario As New ClsInventarios(ObjOS.IniciaTransacSQL)
|
||||
|
||||
Dim ObjInventario As New ClsInventarios(TransaccionSql)
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoGenerado, UsuarioActual.CveEmpresa) Then
|
||||
If Not cancelarPeido Then
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
Dim CveVentaDetalle As Integer = Dr("CveVentaDetalle").ToString().ToEntero()
|
||||
Dim Cantidad As Decimal = Dr("Cantidad").ToString().ToDecimal
|
||||
|
||||
Dim CveVentaDetalle As Integer = Dr("CveVentaDetalle").ToString().ToEntero()
|
||||
Dim Cantidad As Decimal = Dr("Cantidad").ToString().ToDecimal
|
||||
|
||||
If CveVentaDetalle > 0 Then
|
||||
If Not ObjInventario.UpdatePedidoDetalleCantidad(CveVentaDetalle, Cantidad) Then
|
||||
If CveVentaDetalle > 0 Then
|
||||
If Not ObjInventario.UpdatePedidoDetalleCantidad(CveVentaDetalle, Cantidad) Then
|
||||
Respuesta = False
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
Respuesta = False
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
Respuesta = False
|
||||
End If
|
||||
|
||||
Next
|
||||
Next
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If Respuesta AndAlso cancelarPeido Then
|
||||
Dim objVentas As New ClsVentas(TransaccionSql)
|
||||
If Not objVentas.UpdateEstatusVenta(CveVentaSurtir, 4, UsuarioActual.CveEmpresa) Then
|
||||
Respuesta = False
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -4302,4 +4311,48 @@ Partial Class Inventarios_EntregaAlmacen
|
||||
|
||||
End Function
|
||||
|
||||
Private Function CancelarPedido(ByRef TransaccionSql As SqlTransaction, CveMovimientoGenerado As Integer, ByRef RespuestaPadre As Boolean) As Boolean
|
||||
|
||||
Dim Cancelar As Boolean = True
|
||||
|
||||
Dim objVentas As New ClsVentas(TransaccionSql)
|
||||
Dim ObjInventario As New ClsInventarios(TransaccionSql)
|
||||
|
||||
Dim DTMovimiento As New DataTable
|
||||
Dim DTPedidoDetalle As New DataTable
|
||||
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoGenerado, UsuarioActual.CveEmpresa) Then
|
||||
DTMovimiento = ObjInventario.DtResultados
|
||||
Else
|
||||
RespuestaPadre = False
|
||||
End If
|
||||
|
||||
If objVentas.GetVentaDetalle(CveVentaSurtir) Then
|
||||
DTPedidoDetalle = objVentas.DtResultados
|
||||
Else
|
||||
RespuestaPadre = False
|
||||
End If
|
||||
|
||||
|
||||
If RespuestaPadre Then
|
||||
|
||||
For Each rowPedido As DataRow In DTPedidoDetalle.Rows
|
||||
Dim CantidadPedido As Decimal = rowPedido("Cantidad").ToString.ToDecimal
|
||||
Dim CveVentaDetalle As Integer = rowPedido("CveVentaDetalle").ToString.ToEntero
|
||||
|
||||
Dim CantidadDevuelto As Decimal = DTMovimiento.FiltroPrimeroValor("Cantidad", $"CveVentaDetalle = {CveVentaDetalle}").ToDecimal
|
||||
|
||||
If CantidadPedido <> CantidadDevuelto Then
|
||||
Cancelar = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
Return Cancelar
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user