From af784981d6c8beb8f95982659283e12e22f2feb8 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 6 Mar 2020 15:22:04 -0700 Subject: [PATCH] validar pagos econollantas --- Ventas/Ventas.aspx.vb | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index b6bc26f8b..6cdcc7429 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -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