Correcion de asignacion de poliza al cancelar
This commit is contained in:
@@ -4382,186 +4382,185 @@ Partial Class Bancos_IE
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim Banc As New ClsBancos
|
|
||||||
Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL())
|
|
||||||
|
|
||||||
Dim ObjAC As ClsContPAQi = Nothing
|
|
||||||
If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then
|
|
||||||
ObjAC = New ClsContPAQi(UsuarioActual.Empresa)
|
|
||||||
ObjAC.IniciaTransacSQL()
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
Dim ErrorCancelar = False
|
Dim ErrorCancelar = False
|
||||||
Dim MensajeError = ""
|
Dim MensajeError = ""
|
||||||
Dim IdPolizaNueva = -1
|
Dim IdPolizaNueva = -1
|
||||||
Dim FolioPolizaNueva = -1
|
Dim FolioPolizaNueva = -1
|
||||||
|
|
||||||
If (IDPoliza > 0 AndAlso (UsuarioActual.Empresa.UsaAC)) Then
|
Dim Banc As New ClsBancos
|
||||||
|
Dim ObjConta As New ClsContabilidad(Banc.IniciaTransacSQL())
|
||||||
|
|
||||||
If ObjAC Is Nothing Then
|
Dim ObjAC As ClsContPAQi = Nothing
|
||||||
|
If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then
|
||||||
|
Try
|
||||||
|
ObjAC = New ClsContPAQi(UsuarioActual.Empresa)
|
||||||
|
ObjAC.IniciaTransacSQL()
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al iniciar la contabilización", ex)
|
||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
End If
|
End Try
|
||||||
|
|
||||||
If Not ErrorCancelar Then
|
End If
|
||||||
Dim dt As DataTable
|
|
||||||
If ObjAC.GetPoliza(IDPoliza, -1, -1, -1, -1) AndAlso ObjAC.DtResultados.Rows.Count > 0 Then
|
|
||||||
dt = ObjAC.DtResultados
|
|
||||||
|
|
||||||
' MES ANTERIOR, MOVIMIENTOS CONTRARIOS (NEGATIVOS)
|
Try
|
||||||
If dt.Rows(0)("FechaPol").ToString.ToDate < TxtFechaCancelacion.Text.ToDate.FirstDayOfMonth Then 'dt.Rows(0)("FechaPol").ToString.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or dt.Rows(0)("FechaPol").ToString.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then
|
If (IDPoliza > 0 AndAlso (UsuarioActual.Empresa.UsaAC)) Then
|
||||||
IdPolizaNueva = ObjAC.AddPoliza(dt.Rows(0)("CodigoTipoPoliza").ToString.ToEntero, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), 0, 0, UsuarioActual.CveUsuario, TxtFechaCancelacion.Text.ToDate)
|
|
||||||
If IdPolizaNueva > 0 Then
|
|
||||||
FolioPolizaNueva = ObjAC.Folio
|
|
||||||
|
|
||||||
'CREA POLIZA NEGATIVA
|
If ObjAC Is Nothing Then
|
||||||
For Each dr As DataRow In dt.Rows
|
ErrorCancelar = True
|
||||||
If Not ObjAC.AddMovimiento(IdPolizaNueva, dr("IdCuenta").ToString.ToEntero, dr("TipoMovto").ToString = "True", dr("Importe").ToString.ToDecimal * -1, dr("Referencia").ToString, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), dr("IdSegNeg").ToString.ToEntero, TxtFechaCancelacion.Text.ToDate, "") Then
|
End If
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Error al crear poliza negativa"
|
If Not ErrorCancelar Then
|
||||||
Exit For
|
Dim dt As DataTable
|
||||||
|
If ObjAC.GetPoliza(IDPoliza, -1, -1, -1, -1) AndAlso ObjAC.DtResultados.Rows.Count > 0 Then
|
||||||
|
dt = ObjAC.DtResultados
|
||||||
|
|
||||||
|
' MES ANTERIOR, MOVIMIENTOS CONTRARIOS (NEGATIVOS)
|
||||||
|
If dt.Rows(0)("FechaPol").ToString.ToDate < TxtFechaCancelacion.Text.ToDate.FirstDayOfMonth Then 'dt.Rows(0)("FechaPol").ToString.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or dt.Rows(0)("FechaPol").ToString.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then
|
||||||
|
IdPolizaNueva = ObjAC.AddPoliza(dt.Rows(0)("CodigoTipoPoliza").ToString.ToEntero, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), 0, 0, UsuarioActual.CveUsuario, TxtFechaCancelacion.Text.ToDate)
|
||||||
|
If IdPolizaNueva > 0 Then
|
||||||
|
FolioPolizaNueva = ObjAC.Folio
|
||||||
|
|
||||||
|
'CREA POLIZA NEGATIVA
|
||||||
|
For Each dr As DataRow In dt.Rows
|
||||||
|
If Not ObjAC.AddMovimiento(IdPolizaNueva, dr("IdCuenta").ToString.ToEntero, dr("TipoMovto").ToString = "True", dr("Importe").ToString.ToDecimal * -1, dr("Referencia").ToString, String.Format("Cancelacion: {0}", dt.Rows(0)("Concepto").ToString), dr("IdSegNeg").ToString.ToEntero, TxtFechaCancelacion.Text.ToDate, "") Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Error al crear poliza negativa"
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
'AJUSTA POLIZA
|
||||||
|
If Not ErrorCancelar Then
|
||||||
|
If Not ObjAC.AjustaPoliza(IdPolizaNueva) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Error al ajustar poliza negativa"
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
|
||||||
|
|
||||||
'AJUSTA POLIZA
|
'CANCELA IE
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
If Not ObjAC.AjustaPoliza(IdPolizaNueva) Then
|
If Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero) <= 0 Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Error al cancelar IE"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
ErrorCancelar = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
|
||||||
|
If ObjAC.RemovePoliza(IDPoliza) Then
|
||||||
|
If Not ObjConta.DesvincularPrePolizaContabilizada(IDPoliza, UsuarioActual.CveEmpresa) Then
|
||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
MensajeError = "Error al ajustar poliza negativa"
|
MensajeError = "Error al desvincular poliza."
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Error al eliminar poliza."
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not ErrorCancelar Then
|
||||||
|
If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Error al desbloquear prepoliza."
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'CANCELA IE
|
'CANCELA IE
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
If Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero) <= 0 Then
|
If Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero) <= 0 Then
|
||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
MensajeError = "Error al cancelar IE"
|
MensajeError = "Error al cancelar IE"
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then
|
||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
End If
|
MensajeError = "Error al contabilizar poliza"
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Error al obtener la poliza"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
If ObjAC.RemovePoliza(IDPoliza) Then
|
Else
|
||||||
If Not ObjConta.DesvincularPrePolizaContabilizada(IDPoliza, UsuarioActual.CveEmpresa) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Error al desvincular poliza."
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Error al eliminar poliza."
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Not ErrorCancelar Then
|
' If TxtFechaDocumento.Text.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or TxtFechaDocumento.Text.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then
|
||||||
If Not ObjConta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
|
Dim GeneraCancelacionEnCero As Boolean = False
|
||||||
ErrorCancelar = True
|
If TxtFechaCancelacion.Text.ToDate <= TxtFechaDocumento.Text.ToDate.LastDayOfMonth Then 'si es del mismo mes, se genra cancelacion en cero
|
||||||
MensajeError = "Error al desbloquear prepoliza."
|
GeneraCancelacionEnCero = True
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
'CANCELA IE
|
Dim TipoMovimiento As Integer = 1
|
||||||
If Not ErrorCancelar Then
|
|
||||||
If Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero) <= 0 Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Error al cancelar IE"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then
|
If ChkGeneraCancelacion.Checked AndAlso GeneraCancelacionEnCero Then
|
||||||
ErrorCancelar = True
|
GeneraCancelacionEnCero = False
|
||||||
MensajeError = "Error al contabilizar poliza"
|
TipoMovimiento = 2
|
||||||
End If
|
End If
|
||||||
|
Dim CvePrePolizaCancelacion As Integer = 0
|
||||||
|
|
||||||
|
If Not GeneraCancelacionEnCero Then
|
||||||
|
'CANCELA IE MES ANTERIOR
|
||||||
|
CvePrePolizaCancelacion = Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, TipoMovimiento:=TipoMovimiento, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero)
|
||||||
|
If CvePrePolizaCancelacion <= 0 Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Error al cancelar IE MES ANTERIOR"
|
||||||
|
Else
|
||||||
|
'DEBE GENERAR UNA NUEVA POLIZA
|
||||||
|
IDPoliza = -1
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
ErrorCancelar = True
|
'CANCELA IE MES ACTUAL
|
||||||
MensajeError = "Error al obtener la poliza"
|
CvePrePolizaCancelacion = Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero)
|
||||||
|
If CvePrePolizaCancelacion <= 0 Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Error al cancelar IE MES ACTUAL"
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
If UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then
|
||||||
|
|
||||||
' If TxtFechaDocumento.Text.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or TxtFechaDocumento.Text.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then
|
If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaCancelacion, UsuarioActual.CveUsuario, UsuarioActual.Empresa, pIDPoliza:=If(IDPoliza > 0, IDPoliza, -1), ObjConta:=ObjAC) Then
|
||||||
Dim GeneraCancelacionEnCero As Boolean = False
|
ErrorCancelar = True
|
||||||
If TxtFechaCancelacion.Text.ToDate <= TxtFechaDocumento.Text.ToDate.LastDayOfMonth Then 'si es del mismo mes, se genra cancelacion en cero
|
MensajeError = "Error al contabilizar poliza"
|
||||||
GeneraCancelacionEnCero = True
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
Dim TipoMovimiento As Integer = 1
|
|
||||||
|
|
||||||
If ChkGeneraCancelacion.Checked AndAlso GeneraCancelacionEnCero Then
|
|
||||||
GeneraCancelacionEnCero = False
|
|
||||||
TipoMovimiento = 2
|
|
||||||
End If
|
|
||||||
Dim CvePrePolizaCancelacion As Integer = 0
|
|
||||||
|
|
||||||
If Not GeneraCancelacionEnCero Then
|
|
||||||
'CANCELA IE MES ANTERIOR
|
|
||||||
CvePrePolizaCancelacion = Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, True, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, TipoMovimiento:=TipoMovimiento, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero)
|
|
||||||
If CvePrePolizaCancelacion <= 0 Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Error al cancelar IE MES ANTERIOR"
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
'CANCELA IE MES ACTUAL
|
|
||||||
CvePrePolizaCancelacion = Banc.CancelarBancos_IE(UsuarioActual.CveUsuario, CveIE, False, IdPolizaNueva, FolioPolizaNueva, TxtFechaCancelacion.Text.ToDate, CveTipoTransaccionCancelacion:=DdlTipoTransaccionCancelacion.SelectedValue.ToEntero)
|
|
||||||
If CvePrePolizaCancelacion <= 0 Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Error al cancelar IE MES ACTUAL"
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" Then
|
|
||||||
|
|
||||||
If Not ObjConta.ContabilizarPrePoliza(CvePrePolizaCancelacion, UsuarioActual.CveUsuario, UsuarioActual.Empresa, pIDPoliza:=If(IDPoliza > 0, IDPoliza, -1), ObjConta:=ObjAC) Then
|
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Error al contabilizar poliza"
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
If Banc.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) Then
|
If Banc.GetComplementoPagos(-1, CveIE, -1, UsuarioActual.CveEmpresa) Then
|
||||||
If Banc.DtResultados.FiltraParametros("", DistinctColumns:={"CveComplementoPago", "SerieFolio", "Fecha", "CveIE"}).Rows.Count > 0 Then
|
If Banc.DtResultados.FiltraParametros("", DistinctColumns:={"CveComplementoPago", "SerieFolio", "Fecha", "CveIE"}).Rows.Count > 0 Then
|
||||||
If Not Banc.GetFoliosCancelados(UsuarioActual.CveEmpresa) Then
|
If Not Banc.GetFoliosCancelados(UsuarioActual.CveEmpresa) Then
|
||||||
ErrorCancelar = True
|
|
||||||
MensajeError = "Error al cancelar complemento de pago"
|
|
||||||
Else
|
|
||||||
Dim FolioCancelado = $"{TxtFolio.Text}_C_{Banc.DtResultados(0)("Cantidad").ToString().ToEntero + 1}"
|
|
||||||
If Not Banc.UpdateFolioCancelado(CveIE.ToEntero, Folio:=FolioCancelado) Then
|
|
||||||
ErrorCancelar = True
|
ErrorCancelar = True
|
||||||
MensajeError = "Error al actualizar complemento de pago"
|
MensajeError = "Error al cancelar complemento de pago"
|
||||||
|
Else
|
||||||
|
Dim FolioCancelado = $"{TxtFolio.Text}_C_{Banc.DtResultados(0)("Cantidad").ToString().ToEntero + 1}"
|
||||||
|
If Not Banc.UpdateFolioCancelado(CveIE.ToEntero, Folio:=FolioCancelado) Then
|
||||||
|
ErrorCancelar = True
|
||||||
|
MensajeError = "Error al actualizar complemento de pago"
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End If
|
|
||||||
|
|
||||||
If Not ErrorCancelar Then
|
If Not ErrorCancelar Then
|
||||||
|
|
||||||
Dim ErrorCancelarComplemento As Boolean = True
|
Dim ErrorCancelarComplemento As Boolean = True
|
||||||
|
|
||||||
If CancelarComplemento Then
|
If CancelarComplemento Then
|
||||||
Dim ObjCancelacion As New Timbrado
|
Dim ObjCancelacion As New Timbrado
|
||||||
'Dim ObjBanco As New ClsBancos
|
'Dim ObjBanco As New ClsBancos
|
||||||
|
|
||||||
If EstatusSATCancelado(FolioFiscalCancelar, UsuarioActual.Empresa.RFC, RFCReceptorCancelar) Then
|
If EstatusSATCancelado(FolioFiscalCancelar, UsuarioActual.Empresa.RFC, RFCReceptorCancelar) Then
|
||||||
|
|
||||||
If Banc.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=Date.Now, SelloCancelacion:="") Then
|
If Banc.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=Date.Now, SelloCancelacion:="") Then
|
||||||
CargaComplementosPago()
|
|
||||||
RegistraScript("$('#ModalCancelarComplemetno').modal('hide');")
|
|
||||||
ErrorCancelarComplemento = False
|
|
||||||
Alert("El complemento se cancelo correctamente.")
|
|
||||||
End If
|
|
||||||
|
|
||||||
Else
|
|
||||||
If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then
|
|
||||||
|
|
||||||
If Banc.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then
|
|
||||||
CargaComplementosPago()
|
CargaComplementosPago()
|
||||||
RegistraScript("$('#ModalCancelarComplemetno').modal('hide');")
|
RegistraScript("$('#ModalCancelarComplemetno').modal('hide');")
|
||||||
ErrorCancelarComplemento = False
|
ErrorCancelarComplemento = False
|
||||||
@@ -4569,49 +4568,62 @@ Partial Class Bancos_IE
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
Alert("Se presento un error al cancelar el complemento.", TipoMensaje.MsgAdvertencia)
|
If ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscalCancelar, 0, RFCReceptorCancelar, UsuarioActual.Empresa.RFC, CvePACCancelacion) Then
|
||||||
|
|
||||||
|
If Banc.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=ObjCancelacion.CancelacionFecha, SelloCancelacion:=ObjCancelacion.CancelacionAcuse) Then
|
||||||
|
CargaComplementosPago()
|
||||||
|
RegistraScript("$('#ModalCancelarComplemetno').modal('hide');")
|
||||||
|
ErrorCancelarComplemento = False
|
||||||
|
Alert("El complemento se cancelo correctamente.")
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
Alert("Se presento un error al cancelar el complemento.", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
Else
|
|
||||||
ErrorCancelarComplemento = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
If Not ErrorCancelarComplemento Then
|
|
||||||
|
|
||||||
If ObjAC IsNot Nothing Then ObjAC.Commit()
|
|
||||||
Banc.Commit()
|
|
||||||
Dim Msg As New StringBuilder
|
|
||||||
|
|
||||||
If CancelarComplemento Then
|
|
||||||
Msg.Append("El movimiento bancario y su complemento quedaron cancelados exitosamente.")
|
|
||||||
Else
|
Else
|
||||||
Msg.Append("El movimiento bancario quedó cancelado exitosamente.")
|
ErrorCancelarComplemento = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
If IdPolizaNueva > 0 Then Msg.AppendFormat("<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza de cancelación</a>", IdPolizaNueva)
|
If Not ErrorCancelarComplemento Then
|
||||||
Alert(Msg.ToString, TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""")
|
|
||||||
|
If ObjAC IsNot Nothing Then ObjAC.Commit()
|
||||||
|
Banc.Commit()
|
||||||
|
Dim Msg As New StringBuilder
|
||||||
|
|
||||||
|
If CancelarComplemento Then
|
||||||
|
Msg.Append("El movimiento bancario y su complemento quedaron cancelados exitosamente.")
|
||||||
|
Else
|
||||||
|
Msg.Append("El movimiento bancario quedó cancelado exitosamente.")
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
If IdPolizaNueva > 0 Then Msg.AppendFormat("<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza de cancelación</a>", IdPolizaNueva)
|
||||||
|
Alert(Msg.ToString, TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""")
|
||||||
|
|
||||||
|
Else
|
||||||
|
|
||||||
|
If ObjAC IsNot Nothing Then ObjAC.RollBack()
|
||||||
|
Banc.RollBack()
|
||||||
|
Alert("El movimiento bancario no se pudo cancelar. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||||
|
GuardaLog(MensajeError + " | CANCELAR IE")
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
Else
|
Else
|
||||||
|
|
||||||
If ObjAC IsNot Nothing Then ObjAC.RollBack()
|
If ObjAC IsNot Nothing Then ObjAC.RollBack()
|
||||||
Banc.RollBack()
|
Banc.RollBack()
|
||||||
Alert("El movimiento bancario no se pudo cancelar. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
Alert("El movimiento bancario no se pudo cancelar. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||||
GuardaLog(MensajeError + " | CANCELAR IE")
|
GuardaLog(MensajeError + " | CANCELAR IE")
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrio un error al cancelar", ex)
|
||||||
Else
|
End Try
|
||||||
If ObjAC IsNot Nothing Then ObjAC.RollBack()
|
|
||||||
Banc.RollBack()
|
|
||||||
Alert("El movimiento bancario no se pudo cancelar. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
|
||||||
GuardaLog(MensajeError + " | CANCELAR IE")
|
|
||||||
End If
|
|
||||||
|
|
||||||
If ObjAC IsNot Nothing Then ObjAC.Dispose()
|
If ObjAC IsNot Nothing Then ObjAC.Dispose()
|
||||||
Banc.Dispose()
|
Banc.Dispose()
|
||||||
|
|||||||
Reference in New Issue
Block a user