Permitir vinculacion con pue manual

This commit is contained in:
Rakcsle Supertramp
2019-12-14 12:03:56 -07:00
parent dbf518977b
commit 16aaedfdb3

View File

@@ -112,8 +112,15 @@ Partial Class Compras_eFacturas
End Property End Property
Private Property Serie() As String Private Property Serie() As String
Get Get
Return m_Serie If m_Serie Is Nothing Then
Return ""
Else
Return m_Serie
End If
End Get End Get
Set Set
m_Serie = Value m_Serie = Value
@@ -2540,10 +2547,75 @@ Partial Class Compras_eFacturas
#End Region #End Region
Property MSGComplemento As String
Get
If ViewState("MSGComplemento") Is Nothing Then
Return ""
Else
Return ViewState("MSGComplemento").ToString
End If
End Get
Set(value As String)
ViewState("MSGComplemento") = value
End Set
End Property
Property ViculacionConPUE As Boolean
Get
If ViewState("ViculacionConPUE") Is Nothing Then
Return False
Else
Return Boolean.Parse(ViewState("ViculacionConPUE").ToString)
End If
End Get
Set(value As Boolean)
ViewState("ViculacionConPUE") = value
End Set
End Property
Property ListaComprasPUE As List(Of Integer)
Get
If ViewState("ListaComprasPUE") Is Nothing Then
Return New List(Of Integer)
Else
Return DirectCast(ViewState("ListaComprasPUE"), List(Of Integer))
End If
End Get
Set(value As List(Of Integer))
ViewState("ListaComprasPUE") = value
End Set
End Property
Property ComplementoConPUE As String
Get
If ViewState("ComplementoConPUE") Is Nothing Then
Return ""
Else
Return ViewState("ComplementoConPUE").ToString
End If
End Get
Set(value As String)
ViewState("ComplementoConPUE") = value
End Set
End Property
#Region "V I N C U L A R P A G O" #Region "V I N C U L A R P A G O"
Protected Sub LnkAgregarPago_Click(sender As Object, e As EventArgs) Protected Sub LnkAgregarPago_Click(sender As Object, e As EventArgs)
MSGComplemento = ""
ViculacionConPUE = False
ListaComprasPUE.Clear()
ComplementoConPUE = ""
Dim ListaComprasPUEInterna As New List(Of Integer)
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim CveComplementoPagoCompra As Integer = gvRow.DataKey("CveComplementoPagoCompra").ToString.ToEntero Dim CveComplementoPagoCompra As Integer = gvRow.DataKey("CveComplementoPagoCompra").ToString.ToEntero
@@ -2568,7 +2640,8 @@ Partial Class Compras_eFacturas
Dim TextoDiferenciaImporte As String = "" Dim TextoDiferenciaImporte As String = ""
Dim FechaPago As Date Dim FechaPago As Date
Dim PagosCantidad As Integer = 0 Dim PagosCantidad As Integer = 0
Dim MSGComplemento As String = ""
Dim XMLDoc As New XmlDocument Dim XMLDoc As New XmlDocument
Dim Archivo As String = String.Format("{0}Empresas\{1}\Compras\{2}\{3}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML")) Dim Archivo As String = String.Format("{0}Empresas\{1}\Compras\{2}\{3}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML"))
@@ -2724,9 +2797,12 @@ Partial Class Compras_eFacturas
For Each dRow2 As DataRow In DTDocumentosRelacionados.Rows For Each dRow2 As DataRow In DTDocumentosRelacionados.Rows
If dRow2("CveMetodoPago").ToString.ToEntero > 0 Then If dRow2("CveMetodoPago").ToString.ToEntero > 0 Then
If dRow2("CveMetodoPago").ToString.ToEntero = 1 Then If dRow2("CveMetodoPago").ToString.ToEntero = 1 Then
MSGComplemento = MSGComplemento & $" Compra {dRow2("SerieFolioCompra").ToString } bloqueado Tipo ""PUE"". " MSGComplemento = MSGComplemento & $" Compra {dRow2("SerieFolioCompra").ToString } bloqueado Tipo ""PUE"". "
ListaComprasPUEInterna.Add(dRow2("CveCompra").ToString.ToEntero)
ComplementoConPUE = $"{SeriePago}-{FolioPago}"
End If End If
End If End If
Next Next
@@ -2777,7 +2853,9 @@ Partial Class Compras_eFacturas
Next Next
If MSGComplemento.Trim.Length > 0 Then If MSGComplemento.Trim.Length > 0 Then
BtnVincularPago.Visible = False
' BtnVincularPago.Visible = False
ViculacionConPUE = True
End If End If
@@ -2822,6 +2900,9 @@ Partial Class Compras_eFacturas
GvVincularPago.DataBind() GvVincularPago.DataBind()
UpVincularPago.Update() UpVincularPago.Update()
ListaComprasPUE = ListaComprasPUEInterna
RegistraScript("$('#ModalVincularPago').modal('show')", "VincularPagoModalShow") RegistraScript("$('#ModalVincularPago').modal('show')", "VincularPagoModalShow")
End Sub End Sub
@@ -2860,12 +2941,28 @@ Partial Class Compras_eFacturas
If Not TieneError Then If Not TieneError Then
Dim objEventos As New ClsOIEventos(ObjCompra.IniciaTransacSQL)
If ViculacionConPUE Then
For Each CveCompraVinculada In ListaComprasPUE
objEventos.AddEventoBitacora($"Complemento { ComplementoConPUE } vinculado manualmente (Compra PUE) ", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=CveCompraVinculada)
Next
End If
ObjCompra.Commit() ObjCompra.Commit()
Alert("El pago fue vinculado correctamente", TipoMensaje.MsgInformacion) Alert("El pago fue vinculado correctamente", TipoMensaje.MsgInformacion)
RegistraScript("$('#ModalVincularPago').modal('hide')", "VincularPagoModalHide") RegistraScript("$('#ModalVincularPago').modal('hide')", "VincularPagoModalHide")
CargaDatos() CargaDatos()
Else Else
ObjCompra.RollBack() ObjCompra.RollBack()
Alert("Ocurrió un error al vincular el pago. Por favor verifique y vuelva a intentar", TipoMensaje.MsgError) Alert("Ocurrió un error al vincular el pago. Por favor verifique y vuelva a intentar", TipoMensaje.MsgError)