Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f01741e3

Von Moritz Bunkus vor fast 18 Jahren hinzugefügt

  • ID f01741e36a022e2bb7503abb23fbc0f46f27cd62
  • Vorgänger a4b22a8f
  • Nachfolger 185d7c5b

Projektauswahl in Debitoren- und Kreditorenbuchungen per Drop-Down-Box. Bei der Buchung auf das Gegenkonto wird keine Projektnummer vermerkt.

Unterschiede anzeigen:

SL/AP.pm
222 222
  for $i (1 .. $form->{rowcount}) {
223 223
    if ($form->{"amount_$i"} != 0) {
224 224
      my $project_id;
225
      if ("amount_$i" =~ /amount_/) {
226
        if ($form->{"project_id_$i"} && $form->{"projectnumber_$i"}) {
227
          $project_id = $form->{"project_id_$i"};
228
        }
229
      }
230
      if ("amount_$i" =~ /amount/) {
231
        $taxkey = $form->{AP_amounts}{"amount_$i"}{taxkey};
232
      }
225
      $project_id = conv_i($form->{"project_id_$i"});
226
      $taxkey = $form->{AP_amounts}{"amount_$i"}{taxkey};
233 227

  
234 228
      # insert detail records in acc_trans
235 229
      $query =
......
239 233
        qq|  ?, ?, ?, ?)|;
240 234
      @values = ($form->{id}, $form->{AP_amounts}{"amount_$i"},
241 235
                 $form->{"amount_$i"}, conv_date($form->{transdate}),
242
                 conv_i($project_id), $taxkey);
236
                 $project_id, $taxkey);
243 237
      do_query($form, $dbh, $query, @values);
244 238

  
245 239
      if ($form->{"tax_$i"} != 0) {
......
251 245
          qq|  ?, ?, ?, ?)|;
252 246
        @values = ($form->{id}, $form->{AP_amounts}{"tax_$i"},
253 247
                   $form->{"tax_$i"}, conv_date($form->{transdate}),
254
                   conv_date($project_id), $taxkey);
248
                   $project_id, $taxkey);
255 249
        do_query($form, $dbh, $query, @values);
256 250
      }
257 251

  
......
260 254

  
261 255
  # add payables
262 256
  $query =
263
    qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, project_id) | .
264
    qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | .
265
    qq|  ?, ?, ?)|;
257
    qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate) | .
258
    qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), ?, ?)|;
266 259
  @values = ($form->{id}, $form->{AP_amounts}{payables}, $form->{payables},
267
             conv_date($form->{transdate}), conv_i($project_id));
260
             conv_date($form->{transdate}));
268 261
  do_query($form, $dbh, $query, @values);
269 262

  
270 263
  # if there is no amount but a payment record a payable
SL/AR.pm
35 35
package AR;
36 36

  
37 37
use Data::Dumper;
38
use SL::DBUtils;
38 39

  
39 40
sub post_transaction {
40 41
  $main::lxdebug->enter_sub();
......
45 46
  my $exchangerate = 0;
46 47
  my $i;
47 48

  
49
  my @values;
50

  
48 51
  my $dbh = $form->dbconnect_noauto($myconfig);
49 52

  
50 53
  if ($form->{currency} eq $form->{defaultcurrency}) {
......
226 229
  # add individual transactions for AR, amount and taxes
227 230
  for $i (1 .. $form->{rowcount}) {
228 231
    if ($form->{"amount_$i"} != 0) {
229
      $project_id = 'NULL';
230
      if ("amount_$i" =~ /amount_/) {
231
        if ($form->{"project_id_$i"} && $form->{"projectnumber_$i"}) {
232
          $project_id = $form->{"project_id_$i"};
233
        }
234
      }
235
      if ("amount_$i" =~ /amount/) {
236
        $taxkey = $form->{AR_amounts}{"amount_$i"}{taxkey};
237
      }
232
      my $project_id = undef;
233
      $project_id = conv_i($form->{"project_id_$i"});
234
      $taxkey = $form->{AR_amounts}{"amount_$i"}{taxkey};
238 235

  
236
      @values = ($project_id);
239 237
      # insert detail records in acc_trans
240 238
      $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
241 239
                                         project_id, taxkey)
242 240
		  VALUES ($form->{id}, (SELECT c.id FROM chart c
243 241
		                        WHERE c.accno = '$form->{AR_amounts}{"amount_$i"}'),
244
		  $form->{"amount_$i"}, '$form->{transdate}', $project_id, '$taxkey')|;
245
      $dbh->do($query) || $form->dberror($query);
242
		  $form->{"amount_$i"}, '$form->{transdate}', ?, '$taxkey')|;
243
      do_query($form, $dbh, $query, @values);
246 244
      if ($form->{"tax_$i"} != 0) {
247 245

  
246
        @values = ($project_id);
248 247
        # insert detail records in acc_trans
249 248
        $query =
250 249
          qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
251 250
                                          project_id, taxkey)
252 251
                    VALUES ($form->{id}, (SELECT c.id FROM chart c
253 252
                                          WHERE c.accno = '$form->{AR_amounts}{"tax_$i"}'),
254
                    $form->{"tax_$i"}, '$form->{transdate}', $project_id, '$taxkey')|;
255
        $dbh->do($query) || $form->dberror($query);
253
                    $form->{"tax_$i"}, '$form->{transdate}', ?, '$taxkey')|;
254
        do_query($form, $dbh, $query, @values);
256 255
      }
