--FIX
This commit is contained in:
@@ -240,49 +240,52 @@ Partial Class Ventas_CatAutorizacionLimites
|
||||
End If
|
||||
|
||||
Dim Importe As Decimal = 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 As Decimal = gvRow.DataKey("Saldo").ToDecimal()
|
||||
Dim LimiteCredito As Decimal = gvRow.DataKey("LimiteCredito").ToDecimal()
|
||||
'SI EL LIMITE ES 0, PERMITE AUTORIZAR
|
||||
If LimiteCredito > 0 Then
|
||||
Dim PorcentajeMaximoAutorizar As Decimal = 0.1D
|
||||
If UsuarioActual.Empresa.Funcionalidad(595).Contiene("1", "2") Then
|
||||
'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
|
||||
|
||||
If UsuarioActual.PorcentajeMaximoAutorizacion > 0 Then
|
||||
PorcentajeMaximoAutorizar = (UsuarioActual.PorcentajeMaximoAutorizacion / 100)
|
||||
Dim SaldoCliente As Decimal = gvRow.DataKey("Saldo").ToDecimal()
|
||||
Dim LimiteCredito As Decimal = gvRow.DataKey("LimiteCredito").ToDecimal()
|
||||
'SI EL LIMITE ES 0, PERMITE AUTORIZAR
|
||||
If LimiteCredito > 0 Then
|
||||
Dim PorcentajeMaximoAutorizar As Decimal = 0.1D
|
||||
|
||||
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
|
||||
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
|
||||
End If
|
||||
'AUTORIZACION POR DIAS VENCIDOS
|
||||
ElseIf TipoAutorizacion = 2 Then
|
||||
Dim DiasVencidos As Integer = gvRow.DataKey("DiasVencidos").ToEntero()
|
||||
If DiasVencidos > 0 Then
|
||||
Dim DiasVencidosPermitidos As Integer = 5
|
||||
|
||||
Dim DiasVencidosAutorizacion As Integer = gvRow.DataKey("DiasVencidosAutorizacion").ToEntero()
|
||||
|
||||
'AUTORIZACION POR DIAS VENCIDOS
|
||||
ElseIf TipoAutorizacion = 2 Then
|
||||
Dim DiasVencidos As Integer = gvRow.DataKey("DiasVencidos").ToEntero()
|
||||
If DiasVencidos > 0 Then
|
||||
Dim DiasVencidosPermitidos As Integer = 5
|
||||
If DiasVencidos > DiasVencidosAutorizacion Then
|
||||
Alert($"No se puede autorizar, los días vencidos del cliente son mayores a la autorización. <br/> Dias Vencidos: {DiasVencidos:N0} . Dias autorizados. {DiasVencidosAutorizacion:N0}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim DiasVencidosAutorizacion As Integer = gvRow.DataKey("DiasVencidosAutorizacion").ToEntero()
|
||||
If UsuarioActual.DiasMaximoAutorizacion > 0 Then
|
||||
DiasVencidosPermitidos = UsuarioActual.DiasMaximoAutorizacion
|
||||
End If
|
||||
|
||||
If DiasVencidos > DiasVencidosAutorizacion Then
|
||||
Alert($"No se puede autorizar, los días vencidos del cliente son mayores a la autorización. <br/> Dias Vencidos: {DiasVencidos:N0} . Dias autorizados. {DiasVencidosAutorizacion:N0}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If UsuarioActual.DiasMaximoAutorizacion > 0 Then
|
||||
DiasVencidosPermitidos = UsuarioActual.DiasMaximoAutorizacion
|
||||
End If
|
||||
|
||||
If DiasVencidosAutorizacion > DiasVencidosPermitidos Then
|
||||
Alert($"No se puede autorizar, la cantidad máxima de días vencidos permitidas es de {DiasVencidosPermitidos:N0}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
If DiasVencidosAutorizacion > DiasVencidosPermitidos Then
|
||||
Alert($"No se puede autorizar, la cantidad máxima de días vencidos permitidas es de {DiasVencidosPermitidos:N0}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -1493,6 +1493,7 @@ Partial Class Ventas_PVCobranza
|
||||
ObjNC.CalculaTotales()
|
||||
|
||||
Dim CveIE As Integer = -1
|
||||
Dim UUIDFactura As String = "" 'VACIO PORQUE AUN NO SE HA GENERADO
|
||||
If GvRowAnticipo IsNot Nothing Then
|
||||
CveIE = GvRowAnticipo.DataKey("CveIE").ToEntero()
|
||||
End If
|
||||
@@ -1501,13 +1502,13 @@ Partial Class Ventas_PVCobranza
|
||||
DtVentasNC.Columns.Add("CveVenta", GetType(Integer))
|
||||
DtVentasNC.Columns.Add("Importe", GetType(Decimal))
|
||||
DtVentasNC.Columns.Add("FolioFiscal", GetType(String))
|
||||
'DtVentasNC.Columns.Add("CveIE", GetType(Integer))
|
||||
DtVentasNC.Columns.Add("CveIE", GetType(Integer))
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TC", .DataType = GetType(Decimal), .DefaultValue = 1})
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TCCambioValuacion", .DataType = GetType(Decimal), .DefaultValue = 1})
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "CveEstatusFactura", .DataType = GetType(Integer), .DefaultValue = -1})
|
||||
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "Folio", .DataType = GetType(String), .DefaultValue = ""})
|
||||
|
||||
'DtVentasNC.Rows.Add(Venta.CveVenta, CveIE, Total, "")
|
||||
DtVentasNC.Rows.Add(Venta.CveVenta, Total, UUIDFactura, CveIE)
|
||||
|
||||
ObjNC.DtVentasNC = DtVentasNC
|
||||
|
||||
|
||||
Reference in New Issue
Block a user