Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 46231fcc

Von Thomas Heck vor fast 12 Jahren hinzugefügt

HTML-Code aus bin/ap.pl/form_header in ein eigenes Template übertragen

Unterschiede anzeigen:

bin/mozilla/ap.pl
192 192

  
193 193
  $main::auth->assert('general_ledger');
194 194

  
195
  my $title = $form->{title};
196
  $form->{title} = $locale->text("$title Accounts Payables Transaction");
197

  
198
  $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
195
  $form->{title_} = $form->{title};
196
  $form->{title} = $locale->text($form->{title} .' Accounts Payables Transaction');
199 197

  
200 198
  # type=submit $locale->text('Add Accounts Payables Transaction')
201 199
  # type=submit $locale->text('Edit Accounts Payables Transaction')
202 200

  
203
  $form->{javascript} = qq|<script type="text/javascript">
204
  <!--
205
  function setTaxkey(accno, row) {
206
    var taxkey = accno.options[accno.selectedIndex].value;
207
    var reg = /--([0-9]*)/;
208
    var found = reg.exec(taxkey);
209
    var index = found[1];
210
    index = parseInt(index);
211
    var tax = 'taxchart_' + row;
212
    for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
213
      var reg2 = new RegExp("^"+ index, "");
214
      if (reg2.exec(document.getElementById(tax).options[i].value)) {
215
        document.getElementById(tax).options[i].selected = true;
216
        break;
217
      }
218
    }
219
  };
220
  //-->
221
  </script>|;
222
  # show history button
223
  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
224
  #/show hhistory button
225

  
226 201
  # set option selected
227 202
  foreach my $item (qw(vendor currency department)) {
228 203
    my $to_replace         =  H($form->{$item});
229 204
    $form->{"select$item"} =~ s/ selected//;
230 205
    $form->{"select$item"} =~ s/>\Q${to_replace}\E/ selected>${to_replace}/;
231 206
  }
232
  my $readonly = ($form->{id}) ? "readonly" : "";
207
  my $readonly = $form->{id} ? "readonly" : "";
233 208

  
234 209
  $form->{radier} = ($::instance_conf->get_ap_changeable == 2)
235 210
                      ? ($form->current_date(\%myconfig) eq $form->{gldate})
236 211
                      : ($::instance_conf->get_ap_changeable == 1);
237
  $readonly       = ($form->{radier}) ? "" : $readonly;
212
  $readonly       = $form->{radier} ? "" : $readonly;
238 213

  
239
  $form->{forex}        = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'sell');
240
  $form->{exchangerate} = $form->{forex} if $form->{forex};
214
  $form->{readonly} = $readonly;
215

  
216
  $form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'sell');
217
  if ( $form->{forex} ) {
218
    $form->{exchangerate} = $form->{forex};
219
  }
241 220

  
242 221
  # format amounts
243 222
  $form->{exchangerate}    = $form->{exchangerate} ? $form->format_amount(\%myconfig, $form->{exchangerate}) : '';
244 223
  $form->{creditlimit}     = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
245 224
  $form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
246 225

  
247
  my $exchangerate = qq|
248
<input type=hidden name=forex value=$form->{forex}>
249
|;
250
  if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
251
    if ($form->{forex}) {
252
      $exchangerate .= qq|
253
            <tr>
254
              <th align=right>| . $locale->text('Exchangerate') . qq|</th>
255
              <td><input type=hidden name=exchangerate value=$form->{exchangerate}>$form->{exchangerate}</td>
256
           </tr>
257
|;
258
    } else {
259
      $exchangerate .= qq|
260
             <th align=right>| . $locale->text('Exchangerate') . qq|</th>
261
             <td><input name=exchangerate size=10 value=$form->{exchangerate}></td>
262
|;
263
    }
264
  }
265

  
266
  my $taxincluded = "";
267

  
268
  $taxincluded = qq|
269
            <tr>
270
              <td align=right><input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}></td>
271
              <th align=left nowrap>|
272
    . $locale->text('Tax Included') . qq|</th>
273
            </tr>
274
|;
275

  
276 226
  my $rows;
277 227
  if (($rows = $form->numtextrows($form->{notes}, 50)) < 2) {
278 228
    $rows = 2;
279 229
  }
280
  my $notes =
281
    qq|<textarea name=notes rows=$rows cols=50 wrap=soft $readonly>$form->{notes}</textarea>|;
282
  my $intnotes = qq|<textarea name=intnotes rows=$rows cols=50 wrap=soft readonly>$form->{intnotes}</textarea>|;
283

  
284
  my $department;
285
  $department = qq|
286
              <tr>
287
                <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
288
                <td colspan=3><select name=department>$form->{selectdepartment}</select>
289
                <input type=hidden name=selectdepartment value="| . H($form->{selectdepartment}) . qq|">
290
                </td>
291
              </tr>
292
| if $form->{selectdepartment};
293

  
294
  my $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
295

  
296
  my $vendor =
297
    ($form->{selectvendor})
298
    ? qq|<select name="vendor" onchange="document.getElementById('update_button').click();">$form->{selectvendor} </select>|
