Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 84da0ba2

Von Moritz Bunkus vor fast 18 Jahren hinzugefügt

  • ID 84da0ba2f48ac09652557a5aca1a912b06fb0b0b
  • Vorgänger d4651135
  • Nachfolger 5b4da8b5

Debitorenrechnungen: Bei Zahlungseingängen ist für jede Zeile eine Projektnummer vergebbar.

Unterschiede anzeigen:

SL/AR.pm
299 299

  
300 300
        # add receivable
301 301
        $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
302
		    transdate)
302
		    transdate, project_id)
303 303
		    VALUES ($form->{id},
304 304
		           (SELECT c.id FROM chart c
305 305
			    WHERE c.accno = '$form->{AR}{receivables}'),
306
		    $amount, '$form->{"datepaid_$i"}')|;
307
        $dbh->do($query) || $form->dberror($query);
306
		    $amount, '$form->{"datepaid_$i"}', ?)|;
307
        do_query($form, $dbh, $query, $project_id);
308 308
      }
309 309
      $form->{receivables} = $amount;
310 310

  
311 311
      $form->{"memo_$i"} =~ s/\'/\'\'/g;
312 312

  
313 313
      if ($form->{"paid_$i"} != 0) {
314

  
314
        my $project_id = conv_i($form->{"paid_project_id_$i"});
315 315
        # add payment
316 316
        $amount = $form->{"paid_$i"} * -1;
317 317
        $query  = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
318
		    transdate, source, memo)
318
		    transdate, source, memo, project_id)
319 319
		    VALUES ($form->{id},
320 320
			   (SELECT c.id FROM chart c
321 321
			    WHERE c.accno = '$form->{AR}{"paid_$i"}'),
322 322
		    $amount, '$form->{"datepaid_$i"}',
323
		    '$form->{"source_$i"}', '$form->{"memo_$i"}')|;
324
        $dbh->do($query) || $form->dberror($query);
323
		    '$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|;
324
        do_query($form, $dbh, $query, $project_id);
325 325

  
326 326
        # exchangerate difference for payment
327 327
        $amount =
......
331 331

  
332 332
        if ($amount != 0) {
333 333
          $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
334
		      transdate, fx_transaction, cleared)
334
		      transdate, fx_transaction, cleared, project_id)
335 335
		      VALUES ($form->{id},
336 336
			     (SELECT c.id FROM chart c
337 337
			      WHERE c.accno = '$form->{AR}{"paid_$i"}'),
338
		      $amount, '$form->{"datepaid_$i"}', '1', '0')|;
339
          $dbh->do($query) || $form->dberror($query);
338
		      $amount, '$form->{"datepaid_$i"}', '1', '0', ?)|;
339
          do_query($form, $dbh, $query, $project_id);
340 340
        }
341 341

  
342 342
        # exchangerate gain/loss
......
350 350
          $accno =
351 351
            ($amount > 0) ? $form->{fxgain_accno} : $form->{fxloss_accno};
352 352
          $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
353
		      transdate, fx_transaction, cleared)
353
		      transdate, fx_transaction, cleared, project_id)
354 354
		      VALUES ($form->{id}, (SELECT c.id FROM chart c
355 355
					    WHERE c.accno = '$accno'),
356
		      $amount, '$form->{"datepaid_$i"}', '1', '0')|;
357
          $dbh->do($query) || $form->dberror($query);
356
		      $amount, '$form->{"datepaid_$i"}', '1', '0', ?)|;
357
          do_query($form, $dbh, $query, $project_id);
358 358
        }
359 359
      }
360 360

  
......
404 404
  for my $i (1 .. $form->{paidaccounts}) {
405 405

  
406 406
    if ($form->{"paid_$i"} != 0) {
407
      my $project_id = conv_i($form->{"paid_project_id_$i"});
408

  
407 409
      my ($accno) = split /--/, $form->{"AR_paid_$i"};
408 410
      $form->{"datepaid_$i"} = $form->{invdate}
409 411
        unless ($form->{"datepaid_$i"});
......
434 436
      $dbh->do($query) || $form->dberror($query);
435 437

  
436 438
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
437
                  transdate)
439
                  transdate, project_id)
438 440
                  VALUES ($form->{id}, (SELECT c.id FROM chart c
439 441
                                      WHERE c.accno = '$form->{AR}'),
440
                  $amount, '$form->{"datepaid_$i"}')|;
441
      $dbh->do($query) || $form->dberror($query);
442
                  $amount, '$form->{"datepaid_$i"}', ?)|;
443
      do_query($form, $dbh, $query, $project_id);
442 444

  
443 445

  
444 446
      # record payment
......
449 451
      $dbh->do($query) || $form->dberror($query);
450 452

  
451 453
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
452
                  source, memo)
454
                  source, memo, project_id)
453 455
                  VALUES ($form->{id}, (SELECT c.id FROM chart c
454 456
		                      WHERE c.accno = '$accno'),
455 457
		  $form->{"paid_$i"}, '$form->{"datepaid_$i"}',
456
		  '$form->{"source_$i"}', '$form->{"memo_$i"}')|;
457
      $dbh->do($query) || $form->dberror($query);
458
		  '$form->{"source_$i"}', '$form->{"memo_$i"}', ?)|;
459
      do_query($form, $dbh, $query, $project_id);
458 460

  
459 461

  
460 462
      # gain/loss
