-
- |
- . $locale->text('') . qq| |
+
+
+
+ $buchungsgruppe
+ $linkaccounts
+
+ |
-
-
- $buchungsgruppe
- $linkaccounts
-
- |
| . $locale->text('Notes') . qq| |
- | . $locale->text('Formula') . qq| |
+ $formula_label |
$notes
|
- $formel
+ $formula
|
@@ -2613,6 +2445,7 @@ sub form_header {
{sellprice}> |
$lastcost
+ $price_factor
| . $locale->text('Unit') . qq| |
$unit_select |
@@ -2660,7 +2493,6 @@ sub form_footer {
}
print qq|
- {path}>
{login}>
{password}>
@@ -2717,7 +2549,7 @@ sub form_footer {
if (!$form->{previousform}) {
if ($form->{menubar}) {
- require "$form->{path}/menu.pl";
+ require "bin/mozilla/menu.pl";
&menubar;
}
}
@@ -2747,10 +2579,7 @@ sub form_footer {
sub makemodel_row {
$lxdebug->enter_sub();
my ($numrows) = @_;
-
- $form->{"make_$i"} =~ s/\"/"/g;
- $form->{"model_$i"} =~ s/\"/"/g;
-
+
print qq|
@@ -2761,7 +2590,9 @@ sub makemodel_row {
|
|;
- for $i (1 .. $numrows) {
+ for my $i (1 .. $numrows) {
+ $form->{"make_$i"} =~ s/\"/"/g;
+ $form->{"model_$i"} =~ s/\"/"/g;
print qq|
|
@@ -2782,6 +2613,10 @@ sub makemodel_row {
sub assembly_row {
$lxdebug->enter_sub();
my ($numrows) = @_;
+ my (@column_index, %column_data, %column_header);
+ my ($nochange, $callback, $previousform, $linetotal, $href);
+
+ our ($deliverydate); # ToDO: cjeck if this indeed comes from global context
@column_index =
qw(runningnumber qty unit bom partnumber description partsgroup total);
@@ -2802,7 +2637,7 @@ sub assembly_row {
$previousform = "";
# save form variables in a previousform variable
- foreach $key (sort keys %$form) {
+ foreach my $key (sort keys %$form) {
# escape ampersands
$form->{$key} =~ s/&/%26/g;
@@ -2849,7 +2684,7 @@ sub assembly_row {
|;
- for $i (1 .. $numrows) {
+ for my $i (1 .. $numrows) {
$form->{"partnumber_$i"} =~ s/\"/"/g;
$linetotal =
@@ -2898,7 +2733,7 @@ sub assembly_row {
} else {
$href =
- qq|$form->{script}?action=edit&id=$form->{"id_$i"}&path=$form->{path}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
+ qq|$form->{script}?action=edit&id=$form->{"id_$i"}&login=$form->{login}&password=$form->{password}&rowcount=$i&previousform=$previousform|;
$column_data{partnumber} =
qq|$form->{"partnumber_$i"} | |;
$column_data{runningnumber} =
@@ -2950,7 +2785,7 @@ sub update {
$lxdebug->enter_sub();
if ($form->{item} eq "assembly") {
- $i = $form->{assembly_rows};
+ my $i = $form->{assembly_rows};
# if last row is empty check the form otherwise retrieve item
if ( ($form->{"partnumber_$i"} eq "")
@@ -2963,7 +2798,7 @@ sub update {
IC->assembly_item(\%myconfig, \%$form);
- $rows = scalar @{ $form->{item_list} };
+ my $rows = scalar @{ $form->{item_list} };
if ($rows) {
$form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
@@ -2993,26 +2828,19 @@ sub update {
}
}
- }
- if ($form->{item} eq "part") {
+ } elsif (($form->{item} eq 'part') || ($form->{item} eq 'service')) {
&check_form;
}
- if ($form->{item} eq 'service') {
- map { $form->{$_} = $form->parse_amount(\%myconfig, $form->{$_}) }
- qw(sellprice listprice);
- &form_header;
- &price_row;
- &form_footer;
- }
-
$lxdebug->leave_sub();
}
sub save {
$lxdebug->enter_sub();
+ my ($parts_id, %newform, $previousform, $amount, $callback);
+
# check if there is a part number - commented out, cause there is an automatic allocation of numbers
# $form->isblank("partnumber", $locale->text(ucfirst $form->{item}." Part Number missing!"));
@@ -3044,20 +2872,20 @@ sub save {
# $locale->text('Assembly Number missing!')
# save part
- $lxdebug->message(LXDebug::DEBUG1,
- "ic.pl: sellprice in save = $form->{sellprice}\n");
- $rc = IC->save(\%myconfig, \%$form);
- if ($rc == 3) {
+ $lxdebug->message($LXDebug::DEBUG1, "ic.pl: sellprice in save = $form->{sellprice}\n");
+ if (IC->save(\%myconfig, \%$form) == 3) {
$form->error($locale->text('Partnumber not unique!'));
}
# saving the history
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
$form->{addition} = "SAVED";
$form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
$parts_id = $form->{id};
+ my $i;
# load previous variables
if ($form->{previousform}) {
@@ -3070,8 +2898,8 @@ sub save {
map { delete $form->{$_} } keys %newform;
# now take it apart and restore original values
- foreach $item (split /&/, $previousform) {
- ($key, $value) = split /=/, $item, 2;
+ foreach my $item (split /&/, $previousform) {
+ my ($key, $value) = split m/=/, $item, 2;
$value =~ s/%26/&/g;
$form->{$key} = $value;
}
@@ -3091,8 +2919,7 @@ sub save {
$form->{weight} -= $form->{"weight_$i"} * $form->{"qty_$i"};
# change/add values for assembly item
- map { $form->{"${_}_$i"} = $newform{$_} }
- qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno);
+ map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit weight listprice sellprice inventory_accno income_accno expense_accno price_factor_id);
$form->{sellprice} += $form->{"sellprice_$i"} * $form->{"qty_$i"};
$form->{weight} += $form->{"weight_$i"} * $form->{"qty_$i"};
@@ -3103,44 +2930,46 @@ sub save {
$i = $form->{rowcount};
$form->{"qty_$i"} = 1 unless ($form->{"qty_$i"});
- map { $form->{"${_}_$i"} = $newform{$_} }
- qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice);
+ map { $form->{"${_}_$i"} = $newform{$_} } qw(partnumber description bin unit listprice inventory_accno income_accno expense_accno sellprice lastcost price_factor_id);
+
$form->{"sellprice_$i"} = $newform{lastcost} if ($form->{vendor_id});
+
if ($form->{exchangerate} != 0) {
$form->{"sellprice_$i"} /= $form->{exchangerate};
}
- $lxdebug->message(LXDebug::DEBUG1,
- qq|sellprice_$i in previousform 2 = |
- . $form->{"sellprice_$i"} . qq|\n|);
- map { $form->{"taxaccounts_$i"} .= "$_ " } split / /,
- $newform{taxaccount};
+
+ $lxdebug->message($LXDebug::DEBUG1, qq|sellprice_$i in previousform 2 = | . $form->{"sellprice_$i"} . qq|\n|);
+
+ map { $form->{"taxaccounts_$i"} .= "$_ " } split / /, $newform{taxaccount};
chop $form->{"taxaccounts_$i"};
- foreach $item (qw(description rate taxnumber)) {
- $index = $form->{"taxaccounts_$i"} . "_$item";
+ foreach my $item (qw(description rate taxnumber)) {
+ my $index = $form->{"taxaccounts_$i"} . "_$item";
$form->{$index} = $newform{$index};
}
# credit remaining calculation
- $amount =
- $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) *
- $form->{"qty_$i"};
- map { $form->{"${_}_base"} += $amount }
- (split / /, $form->{"taxaccounts_$i"});
- map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) }
- split / /, $form->{"taxaccounts_$i"}
- if !$form->{taxincluded};
+ $amount = $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) * $form->{"qty_$i"};
+
+ map { $form->{"${_}_base"} += $amount } (split / /, $form->{"taxaccounts_$i"});
+ map { $amount += ($form->{"${_}_base"} * $form->{"${_}_rate"}) } split / /, $form->{"taxaccounts_$i"} if !$form->{taxincluded};
$form->{creditremaining} -= $amount;
# redo number formatting, because invoice parse them!
- $i = $form->{rowcount};
- map {
- $form->{"${_}_$i"} =
- $form->format_amount(\%myconfig, $form->{"${_}_$i"})
- } qw(weight listprice sellprice rop);
+ map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}) } qw(weight listprice sellprice rop);
}
$form->{"id_$i"} = $parts_id;
+
+ # Get the actual price factor (not just the ID) for the marge calculation.
+ $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS');
+ foreach my $pfac (@{ $form->{ALL_PRICE_FACTORS} }) {
+ next if ($pfac->{id} != $newform{price_factor_id});
+ $form->{"marge_price_factor_$i"} = $pfac->{factor};
+ last;
+ }
+ delete $form->{ALL_PRICE_FACTORS};
+
delete $form->{action};
# restore original callback
@@ -3151,17 +2980,15 @@ sub save {
$form->{makemodel_rows}--;
# put callback together
- foreach $key (keys %$form) {
+ foreach my $key (keys %$form) {
# do single escape for Apache 2.0
- $value = $form->escape($form->{$key}, 1);
+ my $value = $form->escape($form->{$key}, 1);
$callback .= qq|&$key=$value|;
}
$form->{callback} = $callback;
}
- $lxdebug->message(LXDebug::DEBUG1,
- qq|ic.pl: sellprice_$i nach sub save = |
- . $form->{"sellprice_$i"} . qq|\n|);
+ $lxdebug->message($LXDebug::DEBUG1, qq|ic.pl: sellprice_$i nach sub save = | . $form->{"sellprice_$i"} . qq|\n|);
# redirect
$form->redirect;
@@ -3174,6 +3001,7 @@ sub save_as_new {
# saving the history
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
$form->{addition} = "SAVED AS NEW";
$form->save_history($form->dbconnect(\%myconfig));
}
@@ -3191,11 +3019,12 @@ sub delete {
$lxdebug->enter_sub();
# saving the history
if(!exists $form->{addition}) {
+ $form->{snumbers} = qq|partnumber_| . $form->{partnumber};
$form->{addition} = "DELETED";
$form->save_history($form->dbconnect(\%myconfig));
}
# /saving the history
- $rc = IC->delete(\%myconfig, \%$form);
+ my $rc = IC->delete(\%myconfig, \%$form);
# redirect
$form->redirect($locale->text('Item deleted!')) if ($rc > 0);
@@ -3218,7 +3047,7 @@ sub price_row {
| . $locale->text('Preis') . qq| |
|;
- for $i (1 .. $numrows) {
+ for my $i (1 .. $numrows) {
print qq|
$form->{"pricegroup_$i"} |
@@ -3240,13 +3069,23 @@ sub price_row {
sub parts_language_selection {
$lxdebug->enter_sub();
+ our ($onload);
my $languages = IC->retrieve_languages(\%myconfig, $form);
+ if ($form->{language_values} ne "") {
+ foreach $item (split(/---\+\+\+---/, $form->{language_values})) {
+ my ($language_id, $translation, $longdescription) = split(/--\+\+--/, $item);
+
+ foreach my $language (@{ $languages }) {
+ next unless ($language->{id} == $language_id);
- my $callback = "$form->{script}?action=parts_language_selection&";
- map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
- (qw(login path password name input_name), grep({ /^[fl]_/ } keys %$form)));
+ $language->{translation} = $translation;
+ $language->{longdescription} = $longdescription;
+ last;
+ }
+ }
+ }
my @header_sort = qw(name longdescription);
my %header_title = ( "name" => $locale->text("Name"),
@@ -3262,11 +3101,11 @@ sub parts_language_selection {
$form->{"title"} = $locale->text("Language Values");
$form->header();
- print($form->parse_html_template("ic/parts_language_selection", { "HEADER" => \@header,
- "LANGUAGES" => $languages,
- "onload" => $onload }));
+ print $form->parse_html_template2("ic/parts_language_selection", { "HEADER" => \@header,
+ "LANGUAGES" => $languages,
+ "onload" => $onload });
$lxdebug->leave_sub();
}
-sub continue { &{ $form->{nextsub} } }
+sub continue { call_sub($form->{"nextsub"}); }
|