299
    : qq|<input name=vendor value="$form->{vendor}" size=35>|;
230
  $form->{textarea_rows} = $rows;
231

  
232
  $form->{creditremaining_plus} = ($form->{creditremaining} =~ /-/) ? "0" : "1";
300 233

  
301 234
  my @old_project_ids = ();
302
  map({ push(@old_project_ids, $form->{"project_id_$_"})
303
          if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
235
  map(
236
    {
237
      if ($form->{"project_id_$_"}) {
238
        push(@old_project_ids, $form->{"project_id_$_"});
239
      }
240
    }
241
    (1..$form->{"rowcount"})
242
  );
304 243

  
305 244
  $form->get_lists("projects"  => { "key"       => "ALL_PROJECTS",
306 245
                                    "all"       => 0,
......
310 249
                   "taxcharts" => { "key"       => "ALL_TAXCHARTS",
311 250
                                    "module"    => "AP" },);
312 251

  
313
  map({ $_->{link_split} = [ split(/:/, $_->{link}) ]; }
314
      @{ $form->{ALL_CHARTS} });
252
  map(
253
    { $_->{link_split} = [ split(/:/, $_->{link}) ]; }
254
    @{ $form->{ALL_CHARTS} }
255
  );
315 256

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

  
323 264
  my (%AP_amount_labels, @AP_amount_values);
......
359 300
    $taxcharts{$item->{id}} = $item;
360 301
  }
361 302

  
362
  # use JavaScript Calendar or not
363 303
  $form->{jsscript} = 1;
364
  my $jsscript = "";
365
  my ($button1, $button2);
366
  if ($form->{jsscript}) {
367

  
368
    # with JavaScript Calendar
369
    $button1 = qq|
370
       <td><input name=transdate onchange="set_duedate()" id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\" $readonly></td>
371
       <td><input type=button name=transdate id="trigger1" value=|
372
      . $locale->text('button') . qq|></td>
373
       |;
374
    $button2 = qq|
375
       <td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\" $readonly></td>
376
       <td><input type=button name=duedate id="trigger2" value=|
377
      . $locale->text('button') . qq|></td></td>
378
     |;
379

  
380
    #write Trigger
381
    $jsscript =
382
      Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
383
                          "duedate", "BL", "trigger2");
384
  } else {
385

  
386
    # without JavaScript Calendar
387
    $button1 =
388
      qq|<td><input name=transdate onchange="set_duedate()" id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\" $readonly></td>|;
389
    $button2 =
390
      qq|<td><input name=duedate id=duedate size=11 title="$myconfig{dateformat}" value="$form->{duedate}" onBlur=\"check_right_date_format(this)\" $readonly></td>|;
391
  }
392 304

  
393 305
  my $follow_up_vc         =  $form->{vendor};
394 306
  $follow_up_vc            =~ s/--.*?//;
......
398 310
  $form->{javascript} .= qq|<script type="text/javascript" src="js/show_vc_details.js"></script>|;
399 311
  $form->{javascript} .= qq|<script type="text/javascript" src="js/follow_up.js"></script>|;
400 312

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

  
407 319
  $form->header;
408
  print qq|
409
<form method=post action=$form->{script}>
410

  
411
<input type=hidden name=id value=$form->{id}>
412
<input type=hidden name=sort value=$form->{sort}>
413
<input type=hidden name=closedto value=$form->{closedto}>
414
<input type=hidden name=locked value=$form->{locked}>
415
<input type=hidden name=title value="$title">
416

  
417
<input type="hidden" name="follow_up_trans_id_1" value="| . H($form->{id}) . qq|">
418
<input type="hidden" name="follow_up_trans_type_1" value="ap_transaction">
419
<input type="hidden" name="follow_up_trans_info_1" value="| . H($follow_up_trans_info) . qq|">
420
<input type="hidden" name="follow_up_rowcount" value="1">
421

  
422
| . ($form->{saved_message} ? qq|<p>$form->{saved_message}</p>| : "") . qq|
423

  
424
<table width=100%>
425
  <tr class=listtop>
426
    <th class=listtop>$form->{title}</th>
427
  </tr>
428
  <tr height="5"></tr>
429
  <tr valign=top>
430
    <td>
431
      <table width=100%>
432
        <tr valign=top>
433
          <td>
434
            <table>
435
              <tr>
436
                <th align=right nowrap>| . $locale->text('Vendor') . qq|</th>
437
                <td colspan=3>$vendor <input type="button" value="D" onclick="show_vc_details('vendor')"></td>
438
                <input type=hidden name=selectvendor value="| . H($form->{selectvendor}) . qq|">
439
                <input type=hidden name=oldvendor value="| . H($form->{oldvendor}) . qq|">
440
                <input type=hidden name=vendor_id value="| . H($form->{vendor_id}) . qq|">
441
                <input type=hidden name=terms value="| . H($form->{terms}) . qq|">
442
              </tr>
443
              <tr>
444
                <td></td>
445
                <td colspan=3>
446
                  <table width=100%>
447
                    <tr>
448
                      <th align=left nowrap>| . $locale->text('Credit Limit') . qq|</th>
449
                      <td>$form->{creditlimit}</td>
450
                      <th align=left nowrap>| . $locale->text('Remaining') . qq|</th>
451
                      <td class="plus$n">$form->{creditremaining}</td>
452
                      <input type=hidden name=creditlimit value=$form->{creditlimit}>
453
                      <input type=hidden name=creditremaining value=$form->{creditremaining}>
454
                    </tr>
455
                  </table>
456
                </td>
457
              <tr>
458
                <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
459
                <td><select name=currency>$form->{selectcurrency}</select></td>
460
                <input type=hidden name=selectcurrency value="| . H($form->{selectcurrency}) . qq|">
461
                <input type=hidden name=defaultcurrency value=$form->{defaultcurrency}>
462
                <input type=hidden name=fxgain_accno value=$form->{fxgain_accno}>
463
                <input type=hidden name=fxloss_accno value=$form->{fxloss_accno}>
464
                $exchangerate
465
              </tr>
466
              $department
467
              $taxincluded
468
            </table>
469
          </td>
470
          <td align=right>
471
            <table>
472
              <tr>
473
                <th align=right nowrap>| . $locale->text('Invoice Number') . qq|</th>
474
                <td><input name=invnumber size=11 value="$form->{invnumber}" $readonly></td>
475
              </tr>
476
              <tr>
477
                <th align=right nowrap>| . $locale->text('Order Number') . qq|</th>
478
                <td><input name=ordnumber size=11 value="$form->{ordnumber}" $readonly></td>
479
              </tr>
480
              <tr>
481
                <th align=right nowrap>| . $locale->text('Invoice Date') . qq|</th>
482
                $button1
483
              </tr>
484
              <tr>
485
                <th align=right nowrap>| . $locale->text('Due Date') . qq|</th>
486
                $button2
487
              </tr>
488
              <tr>
489
                <th align=right nowrap>| . $locale->text('Project Number') . qq|</th>
490
                <td>$globalprojectnumber</td>
491
              </tr>
492
            </table>
493
          </td>
494
        </tr>
495
      </table>
496
    </td>
497
  </tr>
498

  
499

  
500

  
501
$jsscript
502
  <input type=hidden name=rowcount value=$form->{rowcount}>
503
  <tr>
504
    <td>
505
      <table width=100%>
506
        <tr class=listheading>
507
          <th class=listheading style="width:15%">| . $locale->text('Account') . qq|</th>
508
          <th class=listheading style="width:10%">| . $locale->text('Amount') . qq|</th>
509
          <th class=listheading style="width:10%">| . $locale->text('Tax') . qq|</th>
510
          <th class=listheading style="width:10%">| . $locale->text('Taxkey') . qq|</th>
511
          <th class=listheading style="width:10%">| . $locale->text('Project') . qq|</th>
512
        </tr>
513
|;
514

  
515
  my $amount  = $locale->text('Amount');
516
  my $project = $locale->text('Project');
517 320

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

  
520 323
    # format amounts
521
    $form->{"amount_$i"} =
522
      $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
324
    $form->{"amount_$i"} = $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
523 325
    $form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
524 326

  
525 327
    my $selected_accno_full;
......
540 342

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

  
543
    my $selectAP_amount =
345
    $form->{'selectAP_amount_'. $i} =
544 346
      NTI($cgi->popup_menu('-name' => "AP_amount_$i",
545 347
                           '-id' => "AP_amount_$i",
546 348
                           '-style' => 'width:400px',
......
551 353
      . $cgi->hidden('-name' => "previous_AP_amount_$i",
552 354
                     '-default' => $selected_accno_full);
553 355

  
554
    my $tax = qq|<td>| .
356
    $form->{'select_tax_'. $i} =
555 357
      NTI($cgi->popup_menu('-name' => "taxchart_$i",
556 358
                           '-id' => "taxchart_$i",
557 359
                           '-style' => 'width:200px',
558 360
                           '-values' => \@taxchart_values,
559 361
                           '-labels' => \%taxchart_labels,
560
                           '-default' => $selected_taxchart))
561
      . qq|</td>|;
362
                           '-default' => $selected_taxchart));
562 363

  
563
    my $projectnumber =
364
    $form->{'select_projectnumber_'. $i} =
564 365
      NTI($cgi->popup_menu('-name' => "project_id_$i",
565 366
                           '-values' => \@project_values,
566 367
                           '-labels' => \%project_labels,
567 368
                           '-default' => ($i==$form->{rowcount})? $form->{globalproject_id} : $form->{"project_id_$i"} ));
568

  
569
    print qq|
570
        <tr>
571
          <td>$selectAP_amount</td>
572
          <td><input name="amount_$i" size=10 value=$form->{"amount_$i"}></td>
573
          <td><input type="hidden" name="tax_$i" value="$form->{"tax_$i"}">$form->{"tax_$i"}</td>
574
          $tax
575
          <td>$projectnumber</td>
576
        </tr>
577
|;
578
    $amount  = "";
579
    $project = "";
580 369
  }
