Recepcion de usados
This commit is contained in:
@@ -3929,6 +3929,92 @@ Public Class ClsVentas
|
|||||||
Return retorno
|
Return retorno
|
||||||
End Function
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
#Region " U S A D O S "
|
||||||
|
|
||||||
|
Public Function AddVentaUsado(CveVenta As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Vta_VentasUsadosAdd", CommandType.StoredProcedure)
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||||
|
.Add("@Cantidad", SqlDbType.Float).Value = Cantidad
|
||||||
|
.Add("@PU", SqlDbType.Money).Value = PU
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al relacionar las ventas con los usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
Public Function GetVentasUsados(CveVenta As Integer, CveSubProyecto As Integer, Fecha As DateTime, CveEmpresa As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Vta_VentasUsadosGet", CommandType.StoredProcedure)
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
|
||||||
|
.Add("@Fecha", SqlDbType.DateTime).Value = Fecha
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener las ventas con usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
Public Function GetVentasUsadosDetalle(CveVenta As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Vta_VentasUsadosDetalleGet", CommandType.StoredProcedure)
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener las ventas con usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
Public Function UpdateVentaUsadoRecibido(CveVenta As Integer, CvePS As Integer, Recibido As Boolean) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Vta_VentasUsadosRecibidoUpdate", CommandType.StoredProcedure)
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||||
|
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||||
|
.Add("@Recibido", SqlDbType.Bit).Value = Recibido
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al actualizar el recibo de los usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
#End Region
|
||||||
#Region "IDisposable Support"
|
#Region "IDisposable Support"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1230,7 +1230,7 @@ Namespace Modelos
|
|||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not GuardarUsados(ObjVentas.IniciaTransacSQL, ObjVentas.CveVenta) Then
|
If Not GuardarUsados(ObjVentas.IniciaTransacSQL, ObjVentas.CveVenta, ObjVentas) Then
|
||||||
ErrorList.Add("Error al guardar usados")
|
ErrorList.Add("Error al guardar usados")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -1480,7 +1480,7 @@ Namespace Modelos
|
|||||||
'inventarios
|
'inventarios
|
||||||
GuardarVentaInventarios(factura, ObjInventario, ObjConta)
|
GuardarVentaInventarios(factura, ObjInventario, ObjConta)
|
||||||
|
|
||||||
GuardaRecepcionUsados(factura, ObjInventario, ObjConta)
|
'GuardaRecepcionUsados(factura, ObjInventario, ObjConta)
|
||||||
|
|
||||||
If ErrorList.Count = 0 Then
|
If ErrorList.Count = 0 Then
|
||||||
'estimaciones
|
'estimaciones
|
||||||
@@ -1755,36 +1755,50 @@ Namespace Modelos
|
|||||||
DtVentasNC.Rows.Add(Dr)
|
DtVentasNC.Rows.Add(Dr)
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, CveVenta As Integer) As Boolean
|
Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, CveVenta As Integer, ByRef ObjVentas As ClsVentas) As Boolean
|
||||||
Dim Resultado As Boolean = True
|
Dim Resultado As Boolean = True
|
||||||
|
|
||||||
If ClienteEsDistribuidor Then
|
'If ClienteEsDistribuidor Then
|
||||||
If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 Then
|
If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 Then
|
||||||
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
|
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
|
||||||
|
|
||||||
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
|
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
|
||||||
|
|
||||||
|
For Each drow As DataRow In DtDetalle.Rows
|
||||||
For Each drow As DataRow In DtDetalle.Rows
|
If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then
|
||||||
If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then
|
If ObjAcum.DistribuidorMovtosAdd(CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, CveVenta, UsuarioActual.CveUsuario,
|
||||||
If ObjAcum.DistribuidorMovtosAdd(CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, CveVenta, UsuarioActual.CveUsuario,
|
UsuarioActual.CveEmpresa, 0D, "") Then
|
||||||
UsuarioActual.CveEmpresa, 0D, "") Then
|
Else
|
||||||
Else
|
Resultado = False
|
||||||
Resultado = False
|
Exit For
|
||||||
Exit For
|
End If
|
||||||
End If
|
Else
|
||||||
Else
|
Resultado = True
|
||||||
Resultado = True
|
End If
|
||||||
End If
|
Next
|
||||||
Next
|
|
||||||
Else
|
If TipoDocto.Contiene("Rem") Then
|
||||||
ErrorList.Add("El cliente es Distribuidor y no se tiene un producto o servicio asigando como PS Acumulador")
|
If DtRecepcionUsados IsNot Nothing Then
|
||||||
Resultado = False
|
For Each drow As DataRow In DtRecepcionUsados.Rows
|
||||||
End If
|
If Not ObjVentas.AddVentaUsado(CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal) Then
|
||||||
Else
|
Resultado = False
|
||||||
Resultado = True
|
Exit For
|
||||||
End If
|
End If
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
Resultado = False
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
Else
|
||||||
|
ErrorList.Add("El cliente es Distribuidor y no se tiene un producto o servicio asigando como PS Acumulador")
|
||||||
|
Resultado = False
|
||||||
|
End If
|
||||||
|
'Else
|
||||||
|
' Resultado = True
|
||||||
|
'End If
|
||||||
|
|
||||||
Return Resultado
|
Return Resultado
|
||||||
|
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
Reference in New Issue
Block a user