Correcion en validacion de facturacion de remisiones
This commit is contained in:
@@ -11600,7 +11600,7 @@ Partial Class Ventas
|
||||
'INVENTARIOS
|
||||
If ErrorList.Count = 0 Then
|
||||
If Not EsNCAmortizacion AndAlso Not NCDescuento Then
|
||||
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
||||
If GuardarVentaInventarios(ObjInventario, ObjVentas, ObjConta, factura) Then
|
||||
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
||||
End If
|
||||
End If
|
||||
@@ -13230,7 +13230,7 @@ Partial Class Ventas
|
||||
End Try
|
||||
|
||||
End Function
|
||||
Private Function GuardarVentaInventarios(ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, factura As Modelos.Factura) As Boolean
|
||||
Private Function GuardarVentaInventarios(ObjInventario As ClsInventarios, ObjVentas As ClsVentas, ObjConta As ClsContabilidad, factura As Modelos.Factura) As Boolean
|
||||
Dim OcurrioError As Boolean = False
|
||||
Try
|
||||
|
||||
@@ -13239,7 +13239,7 @@ Partial Class Ventas
|
||||
If RemisionesLista.Count > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
|
||||
For Each CveRemision As Integer In RemisionesLista
|
||||
'El almacen general es el Primer Almacen de Material en la Sucursal
|
||||
If Not TraspasoAlmacen(ObjInventario, CveRemision, ObjConta, True, 9) Then
|
||||
If Not TraspasoAlmacen(ObjInventario, ObjVentas, CveRemision, ObjConta, True, 9) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -18665,7 +18665,7 @@ Partial Class Ventas
|
||||
gvr.FCDropDownList("DdlUnidadMedida").DataBind()
|
||||
|
||||
End Sub
|
||||
Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
|
||||
Private Function TraspasoAlmacen(ByRef ObjInventario As ClsInventarios, ByRef ObjVentas As ClsVentas, CveRemision As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
|
||||
Dim OcurrioError As Boolean = False
|
||||
Try
|
||||
Dim DtMovimientos As DataTable
|
||||
@@ -18747,9 +18747,9 @@ Partial Class Ventas
|
||||
MovDetalle = DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}")
|
||||
Else
|
||||
If TieneMovimientosContrato Then
|
||||
MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"))
|
||||
MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"))
|
||||
Else
|
||||
MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND (TieneSalidaxFactura IS NULL OR SaldoAlmacen > 0)"))
|
||||
MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")} AND (TieneSalidaxFactura IS NULL OR SaldoAlmacen > 0)"))
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -18761,26 +18761,12 @@ Partial Class Ventas
|
||||
Dim CveMovimientoSalidaPorTraspaso As Integer = -1
|
||||
Dim CveConceptoSalidaAlmacen As Integer = 3
|
||||
Dim CveAlmacenParaSalida As Integer = CveAlmacenEntrada
|
||||
|
||||
'SALIDA DEFINITIVA DEL SISTEMA
|
||||
If UsuarioActual.Empresa.Funcionalidad(575) = "1" Then
|
||||
CveConceptoSalidaAlmacen = 40
|
||||
CveAlmacenParaSalida = CveAlmacenSalida
|
||||
AplicaMovimientoDetalleEntrada = True
|
||||
''Le damos salida normal
|
||||
'If ConSalida Then
|
||||
' GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 40, CveMoneda, CveVenta, AplicaMovimientoDetalleEntrada:=AplicaMovimientoDetalleEntrada, MovimientoPrePoliza:=True, ObjConta:=ObjConta) > 0
|
||||
|
||||
' If Not GeneroMovimientoAlmacen Then
|
||||
' OcurrioError = True
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
' If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
' If Not GeneroMovimientoAlmacen Then
|
||||
' OcurrioError = Not GenerarMovimientoAlmacenVirtual(CveRemision, ObjInventario, ObjFactura)
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
Else
|
||||
'Le damos salida de apartado por traspaso
|
||||
CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=AplicaMovimientoDetalleEntrada)
|
||||
@@ -18820,19 +18806,10 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
OcurrioError = True
|
||||
Alert("Error traspaso almacen(sin Movtos. Detalle). Por favor comuniquese con atención SIG.", TipoMensaje.ToastError)
|
||||
End If
|
||||
|
||||
MovDetalle.Dispose()
|
||||
|
||||
'VERIFICA QUE SE HAYA GENERADO MOVIMIENTO DE ALMACEN
|
||||
If Not OcurrioError Then
|
||||
OcurrioError = Not GeneroMovimientoAlmacen
|
||||
End If
|
||||
|
||||
If OcurrioError Then
|
||||
Exit For
|
||||
End If
|
||||
@@ -18841,12 +18818,6 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
ElseIf ObjInventario.GetMovimientos(dr("CveMovimiento").ToString().ToEntero(), 3, -1, UsuarioActual.CveEmpresa) Then
|
||||
'Esquema viejo, evitamos que aparezca por surtir
|
||||
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If OcurrioError Then
|
||||
@@ -18854,6 +18825,24 @@ Partial Class Ventas
|
||||
End If
|
||||
Next
|
||||
|
||||
'VERIFICA QUE SE HAYA GENERADO MOVIMIENTO DE ALMACEN
|
||||
If Not OcurrioError Then
|
||||
OcurrioError = Not GeneroMovimientoAlmacen
|
||||
End If
|
||||
|
||||
'VERIFICA SI YA SE GENERARON LAS SALIDAS DE ALMACEN NECESARIAS
|
||||
If Not OcurrioError AndAlso RemisionesLista.Count > 0 AndAlso DtRemConceptosSurtidos IsNot Nothing Then
|
||||
If DtRemConceptosSurtidos.SUMD("Surtido") <> DtRemConceptosSurtidos.SUMD("Cantidad") Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso ConSalida Then
|
||||
'Esquema viejo, evitamos que aparezca por surtir
|
||||
If Not ObjInventario.ActualizarEsDevolucionVenta(ObjFactura.CveVenta, 2) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
@@ -18862,31 +18851,59 @@ Partial Class Ventas
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'LIMPIAR EL DT DE CONCEPTOS SURTIDOS
|
||||
If DtRemConceptosSurtidos IsNot Nothing Then
|
||||
DtRemConceptosSurtidos.Clear()
|
||||
DtRemConceptosSurtidos = Nothing
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OcurrioError = True
|
||||
OnError("Ocurrió un error al realizar el traspaso", ex)
|
||||
End Try
|
||||
Return Not OcurrioError
|
||||
End Function
|
||||
Private Function CuadrarFacturaMovimientos(MovDetalle As DataTable) As DataTable
|
||||
Private Function CuadrarFacturaMovimientos(ByRef ObjVentas As ClsVentas, CveRemision As Integer, MovDetalle As DataTable) As DataTable
|
||||
Dim MovDTCuadrados As New DataTable
|
||||
MovDTCuadrados = MovDetalle.Clone
|
||||
MovDTCuadrados.Clear()
|
||||
|
||||
'Llenamos el DT solo si es primera llamada
|
||||
If DtRemConceptosSurtidos Is Nothing Then
|
||||
DtRemConceptosSurtidos = New DataTable
|
||||
DtRemConceptosSurtidos.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
DtRemConceptosSurtidos.Columns.Add("Cantidad", GetType(Decimal))
|
||||
DtRemConceptosSurtidos.Columns.Add("Surtido", GetType(Decimal))
|
||||
Dim DtDetalleRemision As DataTable = Nothing
|
||||
Dim StrCveVentasDetalle As New StringBuilder()
|
||||
|
||||
For Each dr As DataRow In DtRemisionesTmpDT.Rows
|
||||
Dim dtr As DataRow = DtRemConceptosSurtidos.NewRow
|
||||
dtr("CveVentaDetalle") = dr("CveVentaDetalle")
|
||||
dtr("Cantidad") = dr("Cantidad")
|
||||
dtr("Surtido") = 0
|
||||
DtRemConceptosSurtidos.Rows.Add(dtr)
|
||||
If ObjVentas.GetVentaDetalle(CveRemision) Then
|
||||
DtDetalleRemision = ObjVentas.DtResultados.FiltraParametros("", DistinctColumns:={"CveVenta", "CveVentaDetalle"})
|
||||
End If
|
||||
|
||||
For Each RowDetalle As DataRow In DtDetalleRemision.Rows
|
||||
StrCveVentasDetalle.AppendFormat("{0},", RowDetalle("CveVentaDetalle"))
|
||||
Next
|
||||
|
||||
If StrCveVentasDetalle.Length > 0 Then
|
||||
StrCveVentasDetalle.Remove(StrCveVentasDetalle.Length - 1, 1)
|
||||
End If
|
||||
|
||||
If DtDetalleRemision IsNot Nothing Then
|
||||
|
||||
DtRemConceptosSurtidos = New DataTable
|
||||
DtRemConceptosSurtidos.Columns.Add("CveRemision", GetType(Integer))
|
||||
DtRemConceptosSurtidos.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
DtRemConceptosSurtidos.Columns.Add("Cantidad", GetType(Decimal))
|
||||
DtRemConceptosSurtidos.Columns.Add("Surtido", GetType(Decimal))
|
||||
|
||||
'VERIFICA SOLO LOS QUE SON TIPO PRODUCTOS
|
||||
For Each dr As DataRow In DtRemisionesTmpDT.FiltraParametros($"CveTipoPS = 2 AND CveVentaDetalle IN ({StrCveVentasDetalle.ToString()})").Rows
|
||||
Dim dtr As DataRow = DtRemConceptosSurtidos.NewRow
|
||||
dtr("CveRemision") = CveRemision
|
||||
dtr("CveVentaDetalle") = dr("CveVentaDetalle")
|
||||
dtr("Cantidad") = dr("Cantidad")
|
||||
dtr("Surtido") = 0
|
||||
DtRemConceptosSurtidos.Rows.Add(dtr)
|
||||
Next
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
For Each dr As DataRow In MovDetalle.Rows
|
||||
@@ -29633,6 +29650,9 @@ Partial Class Ventas
|
||||
LbAgregar.Enabled = True
|
||||
LnkAgregarPyME.Enabled = True
|
||||
|
||||
ImgDescPU.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '0'; $get('LblPrecio1').style.display = ''; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
|
||||
ImgDescConcepto.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '1'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = ''; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
|
||||
ImgDescTotal.Visible = False
|
||||
ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
|
||||
|
||||
TxtMotivoDescuento.Enabled = True
|
||||
|
||||
Reference in New Issue
Block a user