581 370

  
582
  my $taxlabel =
583
    ($form->{taxincluded})
584
    ? $locale->text('Tax Included')
585
    : $locale->text('Tax');
586 371

  
587 372
  $form->{invtotal_unformatted} = $form->{invtotal};
588 373
  $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
589 374

  
590
  my $APselected =
375
  $form->{APselected} =
591 376
    NTI($cgi->popup_menu('-name' => "APselected", '-id' => "APselected",
592 377
                         '-style' => 'width:400px',
593 378
                         '-values' => \@AP_values, '-labels' => \%AP_labels,
594 379
                         '-default' => $form->{APselected}));
595
  print qq|
596
        <tr>
597
          <td colspan=6>
598
            <hr noshade>
599
          </td>
600
        </tr>
601
        <tr>
602
          <td>${APselected}</td>
603
          <th align=left>$form->{invtotal}</th>
604

  
605
          <input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
606
          <input type=hidden name=oldtotalpaid value=$form->{oldtotalpaid}>
607

  
608
          <input type=hidden name=taxaccounts value="$form->{taxaccounts}">
609

  
610
          <td colspan=4></td>
611

  
612

  
613
        </tr>
614
      </table>
615
     </td>
616
    </tr>
617
    <tr>
618
      <td>
619
        <table width=100%>
