validar pagos econollantas

This commit is contained in:
2020-03-06 15:22:04 -07:00
parent 321a660b61
commit af784981d6

View File

@@ -2592,6 +2592,11 @@ Partial Class Ventas
BloqueaCondiconesPago()
BloqueaClasificaciones()
'NO PERMITIR AGREGAR PS DESDE VENTAS EN ECONOLLANTAS
If UsuarioActual.CveEmpresa = 141 Then
BtnModalAddPS.Enabled = False
End If
End Sub
Private Sub BloqueaClasificaciones()
If UsuarioActual.CveEmpresa = 141 AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
@@ -17504,6 +17509,28 @@ Partial Class Ventas
End Sub
Private Function ValidaPagosContado() As Boolean
Dim Retorno = False
'SI LA VENTA ES NUEVA VALIDAR TAMBIEN LOS PAGOS DE CONTADO
If UsuarioActual.CveEmpresa = 141 AndAlso CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then
If Not PermiteCredito AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) Then
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
Retorno = True
Return Retorno
End If
If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then
Dim Total As Decimal = TxtTotal.Text.ToDecimal()
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal()
If TotalPago < Total Then
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia)
Retorno = True
Return Retorno
End If
End If
End If
'SI TIENE SALDO PENDIENTE VALIDA SI TIENE PAGOS
If Me.SaldoVenta > 0 Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso (UsuarioActual.Empresa.Funcionalidad(531) = "1") AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then
@@ -17511,6 +17538,21 @@ Partial Class Ventas
Retorno = True
End If
If UsuarioActual.CveEmpresa = 141 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") Then
If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then
Dim Total As Decimal = TxtTotal.Text.ToDecimal()
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal()
If TotalPago < Total Then
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia)
Retorno = True
Return Retorno
End If
End If
End If
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, LblTotalNC.Text.Trim().ToDecimal(), 0)
If TotalNC > 0 Then
@@ -23945,6 +23987,20 @@ Partial Class Ventas
Retorno = False
Return Retorno
End If
If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then
Dim Total As Decimal = TxtTotal.Text.ToDecimal()
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal()
If TotalPago < Total Then
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia)
Retorno = False
Return Retorno
End If
End If
End If
Return Retorno