Validacion de aplicacion de NC al facturar cotizacion
This commit is contained in:
@@ -24761,14 +24761,27 @@ Partial Class Ventas
|
||||
If UsuarioActual.CveEmpresa = 141 Then
|
||||
Dim Total As Decimal = TxtTotal.Text.ToDecimal()
|
||||
|
||||
If Not PermiteCredito AndAlso ((DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) AndAlso Total > 0) Then
|
||||
Dim AmortizacionNC As Decimal = 0
|
||||
|
||||
Dim TienePagos As Boolean = ((Not (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0)) AndAlso (DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0)) OrElse AmortizacionNC > 0
|
||||
|
||||
'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO
|
||||
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
||||
For Each gvr As GridViewRow In GVAnticipos.Rows
|
||||
If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then
|
||||
AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
If Not PermiteCredito AndAlso Not TienePagos AndAlso Total > 0 Then
|
||||
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = False
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
If Not PermiteCredito AndAlso DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 AndAlso Total > 0 Then
|
||||
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal()
|
||||
If Not PermiteCredito AndAlso TienePagos AndAlso Total > 0 Then
|
||||
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC
|
||||
|
||||
If TotalPago < Total Then
|
||||
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia)
|
||||
|
||||
Reference in New Issue
Block a user