620
        <tr>
621
          <th align=left width=1%>| . $locale->text('Notes') . qq|</th>
622
          <td align=left>$notes</td>
623

  
624
          <th align=left width=1%>| . $locale->text('Notes for vendor') . qq|</th>
625
          <td align=left>$intnotes</td>
626
        </tr>
627
      </table>
628
    </td>
629
  </tr>
630
  <tr>
631
    <td>
632
      <table width=100%>
633
        <tr class=listheading>
634
          <th class=listheading colspan=7>| . $locale->text('Payments') . qq|</th>
635
        </tr>
636
|;
637 380

  
638
  my @column_index;
639
  if ($form->{defaultcurrency} && ($form->{currency} eq $form->{defaultcurrency})) {
640
    @column_index = qw(datepaid source memo paid AP_paid paid_project_id);
641
  } else {
642
    @column_index = qw(datepaid source memo paid exchangerate AP_paid paid_project_id);
643
  }
644

  
645
  my %column_data;
646
  $column_data{datepaid}     = "<th>" . $locale->text('Date') . "</th>";
647
  $column_data{paid}         = "<th>" . $locale->text('Amount') . "</th>";
648
  $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
649
  $column_data{AP_paid}      = "<th>" . $locale->text('Account') . "</th>";
650
  $column_data{source}       = "<th>" . $locale->text('Source') . "</th>";
651
  $column_data{memo}         = "<th>" . $locale->text('Memo') . "</th>";
652
  $column_data{paid_project_id} = "<th>" . $locale->text('Project Number') . "</th>";
653

  
654
  print "
655
        <tr>
656
";
657
  map { print "$column_data{$_}\n" } @column_index;
658
  print "
659
        </tr>
660
";
661

  
662
  my @triggers  = ();
663 381
  $form->{totalpaid} = 0;
664 382

  
665
  $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"});
383
  if ( $form->{'paid_'. $form->{paidaccounts}} ) {
384
    $form->{paidaccounts}++;
385
  }
