Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9fe00490

Von Thomas Heck vor fast 12 Jahren hinzugefügt

  • ID 9fe004908828ea3844303b0da3dd893caaf82357
  • Vorgänger b90f08dc
  • Nachfolger 79135719

cgi->popup_menu durch L.select_tag (in templates/webpages/ap/form_header.html) ersetzt

Unterschiede anzeigen:

bin/mozilla/ap.pl
255 255
  );
256 256

  
257 257
  my %project_labels = ();
258
  my @project_values = ("");
259 258
  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
260
    push(@project_values, $item->{id});
261 259
    $project_labels{$item->{id}} = $item->{projectnumber};
262 260
  }
263 261

  
264
  my (%AP_amount_labels, @AP_amount_values);
265
  my (%AP_labels, @AP_values);
266
  my (%AP_paid_labels, @AP_paid_values);
267 262
  my %charts;
268 263
  my $taxchart_init;
269 264

  
270 265
  foreach my $item (@{ $form->{ALL_CHARTS} }) {
271
    if (grep({ $_ eq "AP_amount" } @{ $item->{link_split} })) {
272
      $taxchart_init = $item->{tax_id} if ($taxchart_init eq "");
273
      my $key = "$item->{accno}--$item->{tax_id}";
274
      push(@AP_amount_values, $key);
275
      $AP_amount_labels{$key} =
276
        "$item->{accno}--$item->{description}";
277

  
278
    } elsif (grep({ $_ eq "AP" } @{ $item->{link_split} })) {
279
      push(@AP_values, $item->{accno});
280
      $AP_labels{$item->{accno}} = "$item->{accno}--$item->{description}";
281

  
282
    } elsif (grep({ $_ eq "AP_paid" } @{ $item->{link_split} })) {
283
      push(@AP_paid_values, $item->{accno});
284
      $AP_paid_labels{$item->{accno}} =
285
        "$item->{accno}--$item->{description}";
266
    if ( grep({ $_ eq 'AP_amount' } @{ $item->{link_split} }) ) {
267
      if ( $taxchart_init eq '' ) {
268
        $taxchart_init = $item->{tax_id};
269
      }
270

  
271
      push(@{ $form->{ALL_CHARTS_AP_amount} }, $item);
272
    }
273
    elsif ( grep({ $_ eq 'AP' } @{ $item->{link_split} }) ) {
274
      push(@{ $form->{ALL_CHARTS_AP} }, $item);
275
    }
276
    elsif ( grep({ $_ eq 'AP_paid' } @{ $item->{link_split} }) ) {
277
      push(@{ $form->{ALL_CHARTS_AP_paid} }, $item);
286 278
    }
287 279

  
288 280
    $charts{$item->{accno}} = $item;
289 281
  }
290 282

  
291
  my %taxchart_labels = ();
292
  my @taxchart_values = ();
293 283
  my %taxcharts = ();
294 284
  foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
295
    my $key = "$item->{id}--$item->{rate}";
296
    $taxchart_init = $key if ($taxchart_init eq $item->{id});
297
    push(@taxchart_values, $key);
298
    $taxchart_labels{$key} =
299
      "$item->{taxdescription} " . ($item->{rate} * 100) . ' %';
285
    my $key = $item->{id} .'--'. $item->{rate};
286

  
287
    if ( $taxchart_init eq $item->{id} ) {
288
      $taxchart_init = $key;
289
    }
290

  
300 291
    $taxcharts{$item->{id}} = $item;
301 292
  }
302 293

  
......
310 301
  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
311 302
  $form->{javascript} .= qq|<script type="text/javascript" src="js/follow_up.js"></script>|;
312 303

  
313
  $form->{globalprojectnumber} =
314
    NTI($cgi->popup_menu('-name' => "globalproject_id",
315
                         '-values' => \@project_values,
316
                         '-labels' => \%project_labels,
317
                         '-default' => $form->{"globalproject_id"} ));
318

  
319
  $form->header;
304
  $form->header();
320 305

  
321 306
  for my $i (1 .. $form->{rowcount}) {
322 307

  
......
342 327

  
343 328
    $selected_taxchart = $taxchart_init unless ($form->{"taxchart_$i"});
344 329

  
345
    $form->{'selectAP_amount_'. $i} =
346
      NTI($cgi->popup_menu('-name' => "AP_amount_$i",
347
                           '-id' => "AP_amount_$i",
348
                           '-style' => 'width:400px',
349
                           '-onChange' => "setTaxkey(this, $i)",
350
                           '-values' => \@AP_amount_values,
351
                           '-labels' => \%AP_amount_labels,
352
                           '-default' => $selected_accno_full))
353
      . $cgi->hidden('-name' => "previous_AP_amount_$i",
354
                     '-default' => $selected_accno_full);
355

  
356
    $form->{'select_tax_'. $i} =
357
      NTI($cgi->popup_menu('-name' => "taxchart_$i",
358
                           '-id' => "taxchart_$i",
359
                           '-style' => 'width:200px',
360
                           '-values' => \@taxchart_values,
361
                           '-labels' => \%taxchart_labels,
362
                           '-default' => $selected_taxchart));
363

  
364
    $form->{'select_projectnumber_'. $i} =
365
      NTI($cgi->popup_menu('-name' => "project_id_$i",
366
                           '-values' => \@project_values,
367
                           '-labels' => \%project_labels,
368
                           '-default' => ($i==$form->{rowcount})? $form->{globalproject_id} : $form->{"project_id_$i"} ));
330
    $form->{'selected_accno_full_'. $i} = $selected_accno_full;
331

  
332
    $form->{'selected_taxchart_'. $i} = $selected_taxchart;
369 333
  }
370 334

  
335
  $form->{AP_amount_value_title_sub} = sub {
336
    my $item = shift;
337
    return [
338
      $item->{accno} .'--'. $item->{tax_id},
339
      $item->{accno} .'--'. $item->{description},
340
    ];
341
  };
342

  
343
  $form->{taxchart_value_title_sub} = sub {
344
    my $item = shift;
345
    return [
346
      $item->{id} .'--'. $item->{rate},
347
      $item->{taxdescription} .' '. ($item->{rate} * 100) .' %',
348
    ];
349
  };
350

  
351
  $form->{AP_paid_value_title_sub} = sub {
352
    my $item = shift;
353
    return [
354
      $item->{accno},
355
      $item->{accno} .'--'. $item->{description}
356
    ];
357
  };
358

  
359
  $form->{APselected_value_title_sub} = sub {
360
    my $item = shift;
361
    return [
362
      $item->{accno},
363
      $item->{accno} .'--'. $item->{description}
364
    ];
365
  };
371 366

  
372 367
  $form->{invtotal_unformatted} = $form->{invtotal};
373 368
  $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
374 369

  
375
  $form->{APselected} =
376
    NTI($cgi->popup_menu('-name' => "APselected", '-id' => "APselected",
377
                         '-style' => 'width:400px',
378
                         '-values' => \@AP_values, '-labels' => \%AP_labels,
379
                         '-default' => $form->{APselected}));
380

  
381 370
  $form->{totalpaid} = 0;
382 371

  
383 372
  if ( $form->{'paid_'. $form->{paidaccounts}} ) {
384 373
    $form->{paidaccounts}++;
385 374
  }
386 375
  for my $i (1 .. $form->{paidaccounts}) {
387

  
388
    $form->{'selectAP_paid_'. $i} =
389
      NTI($cgi->popup_menu('-name' => "AP_paid_$i",
390
                           '-id' => "AP_paid_$i",
391
                           '-values' => \@AP_paid_values,
392
                           '-labels' => \%AP_paid_labels,
393
                           '-default' => $form->{"AP_paid_$i"}));
394

  
395 376
    $form->{totalpaid} += $form->{"paid_$i"};
396 377

  
397 378
    # format amounts
......
417 398

  
418 399
    $form->{'paidaccount_changeable_'. $i} = $changeable;
419 400

  
420
    if ( $changeable ) {
421
      $form->{'selectpaid_project_id_'. $i} =
422
        NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
423
          '-values' => \@project_values,
424
          '-labels' => \%project_labels,
425
          '-default' => $form->{"paid_project_id_$i"}));
426
    } else {
427
      $form->{'labelpaid_project_id_'. $i} = $project_labels{$form->{'paid_project_id_'. $i}};
428
    }
401
    $form->{'labelpaid_project_id_'. $i} = $project_labels{$form->{'paid_project_id_'. $i}};
429 402
  }
430 403

  
431 404
  $form->{paid_missing} = $form->{invtotal_unformatted} - $form->{totalpaid};
templates/webpages/ap/form_header.html
162 162
              </tr>
163 163
              <tr>
164 164
                <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
165
                <td>[% globalprojectnumber %]</td>
165
                <td>
166
                  [% L.select_tag('globalproject_id', ALL_PROJECTS, with_empty = 1, default = globalproject_id, value_key = 'id', title_key = 'projectnumber') %]
167
                </td>
166 168
              </tr>
167 169
            </table>
168 170
          </td>
......
185 187
        [% FOREACH i IN [1..rowcount] %]
186 188
          <tr>
187 189
            <td>
188
              [% temp = "selectAP_amount_"_ i %][% $temp %]
190
              [% selected_accno_full = "selected_accno_full_"_ i %]
191
              [% L.select_tag('AP_amount_'_ i, ALL_CHARTS_AP_amount, value_title_sub = \AP_amount_value_title_sub, onchange = 'setTaxkey(this, '_ i _')', default = $selected_accno_full) %]
192

  
193
              <input type="hidden" name="previous_AP_amount_[% i %]" value="[% $selected_accno_full %]">
189 194
              <input type="hidden" name="tax_[% i %]" value="[% temp = "tax"_ i %][% $temp | html %]">
190 195
            </td>
191 196
            <td>
......
195 200
              [% temp = "tax_"_ i %][% $temp | html %]
196 201
            </td>
197 202
            <td>
198
              [% temp = "select_tax_"_ i %][% $temp %]
203
              [% temp = 'selected_taxchart_'_ i %]
204
              [% L.select_tag('taxchart_'_ i, ALL_TAXCHARTS, value_title_sub = \taxchart_value_title_sub, default = $temp) %]
199 205
            </td>
200 206
            <td>
201
              [% temp = "select_projectnumber_"_ i %][% $temp %]
207
              [% temp = "project_id_"_ i %]
208
              [% L.select_tag(temp, ALL_PROJECTS, with_empty = 1, default = loop.last ? globalproject_id : $temp, value_key = 'id', title_key = 'projectnumber') %]
202 209
            </td>
203 210
          </tr>
204 211
        [% END %]
......
209 216
          </td>
210 217
        </tr>
211 218
        <tr>
212
          <td>[% APselected %]</td>
219
          <td>
220
            [% L.select_tag('APselected', ALL_CHARTS_AP, value_title_sub = \APselected_value_title_sub, default = APselected) %]
221
          </td>
213 222
          <th align="left">[% invtotal | html %]</th>
214 223
          <td colspan="4"></td>
215 224
        </tr>
......
316 325
            [% temp = "AP_paid_"_ i %]
317 326
            <td align="center">
318 327
              [% IF( changeable ) %]
319
                [% temp = "select"_ temp %]
320
                [% $temp %]
328
                [% L.select_tag(temp, ALL_CHARTS_AP_paid, value_title_sub = \AP_paid_value_title_sub, default = $temp) %]
321 329
              [% ELSE %]
322 330
                [% $temp | html %]
323 331
                <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
324 332
              [% END %]
325 333
            </td>
326 334

  
327
            [% temp = "paid_project_id_"_ i %]
328 335
            <td align="center">
336
              [% temp = "paid_project_id_"_ i %]
329 337
              [% IF( changeable ) %]
330
                [% temp = "select"_ temp %]
331
                [% $temp %]
338
                [% L.select_tag(temp, ALL_PROJECTS, with_empty = 1, default = $temp, value_key = 'id', title_key = 'projectnumber') %]
332 339
              [% ELSE %]
333 340
                <input type="hidden" name="[% temp %]" value="[% $temp | html %]">
334 341
                [% temp = "label"_ temp %]

Auch abrufbar als: Unified diff