Correciones en cancelacion, carga de inventario

This commit is contained in:
2022-07-09 00:23:19 -07:00
parent bc825bafa1
commit 4256bfaeaf
3 changed files with 239 additions and 218 deletions

View File

@@ -7,10 +7,10 @@ Imports Extensiones
Public Class ClsAcumuladores Public Class ClsAcumuladores
Implements IDisposable Implements IDisposable
#Region "Campos" #Region "Campos"
'SQL 'SQL
Private SqlConexion As SqlConnection Private SqlConexion As SqlConnection
Private SqlAdapter As SqlDataAdapter Private SqlAdapter As SqlDataAdapter
Private SqlTransacc As SqlTransaction Private SqlTransacc As SqlTransaction
@@ -51,7 +51,7 @@ Public Class ClsAcumuladores
If TransaccionCompartida Is Nothing Then If TransaccionCompartida Is Nothing Then
SqlConexion = New SqlConnection SqlConexion = New SqlConnection
SqlConexion.ConnectionString = CadenaConexion() ' ConfigurationManager.ConnectionStrings("Conexion").ConnectionString SqlConexion.ConnectionString = CadenaConexion() ' ConfigurationManager.ConnectionStrings("Conexion").ConnectionString
SqlAdapter = New SqlDataAdapter("", SqlConexion) SqlAdapter = New SqlDataAdapter("", SqlConexion)
Try Try
@@ -68,9 +68,9 @@ Public Class ClsAcumuladores
SqlAdapter = New SqlDataAdapter("", SqlConexion) SqlAdapter = New SqlDataAdapter("", SqlConexion)
ConexionAdd() ConexionAdd()
End Sub End Sub
#Region "Conexiones" #Region "Conexiones"
Private Sub ConexionAdd() Private Sub ConexionAdd()
If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then If Not EsTransaccionCompartida AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then
Try Try
@@ -103,18 +103,18 @@ Public Class ClsAcumuladores
CveConexion = 0 CveConexion = 0
End If End If
End Sub End Sub
#End Region #End Region
Public ReadOnly Property DtResultados() As DataTable Public ReadOnly Property DtResultados() As DataTable
Get Get
DtResultados = Data DtResultados = Data
End Get End Get
End Property End Property
#End Region #End Region
#Region " TAMAÑOS " #Region " TAMAÑOS "
Public Function TamañoGet(CveTamaño As Integer, CveEmpresa As Integer) As Boolean Public Function TamañoGet(CveTamaño As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -245,38 +245,38 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function EntradasUsadosGet(CveEmpresa As Integer, CveAlmacen As Integer, FechaInicial As Date, FechaFinal As Date) As Boolean Public Function EntradasUsadosGet(CveEmpresa As Integer, CveAlmacen As Integer, FechaInicial As Date, FechaFinal As Date) As Boolean
Dim retorno As Boolean = False Dim retorno As Boolean = False
SqlDataAdapter("PA_Acum_EntradasUsadosResumenRep") SqlDataAdapter("PA_Acum_EntradasUsadosResumenRep")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
.Add("@FechaInicial", SqlDbType.Date).Value = FechaInicial .Add("@FechaInicial", SqlDbType.Date).Value = FechaInicial
.Add("@FechaFinal", SqlDbType.Date).Value = FechaFinal .Add("@FechaFinal", SqlDbType.Date).Value = FechaFinal
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
retorno = True retorno = True
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al traerse el reporte de usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error al traerse el reporte de usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return retorno Return retorno
End Function End Function
#End Region #End Region
#Region " TIPOS DEFECTO " #Region " TIPOS DEFECTO "
Public Function TiposDefectoGet(CveTipoDefecto As Integer, CveEmpresa As Integer) As Boolean Public Function TiposDefectoGet(CveTipoDefecto As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -375,12 +375,12 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
#Region " TIPOS USO " #Region " TIPOS USO "
Public Function TiposUsoGet(CveTipoUso As Integer, CveEmpresa As Integer) As Boolean Public Function TiposUsoGet(CveTipoUso As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -479,12 +479,12 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
#Region " FOLIOS GARANTÍA " #Region " FOLIOS GARANTÍA "
Public Function FoliosGarantiaGet(CveFolioGarantia As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional TipoFolio As String = "-1", Optional Area As Integer = 1) As Boolean Public Function FoliosGarantiaGet(CveFolioGarantia As Integer, CveEmpresa As Integer, Optional Estatus As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional TipoFolio As String = "-1", Optional Area As Integer = 1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -492,11 +492,11 @@ Public Class ClsAcumuladores
SqlDataAdapter("PA_Acum_FoliosGarantiaGet") SqlDataAdapter("PA_Acum_FoliosGarantiaGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia .Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia
.Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@Estatus", SqlDbType.Int).Value = Estatus
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@tipoFolio", SqlDbType.VarChar).Value = TipoFolio .Add("@tipoFolio", SqlDbType.VarChar).Value = TipoFolio
.Add("@Area", SqlDbType.Int).Value = Area .Add("@Area", SqlDbType.Int).Value = Area
End With End With
@@ -526,7 +526,7 @@ Public Class ClsAcumuladores
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@TipoFolio", SqlDbType.VarChar).Value = TipoFolio .Add("@TipoFolio", SqlDbType.VarChar).Value = TipoFolio
.Add("@Limite", SqlDbType.Int).Value = Limite .Add("@Limite", SqlDbType.Int).Value = Limite
.Add("@Area", SqlDbType.Int).Value = Area .Add("@Area", SqlDbType.Int).Value = Area
End With End With
@@ -594,27 +594,27 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetNuevoConsecutivoFolio(CveFolioGarantia As Integer) As Boolean Public Function GetNuevoConsecutivoFolio(CveFolioGarantia As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter(String.Format("SELECT MAX(dbo.FNC_Numero(Consecutivo)) AS NuevoConsecutivo FROM Acum_GarantiasDetalle d WHERE d.CveFolioGarantia = {0}", CveFolioGarantia), CommandType.Text) SqlDataAdapter(String.Format("SELECT MAX(dbo.FNC_Numero(Consecutivo)) AS NuevoConsecutivo FROM Acum_GarantiasDetalle d WHERE d.CveFolioGarantia = {0}", CveFolioGarantia), CommandType.Text)
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
Retorno = True Retorno = True
Catch ex As Exception Catch ex As Exception
OnError(String.Format("Ocurrió un error al consultar un nuevo consecutivo para el folio {0}", CveFolioGarantia), ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError(String.Format("Ocurrió un error al consultar un nuevo consecutivo para el folio {0}", CveFolioGarantia), ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
#Region " GARANTÍAS MESES " #Region " GARANTÍAS MESES "
Public Function GarantiasMesesGet(CveGarantiaMes As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveTipoUso As Integer = -1, Optional Mes As Integer = -1) As Boolean Public Function GarantiasMesesGet(CveGarantiaMes As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveTipoUso As Integer = -1, Optional Mes As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -720,12 +720,12 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
#Region "GARANTIAS DETALLES" #Region "GARANTIAS DETALLES"
Public Function AddGarantiasDetalle(CveVentaDetalle As Integer, CvePS As Integer, CveFolioGarantia As Integer, CveTipoUso As Integer, Public Function AddGarantiasDetalle(CveVentaDetalle As Integer, CvePS As Integer, CveFolioGarantia As Integer, CveTipoUso As Integer,
CodigoEnsamble As String, CodigoLinea As String, CodigoInspeccion As String, CodigoEnsamble As String, CodigoLinea As String, CodigoInspeccion As String,
CveTipoDefecto As Integer, CodigoTD As String, TipoComprobante As Integer, Comprobante As String, Importe As Double, CveTipoDefecto As Integer, CodigoTD As String, TipoComprobante As Integer, Comprobante As String, Importe As Double,
@@ -741,18 +741,18 @@ Public Class ClsAcumuladores
.Add("@CodigoEnsamble", SqlDbType.VarChar).Value = CodigoEnsamble .Add("@CodigoEnsamble", SqlDbType.VarChar).Value = CodigoEnsamble
.Add("@CodigoLinea", SqlDbType.VarChar).Value = CodigoLinea .Add("@CodigoLinea", SqlDbType.VarChar).Value = CodigoLinea
.Add("@CodigoInspeccion", SqlDbType.VarChar).Value = CodigoInspeccion .Add("@CodigoInspeccion", SqlDbType.VarChar).Value = CodigoInspeccion
.Add("@CveTipoDefecto", SqlDbType.Int).Value = CveTipoDefecto .Add("@CveTipoDefecto", SqlDbType.Int).Value = CveTipoDefecto
.Add("@CodigoTD", SqlDbType.VarChar).Value = CodigoTD .Add("@CodigoTD", SqlDbType.VarChar).Value = CodigoTD
.Add("@TipoComprobante", SqlDbType.TinyInt).Value = TipoComprobante .Add("@TipoComprobante", SqlDbType.TinyInt).Value = TipoComprobante
.Add("@Comprobante", SqlDbType.VarChar).Value = Comprobante .Add("@Comprobante", SqlDbType.VarChar).Value = Comprobante
.Add("@Importe", SqlDbType.Float).Value = Importe .Add("@Importe", SqlDbType.Float).Value = Importe
.Add("@Consecutivo", SqlDbType.VarChar).Value = Consecutivo .Add("@Consecutivo", SqlDbType.VarChar).Value = Consecutivo
.Add("@FechaAjuste", SqlDbType.DateTime).Value = FechaAjuste .Add("@FechaAjuste", SqlDbType.DateTime).Value = FechaAjuste
.Add("@PorcentajeAjuste", SqlDbType.Float).Value = PorcentajeAjuste .Add("@PorcentajeAjuste", SqlDbType.Float).Value = PorcentajeAjuste
.Add("@CveBCIAjuste", SqlDbType.Int).Value = CveBCIAjuste .Add("@CveBCIAjuste", SqlDbType.Int).Value = CveBCIAjuste
.Add("@Etiqueta", SqlDbType.VarChar).Value = Etiqueta .Add("@Etiqueta", SqlDbType.VarChar).Value = Etiqueta
.Add("@CveClienteDistribuidor", SqlDbType.Int).Value = CveClienteDistribuidor .Add("@CveClienteDistribuidor", SqlDbType.Int).Value = CveClienteDistribuidor
.Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto .Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto
.Add("@Año", SqlDbType.VarChar).Value = Año .Add("@Año", SqlDbType.VarChar).Value = Año
End With End With
Try Try
@@ -762,9 +762,9 @@ Public Class ClsAcumuladores
OnError("Ocurrió un al agregar la garantia detalle. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un al agregar la garantia detalle. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetGarantiasDetalle(CveVenta As Integer) As Boolean Public Function GetGarantiasDetalle(CveVenta As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_GarantiasDetalleGet") SqlDataAdapter("PA_Acum_GarantiasDetalleGet")
@@ -778,7 +778,7 @@ Public Class ClsAcumuladores
OnError("Ocurrió un al obtener la garantía detalle. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un al obtener la garantía detalle. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetGarantiasPolizaVirtual(CveVenta As Integer, CveEmpresa As Integer) As Boolean Public Function GetGarantiasPolizaVirtual(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_GarantiasPolizaVirtualGet") SqlDataAdapter("PA_Acum_GarantiasPolizaVirtualGet")
@@ -793,8 +793,8 @@ Public Class ClsAcumuladores
OnError("Ocurrió un al obtener la información de poliza virtual.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un al obtener la información de poliza virtual.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function UpdateGarantiasDetallePoliza(CveVenta As Integer, FolioPolizaVirtual As String) As Boolean Public Function UpdateGarantiasDetallePoliza(CveVenta As Integer, FolioPolizaVirtual As String) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_GarantiasDetallePolizaUpdate") SqlDataAdapter("PA_Acum_GarantiasDetallePolizaUpdate")
@@ -809,8 +809,8 @@ Public Class ClsAcumuladores
OnError("Ocurrió un error a actualizar folio de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error a actualizar folio de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function EliminarGarantiasDetalle(CveVenta As Integer) As Boolean Public Function EliminarGarantiasDetalle(CveVenta As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_GarantiasDetallePolizaRemove") SqlDataAdapter("PA_Acum_GarantiasDetallePolizaRemove")
@@ -824,13 +824,13 @@ Public Class ClsAcumuladores
OnError("Ocurrió un error a eliminar de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error a eliminar de garantia.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
#Region "P O L I Z A - V I R T U A L" #Region "P O L I Z A - V I R T U A L"
Public Function AddPolizaVirtual(CveVenta As Integer, CveVentaDetalle As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Total As Decimal, Public Function AddPolizaVirtual(CveVenta As Integer, CveVentaDetalle As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Total As Decimal,
TipoServicio As Integer, TipoPoliza As Integer, CveModeloAuto As Integer, AnioVehiculo As Integer, TieneUsado As Boolean, FechaUsado As DateTime, TipoServicio As Integer, TipoPoliza As Integer, CveModeloAuto As Integer, AnioVehiculo As Integer, TieneUsado As Boolean, FechaUsado As DateTime,
CvePSUsado As Integer, CveBCIUsado As Integer, CveMarcaUsado As Integer) As Boolean CvePSUsado As Integer, CveBCIUsado As Integer, CveMarcaUsado As Integer) As Boolean
@@ -841,16 +841,16 @@ Public Class ClsAcumuladores
.Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle .Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle
.Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@Cantidad", SqlDbType.Float).Value = Cantidad .Add("@Cantidad", SqlDbType.Float).Value = Cantidad
.Add("@PU", SqlDbType.Money).Value = PU .Add("@PU", SqlDbType.Money).Value = PU
.Add("@Descuento", SqlDbType.Money).Value = Descuento .Add("@Descuento", SqlDbType.Money).Value = Descuento
.Add("@Total", SqlDbType.Money).Value = Total .Add("@Total", SqlDbType.Money).Value = Total
.Add("@TipoServicio", SqlDbType.Int).Value = TipoServicio .Add("@TipoServicio", SqlDbType.Int).Value = TipoServicio
.Add("@TipoPoliza", SqlDbType.Int).Value = TipoPoliza .Add("@TipoPoliza", SqlDbType.Int).Value = TipoPoliza
.Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto .Add("@CveModeloAuto", SqlDbType.Int).Value = CveModeloAuto
.Add("@AnioVehiculo", SqlDbType.Int).Value = AnioVehiculo .Add("@AnioVehiculo", SqlDbType.Int).Value = AnioVehiculo
.Add("@TieneUsado", SqlDbType.Bit).Value = TieneUsado .Add("@TieneUsado", SqlDbType.Bit).Value = TieneUsado
.Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado .Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado
.Add("@CvePSUsado", SqlDbType.Int).Value = CvePSUsado .Add("@CvePSUsado", SqlDbType.Int).Value = CvePSUsado
.Add("@CveBCIUsado", SqlDbType.Int).Value = CveBCIUsado .Add("@CveBCIUsado", SqlDbType.Int).Value = CveBCIUsado
.Add("@CveMarcaUsado", SqlDbType.Int).Value = CveMarcaUsado .Add("@CveMarcaUsado", SqlDbType.Int).Value = CveMarcaUsado
End With End With
@@ -861,7 +861,7 @@ Public Class ClsAcumuladores
OnError("Ocurrió un al agregar la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un al agregar la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetPolizasVirtuales(CveVenta As Integer) As Boolean Public Function GetPolizasVirtuales(CveVenta As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualGet") SqlDataAdapter("PA_Vta_PolizaVirtualGet")
@@ -875,14 +875,14 @@ Public Class ClsAcumuladores
OnError("Ocurrió un al obtener la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un al obtener la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function UpdatePolizaVirtual(CvePolizaVirtual As Integer, CveMarca As Integer, FechaUsado As DateTime) As Boolean Public Function UpdatePolizaVirtual(CvePolizaVirtual As Integer, CveMarca As Integer, FechaUsado As DateTime) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualUpdate") SqlDataAdapter("PA_Vta_PolizaVirtualUpdate")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual .Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual
.Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@CveMarca", SqlDbType.Int).Value = CveMarca
.Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado .Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado
End With End With
Try Try
@@ -892,15 +892,15 @@ Public Class ClsAcumuladores
OnError("Ocurrió un al actualizar el envio de la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un al actualizar el envio de la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function UpdateEnvioPolizaVirtual(CvePolizaVirtual As Integer, Envio As Boolean, FechaEnvio As DateTime, CodigoUnico As String, RespuestaEnvio As String) As Boolean Public Function UpdateEnvioPolizaVirtual(CvePolizaVirtual As Integer, Envio As Boolean, FechaEnvio As DateTime, CodigoUnico As String, RespuestaEnvio As String) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualEnvioUpdate") SqlDataAdapter("PA_Vta_PolizaVirtualEnvioUpdate")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual .Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual
.Add("@Envio", SqlDbType.TinyInt).Value = Envio .Add("@Envio", SqlDbType.TinyInt).Value = Envio
.Add("@FechaEnvio", SqlDbType.DateTime).Value = FechaEnvio .Add("@FechaEnvio", SqlDbType.DateTime).Value = FechaEnvio
.Add("@CodigoUnico", SqlDbType.VarChar).Value = CodigoUnico .Add("@CodigoUnico", SqlDbType.VarChar).Value = CodigoUnico
.Add("@RespuestaEnvio", SqlDbType.VarChar).Value = RespuestaEnvio .Add("@RespuestaEnvio", SqlDbType.VarChar).Value = RespuestaEnvio
End With End With
Try Try
@@ -910,8 +910,8 @@ Public Class ClsAcumuladores
OnError("Ocurrió un al actualizar el envio de la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un al actualizar el envio de la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function EliminarPolizaVirtual(CveVenta As Integer) As Boolean Public Function EliminarPolizaVirtual(CveVenta As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualRemove") SqlDataAdapter("PA_Vta_PolizaVirtualRemove")
@@ -925,11 +925,12 @@ Public Class ClsAcumuladores
OnError("Ocurrió un al eliminar poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un al eliminar poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
#End Region #End Region
Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Decimal, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer, Public Function DistribuidorMovtosAdd(CveCliente As Integer, Cantidad As Decimal, CveTamaño As Integer, CveConcepto As Integer, CveVenta As Integer, CveUsuario As Integer,
CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String, FechaIng As DateTime, Optional CveMovimiento As Integer = -1) As Boolean CveEmpresa As Integer, ImporteCompras As Decimal, Observaciones As String, FechaIng As DateTime, Optional CveMovimiento As Integer = -1,
Optional CveVentaBonificacion As Integer = -1, Optional FacturadoBonificacion As Boolean = False) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -947,6 +948,8 @@ Public Class ClsAcumuladores
.Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones
.Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento
.Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng .Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng
.Add("@CveVentaBonificacion", SqlDbType.Int).Value = CveVentaBonificacion
.Add("@FacturadoBonificacion", SqlDbType.Bit).Value = FacturadoBonificacion
End With End With
Try Try
@@ -983,8 +986,8 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetMovimientosDistribuidorResumen(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha) As Boolean Public Function GetMovimientosDistribuidorResumen(CveCliente As Integer, CveEmpresa As Integer, Optional FechaI As Date = MinFecha, Optional FechaF As Date = MaxFecha) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -1076,8 +1079,8 @@ Public Class ClsAcumuladores
OnError("Ocurrió un error al consultar el reporte de usados. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error al consultar el reporte de usados. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function EntradasUsadosClientesRep(CveAlmacen As Integer, FechaI As Date, FechaF As Date, CveUsuario As Integer, CveEmpresa As Integer, Optional CveCliente As Integer = -1) As Boolean Public Function EntradasUsadosClientesRep(CveAlmacen As Integer, FechaI As Date, FechaF As Date, CveUsuario As Integer, CveEmpresa As Integer, Optional CveCliente As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -1085,10 +1088,10 @@ Public Class ClsAcumuladores
SqlDataAdapter("PA_Acum_EntradasUsadosClientesGet") SqlDataAdapter("PA_Acum_EntradasUsadosClientesGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
.Add("@FechaInicio", SqlDbType.Date).Value = FechaI .Add("@FechaInicio", SqlDbType.Date).Value = FechaI
.Add("@FechaFin", SqlDbType.Date).Value = FechaF .Add("@FechaFin", SqlDbType.Date).Value = FechaF
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
@@ -1104,8 +1107,8 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function EntradasUsadosClientesDetalleRep(EsDistribuidor As Boolean, CveCliente As Integer, CvePS As Integer, FechaInicio As Date, FechaFin As Date, CveAlmacen As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Public Function EntradasUsadosClientesDetalleRep(EsDistribuidor As Boolean, CveCliente As Integer, CvePS As Integer, FechaInicio As Date, FechaFin As Date, CveAlmacen As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
@@ -1116,10 +1119,10 @@ Public Class ClsAcumuladores
.Add("@EsDistribuidor", SqlDbType.Bit).Value = If(EsDistribuidor, 1, 0) .Add("@EsDistribuidor", SqlDbType.Bit).Value = If(EsDistribuidor, 1, 0)
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With End With
@@ -1133,25 +1136,25 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetRepIndicadorDiario(FechaInicio As Date, FechaFin As Date, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Public Function GetRepIndicadorDiario(FechaInicio As Date, FechaFin As Date, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_RepIndicadorDiarioGet") SqlDataAdapter("PA_Acum_RepIndicadorDiarioGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
Retorno = True Retorno = True
@@ -1162,25 +1165,25 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetRepIndicadorDiarioDetalle(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Public Function GetRepIndicadorDiarioDetalle(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveSubProyecto As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_RepIndicadorDiarioDetalleGet") SqlDataAdapter("PA_Acum_RepIndicadorDiarioDetalleGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@Opcion", SqlDbType.Int).Value = Opcion .Add("@Opcion", SqlDbType.Int).Value = Opcion
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
Retorno = True Retorno = True
@@ -1191,22 +1194,22 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetUsadosClasificacionVentas(CveCliente As Integer, CvePS As Integer, FechaInicio As String, FechaFin As String) As Boolean Public Function GetUsadosClasificacionVentas(CveCliente As Integer, CvePS As Integer, FechaInicio As String, FechaFin As String) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_UsadosClasificacionVentas") SqlDataAdapter("PA_Acum_UsadosClasificacionVentas")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
Retorno = True Retorno = True
Catch ex As SqlException Catch ex As SqlException
@@ -1214,15 +1217,15 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetFoliosGarantiasDetalle(CveFolioGarantia As Integer, Optional CveGarantiaDetalle As Integer = -1, Optional CveEstatusConsecutivo As Integer = -1, Optional Consec As Integer = -1) As Boolean Public Function GetFoliosGarantiasDetalle(CveFolioGarantia As Integer, Optional CveGarantiaDetalle As Integer = -1, Optional CveEstatusConsecutivo As Integer = -1, Optional Consec As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_GarantiasDetalleFolioGet") SqlDataAdapter("PA_Acum_GarantiasDetalleFolioGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia .Add("@CveFolioGarantia", SqlDbType.Int).Value = CveFolioGarantia
.Add("@CveGarantiaDetalle", SqlDbType.Int).Value = CveGarantiaDetalle .Add("@CveGarantiaDetalle", SqlDbType.Int).Value = CveGarantiaDetalle
.Add("@CveEstatusConsecutivo", SqlDbType.Int).Value = CveEstatusConsecutivo .Add("@CveEstatusConsecutivo", SqlDbType.Int).Value = CveEstatusConsecutivo
.Add("@Consec", SqlDbType.Int).Value = Consec .Add("@Consec", SqlDbType.Int).Value = Consec
@@ -1236,8 +1239,8 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function UpdateGarantiaCancelacion(CveVenta As Integer) As Boolean Public Function UpdateGarantiaCancelacion(CveVenta As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
@@ -1255,17 +1258,17 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetSabanaVenta(Fecha As Date, CveOpcion As Integer, CveEmpresa As Integer) As Boolean Public Function GetSabanaVenta(Fecha As Date, CveOpcion As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Acum_SabanaVentaGet") SqlDataAdapter("PA_Acum_SabanaVentaGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@Fecha", SqlDbType.Date).Value = Fecha .Add("@Fecha", SqlDbType.Date).Value = Fecha
.Add("@Opcion", SqlDbType.Int).Value = CveOpcion .Add("@Opcion", SqlDbType.Int).Value = CveOpcion
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With End With
@@ -1278,19 +1281,19 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
Public Function GetPolizaVirtualRep(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, CveUsuario As Integer) As Boolean Public Function GetPolizaVirtualRep(FechaInicio As Date, FechaFin As Date, Opcion As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, CveUsuario As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualRepGet") SqlDataAdapter("PA_Vta_PolizaVirtualRepGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@FechaFin", SqlDbType.Date).Value = FechaFin
.Add("@Opcion", SqlDbType.Int).Value = Opcion .Add("@Opcion", SqlDbType.Int).Value = Opcion
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
@@ -1304,20 +1307,20 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function End Function
#Region " IDisposable Support " #Region " IDisposable Support "
' IDisposable ' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean) Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not disposedValue Then If Not disposedValue Then
If disposing Then If disposing Then
If Not Data Is Nothing Then Data.Dispose() : Data = Nothing If Not Data Is Nothing Then Data.Dispose() : Data = Nothing
If Not DSet Is Nothing Then DSet.Dispose() : DSet = Nothing If Not DSet Is Nothing Then DSet.Dispose() : DSet = Nothing
If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() : SqlAdapter = Nothing
If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing If Not SqlTransacc Is Nothing Then SqlTransacc.Dispose() : SqlTransacc = Nothing
If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close() If SqlConexion.State <> ConnectionState.Closed Then SqlConexion.Close()
If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing If Not SqlConexion Is Nothing Then SqlConexion.Dispose() : SqlConexion = Nothing
End If End If
@@ -1334,7 +1337,7 @@ Public Class ClsAcumuladores
ConexionClose() ConexionClose()
Dispose(True) Dispose(True)
GC.SuppressFinalize(Me) GC.SuppressFinalize(Me)
End Sub End Sub
#End Region #End Region
End Class End Class

View File

@@ -379,7 +379,7 @@ Namespace Modelos
End If End If
Timbre = New CFDITimbre Timbre = New CFDITimbre
End Sub End Sub
Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "", Optional EsCancelacion As Boolean = False, Optional CargaDTDetalle As Boolean = True, Optional CargaDatosCliente As Boolean = True, Optional CargaDatosRelacionados As Boolean = True) Public Sub New(UsuarioActual As Usuario, CveVenta As Integer, CveEmpresa As Integer, Optional DirectorioServidor As String = "", Optional EsCancelacion As Boolean = False, Optional CargaDTDetalle As Boolean = True, Optional CargaDatosCliente As Boolean = True, Optional CargaDatosRelacionados As Boolean = True, Optional VerificaAlmacen As Boolean = True)
Me.UsuarioActual = UsuarioActual Me.UsuarioActual = UsuarioActual
Me.CveVenta = CveVenta Me.CveVenta = CveVenta
Me.CveEmpresa = CveEmpresa Me.CveEmpresa = CveEmpresa
@@ -391,7 +391,7 @@ Namespace Modelos
IniciaValores() IniciaValores()
Dim ObjVentas As New ClsVentas() Dim ObjVentas As New ClsVentas()
If ObjVentas.GetVenta(CveVenta, CveEmpresa) Then If ObjVentas.GetVenta(CveVenta, CveEmpresa, VerificaAlmacen:=VerificaAlmacen) Then
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
setValues(ObjVentas.DtResultados.Rows(0)) setValues(ObjVentas.DtResultados.Rows(0))
@@ -2101,21 +2101,34 @@ Namespace Modelos
Case "Egs" Case "Egs"
CveConcepto = 6 CveConcepto = 6
End Select End Select
'SI ES FACTURA,NC,DEV O ES RNC DE CARGO, CANCELAR MOVIMIENTOS
If factura.TipoDocto.Contiene("Ing", "Dev", "Egs") OrElse factura.TipoDocto.Contiene("RNC") AndAlso factura.Num1 = 1 Then
If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=CveConcepto) Then
Dim DtMovimientos As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0")
If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then
For Each RowSalida As DataRow In DtMovimientos.Rows
Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1
If ObjAcum.DistribuidorMovtosGet(factura.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=factura.CveVenta, CveConcepto:=CveConcepto) Then Dim FacturadoBonificacion = False
Dim DtMovimientos As DataTable = ObjAcum.DtResultados.FiltraParametros("Cantidad > 0") Dim CveVentaBonificacion As Integer = -1
If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then
For Each RowSalida As DataRow In DtMovimientos.Rows
Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha) Then If factura.TipoDocto = "RNC" Then
Retorno = False CveVentaBonificacion = RowSalida("CveVentaBonificacion").ToString().ToEntero()
Exit For FacturadoBonificacion = CBool(RowSalida("FacturadoBonificacion").ToString())
End If End If
Next
DtMovimientos.Dispose() If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, RowSalida("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", factura.Fecha, CveVentaBonificacion:=CveVentaBonificacion, FacturadoBonificacion:=FacturadoBonificacion) Then
Retorno = False
Exit For
End If
Next
DtMovimientos.Dispose()
End If
End If End If
Else
End If End If
Return Retorno Return Retorno
End Function End Function
@@ -2217,7 +2230,7 @@ Namespace Modelos
End Function End Function
Private Function CancelarInventarioUsado(factura As Modelos.Factura, CveAlmacenUsado As Integer, CveMovimientoEntrada As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad) As Integer Private Function CancelarInventarioUsado(factura As Modelos.Factura, CveAlmacenUsado As Integer, CveMovimientoEntrada As Integer, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, Optional GenerarPrePoliza As Boolean = True) As Integer
Dim CveMovimiento As Integer = -1 Dim CveMovimiento As Integer = -1
Try Try
Dim CveConceptoSalidaUsado As Integer = 45 Dim CveConceptoSalidaUsado As Integer = 45
@@ -2240,7 +2253,7 @@ Namespace Modelos
End If End If
Next Next
If CveMovimiento > 0 Then If GenerarPrePoliza AndAlso CveMovimiento > 0 Then
Dim Concepto As String = "Cancelación Usado" & factura.SerieFolio Dim Concepto As String = "Cancelación Usado" & factura.SerieFolio
Dim CvePrePoliza = ObjConta.AddPrePolizas("Mod/CancSalUsados", 74, DtMovimientosEntrada.SUMD("Total"), DtMovimientosEntrada.SUMD("Total"), 1, tFecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Dim CvePrePoliza = ObjConta.AddPrePolizas("Mod/CancSalUsados", 74, DtMovimientosEntrada.SUMD("Total"), DtMovimientosEntrada.SUMD("Total"), 1, tFecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero Dim tCveSubProyecto = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", $"CveAlmacen={CveAlmacen}").ToEntero
@@ -2498,7 +2511,7 @@ Namespace Modelos
Dim TipoMovto68 = TipoMovimiento Dim TipoMovto68 = TipoMovimiento
'SI ES CANCELACION DEBE GENERAR EL MOVIMIENTO DE SALIDA DE USADOS 'SI ES CANCELACION DEBE GENERAR EL MOVIMIENTO DE SALIDA DE USADOS
If ValorMultiplicador = -1 Then If ValorMultiplicador = -1 Then
CveMovimientoReferencia = CancelarInventarioUsado(ObjFactura, CveAlmacen, CveMovimiento, ObjInventario, ObjConta) CveMovimientoReferencia = CancelarInventarioUsado(ObjFactura, CveAlmacen, CveMovimiento, ObjInventario, ObjConta, GenerarPrePoliza:=False)
Else Else
CveMovimientoReferencia = CveMovimiento CveMovimientoReferencia = CveMovimiento
End If End If
@@ -5675,6 +5688,11 @@ Namespace Modelos
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10") DtMovRemision = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 10")
CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 1").ToString().ToEntero() CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 1").ToString().ToEntero()
'SI ES SERVICIO A DOMICILIO DEBE REGRESAR A ESTE TIPO DE ALMACEN
If Me.ServicioDomicilio Then
CveAlmacenGeneral = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 29").ToString().ToEntero()
End If
CveAlmacenExA = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 10").ToString().ToEntero() CveAlmacenExA = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CveTipoAlmacen = 10").ToString().ToEntero()
CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero() CveMovimientoUsado = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero()

View File

@@ -2278,7 +2278,7 @@ Partial Class Inventarios_RecepcionUsados
Me.ObjFactura = Nothing Me.ObjFactura = Nothing
End If End If
Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, CargaDatosCliente:=False, CargaDatosRelacionados:=False) Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas, CargaDatosCliente:=False, CargaDatosRelacionados:=False, VerificaAlmacen:=False)
If Me.ObjFactura IsNot Nothing Then If Me.ObjFactura IsNot Nothing Then