666 386
  for my $i (1 .. $form->{paidaccounts}) {
667
    print "
668
        <tr>
669
";
670 387

  
671
    my $selectAP_paid =
388
    $form->{'selectAP_paid_'. $i} =
672 389
      NTI($cgi->popup_menu('-name' => "AP_paid_$i",
673 390
                           '-id' => "AP_paid_$i",
674 391
                           '-values' => \@AP_paid_values,
......
679 396

  
680 397
    # format amounts
681 398
    if ($form->{"paid_$i"}) {
682
      $form->{"paid_$i"} =
683
        $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
399
      $form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2);
684 400
    }
685 401
    if ($form->{"exchangerate_$i"} == 0) {
686 402
      $form->{"exchangerate_$i"} = "";
......
689 405
        $form->format_amount(\%myconfig, $form->{"exchangerate_$i"});
690 406
    }
691 407

  
692
    print qq|<input type=hidden name="acc_trans_id_$i" value=$form->{"acc_trans_id_$i"}>\n|;
693
    print qq|<input type=hidden name="gldate_$i" value=$form->{"gldate_$i"}>\n|;
694 408
    my $changeable = 1;
695 409
    if (SL::DB::Default->get->payments_changeable == 0) {
696 410
      # never
......
701 415
      $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"});
702 416
    }
703 417

  
704
    $exchangerate = qq|&nbsp;|;
705
    if ($form->{defaultcurrency} && ($form->{currency} ne $form->{defaultcurrency})) {
706
      if ($form->{"forex_$i"}) {
707
        $exchangerate =
708
          qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
709
      } else {
710
        if ($changeable) {
711
          $exchangerate =
712
            qq|<input name="exchangerate_$i" size=10 value=$form->{"exchangerate_$i"}>|;
713
        } else {
714
          $exchangerate =
715
            qq|<input type=hidden name="exchangerate_$i" value=$form->{"exchangerate_$i"}>$form->{"exchangerate_$i"}|;
716
        }
717
      }
718
    }
719

  
720
    $exchangerate .= qq|
721
<input type=hidden name="forex_$i" value=$form->{"forex_$i"}>
722
|;
723

  
724
    my $datepaid;
725
    if ($changeable) {
726
      $datepaid = qq|<td align=center><input name="datepaid_$i" id="datepaid_$i" size=11 title="($myconfig{'dateformat'})" value="$form->{"datepaid_$i"}" onBlur=\"check_right_date_format(this)\">
727
         <input type="button" name="datepaid_$i" id="trigger_datepaid_$i" value="| . $locale->text('Details (one letter abbreviation)') . qq|"></td>|;
728
    } else {
729
      $datepaid = qq|<td align=center>$form->{"datepaid_$i"}</td>|.
730
        qq|<input type=hidden name="datepaid_$i" value=$form->{"datepaid_$i"}>|;
731
    }
418
    $form->{'paidaccount_changeable_'. $i} = $changeable;
732 419

  
733
    my $paid;
734
    if ($changeable) {
735
      $paid = qq|<td align=center><input name="paid_$i" size=11 value="$form->{"paid_$i"}" onBlur=\"check_right_number_format(this)\"></td>|;
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"}));
736 426
    } else {
737
      $paid = qq|<td align=center>$form->{"paid_$i"}</td>|.
738
        qq|<input type=hidden name="paid_$i" value=$form->{"paid_$i"}>|;
739
    }
740

  
741
    my $source;
742
    if ($changeable) {
743
      $source = qq|<td align=center><input name="source_$i" size=11 value="$form->{"source_$i"}"></td>|;
744
    } else {
745
      $source = qq|<td align=center>$form->{"source_$i"}</td>|.
746
        qq|<input type=hidden name="source_$i" value=$form->{"source_$i"}>|;
747
    }
748

  
749
    my $memo;
750
    if ($changeable) {
751
      $memo = qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
752
    } else {
753
      $memo = qq|<td align=center>$form->{"memo_$i"}</td>|.
754
        qq|<input type=hidden name="memo_$i" value=$form->{"memo_$i"}>|;
755
    }
756

  
757
    my $AP_paid;
758
    if ($changeable) {
759
      $AP_paid = qq|<td align=center>${selectAP_paid}</td>|;
760
    } else {
761
      $AP_paid = qq|<td align=center>$form->{"AP_paid_$i"}</td>|.
762
        qq|<input type=hidden name="AP_paid_$i" value=$form->{"AP_paid_$i"}>|;
763
    }
764

  
765
    my $paid_project_id;
766
    if ($changeable) {
767
      $paid_project_id =
768
      qq|<td>|
769
      . NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
770
                             '-values' => \@project_values,
771
                             '-labels' => \%project_labels,
772
                             '-default' => $form->{"paid_project_id_$i"} ))
773
      . qq|</td>|;
774
    } else {
775
      my $projectnumber = $project_labels{$form->{"paid_project_id_$i"}};
776
      $paid_project_id = qq|<td>$projectnumber</td>|.
777
        qq|<input type=hidden name="paid_project_id_$i" value=$form->{"paid_project_id_$i"}>|;
778
    }
779

  
780
    $column_data{"paid_$i"}            = $paid;
781
    $column_data{"AP_paid_$i"}         = $AP_paid;
782
    $column_data{"exchangerate_$i"}    = qq|<td align=center>$exchangerate</td>|;
783
    $column_data{"datepaid_$i"}        = $datepaid;
784
    $column_data{"source_$i"}          = $source;
785
    $column_data{"memo_$i"}            = $memo;
786
    $column_data{"paid_project_id_$i"} = $paid_project_id;
787

  
788
    map { print qq|$column_data{"${_}_$i"}\n| } @column_index;
789

  
790
    print "
791
        </tr>
792
";
793
    if ($changeable) {
794
      push(@triggers, "datepaid_$i", "BL", "trigger_datepaid_$i");
427
      $form->{'labelpaid_project_id_'. $i} = $project_labels{$form->{'paid_project_id_'. $i}};
795 428
    }
796 429
  }
797 430

  
798
  my $paid_missing = $form->{invtotal_unformatted} - $form->{totalpaid};
431
  $form->{paid_missing} = $form->{invtotal_unformatted} - $form->{totalpaid};
799 432

  
800
  print qq|
801
        <tr>
802
          <td></td>
803
          <td></td>
804
          <td align="center">| . $locale->text('Total') . qq|</td>
805
          <td align="center">| . H($form->format_amount(\%myconfig, $form->{totalpaid}, 2)) . qq|</td>
806
        </tr>
807
        <tr>
808
          <td></td>
809
          <td></td>
810
          <td align="center">| . $locale->text('Missing amount') . qq|</td>
811
          <td align="center">| . H($form->format_amount(\%myconfig, $paid_missing, 2)) . qq|</td>
812
        </tr>
