Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. Private void calculatePayroll(string ID,DateTime FromDate,DateTime ToDate)
  2. {
  3. float cworkedDay=0, cPaidLeave=0, cAbsent=0;
  4. TimeSpan vWorkHr,vweekOT,vsatOT,vsunOT;
  5. while (FromDate <= ToDate)
  6. {
  7. var objAttMas = getAttendance(EmpID, FromDate);
  8. var objLeaveMas = getLeave(empID,FromDate)
  9. if (objAttMas != null) //Present
  10. {
  11. if (FromDate .DayOfWeek.ToString() == "Sunday") //Allowance for Sunday work
  12. {
  13. sunOT= sunOT+ sunOT
  14. }
  15.  
  16. if (FromDate .DayOfWeek.ToString() == "Saturday") //Saturday 5 hr work
  17. {
  18. if (totalHour < new TimeSpan(5, 0, 0))
  19. {
  20. totalHour = WorkHr + totalHour);
  21. }
  22. else
  23. {
  24. satOT= satOT+totalHour - new TimeSpan(5, 0, 0));
  25. WorkHr= WorkHr + TimeSpan(5, 0, 0));
  26. }
  27. }
  28. else//Week day work
  29. {
  30. WorkHr= WorkHr+ totalHour
  31. }
  32.  
  33. cworkedDay += float.Parse(noOfDay.ToString());
  34. }
  35. if (objLeaveMas != null) //Leave
  36. {
  37. var objleaveType = getLeaveType(leaveType)
  38. if (objleaveType != null) //
  39. {
  40. if (FromDate .DayOfWeek.ToString() == "Saturday")
  41. {
  42. if (objleaveType.incWeekend == 1)
  43. {
  44. cPaidLeave += float.Parse(objLeaveMas.noOfDay.ToString());
  45. }
  46. else
  47. {
  48. cAbsent += float.Parse(objLeaveMas.noOfDay.ToString());
  49. }
  50. }
  51. else
  52. {
  53. if (objleaveType.paidLeave == 1)
  54. {
  55. cPaidLeave += float.Parse(objLeaveMas.noOfDay.ToString());
  56. }
  57. else
  58. {
  59. cAbsent += float.Parse(objLeaveMas.noOfDay.ToString());
  60. }
  61. }
  62. }
  63. }
  64. if (objAttMas != null && objLeaveMas != null) //Absent
  65. {
  66. if (FromDate .DayOfWeek.ToString() != "Sunday)
  67. {
  68. cAbsent += 1;
  69. }
  70. }
  71. FromDate =FromDate .AddDays(1);
  72. } //End of For loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement