Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. p4 = Convert.ToInt32(validacampo(zp_.Rows(cont)("pax_evaden_p4")))
  2.  
  3. Private Function validacampo(v As Object) As Integer
  4. If v.Equals(DBNull.Value) Then
  5. Return 0
  6. Else
  7. Return v
  8. End If
  9. End Function
  10.  
  11. Private Function ValTotales(ppu As String, sentido As String, conexion As OleDbConnection) As Object
  12. Dim zp_ As New DataTable
  13. Dim cont As Integer = 0
  14. Dim evasores, p1, p2, p3, p4, val, totalusuarios, zp As Integer
  15. Dim array(4) As Integer
  16. Dim query_string As String = "SELECT * FROM Evasiones WHERE ppu='" + ppu + "' AND sentido_serv='" + sentido + "'"
  17. Dim cmm As New OleDbCommand(query_string, conexion)
  18. Dim dr As New OleDbDataAdapter(cmm)
  19. dr.Fill(zp_)
  20.  
  21. While zp_.Rows.Count > cont
  22. val += Convert.ToInt32(zp_.Rows(cont)("pax_validan_p1"))
  23. p1 += Convert.ToInt32(zp_.Rows(cont)("pax_evaden_p1"))
  24. p2 += Convert.ToInt32(zp_.Rows(cont)("pax_evaden_p2"))
  25. p3 += Convert.ToInt32(zp_.Rows(cont)("pax_evaden_p3"))
  26.  
  27. p4 = Convert.ToInt32(validacampo(zp_.Rows(cont)("pax_evaden_p4")))
  28.  
  29. Dim zp_str As String = Convert.ToString(zp_.Rows(cont)("zona_paga"))
  30. Dim new_str As String = Mid(zp_str, 1, 6)
  31. If zp_str <> "" And Mid(new_str, 1, 3) = "PAX" Then
  32. Dim a As Object = Split(new_str, " ")
  33. If Mid(a(1), 2, 1) = "," Then
  34. zp += Convert.ToInt32(Mid(a(1), 1, 1))
  35. Else
  36. zp += Convert.ToInt32(a(1))
  37. End If
  38. End If
  39.  
  40. cont += 1
  41. End While
  42.  
  43. evasores = p1 + p2 + p3 + p4
  44. totalusuarios = val + p1 + p2 + p3 + p4
  45.  
  46. array(0) = cont
  47. array(1) = zp
  48. array(2) = val
  49. array(3) = evasores
  50. array(4) = totalusuarios
  51.  
  52. Return array
  53.  
  54. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement