]> git.donarmstrong.com Git - bin.git/blobdiff - make_invoice
add update_git_repos command
[bin.git] / make_invoice
index 7494e2a2a06168c753f84bffb832c33f85d8fca4..5f87df414c6758c2dbdaae96a216eba74f718814 100755 (executable)
@@ -65,6 +65,14 @@ Time granularity, defaults to 0.
 
 Hourly fee, defaults to 50.00
 
+=item B<--tex-only>
+
+Only output the LaTeX file
+
+=item B<--log-only>
+
+Only output the log file
+
 =item B<--debug, -d>
 
 Debug verbosity. (Default 0)
@@ -178,11 +186,18 @@ while (<$log_fh>) {
               $date = undef;
               $time = undef;
          }
-         s/\s*\[[\.\d]+\]\s*\[[\.\d]+\]\s*$//;
-         my $string = $_;
-         my ($d1,$d2) = map {s/^\s*\*\s*//;
-                            UnixDate(ParseDate($_),'%s')
-                       } split /\s*-\s*/;
+          s/\s*\[[\.\d]+\]\s*\[[\.\d]+\]\s*$//;
+         my ($d1,$d2);
+          if (/\s*\*\s*CLOCK:\s+\[([^\]]+)\]--\[([^\]]+)\]/) {
+              $d1 = UnixDate(ParseDate($1),'%s');
+              $d2 = UnixDate(ParseDate($2),'%s');
+          } else {
+              ($d1,$d2) = map {s/^\s*\*\s*//;
+                               UnixDate(ParseDate($_),'%s')
+                           } split /\s*-\s*/;
+          }
+          my $string = '* '.strftime('%A, %B %e, %H:%M:%S',localtime($d1)).' - '.
+              strftime('%A, %B %e, %H:%M:%S',localtime($d2));
          if (not defined $first_date) {
               $first_date = $d1;
          }
@@ -199,7 +214,7 @@ while (<$log_fh>) {
          }
          $time = $hours;
          $totaldelta += $delta;
-         $calc_log .= qq($string [).sprintf('%.2f',$hours).qq(] [).sprintf('%.2f',$totaldelta/(60*60)).qq(]\n);
+         $calc_log .= $string.q( [).sprintf('%.2f',$hours).qq(] [).sprintf('%.2f',$totaldelta/(60*60)).qq(]\n);
      }
      elsif (/^\s+-\s*(.+)/) {
          my $event = $1;