Correcion en validacion de facturacion de remisiones
This commit is contained in:
@@ -11600,7 +11600,7 @@ Partial Class Ventas
|
|||||||
'INVENTARIOS
|
'INVENTARIOS
|
||||||
If ErrorList.Count = 0 Then
|
If ErrorList.Count = 0 Then
|
||||||
If Not EsNCAmortizacion AndAlso Not NCDescuento 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")
|
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
@@ -13230,7 +13230,7 @@ Partial Class Ventas
|
|||||||
End Try
|
End Try
|
||||||
|
|
||||||
End Function
|
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
|
Dim OcurrioError As Boolean = False
|
||||||
Try
|
Try
|
||||||
|
|
||||||
@@ -13239,7 +13239,7 @@ Partial Class Ventas
|
|||||||
If RemisionesLista.Count > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
|
If RemisionesLista.Count > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
|
||||||
For Each CveRemision As Integer In RemisionesLista
|
For Each CveRemision As Integer In RemisionesLista
|
||||||
'El almacen general es el Primer Almacen de Material en la Sucursal
|
'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
|
OcurrioError = True
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
@@ -18665,7 +18665,7 @@ Partial Class Ventas
|
|||||||
gvr.FCDropDownList("DdlUnidadMedida").DataBind()
|
gvr.FCDropDownList("DdlUnidadMedida").DataBind()
|
||||||
|
|
||||||
End Sub
|
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
|
Dim OcurrioError As Boolean = False
|
||||||
Try
|
Try
|
||||||
Dim DtMovimientos As DataTable
|
Dim DtMovimientos As DataTable
|
||||||
@@ -18747,9 +18747,9 @@ Partial Class Ventas
|
|||||||
MovDetalle = DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}")
|
MovDetalle = DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}")
|
||||||
Else
|
Else
|
||||||
If TieneMovimientosContrato Then
|
If TieneMovimientosContrato Then
|
||||||
MovDetalle = CuadrarFacturaMovimientos(DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"))
|
MovDetalle = CuadrarFacturaMovimientos(ObjVentas, CveRemision, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"))
|
||||||
Else
|
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
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@@ -18761,26 +18761,12 @@ Partial Class Ventas
|
|||||||
Dim CveMovimientoSalidaPorTraspaso As Integer = -1
|
Dim CveMovimientoSalidaPorTraspaso As Integer = -1
|
||||||
Dim CveConceptoSalidaAlmacen As Integer = 3
|
Dim CveConceptoSalidaAlmacen As Integer = 3
|
||||||
Dim CveAlmacenParaSalida As Integer = CveAlmacenEntrada
|
Dim CveAlmacenParaSalida As Integer = CveAlmacenEntrada
|
||||||
|
|
||||||
'SALIDA DEFINITIVA DEL SISTEMA
|
'SALIDA DEFINITIVA DEL SISTEMA
|
||||||
If UsuarioActual.Empresa.Funcionalidad(575) = "1" Then
|
If UsuarioActual.Empresa.Funcionalidad(575) = "1" Then
|
||||||
CveConceptoSalidaAlmacen = 40
|
CveConceptoSalidaAlmacen = 40
|
||||||
CveAlmacenParaSalida = CveAlmacenSalida
|
CveAlmacenParaSalida = CveAlmacenSalida
|
||||||
AplicaMovimientoDetalleEntrada = True
|
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
|
Else
|
||||||
'Le damos salida de apartado por traspaso
|
'Le damos salida de apartado por traspaso
|
||||||
CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=AplicaMovimientoDetalleEntrada)
|
CveMovimientoSalidaPorTraspaso = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 8, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=AplicaMovimientoDetalleEntrada)
|
||||||
@@ -18820,19 +18806,10 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
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
|
End If
|
||||||
|
|
||||||
MovDetalle.Dispose()
|
MovDetalle.Dispose()
|
||||||
|
|
||||||
'VERIFICA QUE SE HAYA GENERADO MOVIMIENTO DE ALMACEN
|
|
||||||
If Not OcurrioError Then
|
|
||||||
OcurrioError = Not GeneroMovimientoAlmacen
|
|
||||||
End If
|
|
||||||
|
|
||||||
If OcurrioError Then
|
If OcurrioError Then
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
@@ -18841,12 +18818,6 @@ Partial Class Ventas
|
|||||||
|
|
||||||
End If
|
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
|
End If
|
||||||
|
|
||||||
If OcurrioError Then
|
If OcurrioError Then
|
||||||
@@ -18854,6 +18825,24 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
Next
|
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
|
End If
|
||||||
|
|
||||||
@@ -18862,31 +18851,59 @@ Partial Class Ventas
|
|||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'LIMPIAR EL DT DE CONCEPTOS SURTIDOS
|
||||||
|
If DtRemConceptosSurtidos IsNot Nothing Then
|
||||||
|
DtRemConceptosSurtidos.Clear()
|
||||||
|
DtRemConceptosSurtidos = Nothing
|
||||||
|
End If
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
OnError("Ocurrió un error al realizar el traspaso", ex)
|
OnError("Ocurrió un error al realizar el traspaso", ex)
|
||||||
End Try
|
End Try
|
||||||
Return Not OcurrioError
|
Return Not OcurrioError
|
||||||
End Function
|
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
|
Dim MovDTCuadrados As New DataTable
|
||||||
MovDTCuadrados = MovDetalle.Clone
|
MovDTCuadrados = MovDetalle.Clone
|
||||||
MovDTCuadrados.Clear()
|
MovDTCuadrados.Clear()
|
||||||
|
|
||||||
'Llenamos el DT solo si es primera llamada
|
'Llenamos el DT solo si es primera llamada
|
||||||
If DtRemConceptosSurtidos Is Nothing Then
|
If DtRemConceptosSurtidos Is Nothing Then
|
||||||
DtRemConceptosSurtidos = New DataTable
|
Dim DtDetalleRemision As DataTable = Nothing
|
||||||
DtRemConceptosSurtidos.Columns.Add("CveVentaDetalle", GetType(Integer))
|
Dim StrCveVentasDetalle As New StringBuilder()
|
||||||
DtRemConceptosSurtidos.Columns.Add("Cantidad", GetType(Decimal))
|
|
||||||
DtRemConceptosSurtidos.Columns.Add("Surtido", GetType(Decimal))
|
|
||||||
|
|
||||||
For Each dr As DataRow In DtRemisionesTmpDT.Rows
|
If ObjVentas.GetVentaDetalle(CveRemision) Then
|
||||||
Dim dtr As DataRow = DtRemConceptosSurtidos.NewRow
|
DtDetalleRemision = ObjVentas.DtResultados.FiltraParametros("", DistinctColumns:={"CveVenta", "CveVentaDetalle"})
|
||||||
dtr("CveVentaDetalle") = dr("CveVentaDetalle")
|
End If
|
||||||
dtr("Cantidad") = dr("Cantidad")
|
|
||||||
dtr("Surtido") = 0
|
For Each RowDetalle As DataRow In DtDetalleRemision.Rows
|
||||||
DtRemConceptosSurtidos.Rows.Add(dtr)
|
StrCveVentasDetalle.AppendFormat("{0},", RowDetalle("CveVentaDetalle"))
|
||||||
Next
|
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
|
End If
|
||||||
|
|
||||||
For Each dr As DataRow In MovDetalle.Rows
|
For Each dr As DataRow In MovDetalle.Rows
|
||||||
@@ -29633,6 +29650,9 @@ Partial Class Ventas
|
|||||||
LbAgregar.Enabled = True
|
LbAgregar.Enabled = True
|
||||||
LnkAgregarPyME.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 = '';")
|
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
|
TxtMotivoDescuento.Enabled = True
|
||||||
|
|||||||
Reference in New Issue
Block a user