......
492 494
                                        WHERE c.accno = '$accno') AND amount=$form->{fx}{$accno}{$transdate} AND transdate='$transdate' AND cleared='0' AND fx_transaction='1'|;
493 495
        $dbh->do($query) || $form->dberror($query);
494 496
        $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount,
495
	            transdate, cleared, fx_transaction)
497
	            transdate, cleared, fx_transaction, project_id)
496 498
		    VALUES ($form->{id},
497 499
		           (SELECT c.id FROM chart c
498 500
		            WHERE c.accno = '$accno'),
499
		    $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1')|;
500
        $dbh->do($query) || $form->dberror($query);
501
		    $form->{fx}{$accno}{$transdate}, '$transdate', '0', '1', ?)|;
502
        do_query($form, $dbh, $query, $project_id);
501 503
      }
502 504
    }
503 505
  }
bin/mozilla/ar.pl
204 204
        $form->{"forex_$j"} = $form->{"exchangerate_$i"} =
205 205
          $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
206 206
        $form->{"AR_paid_$j"} = "$form->{acc_trans}{$key}->[$i-1]->{accno}";
207
        $form->{"paid_project_id_$j"} = $form->{acc_trans}{$key}->[$i - 1]->{project_id};
207 208
        $form->{paidaccounts}++;
208 209
      } else {
209 210

  
......
656 657
    <td>
657 658
      <table width=100%>
658 659
	<tr class=listheading>
659
	  <th colspan=6 class=listheading>|
660
	  <th colspan=7 class=listheading>|
660 661
    . $locale->text('Incoming Payments') . qq|</th>
661 662
	</tr>
662 663
|;
663 664

  
664 665
  if ($form->{currency} eq $form->{defaultcurrency}) {
665
    @column_index = qw(datepaid source memo paid AR_paid);
666
    @column_index = qw(datepaid source memo paid AR_paid paid_project_id);
666 667
  } else {
667
    @column_index = qw(datepaid source memo paid exchangerate AR_paid);
668
    @column_index = qw(datepaid source memo paid exchangerate AR_paid paid_project_id);
668 669
  }
669 670

  
670 671
  $column_data{datepaid}     = "<th>" . $locale->text('Date') . "</th>";
......
672 673
  $column_data{exchangerate} = "<th>" . $locale->text('Exch') . "</th>";
673 674
  $column_data{AR_paid}      = "<th>" . $locale->text('Account') . "</th>";
674 675
  $column_data{source}       = "<th>" . $locale->text('Source') . "</th>";
675
  $column_data{memo}         = "<th>" . $locale->text('Memo') . "</th>";
676
  $column_data{memo}         = "<th>" . $locale->text('Memo') . "</th>"; 
677
  $column_data{paid_project_id} = "<th>" . $locale->text('Project Number') . "</th>"; 
676 678

  
677 679
  print "
678 680
        <tr>
......
729 731
    $column_data{memo} =
730 732
      qq|<td align=center><input name="memo_$i" size=11 value="$form->{"memo_$i"}"></td>|;
731 733

  
734
    $column_data{paid_project_id} =
735
      qq|<td>|
736
      . NTI($cgi->popup_menu('-name' => "paid_project_id_$i",
737
                             '-values' => \@project_values,
738
                             '-labels' => \%project_labels,
739
                             '-default' => $form->{"paid_project_id_$i"} ))
740
      . qq|</td>|;
741

  
732 742
    map { print qq|$column_data{$_}\n| } @column_index;
733 743

  
734 744
    print "
......
760 770

  
761 771
  print qq|
762 772

  
773
<input name=gldate type=hidden value="| . Q($form->{gldate}) . qq|">
774

  
763 775
<input name=callback type=hidden value="$form->{callback}">
764 776

  
765 777
<input type=hidden name=path value=$form->{path}>
......
772 784
  $transdate = $form->datetonum($form->{transdate}, \%myconfig);
773 785
  $closedto  = $form->datetonum($form->{closedto},  \%myconfig);
774 786

  
787
  print qq|<input class=submit type=submit name=action value="|
788
    . $locale->text('Update') . qq|">
789
|;
775 790
  if ($form->{id}) {
776 791
    if ($form->{radier}) {
777
      print qq|<input class=submit type=submit name=action value="|
778
        . $locale->text('Update') . qq|">
779
  |;
780

  
781
          print qq|
792
      print qq|
782 793
          <input class=submit type=submit name=action value="|
783 794
            . $locale->text('Post') . qq|">
784 795
          <input class=submit type=submit name=action value="|
785 796
            . $locale->text('Delete') . qq|">
786 797
  |;
787
  }
788
      if ($transdate > $closedto) {
789
        print qq|
798
    }
799
    if ($transdate > $closedto) {
800
      print qq|
790 801
  <input class=submit type=submit name=action value="|
791 802
          . $locale->text('Use As Template') . qq|">
792 803
  |;
793
      }
794
        print qq|
804
    }
805
    print qq|
795 806
  <input class=submit type=submit name=action value="|
796
          . $locale->text('Post Payment') . qq|">
807
    . $locale->text('Post Payment') . qq|">
797 808
  |;
798
    
809

  
799 810
  } else {
800 811
    if ($transdate > $closedto) {
801 812
      print qq|<input class=submit type=submit name=action value="|
802
        . $locale->text('Update') . qq|">
803
      <input class=submit type=submit name=action value="|
804 813
        . $locale->text('Post') . qq|">|;
805 814
    }
806 815
  }

Auch abrufbar als: Unified diff