Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 662ded38

Von Sven Schöling vor mehr als 14 Jahren hinzugefügt

  • ID 662ded382ad646d46d1e2613df42ed35ee2f6265
  • Vorgänger eed84962
  • Nachfolger 79fe937f

Globale Variablen entfernt/umgewandelt.

Conflicts:

bin/mozilla/ar.pl

Unterschiede anzeigen:

bin/mozilla/rp.pl
107 107
  'balance_sheet'    => 'report',
108 108
};
109 109

  
110
# subs use these pretty freely, so declare them here
111
our (%column_data, @column_index);
112
our ($subtotalnetamount, $subtotaltax, $subtotal);
113

  
114 110
sub check_rp_access {
115 111
  my $form     = $main::form;
116 112

  
......
2115 2111
  my $descvar     = "$form->{accno}_description";
2116 2112
  my $description = $form->escape($form->{$descvar});
2117 2113
  my $ratevar     = "$form->{accno}_rate";
2118
  our $taxrate; # most likely error
2114
  my ($subtotalnetamount, $subtotaltax, $subtotal) = (0, 0, 0);
2119 2115

  
2120 2116
  my $department = $form->escape($form->{department});
2121 2117

  
2122 2118
  # construct href
2123 2119
  my $href =
2124
    "$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
2120
    "$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&report=$form->{report}";
2125 2121

  
2126 2122
  # construct callback
2127 2123
  $description = $form->escape($form->{$descvar},   1);
2128 2124
  $department  = $form->escape($form->{department}, 1);
2129 2125
  my $callback    =
2130
    "$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&$ratevar=$taxrate&report=$form->{report}";
2126
    "$form->{script}?&action=generate_tax_report&fromdate=$form->{fromdate}&todate=$form->{todate}&db=$form->{db}&method=$form->{method}&accno=$form->{accno}&$descvar=$description&department=$department&report=$form->{report}";
2131 2127

  
2132 2128
  my $title = $form->escape($form->{title});
2133 2129
  $href .= "&title=$title";
......
2138 2134

  
2139 2135
  my @columns =
2140 2136
    $form->sort_columns(qw(id transdate invnumber name netamount tax amount));
2137
  my @column_index;
2141 2138

  
2142 2139
  foreach my $item (@columns) {
2143 2140
    if ($form->{"l_$item"} eq "Y") {
......
2242 2239

  
2243 2240
    if ($form->{l_subtotal} eq 'Y') {
2244 2241
      if ($sameitem ne $ref->{ $form->{sort} }) {
2245
        &tax_subtotal;
2242
        tax_subtotal(\@column_index, \$subtotalnetamount, \$subtotaltax, \$subtotal);
2246 2243
        $sameitem = $ref->{ $form->{sort} };
2247 2244
      }
2248 2245
    }
......
2258 2255
      $ref->{$_} = $form->format_amount(\%myconfig, $ref->{$_}, 2, " ");
2259 2256
    } qw(netamount tax amount);
2260 2257

  
2258
    my %column_data;
2261 2259
    $column_data{id}        = qq|<td>$ref->{id}</td>|;
2262 2260
    $column_data{invnumber} =
2263 2261
      qq|<td><a href=$module?action=edit&id=$ref->{id}&callback=$callback>$ref->{invnumber}</a></td>|;
......
2282 2280
  }
2283 2281

  
2284 2282
  if ($form->{l_subtotal} eq 'Y') {
2285
    &tax_subtotal;
2283
    tax_subtotal(\@column_index, \$subtotalnetamount, \$subtotaltax, \$subtotal);
2286 2284
  }
2287 2285

  
2286
  my %column_data;
2288 2287
  map { $column_data{$_} = qq|<th>&nbsp;</th>| } @column_index;
2289 2288

  
2290 2289
  print qq|
......
2322 2321
sub tax_subtotal {
2323 2322
  $main::lxdebug->enter_sub();
2324 2323

  
2324
  my ($column_index, $subtotalnetamount, $subtotaltax, $subtotal) = @_;
2325

  
2325 2326
  my $form     = $main::form;
2326 2327
  my %myconfig = %main::myconfig;
2327 2328
  my $locale   = $main::locale;
2328 2329

  
2329
  map { $column_data{$_} = "<td>&nbsp;</td>" } @column_index;
2330
  my %column_data;
2331
  map { $column_data{$_} = "<td>&nbsp;</td>" } @{ $column_index };
2330 2332

  
2331
  $subtotalnetamount = $form->format_amount(\%myconfig, $subtotalnetamount, 2, "&nbsp;");
2332
  $subtotaltax       = $form->format_amount(\%myconfig, $subtotaltax, 2, "&nbsp;");
2333
  $subtotal          = $form->format_amount(\%myconfig, $subtotalnetamount + $subtotaltax, 2, "&nbsp;");
2333
  $$subtotalnetamount = $form->format_amount(\%myconfig, $$subtotalnetamount, 2, "&nbsp;");
2334
  $$subtotaltax       = $form->format_amount(\%myconfig, $$subtotaltax, 2, "&nbsp;");
2335
  $$subtotal          = $form->format_amount(\%myconfig, $$subtotalnetamount + $$subtotaltax, 2, "&nbsp;");
2334 2336

  
2335
  $column_data{netamount} = "<th class=listsubtotal align=right>$subtotalnetamount</th>";
2336
  $column_data{tax}       = "<th class=listsubtotal align=right>$subtotaltax</th>";
2337
  $column_data{amount}    = "<th class=listsubtotal align=right>$subtotal</th>";
2337
  $column_data{netamount} = "<th class=listsubtotal align=right>$$subtotalnetamount</th>";
2338
  $column_data{tax}       = "<th class=listsubtotal align=right>$$subtotaltax</th>";
2339
  $column_data{amount}    = "<th class=listsubtotal align=right>$$subtotal</th>";
2338 2340

  
2339
  $subtotalnetamount = 0;
2340
  $subtotaltax       = 0;
2341
  $$subtotalnetamount = 0;
2342
  $$subtotaltax       = 0;
2341 2343

  
2342 2344
  print qq|
2343 2345
        <tr class=listsubtotal>
2344 2346
|;
2345
  map { print "\n$column_data{$_}" } @column_index;
2347
  map { print "\n$column_data{$_}" } @{ $column_index };
2346 2348

  
2347 2349
  print qq|
2348 2350
        </tr>

Auch abrufbar als: Unified diff