Private Sub btnRepartirFolios_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRepartirFolios.Click
Dim lista As New ArrayList
Dim folios As Integer = 76
Dim porcentaje As Integer
Dim sucursales() As String = File.ReadAllLines("suc.txt")
Dim cantidad_sucursales As Integer = sucursales.Length
Dim restante As Integer = folios
Dim total_folios As Integer
Dim p As Integer
For Each x In sucursales
p = x.Split(";")(0)
porcentaje = Math.Truncate(folios * (p / 100))
If p > 0 AndAlso porcentaje = 0 Then
porcentaje = 1
End If
restante = restante - porcentaje
lista.Add(porcentaje)
total_folios = total_folios + porcentaje
porcentaje = 0
Next
If restante >= 0 Then
While restante > 0
restante -= 1
End While
End If
lista.Sort()
lista.Reverse()
Dim pause As String = ""
End Sub
No hay comentarios.:
Publicar un comentario