813
| . $form->write_trigger(\%myconfig, scalar(@triggers) / 3, @triggers) .
814
    qq|
815
    <input type=hidden name=paidaccounts value=$form->{paidaccounts}>
816

  
817
      </table>
818
    </td>
819
  </tr>
820
  <tr>
821
    <td><hr size=3 noshade></td>
822
  </tr>
823
</table>
824
|;
433
  print $form->parse_html_template('ap/form_header');
825 434

  
826 435
  $main::lxdebug->leave_sub();
827 436
}
templates/webpages/ap/form_header.html
1
[%- USE L %]
2
[%- USE HTML %]
3
[%- USE T8 %]
4
[%- USE LxERP %]
5

  
6
<script type="text/javascript">
7
<!--
8
  function setTaxkey(accno, row) {
9
    var taxkey = accno.options[accno.selectedIndex].value;
10
    var reg = /--([0-9]*)/;
11
    var found = reg.exec(taxkey);
12
    var index = found[1];
13
    index = parseInt(index);
14
    var tax = 'taxchart_' + row;
15
    for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
16
      var reg2 = new RegExp("^"+ index, "");
17
      if (reg2.exec(document.getElementById(tax).options[i].value)) {
18
        document.getElementById(tax).options[i].selected = true;
19
        break;
20
      }
21
    }
22
  };
23
//-->
24
</script>
25

  
26
<script type="text/javascript" src="js/show_history.js"></script>
27

  
28
<form method="post" action="[% script %]">
29

  
30
<input type="hidden" name="selectvendor" value="[% selectvendor | html %]">
31
<input type="hidden" name="selectdepartment" value="[% selectdepartment | html %]">
32
<input type="hidden" name="selectcurrency" value="[% selectcurrency | html %]">
33

  
34
<input type="hidden" name="oldvendor" value="[% oldvendor | html %]">
35
<input type="hidden" name="vendor_id" value="[% vendor_id | html %]">
36
<input type="hidden" name="terms" value="[% terms | html %]">
37

  
38
<input type="hidden" name="creditlimit" value="[% creditlimit %]">
39
<input type="hidden" name="creditremaining" value="[% creditremaining %]">
40

  
41
<input type="hidden" name="forex" value="[% forex %]">
42

  
43
<input type="hidden" name="id" value="[% id %]">
44
<input type="hidden" name="sort" value="[% sort %]">
45
<input type="hidden" name="closedto" value="[% closedto %]">
46
<input type="hidden" name="locked" value="[% locked %]">
47
<input type="hidden" name="title" value="[% title_ %]">
48

  
49
<input type="hidden" name="follow_up_trans_id_1" value="[% id | html %]">
50
<input type="hidden" name="follow_up_trans_type_1" value="ap_transaction">
51
<input type="hidden" name="follow_up_trans_info_1" value="[% follow_up_trans_info | html %]">
52
<input type="hidden" name="follow_up_rowcount" value="1">
53

  
54
<input type="hidden" name="defaultcurrency" value="[% defaultcurrency | $T8 %]">
55
<input type="hidden" name="fxgain_accno" value="[% fxgain_accno %]">
56
<input type="hidden" name="fxloss_accno" value="[% fxloss_accno %]">
57

  
58
<input type="hidden" name="oldinvtotal" value="[% oldinvtotal %]">
59
<input type="hidden" name="oldtotalpaid" value="[% oldtotalpaid %]">
60

  
61
<input type="hidden" name="taxaccounts" value="[% taxaccounts %]">
62

  
63
<input type="hidden" name="rowcount" value="[% rowcount %]">
64

  
65
<input type="hidden" name="paidaccounts" value="[% paidaccounts %]">
66

  
67
[% FOREACH i IN [1..paidaccounts] %]
68
  [% temp = "acc_trans_id_"_ i %]
69
  <input type="hidden" name="[% temp %]" value="[% $temp %]">
70

  
71
  [% temp = "gldate_"_ i %]
72
  <input type="hidden" name="[% temp %]" value="[% $temp %]">
73
[% END %]
74

  
75
<h1>[% title | html %]</h1>
76

  
77
[% IF ( saved_message ) %]
78
  <p>[% saved_message | html %]</p>
79
[% END %]
80

  
81
<table width=100%>
82
  <tr valign=top>
83
    <td>
84
      <table width=100%>
85
        <tr valign=top>
86
          <td>
87
            <table>
88
              <tr>
89
                <th align=right nowrap>[% 'Vendor' | $T8 %]</th>
90
                <td colspan=3>
91
                  [% IF ( selectvendor ) %]
92
                    <select name="vendor" onchange="document.getElementById('update_button').click();">[% selectvendor %]</select>
93
                  [% ELSE %]
94
                    <input name=vendor value="[% vendor %]" size="35">
95
                  [% END %]
96
                  <input type="button" value="D" onclick="show_vc_details('vendor')">
97
                </td>
98
              </tr>
99

  
100
              <tr>
101
                <td></td>
102
                <td colspan=3>
103
                  <table width="100%">
104
                    <tr>
105
                      <th align="left" nowrap>[% 'Credit Limit' | $T8 %]</th>
