Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     user.getDays = function ( year,month, callback) {
  2.         month = month;
  3.         var from = year + "-" + month + "-1";
  4.         var lastDay = new Date(year, month, 0);
  5.         var to = year + "-" + month + "-" + lastDay.getDate();
  6.  
  7.  
  8.         var query = { FromDate: from, ToDate: to };
  9.  
  10.         connection.getDays(query, function (data) {
  11.  
  12.             var tasks = [];
  13.             data.Days.forEach(function (d) {
  14.                
  15.                 if ((d.ScheduledWorkMinutes > 0 || d.ActualWorkMinutes > 0) && (new Date(d.Date).getTime() < (new Date()).getTime())) {
  16.                     console.log(d.ActualWorkMinutes - d.ScheduledWorkMinutes);
  17.                     tasks[+new Date(d.Date)] = d.ActualWorkMinutes - d.ScheduledWorkMinutes;
  18.                         /*sData.id = id;
  19.                         sData.start = new Date(d.Date);
  20.                         var end = new Date(d.Date);
  21.                         end.setMinutes(d.ActualWorkMinutes);
  22.                         sData.end = end;
  23.                         sData.title = "kirjaus";
  24.  
  25.                         sData.workMinutes = d.ActualWorkMinutes;
  26.                         sData.scheduledWorkMinutes = d.ScheduledWorkMinutes;
  27.                     sDataAll.push(sData);
  28.                     id++;*/
  29.                    
  30.                 } else {
  31.                    
  32.                 }
  33.             });
  34.  
  35.             callback(tasks);
  36.         });
  37.  
  38.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement