Correción de refacturacion
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,6 +2,9 @@
|
|||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
web.config
|
web.config
|
||||||
*.txt
|
*.txt
|
||||||
|
Log.txt
|
||||||
|
LogMail.txt
|
||||||
|
LogTimbrado.txt
|
||||||
[Mm]enu/
|
[Mm]enu/
|
||||||
[Tt]emp/
|
[Tt]emp/
|
||||||
[Ee]mpresas/
|
[Ee]mpresas/
|
||||||
|
|||||||
@@ -3582,12 +3582,12 @@ Namespace Modelos
|
|||||||
|
|
||||||
Dim TieneAlmacen As Boolean = False
|
Dim TieneAlmacen As Boolean = False
|
||||||
|
|
||||||
If ObjFactura.SaldoAlmacen <> 0 Then
|
'If Not EsRefacturacion AndAlso ObjFactura.SaldoAlmacen <> 0 Then
|
||||||
Retorno.Mensaje = "El pedido no se puede cancelar ya que tiene movimientos de almacén.<br/>Nota: Primero hay que hacer la devolución al almacén."
|
' Retorno.Mensaje = "El pedido no se puede cancelar ya que tiene movimientos de almacén.<br/>Nota: Primero hay que hacer la devolución al almacén."
|
||||||
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
|
' Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
|
||||||
|
|
||||||
Return Retorno
|
' Return Retorno
|
||||||
End If
|
'End If
|
||||||
|
|
||||||
'VALIDA QUE LA FACTURA NO TENGA PAGOS
|
'VALIDA QUE LA FACTURA NO TENGA PAGOS
|
||||||
If ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
|
If ObjFactura.TipoDocto.Contiene("Ing", "Rem") AndAlso ObjFactura.Pagado > 0 Then
|
||||||
@@ -3877,7 +3877,7 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
'CUANDO LA CANCELACION ESTA EN PROCESO NO DEBE REALIZAR NADA DE ESTE PROCESO
|
'CUANDO LA CANCELACION ESTA EN PROCESO NO DEBE REALIZAR NADA DE ESTE PROCESO
|
||||||
If Not EsRefacturacion AndAlso (CveEstatus > 0 AndAlso CveEstatus <> 20) Then
|
If Not EsRefacturacion AndAlso (CveEstatus > 0 AndAlso CveEstatus <> 20) AndAlso ObjFactura.CveEstatusRefacturacion = 0 Then
|
||||||
|
|
||||||
'DEVOLUCION DE ALMACEN
|
'DEVOLUCION DE ALMACEN
|
||||||
If Not ErrorCancelar AndAlso TieneAlmacen Then
|
If Not ErrorCancelar AndAlso TieneAlmacen Then
|
||||||
@@ -3936,6 +3936,29 @@ Namespace Modelos
|
|||||||
|
|
||||||
If Not ErrorCancelar AndAlso TieneSalida Then
|
If Not ErrorCancelar AndAlso TieneSalida Then
|
||||||
|
|
||||||
|
Dim DtDatosDetalle As New DataTable
|
||||||
|
DtDatosDetalle.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||||
|
DtDatosDetalle.Columns.Add("Consec", GetType(Integer))
|
||||||
|
DtDatosDetalle.Columns.Add("ConsecId", GetType(Integer))
|
||||||
|
DtDatosDetalle.Columns.Add("CvePS", GetType(Integer))
|
||||||
|
DtDatosDetalle.Columns.Add("PS", GetType(String))
|
||||||
|
DtDatosDetalle.Columns.Add("CveUM", GetType(Integer))
|
||||||
|
DtDatosDetalle.Columns.Add("SerieLote", GetType(String))
|
||||||
|
DtDatosDetalle.Columns.Add("FechaCaducidad", GetType(String))
|
||||||
|
DtDatosDetalle.Columns.Add("FueTraspaso", GetType(Integer))
|
||||||
|
|
||||||
|
Dim DtDatosDetalleLote As New DataTable
|
||||||
|
DtDatosDetalleLote.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||||
|
DtDatosDetalleLote.Columns.Add("Consec", GetType(Integer))
|
||||||
|
DtDatosDetalleLote.Columns.Add("ConsecId", GetType(Integer))
|
||||||
|
DtDatosDetalleLote.Columns.Add("Cantidad", GetType(Double))
|
||||||
|
DtDatosDetalleLote.Columns.Add("CvePS", GetType(Integer))
|
||||||
|
DtDatosDetalleLote.Columns.Add("PS", GetType(String))
|
||||||
|
DtDatosDetalleLote.Columns.Add("CveUM", GetType(Integer))
|
||||||
|
DtDatosDetalleLote.Columns.Add("Lote", GetType(String))
|
||||||
|
DtDatosDetalleLote.Columns.Add("Batch", GetType(String))
|
||||||
|
DtDatosDetalleLote.Columns.Add("FechaCaducidad", GetType(String))
|
||||||
|
DtDatosDetalleLote.Columns.Add("FueTraspaso", GetType(Integer))
|
||||||
|
|
||||||
Dim DtTraspasos As New DataTable
|
Dim DtTraspasos As New DataTable
|
||||||
DtTraspasos.Columns.Add("CveAlmacen", GetType(Integer))
|
DtTraspasos.Columns.Add("CveAlmacen", GetType(Integer))
|
||||||
@@ -3949,6 +3972,8 @@ Namespace Modelos
|
|||||||
Dim CveMovimiento As Integer = 0
|
Dim CveMovimiento As Integer = 0
|
||||||
Dim Folio As Integer = 0
|
Dim Folio As Integer = 0
|
||||||
Dim CantidadPendiente As Decimal = 0
|
Dim CantidadPendiente As Decimal = 0
|
||||||
|
Dim DtDetalle As New DataTable
|
||||||
|
Dim DtDetalleLote As New DataTable
|
||||||
|
|
||||||
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen Then
|
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen Then
|
||||||
Dim CveAlmacenDevolucion = ObjFactura.CveAlmacenDevolucion
|
Dim CveAlmacenDevolucion = ObjFactura.CveAlmacenDevolucion
|
||||||
@@ -3966,14 +3991,44 @@ Namespace Modelos
|
|||||||
If CantidadPendiente > 0 Then
|
If CantidadPendiente > 0 Then
|
||||||
Dim PU As Decimal = 0
|
Dim PU As Decimal = 0
|
||||||
|
|
||||||
If DtExistencias IsNot Nothing Then
|
'SI FUE POR SERIELOTE
|
||||||
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal
|
DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec")))
|
||||||
End If
|
DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec")))
|
||||||
|
|
||||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
If DtDetalle.Rows.Count > 0 Then
|
||||||
ErrorCancelar = True
|
For Each Dr1 As DataRow In DtDetalle.Rows
|
||||||
MensajeError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar."
|
If DtExistencias IsNot Nothing Then
|
||||||
Exit For
|
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar."
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
ElseIf DtDetalleLote.Rows.Count > 0 Then
|
||||||
|
For Each Dr1 As DataRow In DtDetalleLote.Rows
|
||||||
|
If DtExistencias IsNot Nothing Then
|
||||||
|
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar."
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
If DtExistencias IsNot Nothing Then
|
||||||
|
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar."
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
@@ -4065,12 +4120,12 @@ Namespace Modelos
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'If Not ErrorCancelar AndAlso RevivirRemisiones Then
|
If Not ErrorCancelar Then
|
||||||
' If Not GeneraMovimientosApartados(ObjInventario, DtTraspasos) Then
|
If Not GeneraMovimientosApartados(ObjInventario, DtTraspasos) Then
|
||||||
' ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
' MensajeError = "Ocurrió un error al guardar los movimientos de control de apartados"
|
MensajeError = "Ocurrió un error al guardar los movimientos de control de apartados"
|
||||||
' End If
|
End If
|
||||||
'End If
|
End If
|
||||||
|
|
||||||
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
|
||||||
If Not ErrorCancelar AndAlso RevivirRemisiones Then
|
If Not ErrorCancelar AndAlso RevivirRemisiones Then
|
||||||
@@ -4276,14 +4331,12 @@ Namespace Modelos
|
|||||||
Retorno.TipoMensaje = TipoMensaje.MsgConfirmacion
|
Retorno.TipoMensaje = TipoMensaje.MsgConfirmacion
|
||||||
|
|
||||||
Else
|
Else
|
||||||
If Not EsRefacturacion Then
|
Retorno.Mensaje = "El documento se canceló exitosamente"
|
||||||
Retorno.Mensaje = "El documento se canceló exitosamente"
|
Retorno.HuboError = False
|
||||||
Retorno.HuboError = False
|
Retorno.TipoMensaje = TipoMensaje.MsgInformacion
|
||||||
Retorno.TipoMensaje = TipoMensaje.MsgInformacion
|
|
||||||
End If
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Me.CveEstatus = CveEstatus
|
ObjFactura.CveEstatus = CveEstatus
|
||||||
Else
|
Else
|
||||||
ObjVentas.RollBack()
|
ObjVentas.RollBack()
|
||||||
If ObjAC IsNot Nothing Then ObjAC.RollBack()
|
If ObjAC IsNot Nothing Then ObjAC.RollBack()
|
||||||
@@ -4777,32 +4830,32 @@ Namespace Modelos
|
|||||||
'Public Property Sucursal As SucursalModel
|
'Public Property Sucursal As SucursalModel
|
||||||
Public Property SubProyecto As Modelos.SubProyectoModel
|
Public Property SubProyecto As Modelos.SubProyectoModel
|
||||||
|
|
||||||
Public DtDetalle As Data.DataTable
|
Public Property DtDetalle As Data.DataTable
|
||||||
Public DtDetalleAC As Data.DataTable
|
Public Property DtDetalleAC As Data.DataTable
|
||||||
Public DtAjustes As Data.DataTable
|
Public Property DtAjustes As Data.DataTable
|
||||||
Public DtRecepcionUsados As Data.DataTable
|
Public Property DtRecepcionUsados As Data.DataTable
|
||||||
Public DtVentasNC As Data.DataTable
|
Public Property DtVentasNC As Data.DataTable
|
||||||
Public DtDeduccion As Data.DataTable
|
Public Property DtDeduccion As Data.DataTable
|
||||||
Public DtFirmas As Data.DataTable
|
Public Property DtFirmas As Data.DataTable
|
||||||
Public DtDesgloseImpuestos As Data.DataTable
|
Public Property DtDesgloseImpuestos As Data.DataTable
|
||||||
Public DtDocumentosRelacionados As Data.DataTable
|
Public Property DtDocumentosRelacionados As Data.DataTable
|
||||||
Public DtNCVinculadas As Data.DataTable
|
Public Property DtNCVinculadas As Data.DataTable
|
||||||
|
|
||||||
Public DtAnticipos As Data.DataTable
|
Public Property DtAnticipos As Data.DataTable
|
||||||
Public DtPromociones As Data.DataTable
|
Public Property DtPromociones As Data.DataTable
|
||||||
Public DtImpuestosLocales As Data.DataTable
|
Public Property DtImpuestosLocales As Data.DataTable
|
||||||
Public DtPagos As Data.DataTable
|
Public Property DtPagos As Data.DataTable
|
||||||
Public DtRemisionesPS As Data.DataTable
|
Public Property DtRemisionesPS As Data.DataTable
|
||||||
Public DtRemisiones As Data.DataTable
|
Public Property DtRemisiones As Data.DataTable
|
||||||
Public DtPedidos2 As Data.DataTable
|
Public Property DtPedidos2 As Data.DataTable
|
||||||
Public DtPedidos2PS As Data.DataTable
|
Public Property DtPedidos2PS As Data.DataTable
|
||||||
Public DTOrdenesCompraPS As Data.DataTable
|
Public Property DTOrdenesCompraPS As Data.DataTable
|
||||||
Public DtCotizacionesPS As Data.DataTable
|
Public Property DtCotizacionesPS As Data.DataTable
|
||||||
Public DtDocumentacionCliente As Data.DataTable
|
Public Property DtDocumentacionCliente As Data.DataTable
|
||||||
Public DtContratosSerieDetalle As Data.DataTable
|
Public Property DtContratosSerieDetalle As Data.DataTable
|
||||||
Public DtOtrosConceptos As Data.DataTable
|
Public Property DtOtrosConceptos As Data.DataTable
|
||||||
Public DtInventario As Data.DataTable
|
Public Property DtInventario As Data.DataTable
|
||||||
Public DtRemConceptosSurtidos As Data.DataTable
|
Public Property DtRemConceptosSurtidos As Data.DataTable
|
||||||
Public Property UsadosBonificacion As List(Of Integer)
|
Public Property UsadosBonificacion As List(Of Integer)
|
||||||
Public Property TipoBonificacion As Integer = 0
|
Public Property TipoBonificacion As Integer = 0
|
||||||
Public Property Timbre As CFDITimbre
|
Public Property Timbre As CFDITimbre
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
|
|
||||||
@@ -2,3 +2,7 @@
|
|||||||
.. PAC: 4 - Verificado : (5) 5 Certificado : (501) 506 Armado: (25) 531 Genera: (494) 1025 Timbrado: (748) 1773 ..20/08/2019:03:33 p. m.
|
.. PAC: 4 - Verificado : (5) 5 Certificado : (501) 506 Armado: (25) 531 Genera: (494) 1025 Timbrado: (748) 1773 ..20/08/2019:03:33 p. m.
|
||||||
|
|
||||||
.. PAC: 4 - Verificado : (2) 2 Certificado : (388) 390 Armado: (4) 394 Genera: (440) 834 Timbrado: (1030) 1864 Guardado: (361) 2225 Actualizado: (99) 2324 ..20/08/2019:03:39 p. m.
|
.. PAC: 4 - Verificado : (2) 2 Certificado : (388) 390 Armado: (4) 394 Genera: (440) 834 Timbrado: (1030) 1864 Guardado: (361) 2225 Actualizado: (99) 2324 ..20/08/2019:03:39 p. m.
|
||||||
|
|
||||||
|
.. PAC: 2 - Verificado : (200) 200 Armado: (398) 598 Guardado: (564) 1162 Timbrado: (2342) 3504 Actualizado: (456) 3960 ..02/09/2019:11:00 a. m.
|
||||||
|
|
||||||
|
.. PAC: 2 - Verificado : (170) 170 Armado: (285) 455 Guardado: (333) 788 Timbrado: (1949) 2737 Actualizado: (20) 2757 ..02/09/2019:11:00 a. m.
|
||||||
|
|||||||
@@ -17452,13 +17452,19 @@ Partial Class Ventas
|
|||||||
resp = ObjFactura.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar)
|
resp = ObjFactura.CancelarFactura(ChkDevAlm.Checked, ListaRemisionesCancelar)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If resp.CveEstatus = 5 Then
|
If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then
|
||||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnEnviarMailCancelacion();", TextoConfirmacion:=" Si ", TextoCancelacion:=" <a onclick='Recargar()'>No</> ")
|
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnEnviarMailCancelacion();", TextoConfirmacion:=" Si ", TextoCancelacion:=" <a onclick='Recargar()'>No</> ")
|
||||||
Else
|
Else
|
||||||
If Not EsRefacturacion Then
|
If EsRefacturacion Then
|
||||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
If resp.CveEstatus = 20 Then
|
||||||
|
Response.Redirect($"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={CveVenta}")
|
||||||
|
ElseIf resp.CveEstatus.Contiene(4, 5) Then
|
||||||
|
Response.Redirect($"Ventas.aspx?CveDevolucion={CveVenta}&NuevaFactura=1")
|
||||||
|
Else
|
||||||
|
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
Response.Redirect($"/Ventas/RepCancelacionesPorRespuesta.aspx?CveVenta={Me.CveVenta}")
|
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user