diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb
index 6282a37cd..58e9dd59c 100644
--- a/Compras/eFacturas.aspx.vb
+++ b/Compras/eFacturas.aspx.vb
@@ -2639,6 +2639,7 @@ Partial Class Compras_eFacturas
Protected Sub LnkAgregarPago_Click(sender As Object, e As EventArgs)
Dim sbSinIE As New StringBuilder
+ Dim TieneCompras As Boolean = False
HdnCveIE.Value = ""
MSGComplemento = ""
@@ -2841,6 +2842,15 @@ Partial Class Compras_eFacturas
GVPDocumentosRelacionadosPagos.DataBind()
+
+ If DTDocumentosRelacionados.MAX("CveCompra").ToString.ToEntero > 0 Then
+ TieneCompras = True
+ Else
+ TieneCompras = False
+ End If
+
+
+
For Each dRow2 As DataRow In DTDocumentosRelacionados.Rows
If dRow2("CveMetodoPago").ToString.ToEntero > 0 Then
If dRow2("CveMetodoPago").ToString.ToEntero = 1 Then
@@ -2947,27 +2957,41 @@ Partial Class Compras_eFacturas
ObjCompras.Dispose()
- If Math.Abs(DiferenciaImportes) > 5 Then
- TextoDiferenciaImporte = $" - IE ${ImporteIES.FormatoNumero}
Diferencia { DiferenciaImportes.FormatoNumero() }
"
- BtnVincularPago.Visible = False
- MSGComplemento = MSGComplemento & $" Existe una diferencia mayor a $5.00 ({Math.Abs(DiferenciaImportes)})"
+ If TieneCompras Then
+ If ImporteIES > 0 Then
+ If Math.Abs(DiferenciaImportes) > 5 Then
+ TextoDiferenciaImporte = $" - IE ${ImporteIES.FormatoNumero} Diferencia { DiferenciaImportes.FormatoNumero() }
"
+ BtnVincularPago.Visible = False
+ MSGComplemento = MSGComplemento & $" Existe una diferencia mayor a $5.00 ({Math.Abs(DiferenciaImportes)})"
- If TieneRegistros AndAlso UsuarioActual.TienePermisoProceso(286) Then
- DivVincularPagoManualmente.Visible = True
+ If TieneRegistros AndAlso UsuarioActual.TienePermisoProceso(286) Then
+ DivVincularPagoManualmente.Visible = True
+ End If
+ End If
+ Else
+ TextoDiferenciaImporte = $"No se encontraron pagos "
+ BtnVincularPago.Visible = False
+ MSGComplemento = MSGComplemento & $" No se encontraron pagos "
+ If TieneRegistros AndAlso UsuarioActual.TienePermisoProceso(286) Then
+ DivVincularPagoManualmente.Visible = True
+ End If
End If
-
Else
- 'BtnVincularPago.Visible = True
- 'TextoDiferenciaImporte = ""
+ BtnVincularPago.Visible = False
+ MSGComplemento = MSGComplemento & $"No se encontraron compras relacionadas"
+ DivVincularPagoManualmente.Visible = False
End If
+
+
+
LblSerieFolioPago.Text = $"{SeriePago}-{FolioPago}"
LblImportePago.Text = Monto.ToString("###,###,###.00") 'ImportePago.FormatoNumero
LblPagosCantidad.Text = PagosCantidad.ToString
LblImporteIE.Text = ImporteIES.FormatoNumero
- LblDiferencia.Text = If(DiferenciaImportes <> 0, DiferenciaImportes.FormatoNumero, "")
+ LblDiferencia.Text = If(DiferenciaImportes <> 0 And ImporteIES > 0, DiferenciaImportes.FormatoNumero, "")
If MSGComplemento.Trim.Length > 0 And CveComplementoPagoCompra <= 0 Then