Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4d8a6515

Von Philip Reetz vor mehr als 17 Jahren hinzugefügt

  • ID 4d8a65151cff0399654ea47c196ab38361a976e8
  • Vorgänger e8a42733
  • Nachfolger 18da4a96

Erweiterung um Anzeige des Ertrages im Verkauf

Unterschiede anzeigen:

bin/mozilla/io.pl
241 241
    $delvar       = 'reqdate';
242 242
  }
243 243

  
244
  $form->{marge_total} = 0;
245
  $form->{sellprice_total} = 0;
246
  $form->{lastcost_total} = 0;
244 247
  my %projectnumber_labels = ();
245 248
  my @projectnumber_values = ("");
246 249
  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
......
300 303
    $linetotal =
301 304
      $form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces);
302 305
    $linetotal = $form->round_amount($linetotal * $form->{"qty_$i"}, 2);
306
    my $real_sellprice = $form->{"sellprice_$i"} - $discount;
307

  
308
    # marge calculations
309
    my ($marge_font_start, $marge_font_end);
310
    $form->{"lastcost_$i"} *= 1;
311
    if ($real_sellprice && ($form->{"qty_$i"} * 1)) {
312
      $form->{"marge_percent_$i"} =
313
        ($real_sellprice - $form->{"lastcost_$i"}) * 100 / $real_sellprice;
314

  
315
      $myconfig{"marge_percent_warn"} = 15
316
        unless (defined($myconfig{"marge_percent_warn"}));
317
      if ($form->{"id_$i"} &&
318
          ($form->{"marge_percent_$i"} <
319
           (1 * $myconfig{"marge_percent_warn"}))) {
320
        $marge_font_start = "<font color=\"#ff0000\">";
321
        $marge_font_end = "</font>";
322
      }
323
    } else {
324
      $form->{"marge_percent_$i"} = 0;
325
    }
326
    $form->{"marge_absolut_$i"} =
327
      ($real_sellprice - $form->{"lastcost_$i"}) * $form->{"qty_$i"};
328
    $form->{"marge_total"} += $form->{"marge_absolut_$i"};
329
    $form->{"lastcost_total"} += $form->{"lastcost_$i"} * $form->{"qty_$i"};
330
    $form->{"sellprice_total"} += $real_sellprice * $form->{"qty_$i"};
331

  
332
    map {
333
      $form->{"${_}_$i"} =
334
        $form->format_amount(\%myconfig, $form->{"${_}_$i"},
335
                              2)
336
    } qw(marge_absolut marge_percent);
303 337

  
304 338
    # convert " to &quot;
305 339
    map { $form->{"${_}_$i"} =~ s/\"/&quot;/g }
......
439 473
         "id_$i", "inventory_accno_$i", "bin_$i", "partsgroup_$i", "partnotes_$i",
440 474
         "income_accno_$i", "expense_accno_$i", "listprice_$i", "assembly_$i",
441 475
         "taxaccounts_$i", "ordnumber_$i", "transdate_$i", "cusordnumber_$i",
442
         "longdescription_$i", "basefactor_$i"));
476
         "longdescription_$i", "basefactor_$i", "marge_absolut_$i", "marge_percent_$i", "lastcost_$i"));
443 477

  
444 478
########################################
445 479
    # Eintrag fuer Version 2.2.0 geaendert #
......
492 526
    my $subtotalchecked = ($form->{"subtotal_$i"}) ? "checked" : "";
493 527
    print qq|
494 528
          <b>|.$locale->text('Subtotal').qq|</b>&nbsp;<input type="checkbox" name="subtotal_$i" value="1" "$subtotalchecked">
529
|;
530

  
531
    print qq|
532
          ${marge_font_start}<b>|.$locale->text('Ertrag').qq|</b>&nbsp;$form->{"marge_absolut_$i"} &nbsp;$form->{"marge_percent_$i"} % ${marge_font_end}
533
          &nbsp;<b>|.$locale->text('LP').qq|</b>&nbsp;|.$form->format_amount(\%myconfig,$form->{"listprice_$i"},2).qq|
534
          &nbsp;<b>|.$locale->text('EK').qq|</b>&nbsp;|.$form->format_amount(\%myconfig,$form->{"lastcost_$i"},2).qq|
495 535
	  </td>
496 536
	</tr>
497

  
498 537
|;
499 538

  
500 539
############## ENDE Neueintrag ##################
......
511 550
  </tr>
512 551
|;
513 552

  
553
  if (0 != ($form->{sellprice_total} * 1)) {
554
    $form->{marge_percent} = ($form->{sellprice_total} - $form->{lastcost_total}) / $form->{sellprice_total} * 100;
555
  }
556

  
514 557
  $lxdebug->leave_sub();
515 558
}
516 559

  
......
647 690
    my @new_fields =
648 691
      qw(bin listprice inventory_accno income_accno expense_accno unit weight
649 692
         assembly taxaccounts partsgroup formel longdescription not_discountable
650
         part_payment_id partnotes id);
693
         part_payment_id partnotes id lastcost);
651 694
    push(@new_fields, "lizenzen") if ($lizenzen);
652 695

  
653 696
    print join "\n", map { $cgi->hidden("-name" => "new_${_}_$i", "-value" => $ref->{$_}) } @new_fields;
......
946 989
  my @a     = ();
947 990
  my $count = 0;
948 991
  my @flds  = (
949
    qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup payment_id not_discountable shop ve gv buchungsgruppen_id language_values sellprice_pg pricegroup_old price_old price_new unit_old ordnumber transdate longdescription basefactor)
992
    qw(id partnumber description qty ship sellprice unit discount inventory_accno income_accno expense_accno listprice taxaccounts bin assembly weight projectnumber project_id oldprojectnumber runningnumber serialnumber partsgroup payment_id not_discountable shop ve gv buchungsgruppen_id language_values sellprice_pg pricegroup_old price_old price_new unit_old ordnumber transdate longdescription basefactor marge_absolut marge_percent lastcost )
950 993
  );
951 994

  
952 995

  

Auch abrufbar als: Unified diff