106
                      <td>[% creditlimit %]</td>
107
                      <th align="left" nowrap>[% 'Remaining' | $T8 %]</th>
108
                      <td class="plus[% creditremaining_plus %]">[% creditremaining %]</td>
109
                    </tr>
110
                  </table>
111
                </td>
112
              </tr>
113

  
114
              <tr>
115
                <th align="right" nowrap>[% 'Currency' | $T8 %]</th>
116
                <td><select name="currency">[% selectcurrency %]</select></td>
117

  
118
                [% IF ( defaultcurrency && (currency != defaultcurrency) ) %]
119
                  <th align=right>[% 'Exchangerate' | $T8 %]</th>
120
                  [% IF ( forex ) %]
121
                    <td><input type="hidden" name="exchangerate" value="[% exchangerate %]">[% exchangerate %]</td>
122
                  [% ELSE %]
123
                    <td><input type="text" name="exchangerate" size="10" value="[% exchangerate %]"></td>
124
                  [% END %]
125
                [% END %]
126

  
127
              </tr>
128

  
129
              [% IF ( selectdepartment ) %]
130
                <tr>
131
                  <th align="right" nowrap>[% 'Department' | $T8 %]</th>
132
                  <td colspan="3">
133
                    <select name="department">[% selectdepartment %]</select>
134
                  </td>
135
                </tr>
136
              [% END %]
137

  
138
              <tr>
139
                <td align="right"><input name="taxincluded" class="checkbox" type="checkbox" value="1" [% IF ( taxincluded ) %]checked[% END %]></td>
140
                <th align=left nowrap>[% 'Tax Included' | $T8 %]</th>
141
              </tr>
142
            </table>
143
          </td>
144

  
145
          <td align="right">
146
            <table>
147
              <tr>
148
                <th align="right" nowrap>[% 'Invoice Number' | $T8 %]</th>
149
                <td><input name="invnumber" size="11" value="[% invnumber %]" [% readonly %]></td>
150
              </tr>
151
              <tr>
152
                <th align="right" nowrap>[% 'Order Number' | $T8 %]</th>
153
                <td><input name="ordnumber" size="11" value="[% ordnumber %]" [% readonly %]></td>
154
              </tr>
155
              <tr>
156
                <th align="right" nowrap>[% 'Invoice Date' | $T8 %]</th>
157
                <td>[% L.date_tag('transdate', transdate) %]</td>
158
              </tr>
159
              <tr>
160
                <th align="right" nowrap>[% 'Due Date' | $T8 %]</th>
161
                <td>[% L.date_tag('duedate', duedate) %]</td>
162
              </tr>
163
              <tr>
164
                <th align="right" nowrap>[% 'Project Number' | $T8 %]</th>
165
                <td>[% globalprojectnumber %]</td>
166
              </tr>
167
            </table>
168
          </td>
169
        </tr>
170
      </table>
171
    </td>
172
  </tr>
173

  
174
  <tr>
175
    <td>
176
      <table width=100%>
177
        <tr class=listheading>
178
          <th class=listheading style="width:15%">[% 'Account' | $T8 %]</th>
179
          <th class=listheading style="width:10%">[% 'Amount' | $T8 %]</th>
180
          <th class=listheading style="width:10%">[% 'Tax' | $T8 %]</th>
181
          <th class=listheading style="width:10%">[% 'Taxkey' | $T8 %]</th>
182
          <th class=listheading style="width:10%">[% 'Project' | $T8 %]</th>
183
        </tr>
184

  
185
        [% FOREACH i IN [1..rowcount] %]
186
          <tr>
187
            <td>
188
              [% temp = "selectAP_amount_"_ i %][% $temp %]
189
              <input type="hidden" name="tax_[% i %]" value="[% temp = "tax"_ i %][% $temp %]">
190
            </td>
191
            <td>
192
              <input name="amount_[% i %]" size="10" value="[% temp = "amount_"_ i %][% $temp %]">
193
            </td>
194
            <td>
195
              [% temp = "tax_"_ i %][% $temp %]
196
            </td>
197
            <td>
198
              [% temp = "select_tax_"_ i %][% $temp %]
199
            </td>
200
            <td>
201
              [% temp = "select_projectnumber_"_ i %][% $temp %]
202
            </td>
203
          </tr>
204
        [% END %]
205

  
206
        <tr>
207
          <td colspan=6>
208
            <hr noshade>
209
          </td>
210
        </tr>
211
        <tr>
212
          <td>[% APselected %]</td>
213
          <th align=left>[% invtotal %]</th>
214
          <td colspan=4></td>
215
        </tr>
216
      </table>
217
     </td>
218
    </tr>
219
    <tr>
220
      <td>
221
        <table width=100%>
222
        <tr>
223
          <th align=left width=1%>[% 'Notes' | $T8 %]</th>
224
          <td align=left>
225
            <textarea name="notes" rows="[% textarea_rows %]" cols="50" wrap="soft" [% readonly %]>[% notes %]</textarea>
226
          </td>
