[英]Tracking flexitime using Emacs (& org-mode)
因此,在工作中我们使用flexitime(弹性小时,弹性小时......)这很好,但很难跟踪。 我目前正在使用org-mode来跟踪我的工作时间( org-clock-(out|in)
)但是我想扩展它以自动计算我是否工作超过8小时(剩余时间应该是添加到我的弹性帐户'帐户')或更少(取决于我吃午休时间等),我的弹性时间'帐户'等余额。
有没有其他人使用Emacs?
我目前正在使用一个非常基本的设置来跟踪我的时间:
(defun check-in ()
(interactive)
(let (pbuf (current-buffer))
(find-file (convert-standard-filename "whatnot"))
(goto-char (point-max))
(insert "\n")
(org-insert-heading)
(org-insert-time-stamp (current-time))
(org-clock-in)
(save-buffer)
(switch-to-buffer pbuf)))
(defun check-out ()
(interactive)
(let (pbuf (current-buffer))
(find-file (convert-standard-filename "whatnot"))
(goto-char (point-max))
(org-clock-out)
(save-buffer)
(switch-to-buffer pbuf)))
假设我正确地理解了你的问题,我就快速解决了一个问题。 首先,如果您多次登记和退房,则应确保每天只创建一个大纲条目。 定义以下函数,即计算给定日期的加班时间。
(defun compute-overtime (duration-string)
"Computes overtime duration string for the given time DURATION-STRING."
(let (minutes-in-a-workday
work-minutes
overtime-minutes)
(defconst minutes-in-a-workday 480)
(setq work-minutes (org-duration-string-to-minutes duration-string)
overtime-minutes (- work-minutes minutes-in-a-workday))
(if (< overtime-minutes 0) (setq overtime-minutes 0))
(org-minutes-to-hh:mm-string overtime-minutes)))
然后,在文件中的时钟表公式中使用这个whatnot
。
#+BEGIN: clocktable :maxlevel 1 :emphasize nil :scope file :formula "$3='(compute-overtime $2)::@2$3=string(\"Overtime\")"
#+END: clocktable
当你在时钟表上时,点击Cc Cc来重新生成它。
你可以通过使用另一个公式来计算加班时间来获得总加班费。 但是,我还没有解决这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.