557 lines
24 KiB
VB.net
557 lines
24 KiB
VB.net
Option Explicit On
|
|
Option Strict On
|
|
|
|
Imports Extensiones
|
|
Imports Microsoft.Reporting.WebForms
|
|
Imports System.Data
|
|
|
|
Partial Class PopUpAuxiliar
|
|
Inherits ClsPaginas
|
|
|
|
Private Property Tipo As String
|
|
Get
|
|
Return ViewState("Tipo").ToString
|
|
End Get
|
|
Set(value As String)
|
|
ViewState("Tipo") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveCliente As Integer
|
|
Get
|
|
Return ViewState("CveCliente").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCliente") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveVenta As Integer
|
|
Get
|
|
Return ViewState("CveVenta").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveVenta") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveProveedor As Integer
|
|
Get
|
|
Return ViewState("CveProveedor").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveProveedor") = value
|
|
End Set
|
|
End Property
|
|
|
|
Private Property CveCompra As Integer
|
|
Get
|
|
Return ViewState("CveCompra").ToString.ToEntero
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CveCompra") = value
|
|
End Set
|
|
End Property
|
|
Private Property DTDatos As DataTable
|
|
Get
|
|
Return CType(ViewState("DTDatos"), DataTable)
|
|
End Get
|
|
Set(value As DataTable)
|
|
ViewState("DTDatos") = value
|
|
End Set
|
|
End Property
|
|
|
|
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
|
If Not IsPostBack Then
|
|
CType(Me.Master, BaseMasterPage).EsPopup = True
|
|
CType(Me.Master, BaseMasterPage).PopupWidth = 915
|
|
RegistraScript("$get('tdContenido').style.height='1000'")
|
|
|
|
Tipo = Request("Tipo")
|
|
CveCliente = 0
|
|
CveProveedor = 0
|
|
CargaDatos()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub CargaDatos()
|
|
GVAuxiliar.Columns(10).Visible = UsuarioActual.TienePermisoProceso(94)
|
|
'GVAuxiliar.Columns(11).Visible = UsuarioActual.TienePermisoProceso(94)
|
|
GVAuxiliar.Columns(12).Visible = UsuarioActual.TienePermisoProceso(94)
|
|
|
|
Select Case Tipo
|
|
Case "CxCClientes"
|
|
CveCliente = Request("CveCliente").ToEntero
|
|
CveVenta = Request("CveVenta").ToEntero
|
|
CargaAuxiliarClienteCxC(CveCliente, CveVenta)
|
|
LtlTipo1.Text = "Cuentas por Cobrar"
|
|
LtlTipo2.Text = "Folio de la Venta"
|
|
LtlTipo3.Text = "Fecha de la Venta"
|
|
Case "AnticiposClientes"
|
|
CveCliente = Request("CveCliente").ToEntero
|
|
CveVenta = Request("CveVenta").ToEntero
|
|
CargaAuxiliarClienteAnticipos(CveCliente, CveVenta)
|
|
LtlTipo1.Text = "Anticipo de Clientes"
|
|
LtlTipo2.Text = "Folio de la Venta"
|
|
LtlTipo3.Text = "Fecha de la Venta"
|
|
Case "CxPProveedor"
|
|
CveProveedor = Request("CveProveedor").ToEntero
|
|
CveCompra = Request("CveCompra").ToEntero
|
|
CargaAuxiliarProveedor(CveProveedor, CveCompra)
|
|
LtlTipo1.Text = "Cuentas por Pagar"
|
|
LtlTipo2.Text = "Folio de la Compra"
|
|
LtlTipo3.Text = "Fecha de la Compra"
|
|
End Select
|
|
|
|
|
|
UpDatos.Update()
|
|
End Sub
|
|
|
|
Private Sub CargaAuxiliarClienteCxC(CveCliente As Integer, CveVenta As Integer)
|
|
Dim ObjMovtos As New ClsMovimientos()
|
|
If ObjMovtos.GetCxCClienteAuxiliar(CveCliente, CveVenta) Then
|
|
DTDatos = ObjMovtos.DtResultados
|
|
GVAuxiliar.DataSource = ObjMovtos.DtResultados
|
|
If ObjMovtos.DtResultados.Rows.Count > 0 Then
|
|
LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString()
|
|
LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString
|
|
LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2)
|
|
LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2)
|
|
End If
|
|
Else
|
|
GVAuxiliar.DataSource = Nothing
|
|
End If
|
|
ObjMovtos.Dispose()
|
|
GVAuxiliar.DataBind()
|
|
End Sub
|
|
|
|
Private Sub CargaAuxiliarClienteAnticipos(CveCliente As Integer, CveVenta As Integer)
|
|
Dim ObjMovtos As New ClsMovimientos()
|
|
If ObjMovtos.GetAnticiposClienteAuxiliar(CveCliente, CveVenta) Then
|
|
DTDatos = ObjMovtos.DtResultados
|
|
GVAuxiliar.DataSource = ObjMovtos.DtResultados
|
|
If ObjMovtos.DtResultados.Rows.Count > 0 Then
|
|
LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString()
|
|
LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString
|
|
'LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2)
|
|
'LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2)
|
|
End If
|
|
Else
|
|
GVAuxiliar.DataSource = Nothing
|
|
End If
|
|
ObjMovtos.Dispose()
|
|
GVAuxiliar.DataBind()
|
|
End Sub
|
|
|
|
Private Sub CargaAuxiliarProveedor(CveProveedor As Integer, CveCompra As Integer)
|
|
Dim ObjMovtos As New ClsContabilidad()
|
|
If ObjMovtos.GetProveedorAuxiliar(CveProveedor, CveCompra) Then
|
|
DTDatos = ObjMovtos.DtResultados
|
|
GVAuxiliar.DataSource = ObjMovtos.DtResultados
|
|
If ObjMovtos.DtResultados.Rows.Count > 0 Then
|
|
LtlFechaVenta.Text = ObjMovtos.DtResultados.Rows(1)("FechaVenta").ToString.ToDate.ToShortDateString()
|
|
LtlFolio.Text = ObjMovtos.DtResultados.Rows(1)("Folio").ToString
|
|
LtlImporte.Text = ObjMovtos.DtResultados.Rows(1)("Total").ToString.FormatoNumero(2)
|
|
LtlSaldo.Text = ObjMovtos.DtResultados.Rows(1)("Saldo").ToString.FormatoNumero(2)
|
|
End If
|
|
Else
|
|
GVAuxiliar.DataSource = Nothing
|
|
End If
|
|
ObjMovtos.Dispose()
|
|
GVAuxiliar.DataBind()
|
|
End Sub
|
|
|
|
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
|
|
e.Row.FCLiteral("LtlFechaMovto").Text = "Totales: "
|
|
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(0).ColumnSpan = 2
|
|
e.Row.Cells(1).Visible = False
|
|
e.Row.Cells(4).ColumnSpan = 3
|
|
e.Row.Cells(5).Visible = False
|
|
e.Row.Cells(6).Visible = False
|
|
e.Row.Cells(7).Visible = False
|
|
e.Row.Cells(8).Visible = False
|
|
e.Row.Cells(12).Visible = False
|
|
End If
|
|
|
|
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
|
|
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
|
|
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left
|
|
|
|
If e.Row.FCLiteral("LtlContabilizado").Text = "Si" Then
|
|
Dim Liga As String
|
|
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
|
|
Liga = String.Format("<a class=""Texto"" href=""/Contabilidad/RegPrePolizaS.aspx?CvePrePoliza={0}"">", e.Row.DBCampo("CvePrePoliza"))
|
|
Else
|
|
Liga = String.Format("<a class=""Texto"" href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">", e.Row.DBCampo("IdPoliza"))
|
|
End If
|
|
|
|
e.Row.FCLiteral("LtlPoliza").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("Poliza"))
|
|
End If
|
|
|
|
If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(2) AndAlso e.Row.DBCampo("CvePersonal").ToEntero > 0 Then
|
|
Dim Liga As String = String.Format("<a class=""Texto"" href=""/RH/Personal.aspx?CvePersonal={0}"">", e.Row.DBCampo("CvePersonal"))
|
|
e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("ConceptoContable"))
|
|
End If
|
|
|
|
If e.Row.DBCampo("CveConceptoContable").Contiene("91", "294", "251", "301") Then 'desaplicar NC
|
|
|
|
e.Row.FCLinkButton("LnkDesAplicar").Visible = True
|
|
e.Row.FCLinkButton("imgD").Visible = False
|
|
If e.Row.DBCampo("CveConceptoContable").Contiene("251", "301") 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
|
|
ElseIf e.Row.DBCampo("CveConceptoContable").Contiene("60", "272") Then 'desaplicar NC Compra
|
|
|
|
e.Row.FCLinkButton("LnkDesAplicar").Visible = True
|
|
e.Row.FCLinkButton("LnkDesAplicar").CommandName = "DesAplicarCompra"
|
|
e.Row.FCLinkButton("imgD").Visible = False
|
|
If e.Row.DBCampo("CveConceptoContable").Contiene("272") Then
|
|
e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}|{3}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveCompra"), e.Row.DBCampo("CveCompraAmortizacion"), e.Row.DBCampo("CveIE"))
|
|
Else
|
|
e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}|{3}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveCompraAmortizacion"), e.Row.DBCampo("CveCompra"), e.Row.DBCampo("CveIE"))
|
|
End If
|
|
|
|
ElseIf e.Row.DBCampo("CveConceptoContable").Contiene("21") Then 'desaplicar anticipo de compra
|
|
|
|
e.Row.FCLinkButton("LnkDesAplicar").Visible = True
|
|
e.Row.FCLinkButton("LnkDesAplicar").CommandName = "DesAplicarAnticipoCompra"
|
|
e.Row.FCLinkButton("imgD").Visible = False
|
|
e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveCompra"), e.Row.DBCampo("CveIE"))
|
|
|
|
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
|
|
' e.Row.Cells(10).Text = ""
|
|
'End If
|
|
ElseIf e.Row.DBCampo("TipoReferencia").ToEntero = 2 Then
|
|
Select Case Tipo
|
|
Case "CxCClientes"
|
|
e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveReferencia").ToEntero}"
|
|
Case "CxPProveedor"
|
|
e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Compras/Compras.aspx?CveCompra={e.Row.DBCampo("CveReferencia").ToEntero}"
|
|
End Select
|
|
End If
|
|
|
|
'If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(272) AndAlso e.Row.DBCampo("CveCompraAmortizacion").ToEntero > 0 Then
|
|
' Dim Liga As String = String.Format("<a class=""Texto"" href=""/Compras/Compras.aspx?CveCompra={0}"">", e.Row.DBCampo("CveCompraAmortizacion"))
|
|
' e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("ConceptoContable"))
|
|
'End If
|
|
|
|
If e.Row.DBCampo("CveConceptoContable").ToEntero.Contiene(275) AndAlso e.Row.DBCampo("CveVenta").ToEntero > 0 Then
|
|
e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={e.Row.DBCampo("CveVenta").ToEntero}"
|
|
'Dim Liga As String = String.Format("<a class=""Texto"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">", e.Row.DBCampo("CveVenta"))
|
|
'e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}</a>", Liga, e.Row.DBCampo("ConceptoContable"))
|
|
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub GvDatos_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GVAuxiliar.RowDeleting
|
|
|
|
Dim ObjContPaq As ClsContPAQi = Nothing
|
|
Dim Conta As New ClsContabilidad()
|
|
Conta.IniciaTransacSQL()
|
|
|
|
Dim ClavePrePoliza As Integer = GVAuxiliar.Rows(e.RowIndex).DataKey("CvePrePolizaOriginal").ToEntero
|
|
Dim IdPoliza As Integer = GVAuxiliar.Rows(e.RowIndex).DataKey("IdPoliza").ToEntero
|
|
|
|
Dim TieneError As Boolean = False
|
|
|
|
If Not Conta.UpdatePrePolizasDetalleBloquear(ClavePrePoliza, False) Then
|
|
TieneError = True
|
|
End If
|
|
|
|
If Not TieneError AndAlso Not Conta.RemovePrePolizas(ClavePrePoliza, UsuarioActual.CveEmpresa) Then
|
|
TieneError = True
|
|
End If
|
|
|
|
If Not TieneError AndAlso Conta.ValidacionesPrePoliza(ClavePrePoliza, UsuarioActual) Then
|
|
If Conta.ValorPolizaDescuadre > 0 Then
|
|
TieneError = True
|
|
End If
|
|
End If
|
|
|
|
If Not TieneError Then
|
|
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso IdPoliza > 0 Then
|
|
If UsuarioActual.Empresa.UsaAC Or UsuarioActual.Empresa.UsaContabilidad Then
|
|
ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa)
|
|
ObjContPaq.IniciaTransacSQL()
|
|
|
|
If Not ObjContPaq.RemovePoliza(IdPoliza) Then
|
|
TieneError = True
|
|
End If
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
If Not TieneError Then
|
|
Alert("Movimiento Eliminado", TipoMensaje.MsgInformacion, "window.opener.location.reload(); window.close();")
|
|
If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
|
|
Conta.Commit()
|
|
Else
|
|
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
|
Conta.RollBack()
|
|
End If
|
|
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
|
|
Conta.Dispose()
|
|
CargaDatos()
|
|
End Sub
|
|
|
|
Private Sub GVAuxiliar_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GVAuxiliar.RowUpdating
|
|
Dim CvePrePoliza As Integer
|
|
Dim ObjConta As New ClsContabilidad
|
|
ObjConta.IniciaTransacSQL()
|
|
Dim CvePlantillaPoliza As Integer = 0
|
|
Dim Importe As Decimal
|
|
Dim MsgError As String = ""
|
|
|
|
If GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal > GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal Then
|
|
Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Cargo").ToDecimal
|
|
Else
|
|
Importe = GVAuxiliar.Rows(e.RowIndex).DataKey("Abono").ToDecimal
|
|
End If
|
|
|
|
If CveCliente > 0 Then CvePlantillaPoliza = 11
|
|
If CveProveedor > 0 Then CvePlantillaPoliza = 2
|
|
|
|
CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/PopUpAuxiliar", CvePlantillaPoliza, Importe, Importe, 1, NowADS(), "Cancelacion de Pago", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
|
|
|
If CvePlantillaPoliza = 2 Then
|
|
If Not ObjConta.CancelarPagoCompraConAnticipo(CvePrePoliza, CveCompra, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then
|
|
MsgError = "Ocurrió un error al cancelar el pago de la compra"
|
|
End If
|
|
End If
|
|
|
|
If CvePlantillaPoliza = 11 Then
|
|
If Not ObjConta.CancelarPagoVentaConAnticipo(CvePrePoliza, CveVenta, GVAuxiliar.Rows(e.RowIndex).DataKey("CveReferencia").ToEntero) Then
|
|
MsgError = "Ocurrió un error al cancelar el pago de la venta"
|
|
End If
|
|
End If
|
|
|
|
If MsgError = "" Then
|
|
ObjConta.Commit()
|
|
Alert("El movimiento se canceló exitosamente.")
|
|
Else
|
|
ObjConta.RollBack()
|
|
Alert(MsgError, TipoMensaje.MsgError)
|
|
End If
|
|
|
|
|
|
ObjConta.Dispose()
|
|
End Sub
|
|
Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click
|
|
GenerarPDF("Excel")
|
|
End Sub
|
|
Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosPDF.Click
|
|
GenerarPDF()
|
|
End Sub
|
|
Private Sub GenerarPDF(Optional Formato As String = "PDF")
|
|
Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
|
|
|
|
|
|
If DTDatos IsNot Nothing And DTDatos.Rows.Count > 0 Then
|
|
|
|
Dim params As New List(Of ReportParameter)
|
|
|
|
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
|
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
|
params.Add(New ReportParameter("Tipo", LtlTipo1.Text))
|
|
params.Add(New ReportParameter("Folio", LtlFolio.Text))
|
|
params.Add(New ReportParameter("Fecha", LtlFechaVenta.Text))
|
|
params.Add(New ReportParameter("Importe", LtlImporte.Text))
|
|
params.Add(New ReportParameter("Saldo", LtlSaldo.Text))
|
|
|
|
params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")))
|
|
|
|
ImprimirPDF("Empresas\Grales\Formatos\RepAuxiliarContable.rdlc", DTDatos, params, "RepAuxiliarContable_" & LtlFolio.Text, Formato:=Formato)
|
|
|
|
Else
|
|
Alert("No se encontró información suficiente.", TipoMensaje.MsgAdvertencia)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Property CvePrePolizaNegativa As Integer
|
|
Get
|
|
If ViewState("CvePrePolizaNegativa") Is Nothing Then
|
|
Return -1
|
|
Else
|
|
Return ViewState("CvePrePolizaNegativa").ToString.ToEntero
|
|
End If
|
|
End Get
|
|
Set(value As Integer)
|
|
ViewState("CvePrePolizaNegativa") = value
|
|
End Set
|
|
End Property
|
|
|
|
|
|
Private Sub AgregaPolizaNegativo(CvePrePoliza As Integer)
|
|
|
|
Dim ObjContabilidad As New ClsContabilidad
|
|
Dim TieneError As Boolean = False
|
|
ObjContabilidad.IniciaTransacSQL()
|
|
|
|
Dim CvePrePolizaNueva As Integer = ObjContabilidad.AddPrePolizasNegativa(CvePrePoliza, UsuarioActual.CveUsuario, TxtConceptoCancelacion.Text, UsuarioActual.CveEmpresa, TxtFechaCancelacion.Text.ToDate)
|
|
|
|
If Not CvePrePolizaNueva > 0 Then
|
|
TieneError = True
|
|
End If
|
|
|
|
If Not TieneError Then
|
|
|
|
ObjContabilidad.Commit()
|
|
Dim Str As New StringBuilder
|
|
Str.Append("Se agrego la póliza de cancelación correctamente.<br/>")
|
|
RegistraScript(" $('#DivCancelar').modal('hide'); ")
|
|
If UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
|
|
If ObjContabilidad.ContabilizarPrePoliza(CvePrePolizaNueva, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
|
|
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
|
Str.AppendFormat("<a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a>", ObjContabilidad.ContaIdPoliza)
|
|
End If
|
|
End If
|
|
End If
|
|
Alert(Str.ToString)
|
|
Else
|
|
ObjContabilidad.RollBack()
|
|
End If
|
|
|
|
ObjContabilidad.Dispose()
|
|
CargaDatos()
|
|
|
|
End Sub
|
|
|
|
|
|
Protected Sub BtnCancelar_Click(sender As Object, e As EventArgs)
|
|
AgregaPolizaNegativo(CvePrePolizaNegativa)
|
|
End Sub
|
|
|
|
|
|
Protected Sub imgCancelar_Click(sender As Object, e As EventArgs)
|
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow)
|
|
CvePrePolizaNegativa = GvRow.DataKey("CvePrePoliza").ToString.ToEntero
|
|
|
|
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 As Boolean = 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
|
|
|
|
If e.CommandName = "DesAplicarCompra" Then
|
|
|
|
Dim CvePrePoliza, CveCompra, CveCompraAmortizacion As Integer
|
|
Dim TieneError As Boolean = False
|
|
|
|
Dim St As String() = e.CommandArgument.ToString.Split("|"c)
|
|
If St.Length > 0 Then
|
|
CvePrePoliza = St(0).ToEntero
|
|
CveCompra = St(1).ToEntero
|
|
CveCompraAmortizacion = 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, 272, CveCompra, CveCompraAmortizacion) 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
|
|
|
|
If e.CommandName = "DesAplicarAnticipoCompra" Then
|
|
|
|
Dim CvePrePoliza, CveCompra, CveIE As Integer
|
|
Dim TieneError As Boolean = False
|
|
|
|
Dim St As String() = e.CommandArgument.ToString.Split("|"c)
|
|
If St.Length > 0 Then
|
|
CvePrePoliza = St(0).ToEntero
|
|
CveCompra = St(1).ToEntero
|
|
CveIE = 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, 21, CveCompra, CveIE) 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
|