org-mode time tracking setup integrating with SaaS (Harvest, Toggl, Bonsai etc)

2020-10-09 Thread Daryl Manning
I'm just setting up a new time tracking system and have in the past used
Harvest to track and bill clients.

With emacs clocking and calendaring, I was actually hoping to find some way
to have it interface/export with one of the SaaS systems and effectively
allow me to track time in emacs but then get data into one of those systems
(effectively for presentation, and invoicing and such.).

Has anyone run across a good integration for doing that or has a blog post
on their system particularly where they need to track hours/tasks across a
few clients and projects for consultancy purposes (or a roll your own would
be an interesting start though I do like the SaaS systems' invoicing and
payments and such.).

thanks!
Daryl.


Re: org-mode time tracking setup integrating with SaaS (Harvest, Toggl, Bonsai etc)

2020-10-09 Thread Russell Adams
On Fri, Oct 09, 2020 at 07:21:24PM +0800, Daryl Manning wrote:
> I'm just setting up a new time tracking system and have in the past used
> Harvest to track and bill clients.
>

I bill my clients from work I log with Org.

I keep one file per project per customer. Every time I change tasks,
leave the keyboard and return, or just feel it is appropriate I add an
inactive timestamp to my notes. I've simplified that with a keybind to
make it one keypress instead of C-u C-c ! Enter.