227

  
228
          <th align=left width=1%>[% 'Notes for vendor' | $T8 %]</th>
229
          <td align=left>
230
            <textarea name="intnotes" rows="[% textarea_rows %]" cols="50" wrap="soft" readonly>[% intnotes %]</textarea>
231
          </td>
232
        </tr>
233
      </table>
234
    </td>
235
  </tr>
236
  <tr>
237
    <td>
238
      <table width=100%>
239
        <tr class=listheading>
240
          <th class=listheading colspan=7>[% 'Payments' | $T8 %]</th>
241
        </tr>
242

  
243
        <tr>
244
          <th>[% 'Date' | $T8 %]</th>
245
          <th>[% 'Source' | $T8 %]</th>
246
          <th>[% 'Memo' | $T8 %]</th>
247
          <th>[% 'Amount' | $T8 %]</th>
248
          [% IF ( !defaultcurrency || (currency != defaultcurrency) ) %]
249
            <th>[% 'Exch' | $T8 %]</th>
250
          [% END %]
251
          <th>[% 'Account' | $T8 %]</th>
252
          <th>[% 'Project Number' | $T8 %]</th>
253
        </tr>
254

  
255
        [% FOREACH i IN [1..paidaccounts] %]
256
          [% temp = "paidaccount_changeable_"_ i %]
257
          [% changeable = $temp %]
258

  
259
          <tr>
260
            [% temp = "datepaid_"_ i %]
261
            <td align="center">
262
              [% IF( changeable ) %]
263
                [% L.date_tag(temp, $temp) %]
264
              [% ELSE %]
265
                [% $temp %]
266
                <input type="hidden" name="[% temp %]" value="[% $temp %]">|;
267
              [% END %]
268
            </td>
269

  
270
            [% temp = "source_"_ i %]
271
            <td align="center">
272
              [% IF( changeable ) %]
273
                <input name="[% temp %]" size="11" value="[% $temp %]">
274
              [% ELSE %]
275
                [% $temp %]
276
                <input type="hidden" name="[% temp %]" value="[% $temp %]">
277
              [% END %]
278
            </td>
279

  
280
            [% temp = "memo_"_ i %]
281
            <td align="center">
282
              [% IF( changeable ) %]
283
                <input name="[% temp %]" size="11" value="[% $temp %]">
284
              [% ELSE %]
285
                [% $temp %]
286
                <input type="hidden" name="[% temp %]" value="[% $temp %]">
287
              [% END %]
288
            </td>
289

  
290
            [% temp = "paid_"_ i %]
291
            <td align="center">
292
              [% IF( changeable ) %]
293
                <input name="[% temp %]" size="11" value="[% $temp %]" onBlur="check_right_number_format(this);">
294
              [% ELSE %]
295
                [% $temp %]
296
                <input type="hidden" name="[% temp %]" value="[% $temp %]">
297
              [% END %]
298
            </td>
299

  
300
            [% IF ( !defaultcurrency || (currency != defaultcurrency) ) %]
301
              <td align="center">
302
                [% temp = "exchangerate_"_ i %]
303
                [% temp_forex = "forex_"_ i %]
304

  
305
                [% IF( $temp_forex || !changeable ) %]
306
                  [% $temp %]
307
                  <input type="hidden" name="[% temp %]" value="[% $temp %]">
308
                [% ELSE %]
309
                  <input name="[% temp %]" size="11" value="[% $temp %]">
310
                [% END %]
311

  
312
                <input type=hidden name="[% temp_forex %]" value="[% $temp_forex %]">
313
              </td>
314
            [% END %]
315

  
316
            [% temp = "AP_paid_"_ i %]
317
            <td align="center">
318
              [% IF( changeable ) %]
319
                [% temp = "select"_ temp %]
320
                [% $temp %]
321
              [% ELSE %]
322
                [% $temp %]
323
                <input type="hidden" name="[% temp %]" value="[% $temp %]">
324
              [% END %]
325
            </td>
326

  
327
            [% temp = "paid_project_id_"_ i %]
328
            <td align="center">
329
              [% IF( changeable ) %]
330
                [% temp = "select"_ temp %]
331
                [% $temp %]
332
              [% ELSE %]
333
                <input type="hidden" name="[% temp %]" value="[% $temp %]">
334
                [% temp = "label"_ temp %]
335
                [% $temp %]
336
              [% END %]
337
            </td>
338
          </tr>
339
        [% END %]
340

  
341
        <tr>
342
          <td></td>
343
          <td></td>
344
          <td align="center">[% 'Total' | $T8 %]</td>
345
          <td align="center">[% LxERP.format_amount(totalpaid, 2) | html %]</td>
346
        </tr>
347
        <tr>
348
          <td></td>
349
          <td></td>
350
          <td align="center">[% 'Missing amount' | $T8 %]</td>
351
          <td align="center">[% LxERP.format_amount(paid_missing, 2) | html %]</td>
352
        </tr>
353
      </table>
354
    </td>
355
  </tr>
356
  <tr>
357
    <td><hr size="3" noshade></td>
358
  </tr>
359
</table>

Auch abrufbar als: Unified diff