--6 Facturación Global Ferretera, 50, optimización.
This commit is contained in:
@@ -6426,6 +6426,26 @@ Public Class ClsInventarios
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Function GetVentasRemisionesInventario(Ventas As String, CveEmpresa As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Inv_VentasRemisionesInventarioGet")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@Ventas", SqlDbType.VarChar).Value = Ventas
|
||||||
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al obtener el inventario de las remisiones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
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)
|
||||||
|
|||||||
@@ -4521,7 +4521,7 @@ Namespace Modelos
|
|||||||
Private Function GuardarVentaInventarios(ByRef Resp As MMensajeFactura, ByRef factura As Modelos.Factura, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, ObjVentas As ClsVentas, ObjAcum As ClsAcumuladores) As Boolean
|
Private Function GuardarVentaInventarios(ByRef Resp As MMensajeFactura, ByRef factura As Modelos.Factura, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, ObjVentas As ClsVentas, ObjAcum As ClsAcumuladores) As Boolean
|
||||||
Dim OcurrioError As Boolean = False
|
Dim OcurrioError As Boolean = False
|
||||||
|
|
||||||
If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then
|
If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
|
||||||
|
|
||||||
If factura.GenerarSalidaAlmacen AndAlso factura.CveAlmacen > 0 AndAlso DtInventario.Rows.Count > 0 Then
|
If factura.GenerarSalidaAlmacen AndAlso factura.CveAlmacen > 0 AndAlso DtInventario.Rows.Count > 0 Then
|
||||||
Dim CveMovimientoInventario As Integer = GenerarMovimientoAlmacenServicioDomicilio(ObjInventario, factura, factura.DtInventario, factura.CveAlmacen, 3, factura.CveMoneda, factura.CveVenta, "Modelos/SA", MovimientoPrePoliza:=True, ObjConta:=ObjConta)
|
Dim CveMovimientoInventario As Integer = GenerarMovimientoAlmacenServicioDomicilio(ObjInventario, factura, factura.DtInventario, factura.CveAlmacen, 3, factura.CveMoneda, factura.CveVenta, "Modelos/SA", MovimientoPrePoliza:=True, ObjConta:=ObjConta)
|
||||||
@@ -4549,13 +4549,38 @@ Namespace Modelos
|
|||||||
'End If
|
'End If
|
||||||
|
|
||||||
If RemisionesLista IsNot Nothing AndAlso factura.TipoDocto = "Ing" AndAlso RemisionesLista.Count > 0 Then
|
If RemisionesLista IsNot Nothing AndAlso factura.TipoDocto = "Ing" AndAlso RemisionesLista.Count > 0 Then
|
||||||
For Each CveRemision As Integer In RemisionesLista
|
|
||||||
'El almacen general es el Primer Almacen de Material en la Sucursal
|
If factura.EsFacturaGlobal Then
|
||||||
If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9, factura.EsFacturaGlobal) Then
|
Dim DtMovimientosRemisiones As DataTable = Nothing
|
||||||
OcurrioError = True
|
|
||||||
Exit For
|
Dim SbRemisiones As New StringBuilder()
|
||||||
|
|
||||||
|
For Each CveRem In RemisionesLista
|
||||||
|
SbRemisiones.AppendFormat("{0},", CveRem)
|
||||||
|
Next
|
||||||
|
|
||||||
|
SbRemisiones.Remove(SbRemisiones.Length - 1, 1)
|
||||||
|
|
||||||
|
If ObjInventario.GetVentasRemisionesInventario(SbRemisiones.ToString(), UsuarioActual.CveEmpresa) Then
|
||||||
|
DtMovimientosRemisiones = ObjInventario.DtResultados.Copy()
|
||||||
End If
|
End If
|
||||||
Next
|
|
||||||
|
If DtMovimientosRemisiones IsNot Nothing Then
|
||||||
|
If Not TraspasoAlmacenFacturaGlobal(DtMovimientosRemisiones, ObjInventario, ObjConta) Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
For Each CveRemision As Integer In RemisionesLista
|
||||||
|
'El almacen general es el Primer Almacen de Material en la Sucursal
|
||||||
|
If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9, factura.EsFacturaGlobal) Then
|
||||||
|
OcurrioError = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If factura.TipoDocto = "Rem" AndAlso factura.ServicioDomicilio Then
|
If factura.TipoDocto = "Rem" AndAlso factura.ServicioDomicilio Then
|
||||||
@@ -4908,6 +4933,37 @@ Namespace Modelos
|
|||||||
End Try
|
End Try
|
||||||
Return Not OcurrioError
|
Return Not OcurrioError
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Private Function TraspasoAlmacenFacturaGlobal(DtMovimientosRemisiones As DataTable, ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad) As Boolean
|
||||||
|
Dim OcurrioError As Boolean = False
|
||||||
|
Try
|
||||||
|
Dim DtMovimientos As DataTable = DtMovimientosRemisiones.FiltraParametros("", DistinctColumns:={"CveMovimiento", "CveAlmacen"})
|
||||||
|
|
||||||
|
For Each RowMovto As DataRow In DtMovimientos.Rows
|
||||||
|
Dim CveAlmacenParaSalida As Integer = RowMovto("CveAlmacen").ToString().ToEntero()
|
||||||
|
Dim CveConceptoSalidaAlmacen As Integer = 40
|
||||||
|
|
||||||
|
Dim MovDetalle As DataTable = DtMovimientosRemisiones.FiltraParametros($"CveMovimiento = {RowMovto("CveMovimiento")}")
|
||||||
|
|
||||||
|
Dim CveMovimientoSalidaAlmacen As Integer = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenParaSalida, CveConceptoSalidaAlmacen, Me.CveMoneda, Me.CveVenta, AplicaMovimientoDetalleEntrada:=True, MovimientoPrePoliza:=True, ObjConta:=ObjConta)
|
||||||
|
Dim GeneroMovimientoAlmacen = CveMovimientoSalidaAlmacen > 0
|
||||||
|
|
||||||
|
If Not GeneroMovimientoAlmacen Then
|
||||||
|
OcurrioError = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OcurrioError = True
|
||||||
|
OnError("Ocurrió un error al realizar el traspaso", ex)
|
||||||
|
End Try
|
||||||
|
Return Not OcurrioError
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
Private Function GenerarMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, DtMovDetalle As DataTable, CveAlmacen As Integer, ConceptoEntrada As Integer, CveMoneda As Integer, CveVenta As Integer, Optional MovimientoPrePoliza As Boolean = True,
|
Private Function GenerarMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, DtMovDetalle As DataTable, CveAlmacen As Integer, ConceptoEntrada As Integer, CveMoneda As Integer, CveVenta As Integer, Optional MovimientoPrePoliza As Boolean = True,
|
||||||
Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False,
|
Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False,
|
||||||
Optional CveAlmacenDestino As Integer = -1) As Integer
|
Optional CveAlmacenDestino As Integer = -1) As Integer
|
||||||
|
|||||||
Reference in New Issue
Block a user