Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -3973,6 +3973,92 @@ Public Class ClsVentas
|
||||
Return retorno
|
||||
End Function
|
||||
#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"
|
||||
|
||||
|
||||
|
||||
@@ -1230,7 +1230,7 @@ Namespace Modelos
|
||||
|
||||
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")
|
||||
End If
|
||||
|
||||
@@ -1480,7 +1480,7 @@ Namespace Modelos
|
||||
'inventarios
|
||||
GuardarVentaInventarios(factura, ObjInventario, ObjConta)
|
||||
|
||||
GuardaRecepcionUsados(factura, ObjInventario, ObjConta)
|
||||
'GuardaRecepcionUsados(factura, ObjInventario, ObjConta)
|
||||
|
||||
If ErrorList.Count = 0 Then
|
||||
'estimaciones
|
||||
@@ -1755,36 +1755,50 @@ Namespace Modelos
|
||||
DtVentasNC.Rows.Add(Dr)
|
||||
End If
|
||||
End Sub
|
||||
Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, CveVenta As Integer) As Boolean
|
||||
Dim Resultado As Boolean = True
|
||||
|
||||
If ClienteEsDistribuidor Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 Then
|
||||
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
|
||||
|
||||
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
|
||||
|
||||
|
||||
For Each drow As DataRow In DtDetalle.Rows
|
||||
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,
|
||||
UsuarioActual.CveEmpresa, 0D, "") Then
|
||||
Else
|
||||
Resultado = False
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
Resultado = True
|
||||
End If
|
||||
Next
|
||||
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
|
||||
|
||||
Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, CveVenta As Integer, ByRef ObjVentas As ClsVentas) As Boolean
|
||||
Dim Resultado As Boolean = True
|
||||
|
||||
'If ClienteEsDistribuidor Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 Then
|
||||
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
|
||||
|
||||
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
|
||||
|
||||
For Each drow As DataRow In DtDetalle.Rows
|
||||
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,
|
||||
UsuarioActual.CveEmpresa, 0D, "") Then
|
||||
Else
|
||||
Resultado = False
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
Resultado = True
|
||||
End If
|
||||
Next
|
||||
|
||||
If TipoDocto.Contiene("Rem") Then
|
||||
If DtRecepcionUsados IsNot Nothing Then
|
||||
For Each drow As DataRow In DtRecepcionUsados.Rows
|
||||
If Not ObjVentas.AddVentaUsado(CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal) Then
|
||||
Resultado = False
|
||||
Exit For
|
||||
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
|
||||
|
||||
End Function
|
||||
|
||||
Reference in New Issue
Block a user