-- desaplicar pago de venta
This commit is contained in:
@@ -1539,6 +1539,26 @@ Public Class ClsContabilidad
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function DesAplicarPago(CvePrePoliza As Integer, CveConcepto As Integer, CveVenta As Integer, CveVentaAmortizacion As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Conta_DesAplicarMovimiento")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
|
||||
.Add("@CveConceptoContable", SqlDbType.Int).Value = CveConcepto
|
||||
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||
.Add("@CveVentaAmortizacion", SqlDbType.Int).Value = CveVentaAmortizacion
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
|
||||
OnError("Ocurrió un error al desaplicar pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetEncabezadoPrePoliza(CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
@@ -148,6 +148,7 @@
|
||||
|
||||
<asp:TemplateField HeaderText="Eliminar" Visible="false">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="LnkDesAplicar" runat="server" ToolTip="DesAplicar" Visible='<%# Eval("CveConceptoContable").ToString() = "251" %>' AlternateText="Eliminar" CausesValidation="False" CommandName="DesAplicar" CssClass="btn btn-circle btn-sm blue" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
|
||||
<asp:LinkButton ID="imgD" runat="server" Visible='<%# Eval("Eliminable").ToString() = "1" AndAlso Eval("CvePrePoliza").ToString.Length > 0 %>' AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
@@ -164,9 +164,6 @@ Partial Class PopUpAuxiliar
|
||||
|
||||
Protected Sub GVAuxiliar_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAuxiliar.RowDataBound
|
||||
|
||||
|
||||
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.RowIndex = 0 Then
|
||||
e.Row.BackColor = Drawing.Color.LightGray
|
||||
@@ -213,6 +210,17 @@ Partial Class PopUpAuxiliar
|
||||
e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("ConceptoContable"))
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("CveConceptoContable").Contiene("91", "251") Then 'desaplicar NC
|
||||
|
||||
e.Row.FCLinkButton("LnkDesAplicar").Visible = True
|
||||
e.Row.FCLinkButton("imgD").Visible = False
|
||||
If e.Row.DBCampo("CveConceptoContable").Contiene("251") Then
|
||||
e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveVenta"), e.Row.DBCampo("CveVentaAmortizacion"))
|
||||
Else
|
||||
e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveVentaAmortizacion"), e.Row.DBCampo("CveVenta"))
|
||||
End If
|
||||
End If
|
||||
|
||||
If e.Row.DBCampo("TipoReferencia").ToEntero = 1 Then
|
||||
e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DBCampo("CveReferencia").ToEntero}"
|
||||
'If e.Row.DBCampo("CveReferencia").ToEntero > 0 Then
|
||||
@@ -418,7 +426,6 @@ Partial Class PopUpAuxiliar
|
||||
Alert(Str.ToString)
|
||||
Else
|
||||
ObjContabilidad.RollBack()
|
||||
|
||||
End If
|
||||
|
||||
ObjContabilidad.Dispose()
|
||||
@@ -439,6 +446,43 @@ Partial Class PopUpAuxiliar
|
||||
RegistraScript(" $('#DivCancelar').modal('show'); ")
|
||||
End Sub
|
||||
|
||||
Private Sub GVAuxiliar_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GVAuxiliar.RowCommand
|
||||
If e.CommandName = "DesAplicar" Then
|
||||
|
||||
Dim CvePrePoliza, CveVenta, CveVentaAmortizacion As Integer
|
||||
Dim TieneError = False
|
||||
|
||||
Dim St As String() = e.CommandArgument.ToString.Split("|"c)
|
||||
If St.Length > 0 Then
|
||||
CvePrePoliza = St(0).ToEntero
|
||||
CveVenta = St(1).ToEntero
|
||||
CveVentaAmortizacion = St(2).ToEntero
|
||||
End If
|
||||
|
||||
If CvePrePoliza > 0 Then
|
||||
Dim Conta As New ClsContabilidad()
|
||||
Conta.IniciaTransacSQL()
|
||||
|
||||
If Not Conta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If Not TieneError AndAlso Not Conta.DesAplicarPago(CvePrePoliza, 251, CveVenta, CveVentaAmortizacion) Then
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
Conta.Commit()
|
||||
Alert("Pago Desaplicado.", TipoMensaje.ToastInformacion)
|
||||
Else
|
||||
Conta.RollBack()
|
||||
Alert("Pago no fue desaplicado.", TipoMensaje.ToastError)
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user