X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fio.pl;h=f3e92dc94c27878685050db2a2bf2f7e4f10217b;hb=b3bde077a6df1550915b1433b2cabb4cf74ab681;hp=8dcbfa5a39c6657df8082c6d5a0cff7a8dfb060c;hpb=11ddf50890228aae8b06cad05e9d0dea9dcd68e3;p=kivitendo-erp.git
diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl
index 8dcbfa5a3..f3e92dc94 100644
--- a/bin/mozilla/io.pl
+++ b/bin/mozilla/io.pl
@@ -144,8 +144,8 @@ sub display_row {
{ id => 'serialnr', width => 10, value => $locale->text('Serial No.'), display => 0, },
{ id => 'projectnr', width => 10, value => $locale->text('Project'), display => 0, },
{ id => 'sellprice', width => 15, value => $locale->text('Price'), display => !$is_delivery_order, },
- { id => 'sellprice_pg', width => 8, value => $locale->text('Pricegroup'), display => ($form->{type} =~ /^sales_/) && !$is_delivery_order, },
- { id => 'discount', width => 5, value => $locale->text('Discount'), display => ($form->{vc} eq 'customer') && !$is_delivery_order, },
+ { id => 'sellprice_pg', width => 8, value => $locale->text('Pricegroup'), display => ($form->{type} =~ /^sales_/) && !$is_delivery_order, },
+ { id => 'discount', width => 5, value => $locale->text('Discount'), display => !$is_delivery_order, },
{ id => 'linetotal', width => 10, value => $locale->text('Extended'), display => !$is_delivery_order, },
{ id => 'bin', width => 10, value => $locale->text('Bin'), display => 0, },
{ id => 'stock_in_out', width => 10, value => $stock_in_out_title, display => $is_delivery_order, },
@@ -193,9 +193,11 @@ sub display_row {
_update_part_information();
_update_ship() if ($is_s_p_order);
+ _update_custom_variables();
# rows
for $i (1 .. $numrows) {
+ my %column_data = ();
# undo formatting
map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(qty discount sellprice price_new price_old) unless ($form->{simple_save});
@@ -260,7 +262,7 @@ sub display_row {
if ($form->{"id_$i"}) {
my $ship_qty = $form->{"ship_$i"} * 1;
$ship_qty *= $all_units->{$form->{"partunit_$i"}}->{factor};
- $ship_qty /= $all_units->{$form->{"unit_$i"}}->{factor};
+ $ship_qty /= ( $all_units->{$form->{"unit_$i"}}->{factor} || 1 );
$column_data{ship} = $form->format_amount(\%myconfig, $form->round_amount($ship_qty, 2) * 1) . ' ' . $form->{"unit_$i"};
}
@@ -290,11 +292,6 @@ sub display_row {
$column_data{bin} = $form->{"bin_$i"};
if ($is_delivery_order) {
- # $column_data{stock_in_out} = $form->{"inventory_accno_$i"} ? calculate_stock_in_out($i) : ' ';
- # $main::lxdebug->dump(0, "debug", $form->{"inventory_accno_$i"});
- # meine debug-analyse war negativ (s.o.) - die variable war weder bei dienstleistung, erzeugnis noch ware gefüllt.
- # bitte korrigieren, falls ich hier falsch liege. jb 19.3.2009
-
$column_data{stock_in_out} = calculate_stock_in_out($i);
}
@@ -340,6 +337,19 @@ sub display_row {
if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ || $form->{type} =~ /invoice/) && !$is_delivery_order;
# / marge calculations ending
+# calculate onhand
+ if ($form->{"id_$i"}) {
+ my $part = IC->get_basic_part_info(id => $form->{"id_$i"});
+ my $onhand_color = 'color="#ff0000"' if $part->{onhand} < $part->{rop};
+ push @ROW2, { value => sprintf "%s %s %s",
+ $locale->text('On Hand'),
+ $onhand_color,
+ $form->format_amount(\%myconfig, $part->{onhand}, 2),
+ $part->{unit}
+ };
+ }
+# / calculate onhand
+
my @hidden_vars;
if ($is_delivery_order) {
@@ -361,6 +371,9 @@ sub display_row {
$form->{invsubtotal} += $linetotal;
+ # Benutzerdefinierte Variablen für Waren/Dienstleistungen/Erzeugnisse
+ _render_custom_variables_inputs(ROW2 => \@ROW2, row => $i, part_id => $form->{"id_$i"});
+
push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, error => $form->{"row_error_$i"}, };
}
@@ -446,6 +459,13 @@ sub select_item {
print qq||;
+ my @new_fields =
+ qw(bin listprice inventory_accno income_accno expense_accno unit weight
+ assembly taxaccounts partsgroup formel longdescription not_discountable
+ part_payment_id partnotes id lastcost price_factor_id price_factor);
+ push @new_fields, "lizenzen" if ($lizenzen);
+ push @new_fields, grep { m/^ic_cvar_/ } keys %{ $form->{item_list}->[0] };
+
my $i = 0;
foreach $ref (@{ $form->{item_list} }) {
$checked = ($i++) ? "" : "checked";
@@ -499,12 +519,6 @@ sub select_item {
print("\n");
- my @new_fields =
- qw(bin listprice inventory_accno income_accno expense_accno unit weight
- assembly taxaccounts partsgroup formel longdescription not_discountable
- part_payment_id partnotes id lastcost price_factor_id price_factor);
- push(@new_fields, "lizenzen") if ($lizenzen);
-
print join "\n", map { $cgi->hidden("-name" => "new_${_}_$i", "-value" => $ref->{$_}) } @new_fields;
print "\n";
}
@@ -567,6 +581,9 @@ sub item_selected {
partsgroup formel longdescription not_discountable partnotes lastcost
price_factor_id price_factor);
+ my $ic_cvar_configs = CVar->get_configs(module => 'IC');
+ push @new_fields, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
+
map { $form->{"${_}_$i"} = $form->{"new_${_}_$j"} } @new_fields;
$form->{"marge_price_factor_$i"} = $form->{"new_price_factor_$j"};
@@ -677,16 +694,6 @@ sub check_form {
my @a = ();
my $count = 0;
- my @flds = 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_total marge_percent
- marge_price_factor lastcost price_factor_id partnotes
- stock_out stock_in);
-
# remove any makes or model rows
if ($form->{item} eq 'part') {
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
@@ -694,13 +701,13 @@ sub check_form {
} elsif ($form->{item} eq 'assembly') {
- $form->{sellprice} = 0;
+ # fuer assemblies auskommentiert. seiteneffekte? ;-) wird die woanders benoetigt?
+ #$form->{sellprice} = 0;
$form->{weight} = 0;
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
- qw(listprice rop stock);
+ qw(listprice sellprice rop stock);
- @flds =
- qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup);
+ my @flds = qw(id qty unit bom partnumber description sellprice weight runningnumber partsgroup lastcost);
for my $i (1 .. ($form->{assembly_rows} - 1)) {
if ($form->{"qty_$i"}) {
@@ -713,12 +720,13 @@ sub check_form {
#($form->{"sellprice_$i"},$form->{"$pricegroup_old_$i"}) = split /--/, $form->{"sellprice_$i"};
- $form->{sellprice} += ($form->{"qty_$i"} * $form->{"sellprice_$i"});
- $form->{weight} += ($form->{"qty_$i"} * $form->{"weight_$i"});
+ # fuer assemblies auskommentiert. siehe oben
+ # $form->{sellprice} += ($form->{"qty_$i"} * $form->{"sellprice_$i"} / ($form->{"price_factor_$i"} || 1));
+ $form->{weight} += ($form->{"qty_$i"} * $form->{"weight_$i"} / ($form->{"price_factor_$i"} || 1));
$count++;
}
}
-
+ # kann das hier auch weg? s.o. jb
$form->{sellprice} = $form->round_amount($form->{sellprice}, 2);
$form->redo_rows(\@flds, \@a, $count, $form->{assembly_rows});
@@ -728,6 +736,18 @@ sub check_form {
map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) } qw(listprice sellprice lastcost);
} else {
+ my @flds = 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_total marge_percent
+ marge_price_factor lastcost price_factor_id partnotes
+ stock_out stock_in has_sernumber);
+
+ my $ic_cvar_configs = CVar->get_configs(module => 'IC');
+ push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs };
# this section applies to invoices and orders
# remove any empty numbers
@@ -875,7 +895,7 @@ sub order {
$script =~ s|.pl$||;
$locale = new Locale($language, $script);
- map { $form->{"select$_"} = "" } ($form->{vc}, currency);
+ map { $form->{"select$_"} = "" } ($form->{vc}, "currency");
$currency = $form->{currency};
@@ -888,7 +908,7 @@ sub order {
for $i (1 .. $form->{rowcount}) {
map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"})
if ($form->{"${_}_${i}"}) }
- qw(ship qty sellprice listprice basefactor));
+ qw(ship qty sellprice listprice basefactor discount));
}
&prepare_order;
@@ -944,7 +964,7 @@ sub quotation {
map({ $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig,
$form->{"${_}_${i}"})
if ($form->{"${_}_${i}"}) }
- qw(ship qty sellprice listprice basefactor));
+ qw(ship qty sellprice listprice basefactor discount));
}
&prepare_order;
@@ -1078,9 +1098,7 @@ sub print_options {
($form->{type} =~ /_delivery_order$/) ? (
opthash($form->{type}, $form->{PD}{$form->{type}}, $locale->text('Delivery Order')),
opthash('pick_list', $form->{PD}{pick_list}, $locale->text('Pick List')),
- ) : undef,
- ($form->{type} eq 'credit_note') ?
- opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef;
+ ) : undef;
push @SENDMODE,
opthash("attachment", $form->{SM}{attachment}, $locale->text('Attachment')),
@@ -1392,7 +1410,7 @@ sub print_form {
$form->get_shipto(\%myconfig);
}
- @a = qw(name street zipcode city country);
+ @a = qw(name street zipcode city country contact);
$shipto = 1;
@@ -1431,10 +1449,9 @@ sub print_form {
}
if ($form->{language} ne "") {
- map({ $form->{"unit"}->[$_] =
- AM->translate_units($form, $form->{"language"},
- $form->{"unit"}->[$_], $form->{"qty"}->[$_]); }
- (0..scalar(@{$form->{"unit"}}) - 1));
+ my $template_arrays = $form->{TEMPLATE_ARRAYS} || $form;
+ map { $template_arrays->{unit}->[$_] = AM->translate_units($form, $form->{language}, $template_arrays->{unit}->[$_], $template_arrays->{qty}->[$_]); } (0..scalar(@{ $template_arrays->{unit} }) - 1);
+
$form->{language} = "_" . $form->{language};
}
@@ -1484,7 +1501,7 @@ sub print_form {
reformat_numbers($output_numberformat, $precision, @{ $field_list });
}
- my $extension = '';
+ my $extension = 'html';
if ($form->{format} eq 'postscript') {
$form->{postscript} = 1;
$extension = 'tex';
@@ -1941,3 +1958,51 @@ sub _update_ship {
$lxdebug->leave_sub();
}
+
+sub _update_custom_variables {
+ $lxdebug->enter_sub();
+
+ $form->{CVAR_CONFIGS} ||= { };
+ $form->{CVAR_CONFIGS}->{IC} = CVar->get_configs(module => 'IC');
+
+ $lxdebug->leave_sub();
+}
+
+sub _render_custom_variables_inputs {
+ $lxdebug->enter_sub();
+
+ my %params = @_;
+
+ if (!$form->{CVAR_CONFIGS}->{IC}) {
+ $lxdebug->leave_sub();
+ return;
+ }
+
+ foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) {
+ $cvar->{valid} = $params{part_id}
+ ? CVar->get_custom_variables_validity(config_id => $cvar->{id}, trans_id => $params{part_id})
+ : 1;
+
+ $cvar->{value} = $form->{"ic_cvar_" . $cvar->{name} . "_$params{row}"};
+ }
+
+ CVar->render_inputs(hide_non_editable => 1,
+ variables => $form->{CVAR_CONFIGS}->{IC},
+ name_prefix => 'ic_',
+ name_postfix => "_$params{row}");
+
+ my $num_visible_cvars = 0;
+ foreach my $cvar (@{ $form->{CVAR_CONFIGS}->{IC} }) {
+ my $description = '';
+ if ($cvar->{flag_editable} && $cvar->{valid}) {
+ $num_visible_cvars++;
+ $description = $cvar->{description} . ' ';
+ }
+
+ push @{ $params{ROW2} }, { line_break => $num_visible_cvars == 1,
+ value => $description . $cvar->{HTML_CODE},
+ };
+ }
+
+ $lxdebug->leave_sub();
+}