257 256
    }
258 257
  }
259 258

  
260 259
  # add recievables
261
  $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
262
                                      project_id)
260
  $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate)
263 261
              VALUES ($form->{id}, (SELECT c.id FROM chart c
264 262
                                    WHERE c.accno = '$form->{AR_amounts}{receivables}'),
265
              $form->{receivables}, '$form->{transdate}', $project_id)|;
263
              $form->{receivables}, '$form->{transdate}')|;
266 264
  $dbh->do($query) || $form->dberror($query);
267 265

  
268 266
  # add paid transactions
bin/mozilla/ap.pl
397 397
    ? qq|<select name=vendor>$form->{selectvendor}</select>|
398 398
    : qq|<input name=vendor value="$form->{vendor}" size=35>|;
399 399

  
400
  my @old_project_ids = ();
401
  map({ push(@old_project_ids, $form->{"project_id_$_"})
402
          if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
403

  
404
  $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
405
                                   "all" => 0,
406
                                   "old_id" => \@old_project_ids });
407

  
408
  my %project_labels = ();
409
  my @project_values = ("");
410
  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
411
    push(@project_values, $item->{"id"});
412
    $project_labels{$item->{"id"}} = $item->{"projectnumber"};
413
  }
414

  
400 415
  # use JavaScript Calendar or not
401 416
  $form->{jsscript} = $jscalendar;
402 417
  $jsscript = "";
......
558 573

  
559 574
    my $korrektur = $form->{"korrektur_$i"} ? 'checked' : '';
560 575

  
576
    my $projectnumber =
577
      NTI($cgi->popup_menu('-name' => "project_id_$i",
578
                           '-values' => \@project_values,
579
                           '-labels' => \%project_labels,
580
                           '-default' => $form->{"project_id_$i"} ));
581

  
561 582
    print qq|
562 583
	<tr>
563 584
          <td width=50%><select name="AP_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAP_amount</select></td>
......
565 586
          <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
566 587
          <td><input type="checkbox" name="korrektur_$i" value="1" "$korrektur"></td>
567 588
          $tax
568
	  <td><input name="projectnumber_$i" size=20 value="$form->{"projectnumber_$i"}">
569
	      <input type=hidden name="project_id_$i" value=$form->{"project_id_$i"}>
570
	      <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}"></td>
589
          <td>$projectnumber</td>
571 590
	</tr>
572 591
|;
573 592
    $amount  = "";
......
843 862
  &check_name(vendor);
844 863
  $form->{AP} = $save_AP;
845 864

  
846
  &check_project;
847 865
  $form->{rowcount} = $count + 1;
848 866

  
849 867
  $form->{invtotal} =
bin/mozilla/ar.pl
421 421
|;
422 422
  }
423 423

  
424
  my @old_project_ids = ();
425
  map({ push(@old_project_ids, $form->{"project_id_$_"})
426
          if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
427

  
428
  $form->get_lists("projects" => { "key" => "ALL_PROJECTS",
429
                                   "all" => 0,
430
                                   "old_id" => \@old_project_ids });
431

  
432
  my %project_labels = ();
433
  my @project_values = ("");
434
  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
435
    push(@project_values, $item->{"id"});
436
    $project_labels{$item->{"id"}} = $item->{"projectnumber"};
437
  }
438

  
424 439
  $form->{fokus} = "arledger.customer";
425 440

  
426 441
  # use JavaScript Calendar or not
......
582 597
      qq|<td><select id="taxchart_$i" name="taxchart_$i" style="width:200px">$tax</select></td>|;
583 598
    $korrektur_checked = ($form->{"korrektur_$i"} ? 'checked' : '');
584 599

  
600
    my $projectnumber =
601
      NTI($cgi->popup_menu('-name' => "project_id_$i",
602
                           '-values' => \@project_values,
603
                           '-labels' => \%project_labels,
604
                           '-default' => $form->{"project_id_$i"} ));
605

  
585 606
    print qq|
586 607
	<tr>
587 608
          <td width=50%><select name="AR_amount_$i" onChange="setTaxkey(this, $i)" style="width:100%">$selectAR_amount</select></td>
......
589 610
          <td><input name="tax_$i" size=10 value=$form->{"tax_$i"}></td>
590 611
          <td><input type="checkbox" name="korrektur_$i" value="1" $korrektur_checked></td>
591 612
          $tax
592
	  <td><input name="projectnumber_$i" size=20 value="$form->{"projectnumber_$i"}">
593
	      <input type=hidden name="project_id_$i" value=$form->{"project_id_$i"}>
594
	      <input type=hidden name="oldprojectnumber_$i" value="$form->{"oldprojectnumber_$i"}"></td>
613
          <td>$projectnumber</td>
595 614
	</tr>
596 615
|;
597 616
    $amount  = "";
......
870 889
  &check_name(customer);
871 890
  $form->{AR} = $save_AR;
872 891

  
873
  &check_project;
874

  
875 892
  $form->{invtotal} =
876 893
    ($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax;
877 894

  

Auch abrufbar als: Unified diff