At the end of the month, I look at a per Org file agenda via with
logbook mode and inactive timestamps enabled (C-c a 1 a L [) and count
up the hours. On issue with automating the counting (ie: clocking in
and out) is that each customer may have different rules (ie: minimum
hours for a task, emergency after hours support, etc). I haven't a
good way to encode that information. I do tend to make a simple table
with my count.

I enter this data manually into other timekeeping systems depending on
the customer, or my invoicing system. Unfortunately given the variety
I see no good way to directly export and invoice.

I find the flexibility of Org allows me to quickly do this with all my
needed data in one place. I often put ticket #'s as tags on my
headlines, and if a customer questions the bill I just save my agenda
view as HTML and send it over.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: org-mode time tracking setup integrating with SaaS (Harvest, Toggl, Bonsai etc)

2020-10-10 Thread Dr. Arne Babenhauserheide

Daryl Manning  writes:

> Has anyone run across a good integration for doing that or has a blog post
> on their system particularly where they need to track hours/tasks across a
> few clients and projects for consultancy purposes

I don’t do consultancy, but we I need to book for multiple projects at
work. I track my time and projects with org-mode (and found that
whenever I think “this is so small, I don’t need an org-headline for
this”, time gets out of hand). At the end of the week I then book my
time on the corresponding Jira issues using the clocktable in
agenda-view.

These are my essential customizations for that:

(use-package org-agenda
  :defer 8
  :custom
  (alert-default-style 'libnotify)
  (appt-disp-window-function 'alert-for-appt)
  (appt-delete-window-function (lambda ()))
  (org-agenda-clock-consistency-checks
   (quote
(:max-duration "12:00" :min-duration 0 :max-gap "0:05" :gap-ok-around
   ("4:00" "12:00")
   :default-face
   ((:background "DarkRed")
(:foreground "white"))
   :overlap-face nil :gap-face nil :no-end-time-face nil 
:long-face nil :short-face nil)))
  (org-agenda-clockreport-parameter-plist (quote (:link t :maxlevel 2 
:properties ("Effort"
  (org-agenda-start-with-clockreport-mode t)
  :config
  ;; Rebuild the reminders everytime the agenda is displayed
  (add-hook 'org-agenda-finalize-hook (lambda () (org-agenda-to-appt t)))
  ;; Run once when Emacs starts
  (org-agenda-to-appt t)
  ;; Activate appointments so we get notifications
  (appt-activate t))

(defun my/org-agenda-show-kanban ()
  (interactive)
  (save-excursion
(search-forward ":KANBAN:")
(org-agenda-goto)
(org-narrow-to-subtree)
(show-all)
(fit-window-to-buffer)
(widen)
(recenter-top-bottom 0)))

;; KDE: show custom agenda with kanban via f12:
(with-eval-after-load 'org
  (setq org-agenda-custom-commands
'(("o" "Agenda and TODOs"
   ((agenda)
(tags-todo "-notodo" ((org-agenda-block-separator ?-)))
(tags "KANBAN" ((org-agenda-block-separator 
?-)(org-agenda-compact-blocks nil)(org-agenda-overriding-header "")))

;; from https://www.emacswiki.org/emacs/TransposeWindows solution by Robert Bost
(defun rotate-windows (arg)
  "Rotate your windows; use the prefix argument to rotate the other direction"
  (interactive "P")
  (if (not (> (count-windows) 1))
  (message "You can't rotate a single window!")
(let* ((rotate-times (prefix-numeric-value arg))
   (direction (if (or (< rotate-times 0) (equal arg '(4)))
  'reverse 'identity)))
  (dotimes (_ (abs rotate-times))
(dotimes (i (- (count-windows) 1))
  (let* ((w1 (elt (funcall direction (window-list)) i))
 (w2 (elt (funcall direction (window-list)) (+ i 1)))
 (b1 (window-buffer w1))
 (b2 (window-buffer w2))
 (s1 (window-start w1))
 (s2 (window-start w2))
 (p1 (window-point w1))
 (p2 (window-point w2)))
(set-window-buffer-start-and-point w1 b2 s2 p2)
(set-window-buffer-start-and-point w2 b1 s1 p1)))


(defun agenda-and-todo ()
  (interactive)
  (org-agenda nil "o")
  (delete-other-windows)
  (my/org-agenda-show-kanban)
  (rotate-windows 1))
;;  systemsettings shortcuts: map f12 to
;;emacsclient -e '(progn (show-frame)(agenda-and-todo))'
(global-set-key (kbd "") 'agenda-and-todo)

;; KDE: record new issue with M-f12 (alt f12):
;;  systemsettings shortcuts: map alt f12 to
;;emacsclient -e '(progn (show-frame)(org-capture))'
(global-set-key (kbd "M-") 'org-capture)

;; clock into the current task via S-f12 (shift f12). rationale: shift
;; is used to shift from one task to another without clocking out.
(global-set-key (kbd "S-") 'org-clock-in)

;; KDE: global clock out via M-S-f12 (alt-shift f12):
;;  systemsettings shortcuts: map f12 to
;;emacsclient -e '(progn (show-frame)(org-clock-out))'
(global-set-key (kbd "M-S-") 'org-clock-out)

(defun show-frame (&optional frame)
  "Show the current Emacs frame or the FRAME given as argument.

And make sure that it really shows up!"
  (raise-frame)
  ; yes, you have to call this twice. Don’t ask me why…
  ; select-frame-set-input-focus calls x-focus-frame and does a bit of
  ; additional magic.
  (select-frame-set-input-focus (selected-frame))
  (select-frame-set-input-focus (selected-frame)))


I have a dedicated emacs environment for work that I brought over into
homeoffice.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein
ohne es zu merken


signature.asc
Description: PGP signature


Re: org-mode time tracking setup integrating with SaaS (Harvest, Toggl, Bonsai etc)

2020-10-11 Thread Daryl Manning
Very impressive. I am probably going to steal some of these functions.
Thank you.

Is the process you use to get this into jira (via clocktable) automatedx in
any way (even copy/paste) or do you have to put things in manually again?

Daryl.


On Sat, Oct 10, 2020 at 5:21 PM Dr. Arne Babenhauserheide 
wrote:

>
> Daryl Manning  writes:
>
> > Has anyone run across a good integration for doing that or has a blog
> post
> > on their system particularly where they need to track hours/tasks across
> a
> > few clients and projects for consultancy purposes
>
> I don’t do consultancy, but we I need to book for multiple projects at
> work. I track my time and projects with org-mode (and found that
> whenever I think “this is so small, I don’t need an org-headline for
> this”, time gets out of hand). At the end of the week I then book my
> time on the corresponding Jira issues using the clocktable in
> agenda-view.
>
> These are my essential customizations for that:
>
> (use-package org-agenda
>   :defer 8
>   :custom
>   (alert-default-style 'libnotify)
>   (appt-disp-window-function 'alert-for-appt)
>   (appt-delete-window-function (lambda ()))
>   (org-agenda-clock-consistency-checks
>(quote
> (:max-duration "12:00" :min-duration 0 :max-gap "0:05" :gap-ok-around
>("4:00" "12:00")
>:default-face
>((:background "DarkRed")
> (:foreground "white"))
>:overlap-face nil :gap-face nil :no-end-time-face nil
> :long-face nil :short-face nil)))
>   (org-agenda-clockreport-parameter-plist (quote (:link t :maxlevel 2
> :properties ("Effort"
>   (org-agenda-start-with-clockreport-mode t)
>   :config
>   ;; Rebuild the reminders everytime the agenda is displayed
>   (add-hook 'org-agenda-finalize-hook (lambda () (org-agenda-to-appt t)))
>   ;; Run once when Emacs starts
>   (org-agenda-to-appt t)
>   ;; Activate appointments so we get notifications
>   (appt-activate t))
>
> (defun my/org-agenda-show-kanban ()
>   (interactive)
>   (save-excursion
> (search-forward ":KANBAN:")
> (org-agenda-goto)
> (org-narrow-to-subtree)
> (show-all)
> (fit-window-to-buffer)
> (widen)
> (recenter-top-bottom 0)))
>
> ;; KDE: show custom agenda with kanban via f12:
> (with-eval-after-load 'org
>   (setq org-agenda-custom-commands
> '(("o" "Agenda and TODOs"
>((agenda)
> (tags-todo "-notodo" ((org-agenda-block-separator ?-)))
> (tags "KANBAN" ((org-agenda-block-separator
> ?-)(org-agenda-compact-blocks nil)(org-agenda-overriding-header "")))
>
> ;; from https://www.emacswiki.org/emacs/TransposeWindows solution by
> Robert Bost
> (defun rotate-windows (arg)
>   "Rotate your windows; use the prefix argument to rotate the other
> direction"
>   (interactive "P")
>   (if (not (> (count-windows) 1))
>   (message "You can't rotate a single window!")
> (let* ((rotate-times (prefix-numeric-value arg))
>(direction (if (or (< rotate-times 0) (equal arg '(4)))
>   'reverse 'identity)))
>   (dotimes (_ (abs rotate-times))
> (dotimes (i (- (count-windows) 1))
>   (let* ((w1 (elt (funcall direction (window-list)) i))
>  (w2 (elt (funcall direction (window-list)) (+ i 1)))
>  (b1 (window-buffer w1))
>  (b2 (window-buffer w2))
>  (s1 (window-start w1))
>  (s2 (window-start w2))
>  (p1 (window-point w1))
>  (p2 (window-point w2)))
> (set-window-buffer-start-and-point w1 b2 s2 p2)
> (set-window-buffer-start-and-point w2 b1 s1 p1)))
>
>
> (defun agenda-and-todo ()
>   (interactive)
>   (org-agenda nil "o")
>   (delete-other-windows)
>   (my/org-agenda-show-kanban)
>   (rotate-windows 1))
> ;;  systemsettings shortcuts: map f12 to
> ;;emacsclient -e '(progn (show-frame)(agenda-and-todo))'
> (global-set-key (kbd "") 'agenda-and-todo)
>
> ;; KDE: record new issue with M-f12 (alt f12):
> ;;  systemsettings shortcuts: map alt f12 to
> ;;emacsclient -e '(progn (show-frame)(org-capture))'
> (global-set-key (kbd "M-") 'org-capture)
>
> ;; clock into the current task via S-f12 (shift f12). rationale: shift
> ;; is used to shift from one task to another without clocking out.
> (global-set-key (kbd "S-") 'org-clock-in)
>
> ;; KDE: global clock out via M-S-f12 (alt-shift f12):
> ;;  systemsettings shortcuts: map f12 to
> ;;emacsclient -e '(progn (show-frame)(org-clock-out))'
> (global-set-key (kbd "M-S-") 'org-clock-out)
>
> (defun show-frame (&optional frame)
>   "Show the current Emacs frame or the FRAME given as argument.
>
> And make sure that it really shows up!"
>   (raise-frame)
>   ; yes, you have to call this twice. Don’t ask me why…
>   ; select-frame-set-input-focus calls x-focus-frame and does a bit of
>   ; additional magic.
>   (select-frame-se