Package: gnotime Version: 2.2.3-2local1 Severity: wishlist Tags: patch The attached patch adds two new scheme functions, gtt-task-blocktime-str and gtt-task-blockvalue-str, which behave exactly like their counterparts gtt-task-time-str and gtt-task-value-str, except that they round according to the billing block for each task. This patch is against gnotime 2.2.3. This patch has also been submitted to the sourceforge project.
-- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (500, 'testing'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.22-3-vserver-686 (SMP w/2 CPU cores) Locale: LANG=C, LC_CTYPE=en_CA.iso8859-1 (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/bash Versions of packages gnotime depends on: ii gconf2 2.20.1-2 GNOME configuration database syste ii guile-1.6-libs 1.6.8-6 Main Guile libraries ii libart-2.0-2 2.3.19-3 Library of functions for 2D graphi ii libatk1.0-0 1.20.0-1 The ATK accessibility toolkit ii libbonobo2-0 2.20.2-1 Bonobo CORBA interfaces library ii libbonoboui2-0 2.20.0-1 The Bonobo UI library ii libc6 2.7-5 GNU C Library: Shared libraries ii libcairo2 1.4.10-1+lenny2 The Cairo 2D vector graphics libra ii libdbus-1-3 1.1.2-1 simple interprocess messaging syst ii libdbus-glib-1-2 0.74-1 simple interprocess messaging syst ii libfontconfig1 2.4.2-1.2 generic font configuration library ii libgconf2-4 2.20.1-2 GNOME configuration database syste ii libglade2-0 1:2.6.2-1 library to load .glade files at ru ii libglib2.0-0 2.14.3-1 The GLib library of C routines ii libgnome2-0 2.20.1.1-1 The GNOME 2 library - runtime file ii libgnomecanvas2-0 2.20.1.1-1 A powerful object-oriented display ii libgnomeprint2.2-0 2.18.0-2 The GNOME 2.2 print architecture - ii libgnomeprintui2.2-0 2.18.1-1 GNOME 2.2 print architecture User ii libgnomeui-0 2.20.1.1-1 The GNOME 2 libraries (User Interf ii libgnomevfs2-0 1:2.20.1-1 GNOME Virtual File System (runtime ii libgtk2.0-0 2.12.1-1 The GTK+ graphical user interface ii libgtkhtml3.8-15 3.12.3-2 HTML rendering/editing library - r ii libguile-ltdl-1 1.6.8-6 Guile's patched version of libtool ii libice6 2:1.0.4-1 X11 Inter-Client Exchange library ii liborbit2 1:2.14.7-0.1 libraries for ORBit2 - a CORBA ORB ii libpango1.0-0 1.18.3-1 Layout and rendering of internatio ii libpopt0 1.10-3 lib for parsing cmdline parameters ii libqof1 0.7.3-1 Query Object Framework ii libqthreads-12 1.6.8-6 QuickThreads library for Guile ii libsm6 2:1.0.3-1+b1 X11 Session Management library ii libx11-6 2:1.0.3-7 X11 client-side library ii libxcomposite1 1:0.4.0-1 X11 Composite extension library ii libxcursor1 1:1.1.9-1 X cursor management library ii libxdamage1 1:1.1.1-3 X11 damaged region extension libra ii libxext6 1:1.0.3-2 X11 miscellaneous extension librar ii libxfixes3 1:4.0.3-2 X11 miscellaneous 'fixes' extensio ii libxi6 2:1.1.3-1 X11 Input extension library ii libxinerama1 1:1.0.2-1 X11 Xinerama extension library ii libxml2 2.6.30.dfsg-3 GNOME XML library ii libxrandr2 2:1.2.2-1 X11 RandR extension library ii libxrender1 1:0.9.4-1 X Rendering Extension client libra ii scrollkeeper 0.3.14-16 A free electronic cataloging syste ii zlib1g 1:1.2.3.3.dfsg-8 compression library - runtime gnotime recommends no packages. -- no debconf information
diff -urbBw gnotime-2.2.3/src/ghtml.c gnotime-2.2.3-mine/src/ghtml.c --- gnotime-2.2.3/src/ghtml.c 2007-09-05 13:19:52.000000000 -0600 +++ gnotime-2.2.3-mine/src/ghtml.c 2008-01-15 14:20:27.000000000 -0700 @@ -1089,6 +1089,23 @@ } static SCM +task_get_blocktime_str_scm (GttGhtml *ghtml, GttTask *tsk) +{ + time_t task_secs; + char buff[100]; + int bill_unit; + time_t value; + + task_secs = gtt_task_get_secs_ever(tsk); + bill_unit = gtt_task_get_bill_unit(tsk); + + value = (time_t) (lround( ((double) task_secs) / bill_unit ) * bill_unit); + + qof_print_hours_elapsed_buff (buff, 100, value, TRUE); + return scm_mem2string (buff, strlen (buff)); +} + +static SCM task_get_earliest_str_scm (GttGhtml *ghtml, GttTask *tsk) { char buff[100]; @@ -1154,13 +1172,52 @@ return scm_mem2string (buff, strlen (buff)); } +static SCM +task_get_blockvalue_str_scm (GttGhtml *ghtml, GttTask *tsk) +{ + time_t task_secs; + char buff[100]; + double value; + GttProject *prj; + int bill_unit; + + task_secs = gtt_task_get_secs_ever(tsk); + bill_unit = gtt_task_get_bill_unit(tsk); + + value = (round( ((double) task_secs) / bill_unit ) * bill_unit) / 3600.0; + + prj = gtt_task_get_parent (tsk); + + switch (gtt_task_get_billrate (tsk)) + { + case GTT_REGULAR: value *= gtt_project_get_billrate (prj); break; + case GTT_OVERTIME: value *= gtt_project_get_overtime_rate (prj); break; + case GTT_OVEROVER: value *= gtt_project_get_overover_rate (prj); break; + case GTT_FLAT_FEE: value = gtt_project_get_flat_fee (prj); break; + default: value = 0.0; + } + + if (!config_currency_use_locale) { + setlocale(LC_MONETARY, "C"); + setlocale(LC_NUMERIC, "C"); + snprintf (buff, 100, "%s %.2f", config_currency_symbol, value+0.0049); + } else { + setlocale(LC_ALL, ""); + strfmon(buff, 100, "%n", value); + } + + return scm_mem2string (buff, strlen (buff)); +} + RET_TASK_STR (ret_task_billstatus, task_get_billstatus) RET_TASK_STR (ret_task_billable, task_get_billable) RET_TASK_STR (ret_task_billrate, task_get_billrate) RET_TASK_SIMPLE (ret_task_time_str, task_get_time_str) +RET_TASK_SIMPLE (ret_task_blocktime_str,task_get_blocktime_str) RET_TASK_SIMPLE (ret_task_earliest_str, task_get_earliest_str) RET_TASK_SIMPLE (ret_task_latest_str, task_get_latest_str) RET_TASK_SIMPLE (ret_task_value_str, task_get_value_str) +RET_TASK_SIMPLE (ret_task_blockvalue_str,task_get_blockvalue_str) /* ============================================================== */ @@ -1593,9 +1650,11 @@ scm_c_define_gsubr("gtt-task-billable", 1, 0, 0, ret_task_billable); scm_c_define_gsubr("gtt-task-billrate", 1, 0, 0, ret_task_billrate); scm_c_define_gsubr("gtt-task-time-str", 1, 0, 0, ret_task_time_str); + scm_c_define_gsubr("gtt-task-blocktime-str", 1, 0, 0, ret_task_blocktime_str); scm_c_define_gsubr("gtt-task-earliest-str", 1, 0, 0, ret_task_earliest_str); scm_c_define_gsubr("gtt-task-latest-str", 1, 0, 0, ret_task_latest_str); scm_c_define_gsubr("gtt-task-value-str", 1, 0, 0, ret_task_value_str); + scm_c_define_gsubr("gtt-task-blockvalue-str",1, 0, 0, ret_task_blockvalue_str); scm_c_define_gsubr("gtt-task-parent", 1, 0, 0, ret_task_parent); scm_c_define_gsubr("gtt-interval-start", 1, 0, 0, ret_ivl_start);