Correcion de actualizacion de prepolizas
This commit is contained in:
@@ -716,6 +716,31 @@ Public Class ClsContabilidad
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Public Function RemovePrePolizasDetalle(CvePrePoliza As Integer, CvePrePolizaDetalle As Integer) As Boolean
|
||||||
|
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Conta_PrePolizasDetalleEspecificoRemove")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
|
||||||
|
.Add("@CvePrePolizaDetalle", SqlDbType.Int).Value = CvePrePolizaDetalle
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
If ex.Message.Contains("50015;") Then
|
||||||
|
OnError("No se puede eliminar una póliza en un ejercicio Cerrado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
Else
|
||||||
|
OnError("Ocurrió un error al eliminar el detalle de la prepoliza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End If
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Function GetMovimientosPoliza(IdPoliza As Integer, CveEmpresa As Integer) As Integer
|
Public Function GetMovimientosPoliza(IdPoliza As Integer, CveEmpresa As Integer) As Integer
|
||||||
Dim Retorno As Integer = -1
|
Dim Retorno As Integer = -1
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,15 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
ViewState("DtMovimientos") = value
|
ViewState("DtMovimientos") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public Property DtMovimientosEliminar As DataTable
|
||||||
|
Get
|
||||||
|
Return CType(ViewState("DtMovimientosEliminar"), DataTable)
|
||||||
|
End Get
|
||||||
|
Set(value As DataTable)
|
||||||
|
ViewState("DtMovimientosEliminar") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
Public Property DtCuentasContables As DataTable
|
Public Property DtCuentasContables As DataTable
|
||||||
Get
|
Get
|
||||||
Return CType(ViewState("DtCuentasContables"), DataTable)
|
Return CType(ViewState("DtCuentasContables"), DataTable)
|
||||||
@@ -269,6 +278,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
|
|
||||||
ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero
|
ViewState("CvePrePoliza") = Request("CvePrePoliza").ToEntero
|
||||||
CreaDT()
|
CreaDT()
|
||||||
|
CreaDTEliminar()
|
||||||
CargaPrePoliza()
|
CargaPrePoliza()
|
||||||
If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then
|
If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then
|
||||||
GvPrePoliza.Columns(5).Visible = False
|
GvPrePoliza.Columns(5).Visible = False
|
||||||
@@ -412,6 +422,14 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
DtMovimientos.AcceptChanges()
|
DtMovimientos.AcceptChanges()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CreaDTEliminar()
|
||||||
|
DtMovimientosEliminar = New DataTable("MovimientosEliminar")
|
||||||
|
With DtMovimientosEliminar.Columns
|
||||||
|
.Add("CvePrePolizaDetalle", GetType(Integer))
|
||||||
|
End With
|
||||||
|
DtMovimientosEliminar.AcceptChanges()
|
||||||
|
End Sub
|
||||||
Private Sub CargaPrePoliza()
|
Private Sub CargaPrePoliza()
|
||||||
BtnEliminar.Visible = True
|
BtnEliminar.Visible = True
|
||||||
LblEncabezado.Text = "Edición de Póliza"
|
LblEncabezado.Text = "Edición de Póliza"
|
||||||
@@ -1142,7 +1160,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
' Alert(If(MensajeAlert.ToString = "", "Se registro con exito.", MensajeAlert.ToString), TipoMensaje.MsgInformacion, "window.location.reload()")
|
' Alert(If(MensajeAlert.ToString = "", "Se registro con exito.", MensajeAlert.ToString), TipoMensaje.MsgInformacion, "window.location.reload()")
|
||||||
'End If
|
'End If
|
||||||
|
|
||||||
Alert(If(MensajeAlert.ToString = "", $"Se registro con exito <b>{If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}</b>", $"Se registro con exito <b>{If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")} </b><br>" & MensajeAlert.ToString), TipoMensaje.MsgInformacion, $"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={CvePrePolizaInsertada}""")
|
Alert(If(MensajeAlert.ToString = "", $"Se registro con exito <b>{If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")}</b>", $"Se registro con exito <b>{If(FolioPoliza > 0, " Folio " & FolioPoliza & ".", "")} </b><br>" & MensajeAlert.ToString), TipoMensaje.MsgInformacion, $"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={CvePrePolizaInsertada}""", ShowCloseButton:=False)
|
||||||
|
|
||||||
|
|
||||||
ObjIE.Commit()
|
ObjIE.Commit()
|
||||||
@@ -1172,12 +1190,23 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
Dim ObjContabilidad As New ClsContabilidad
|
Dim ObjContabilidad As New ClsContabilidad
|
||||||
ObjContabilidad.IniciaTransacSQL()
|
ObjContabilidad.IniciaTransacSQL()
|
||||||
|
|
||||||
|
Try
|
||||||
ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario)
|
ObjContabilidad.UpdatePrePoliza(MinFecha, -1, DdlTipoPoliza.SelectedValue.ToEntero, -1, CvePrePoliza, UsuarioActual.CveEmpresa, Concepto:=TxtConcepto.Text, FechaPoliza:=TxtFechaDocumento.Text.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario)
|
||||||
|
|
||||||
If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
|
If Not ObjContabilidad.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
|
||||||
OcurrioError = True
|
OcurrioError = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If DtMovimientosEliminar IsNot Nothing AndAlso DtMovimientosEliminar.Rows.Count > 0 Then
|
||||||
|
For Each RowEliminar As DataRow In DtMovimientosEliminar.Rows
|
||||||
|
If Not ObjContabilidad.RemovePrePolizasDetalle(Me.CvePrePoliza, RowEliminar("CvePrePolizaDetalle").ToString().ToEntero()) Then
|
||||||
|
OcurrioError = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not OcurrioError Then
|
||||||
Dim CveIEAgregado As Integer = -1
|
Dim CveIEAgregado As Integer = -1
|
||||||
For Each row As GridViewRow In GvPrePoliza.Rows
|
For Each row As GridViewRow In GvPrePoliza.Rows
|
||||||
If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
|
If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
|
||||||
@@ -1241,10 +1270,15 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
OcurrioError = True
|
||||||
|
OnError("Ocurrío un error al actualizar la PrePoliza", ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
If Not OcurrioError Then
|
If Not OcurrioError Then
|
||||||
ObjContabilidad.Commit()
|
ObjContabilidad.Commit()
|
||||||
Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion)
|
Alert("La PrePoliza se actualizó correctamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:=$"window.location.href=""./RegPrePolizaS.aspx?CvePrePoliza={Me.CvePrePoliza}""", ShowCloseButton:=False)
|
||||||
Else
|
Else
|
||||||
ObjContabilidad.RollBack()
|
ObjContabilidad.RollBack()
|
||||||
Alert("Ocurrio un error al actualizar la PrePoliza.", TipoMensaje.MsgError)
|
Alert("Ocurrio un error al actualizar la PrePoliza.", TipoMensaje.MsgError)
|
||||||
@@ -3057,12 +3091,19 @@ Partial Class ContabilidadC_RegPrePolizaS
|
|||||||
|
|
||||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
|
|
||||||
|
If CvePrePoliza > 0 Then
|
||||||
|
Dim RowEliminar As DataRow = DtMovimientosEliminar.NewRow()
|
||||||
|
RowEliminar("CvePrePolizaDetalle") = GvRow.DataKey("CvePrePolizaDetalle")
|
||||||
|
DtMovimientosEliminar.Rows.Add(RowEliminar)
|
||||||
|
End If
|
||||||
|
|
||||||
DtMovimientos.Rows(GvRow.RowIndex).Delete()
|
DtMovimientos.Rows(GvRow.RowIndex).Delete()
|
||||||
DtMovimientos.AcceptChanges()
|
DtMovimientos.AcceptChanges()
|
||||||
|
|
||||||
GvPrePoliza.DataSource = DtMovimientos
|
GvPrePoliza.DataSource = DtMovimientos
|
||||||
GvPrePoliza.DataBind()
|
GvPrePoliza.DataBind()
|
||||||
|
|
||||||
|
|
||||||
TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero
|
TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero
|
||||||
TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero
|
TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero
|
||||||
UpTotalCargo.Update()
|
UpTotalCargo.Update()
|
||||||
|
|||||||
Reference in New Issue
Block a user