Advertisement
RupeshAcharya60

Employee Earning Code

Aug 18th, 2024 (edited)
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.68 KB | None | 0 0
  1. Sub CalculateEarning()
  2.     Dim i As Integer
  3.     Dim j As Integer
  4.     Dim totalHours As Double
  5.     Dim hour As Variant
  6.     Dim hotel As String
  7.     Dim present As Integer
  8.     Dim off As Integer
  9.     Dim absent As Integer
  10.     Dim sick As Integer
  11.    
  12.    
  13.     For Row = 3 To 340 Step 2
  14.         totalHours = 0
  15.         off = 0
  16.         sick = 0
  17.         absent = 0
  18.         present = 0
  19.         For Col = 3 To 36
  20.             hour = Cells(Row, Col).Value
  21.             hotel = Cells(Row + 1, Col).Value
  22.             If hotel = "ATLANTIS" Then
  23.                 If IsNumeric(hour) Then
  24.                     present = present + 1
  25.                     totalHours = totalHours + CDbl(hour) * 14
  26.                 End If
  27.             ElseIf hotel = "JABEEL" Or hotel = "J. SARAY" Or hotel = "JUM. EMIRATE" Or hotel = "AG TOWER" Then
  28.                 If IsNumeric(hour) Then
  29.                     present = present + 1
  30.                     totalHours = totalHours + CDbl(hour) * 8.4
  31.                 End If
  32.             ElseIf hotel = "B Hotel" Or hotel = "BANQUET" Or hotel = "81-RES" Or hotel = "Leisure" Then
  33.                 If IsNumeric(hour) Then
  34.                     present = present + 1
  35.                     totalHours = totalHours + CDbl(hour) * 14
  36.                     End If
  37.             ElseIf hotel = "WYNNDHAN" Or hotel = "MLNAM" Then
  38.                 If IsNumeric(hour) Then
  39.                 present = present + 1
  40.                 totalHours = totalHours + CDbl(hour) * 8
  41.                 End If
  42.             ElseIf hotel = "JVC" Or hotel = "FIVE LUXE" Or hotel = "FIVE PALM" Then
  43.                 If IsNumeric(hour) Then
  44.                     present = present + 1
  45.                 End If
  46.                
  47.             ElseIf hotel = "P.PLANT " Or hotel = "P.PLANT" Then
  48.                 If hour = "P" Then
  49.                     present = present + 1
  50.                 End If
  51.                
  52.                
  53.             ElseIf hotel = "HOLIDAY INN" Then
  54.                 If IsNumeric(hour) Then
  55.                     present = present + 1
  56.                     totalHours = totalHours + CDbl(hour) * 11
  57.                 End If
  58.            
  59.             End If
  60.             If hour = "OFF" Or hour = "off" Then
  61.                 off = off + 1
  62.             ElseIf hour = "S" Or hour = "SL" Then:
  63.                 sick = sick + 1
  64.             ElseIf hour = "ABSENT" Or hour = "N/P" Then
  65.                 absent = absent + 1
  66.             End If
  67.                
  68.            
  69.            
  70.         Next Col
  71.         Cells(Row, 37).Value = off
  72.         Cells(Row, 36).Value = present
  73.         Cells(Row, 39).Value = totalHours
  74.         Cells(Row, 35).Value = sick
  75.         Cells(Row, 38).Value = absent
  76.     Next Row
  77. End Sub
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement