- } elsif (ref($form->{$idx}) eq "ARRAY") {
- for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) {
- $form->{$idx}->[$i] =
- $form->format_amount(\%myconfig, $form->{$idx}->[$i], $places);
- }
+# -------------------------------------------------------------------------
+
+sub show_vc_details {
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ $form->{vc} = $form->{vc} eq "customer" ? "customer" : "vendor";
+ $form->isblank("vc_id",
+ $form->{vc} eq "customer" ?
+ $locale->text("No customer has been selected yet.") :
+ $locale->text("No vendor has been selected yet."));
+
+ Common->get_vc_details(\%myconfig, $form, $form->{vc}, $form->{vc_id});
+
+ $form->{title} = $form->{vc} eq "customer" ?
+ $locale->text("Customer details") : $locale->text("Vendor details");
+ $form->header();
+ print $form->parse_html_template("common/show_vc_details", { "is_customer" => $form->{vc} eq "customer" });
+
+ $main::lxdebug->leave_sub();
+}
+
+# -------------------------------------------------------------------------
+
+sub retrieve_partunits {
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+
+ my @part_ids = grep { $_ } map { $form->{"id_${_}"} } (1..$form->{rowcount});
+
+ if (@part_ids) {
+ my %partunits = IO->retrieve_partunits('part_ids' => \@part_ids);
+
+ foreach my $i (1..$form->{rowcount}) {
+ next unless ($form->{"id_${i}"});
+ $form->{"partunit_${i}"} = $partunits{$form->{"id_${i}"}};