[BACK]Return to pta.pl CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / pta

Diff for /pta/pta.pl between version 1.1 and 1.4

version 1.1, 2020/09/27 14:35:34 version 1.4, 2020/10/20 09:23:24
Line 40  my %atypes = (
Line 40  my %atypes = (
 );  );
   
 my $translations = {  my $translations = {
       en => {},
     de => {      de => {
         'Account list'          => 'Kontenblatt',          'Account list'          => 'Kontenblatt',
         'Assets'                => 'Aktiva',          'Assets'                => 'Aktiva',
Line 71  my $translations = {
Line 72  my $translations = {
   
 sub translate ($) {  sub translate ($) {
         my $en = shift;          my $en = shift;
         return $translations ? $translations->{$en} : $en;          return $translations->{$en} || $en;
 }  }
   
 sub translate_type ($) {  sub translate_type ($) {
         my $type = shift;          my $type = shift;
         my $en = $atypes{substr $type, 0, 1} || '?';          my $en = $atypes{substr $type, 0, 1};
         return translate $en || $type;          return $en ? translate $en : $type;
 }  }
   
 # Handles account entries (not journal entries) with respect to  # Handles account entries (not journal entries) with respect to
Line 145  sub usage () {
Line 146  sub usage () {
 getopts 'abcL:nps' or usage;  getopts 'abcL:nps' or usage;
 $opt_a = $opt_b = $opt_c = $opt_p = $opt_s = 1  $opt_a = $opt_b = $opt_c = $opt_p = $opt_s = 1
     unless $opt_a || $opt_b || $opt_c || $opt_n || $opt_p || $opt_s;      unless $opt_a || $opt_b || $opt_c || $opt_n || $opt_p || $opt_s;
 $opt_L ||= 'en';  unless ($translations = $translations->{$opt_L || 'en'}) {
 if ($opt_L eq 'de') {          printf STDERR "unsupported language: -L %s\n", $opt_L;
         $translations = $translations->{$opt_L};  
 } elsif ($opt_L eq 'en') {  
         undef $opt_L;  
         undef $translations;  
 } else {  
         printf STDERR "unsupported language %s\n", $opt_L;  
         usage;          usage;
 }  }
   
Line 507  for my $cc (sort keys %cclist) {
Line 502  for my $cc (sort keys %cclist) {
   
         # --- Cost center profits and losses. --------------------------          # --- Cost center profits and losses. --------------------------
   
         if ($opt_p) {          if ($opt_p && $profit{$cc}) {
                 printf "\n%s [%s] %s\n", (translate 'Cost center'), $cc,                  printf "\n%s [%s] %s\n", (translate 'Cost center'), $cc,
                     (translate 'Profits and losses');                      (translate 'Profits and losses');
                 my $pr = 0;                  my $pr = 0;
Line 554  for my $cc (sort keys %cclist) {
Line 549  for my $cc (sort keys %cclist) {
   
 # --- Global list of profits and losses. -------------------------------  # --- Global list of profits and losses. -------------------------------
   
 if ($opt_p) {  if ($opt_p && %ptot) {
         my $pr = 0;          my $pr = 0;
         my $capital = 0;          my $capital = 0;
         my $maxd = 0;          my $maxd = 0;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

CVSweb