Porcentaje y dias vencidos para autorizacion
This commit is contained in:
@@ -100,7 +100,7 @@
|
||||
</asp:UpdatePanel>
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveAutorizacion,CveCliente,CveVendedor,Importe"
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveAutorizacion,CveCliente,CveVendedor,Importe,TipoAutorizacion,Saldo,LimiteCredito,DiasVencidos,DiasVencidosAutorizacion"
|
||||
EmptyDataText="No se encontraron autorizaciones" ToolTip=""
|
||||
CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" Width="100%" GridLines="None">
|
||||
<Columns>
|
||||
|
||||
@@ -183,12 +183,57 @@ Partial Class Ventas_CatAutorizacionLimites
|
||||
' e.Row.Cells(1).Font.Bold = True
|
||||
' e.Row.Cells(1).Text = "Activo"
|
||||
'Else
|
||||
' e.Row.Cells(1).Text = "Inactivo"
|
||||
' e.Row.Cells(1).ForeColor = Drawing.Color.Red
|
||||
' e.Row.Cells(1).Font.Bold = True
|
||||
'End If
|
||||
'End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkAutorizar_Click(sender As Object, e As EventArgs)
|
||||
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
|
||||
Dim TipoAutorizacion = gvRow.DataKey("TipoAutorizacion").ToEntero()
|
||||
Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero()
|
||||
Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero()
|
||||
Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero()
|
||||
Dim CveEstatusAutorizacion As Integer = 1
|
||||
|
||||
Dim Importe = gvRow.DataKey("Importe").ToDecimal().RoundSQL(2)
|
||||
'AUTORIZACION DE IMPORTE,
|
||||
'el cliente limite de 500, y saldo de 501. autorización que puede autorizar no puede ser mayor a 49 ( limite * 1.% - Saldo)
|
||||
If TipoAutorizacion = 1 Then
|
||||
|
||||
Dim SaldoCliente = gvRow.DataKey("Saldo").ToDecimal()
|
||||
Dim LimiteCredito = gvRow.DataKey("LimiteCredito").ToDecimal()
|
||||
|
||||
Dim PorcentajeMaximoAutorizar As Decimal = 0.1
|
||||
|
||||
If UsuarioActual.PorcentajeMaximoAutorizacion > 0 Then
|
||||
PorcentajeMaximoAutorizar = (UsuarioActual.PorcentajeMaximoAutorizacion / 100)
|
||||
End If
|
||||
|
||||
Dim ImporteMaximoAutorizar As Decimal = ((LimiteCredito * (1D + PorcentajeMaximoAutorizar)) - SaldoCliente).RoundSQL(2)
|
||||
|
||||
If Importe > ImporteMaximoAutorizar Then
|
||||
Alert($"No se puede autorizar, el importe máximo a autorizar es de {ImporteMaximoAutorizar:N2}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'AUTORIZACION POR DIAS VENCIDOS
|
||||
ElseIf TipoAutorizacion = 2 Then
|
||||
Dim DiasVencidos = gvRow.DataKey("DiasVencidos").ToEntero()
|
||||
If DiasVencidos > 0 Then
|
||||
Dim DiasVencidosPermitidos As Integer = 5
|
||||
|
||||
Dim DiasVencidosAutorizacion = gvRow.DataKey("DiasVencidosAutorizacion").ToEntero()
|
||||
|
||||
If DiasVencidos > DiasVencidosAutorizacion Then
|
||||
Alert($"No se puede autorizar, los días vencidos del cliente son mayores a la autorización. Dias Vencidos: {DiasVencidos:N0}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Reference in New Issue
Block a user