]> wagnertech.de Git - kivitendo-erp.git/commitdiff
* Auslagerung der OE-Masken in Templates *
authorSven Schöling <s.schoeling@linet-services.de>
Mon, 22 Oct 2007 15:33:48 +0000 (15:33 +0000)
committerSven Schöling <s.schoeling@linet-services.de>
Mon, 22 Oct 2007 15:33:48 +0000 (15:33 +0000)
Diese Patch ist ein Merge der Revisionen
2866, 5349, 5365, 5370, 5408, 5413, 5470, 5473, 5475, 5519, 5520, 5521, 5524, 5526, 5591, 5618, 5622, 5814, 5881, 5882 und 5961
in das Unstable.

Hintergrund ist die Auslagerung der OE-Masken, das heisst aller Masken, die fuer Auftraege, Angebote und teilweise Rechnungen zustaendig sind.
Dadurch vereinfacht sich der Code an vielen Stellen deutlich, ausserdem konnten viele Berechnungen verkleinert werden, weil der Code fuer Angebote/Auftraege jetzt getrennt von Rechnungen liegt.

Ein Grossteil der bin/mozilla/io.pl wurde dafuer dubliziert, die Methoden die fuer Auftraege noetig sind liegen jetzt in der bin/mozilla/oe.pl (vor allem display_form und display_row, aber auch ein paar andere), ihr jeweiliges Pendant fuer Rechnungen wurde unveraendert in eine Datei invoice_io.pl ausgelagert die von den Skripten die sie benoetigen zusaetzlich zur io.pl eingelesen wird.

Wie der Name der Templates andeutet ist der Patch im Verkaufsbaum entstanden, im Verlauf der Programmierung habe cih aber nicht genug Unterschiede gefunden um separate Templates fuer Verkauf und Einkauf zu rechtfertigen. Eventuell werden die Templates noch umbenannt.

Komplexe Maskenaenderungen wie der Austausch von Drop-Down Menues bei zu grosser Anzahl durch Eingabefelder werden ebenfalls noch manuell gemacht.
Auch das wird in der naechsten Version ausgelagert um den Backend Code schlanker zu machen.

Die Berechnung fuer Units und Steuern wurde vereinfacht, und dabei einige unschoene Bugs gefixt, die aus der unvollstaendigen Abdeckung von Verzweigungen resultierten.

Zuletzt wurden noch fast alle serverseitigen Datenformatierungen ausgelagert in ein Templateplugin, welches Zahlen waehrend des Templatings formatiert (mehr dazu in der Dakumentation zu Template.pm).

Der Patch beinhaltet ausserdem die ueblichen Codekosmetika.

19 files changed:
SL/AM.pm
SL/Form.pm
SL/IC.pm
SL/IR.pm
SL/OE.pm
am.pl
bin/mozilla/ic.pl
bin/mozilla/io.pl
bin/mozilla/ir.pl
bin/mozilla/is.pl
bin/mozilla/oe.pl
bin/mozilla/rp.pl
locale/de/all
locale/de/dn
locale/de/ic
locale/de/io
locale/de/ir
locale/de/is
locale/de/oe

index 9802269746c2578905fb1572fff78e5f2f804808..fa6e128ea7d57424c86df0c702fa30cf3ccc0b3b 100644 (file)
--- a/SL/AM.pm
+++ b/SL/AM.pm
@@ -1880,6 +1880,17 @@ sub units_in_use {
   $main::lxdebug->leave_sub();
 }
 
   $main::lxdebug->leave_sub();
 }
 
+# if $a is translatable to $b, return the factor between them.
+# else return 1
+sub convert_unit {
+  $main::lxdebug->enter_sub(2);
+  ($this, $a, $b, $all_units) = @_;
+
+  $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a} && $all_units->{$b};
+  $main::lxdebug->leave_sub(2) and return 0 unless $all_units->{$a}{base_unit} eq $all_units->{$b}{base_unit};
+  $main::lxdebug->leave_sub(2) and return $all_units->{$a}{factor} / $all_units->{$b}{factor}; 
+}
+
 sub unit_select_data {
   $main::lxdebug->enter_sub();
 
 sub unit_select_data {
   $main::lxdebug->enter_sub();
 
index 2236a94ee616ba5b61509bd54b7dff8a933d1b21..e4c4dd5b78bb5f3f5814fe654cf74df468d35c14 100644 (file)
@@ -586,6 +586,7 @@ sub parse_html_template2 {
                                  'EVAL_PERL'   => 0,
                                  'ABSOLUTE'    => 1,
                                  'CACHE_SIZE'  => 0,
                                  'EVAL_PERL'   => 0,
                                  'ABSOLUTE'    => 1,
                                  'CACHE_SIZE'  => 0,
+                                 'PLUGIN_BASE' => 'SL::Template::Plugin',
                                }) || die;
 
   map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self };
                                }) || die;
 
   map { $additional_params->{$_} ||= $self->{$_} } keys %{ $self };
@@ -1865,11 +1866,12 @@ $main::lxdebug->enter_sub();
 sub _get_customers {
   $main::lxdebug->enter_sub();
 
 sub _get_customers {
   $main::lxdebug->enter_sub();
 
-  my ($self, $dbh, $key) = @_;
+  my ($self, $dbh, $key, $limit) = @_;
 
   $key = "all_customers" unless ($key);
 
   $key = "all_customers" unless ($key);
+  $limit_clause = "LIMIT $limit" if $limit;
 
 
-  my $query = qq|SELECT * FROM customer WHERE NOT obsolete ORDER BY name|;
+  my $query = qq|SELECT * FROM customer WHERE NOT obsolete ORDER BY name $limit_clause|;
 
   $self->{$key} = selectall_hashref_query($self, $dbh, $query);
 
 
   $self->{$key} = selectall_hashref_query($self, $dbh, $query);
 
@@ -1985,11 +1987,19 @@ sub get_lists {
   }
   
   if($params{"customers"}) {
   }
   
   if($params{"customers"}) {
-    $self->_get_customers($dbh, $params{"customers"});
+    if (ref $params{"customers"} eq 'HASH') {
+      $self->_get_customers($dbh, $params{"customers"}{key}, $params{"customers"}{limit});
+    } else {
+      $self->_get_customers($dbh, $params{"customers"});
+    }
   }
   
   if($params{"vendors"}) {
   }
   
   if($params{"vendors"}) {
-    $self->_get_vendors($dbh, $params{"vendors"});
+    if (ref $params{"vendors"} eq 'HASH') {
+      $self->_get_vendors($dbh, $params{"vendors"}{key}, $params{"vendors"}{limit});
+    } else {
+      $self->_get_vendors($dbh, $params{"vendors"});
+    }
   }
   
   if($params{"payments"}) {
   }
   
   if($params{"payments"}) {
index 8520f5091d94a681ac0a0d8c044e39a375847efc..8494152f87021f5e9635faff3f888b109b08b7df 100644 (file)
--- a/SL/IC.pm
+++ b/SL/IC.pm
@@ -930,7 +930,17 @@ sub all_parts {
 
   my @sort_cols = (@simple_filters, qw(id bin priceupdate onhand invnumber ordnumber quonumber name serialnumber soldtotal deliverydate));
   $form->{sort} = 'id' unless grep { $form->{"l_$_"} } grep { $form->{sort} eq $_ } @sort_cols;
 
   my @sort_cols = (@simple_filters, qw(id bin priceupdate onhand invnumber ordnumber quonumber name serialnumber soldtotal deliverydate));
   $form->{sort} = 'id' unless grep { $form->{"l_$_"} } grep { $form->{sort} eq $_ } @sort_cols;
-  my $order_clause = " ORDER BY $form->{sort} " . ($form->{revers} ? 'DESC' : 'ASC');
+
+  my $sort_order = ($form->{revers} ? ' DESC' : ' ASC');
+
+  # special case: sorting by partnumber
+  # since partnumbers are expected to be prefixed integers, a special sorting is implemented sorting first lexically by prefix and then by suffix.
+  # and yes, that expression is designed to hold that array of regexes only once, so the map is kinda messy, sorry about that.
+  # ToDO: implement proper functional sorting
+  $form->{sort} = join ', ', map { push @select_tokens, $_; ($table_prefix{$_} = "substring(partnumber,'[") . $_ } qw|^[:digit:]]+') [:digit:]]+')::INTEGER|
+    if $form->{sort} eq 'partnumber';
+
+  my $order_clause = " ORDER BY $form->{sort} $sort_order";
 
   my $limit_clause = " LIMIT 100" if $form->{top100};
 
 
   my $limit_clause = " LIMIT 100" if $form->{top100};
 
@@ -980,7 +990,8 @@ sub all_parts {
 
   #============= build query ================#
 
 
   #============= build query ================#
 
-  my %table_prefix = (
+  %table_prefix = (
+     %table_prefix,
      deliverydate => 'apoe.', serialnumber => 'ioi.',
      transdate    => 'apoe.', trans_id     => 'ioi.',
      module       => 'apoe.', name         => 'cv.',
      deliverydate => 'apoe.', serialnumber => 'ioi.',
      transdate    => 'apoe.', trans_id     => 'ioi.',
      module       => 'apoe.', name         => 'cv.',
index 3a8c4654ccf8b96488dc03d7de6ad56a55146602..1d4b9034836588760b3795cb0d48c8af8cc06369 100644 (file)
--- a/SL/IR.pm
+++ b/SL/IR.pm
@@ -811,7 +811,10 @@ sub retrieve_invoice {
 sub get_vendor {
   $main::lxdebug->enter_sub();
 
 sub get_vendor {
   $main::lxdebug->enter_sub();
 
-  my ($self, $myconfig, $form) = @_;
+  my ($self, $myconfig, $form, $params) = @_;
+
+  $params = $form unless defined $params && ref $params eq "HASH";
+  $main::lxdebug->message(0, Dumper($params));
 
   # connect to database
   my $dbh = $form->dbconnect($myconfig);
 
   # connect to database
   my $dbh = $form->dbconnect($myconfig);
@@ -819,17 +822,27 @@ sub get_vendor {
   my $dateformat = $myconfig->{dateformat};
   $dateformat .= "yy" if $myconfig->{dateformat} !~ /^y/;
 
   my $dateformat = $myconfig->{dateformat};
   $dateformat .= "yy" if $myconfig->{dateformat} !~ /^y/;
 
-  my $vid = conv_i($form->{vendor_id});
+  my $vid = conv_i($params->{vendor_id});
+  my $vnr = conv_i($params->{vendornumber});
 
   my $duedate =
 
   my $duedate =
-    ($form->{invdate})
-    ? "to_date(" . $dbh->quote($form->{invdate}) . ", '$dateformat')"
+    ($params->{invdate})
+    ? "to_date(" . $dbh->quote($params->{invdate}) . ", '$dateformat')"
     : "current_date";
 
   # get vendor
     : "current_date";
 
   # get vendor
+  @values = ();
+  if ($vid) {
+    $where .= 'AND v.id = ?';
+    push @values, $vid;
+  }
+  if ($vnr) {
+    $where .= 'AND v.vendornumber = ?';
+    push @values, $vnr;
+  }
   my $query =
     qq|SELECT
   my $query =
     qq|SELECT
-         v.name AS vendor, v.creditlimit, v.terms, v.notes AS intnotes,
+         v.id, v.name AS vendor, v.creditlimit, v.terms, v.notes AS intnotes,
          v.email, v.cc, v.bcc, v.language_id, v.payment_id,
          v.street, v.zipcode, v.city, v.country, v.taxzone_id,
          $duedate + COALESCE(pt.terms_netto, 0) AS duedate,
          v.email, v.cc, v.bcc, v.language_id, v.payment_id,
          v.street, v.zipcode, v.city, v.country, v.taxzone_id,
          $duedate + COALESCE(pt.terms_netto, 0) AS duedate,
@@ -837,15 +850,15 @@ sub get_vendor {
        FROM vendor v
        LEFT JOIN business b       ON (b.id = v.business_id)
        LEFT JOIN payment_terms pt ON (v.payment_id = pt.id)
        FROM vendor v
        LEFT JOIN business b       ON (b.id = v.business_id)
        LEFT JOIN payment_terms pt ON (v.payment_id = pt.id)
-       WHERE v.id = ?|;
-  $ref = selectfirst_hashref_query($form, $dbh, $query, $vid);
-  map { $form->{$_} = $ref->{$_} } keys %$ref;
+       WHERE 1=1 $where|;
+  $ref = selectfirst_hashref_query($form, $dbh, $query, @values);
+  map { $params->{$_} = $ref->{$_} } keys %$ref;
 
 
-  $form->{creditremaining} = $form->{creditlimit};
+  $params->{creditremaining} = $params->{creditlimit};
 
   $query = qq|SELECT SUM(amount - paid) FROM ap WHERE vendor_id = ?|;
   my ($unpaid_invoices) = selectfirst_array_query($form, $dbh, $query, $vid);
 
   $query = qq|SELECT SUM(amount - paid) FROM ap WHERE vendor_id = ?|;
   my ($unpaid_invoices) = selectfirst_array_query($form, $dbh, $query, $vid);
-  $form->{creditremaining} -= $unpaid_invoices;
+  $params->{creditremaining} -= $unpaid_invoices;
 
   $query = qq|SELECT o.amount,
                 (SELECT e.sell
 
   $query = qq|SELECT o.amount,
                 (SELECT e.sell
@@ -857,21 +870,21 @@ sub get_vendor {
   my $sth = prepare_execute_query($form, $dbh, $query, $vid);
   while (my ($amount, $exch) = $sth->fetchrow_array()) {
     $exch = 1 unless $exch;
   my $sth = prepare_execute_query($form, $dbh, $query, $vid);
   while (my ($amount, $exch) = $sth->fetchrow_array()) {
     $exch = 1 unless $exch;
-    $form->{creditremaining} -= $amount * $exch;
+    $params->{creditremaining} -= $amount * $exch;
   }
   $sth->finish();
 
   # get shipto if we do not convert an order or invoice
   }
   $sth->finish();
 
   # get shipto if we do not convert an order or invoice
-  if (!$form->{shipto}) {
-    delete @{$form}{qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail)};
+  if (!$params->{shipto}) {
+    delete @{$params}{qw(shiptoname shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact shiptophone shiptofax shiptoemail)};
 
     $query = qq|SELECT * FROM shipto WHERE (trans_id = ?) AND (module= 'CT')|;
     $ref = selectfirst_hashref_query($form, $dbh, $query, $vid);
 
     $query = qq|SELECT * FROM shipto WHERE (trans_id = ?) AND (module= 'CT')|;
     $ref = selectfirst_hashref_query($form, $dbh, $query, $vid);
-    @{$form}{keys %$ref} = @{$ref}{keys %$ref};
-    map { $form->{$_} = $ref->{$_} } keys %$ref;
+    @{$params}{keys %$ref} = @{$ref}{keys %$ref};
+    map { $params->{$_} = $ref->{$_} } keys %$ref;
   }
 
   }
 
-  if (!$form->{id} && $form->{type} !~ /_(order|quotation)/) {
+  if (!$params->{id} && $params->{type} !~ /_(order|quotation)/) {
     # setup last accounts used
     $query =
       qq|SELECT c.id, c.accno, c.description, c.link, c.category
     # setup last accounts used
     $query =
       qq|SELECT c.id, c.accno, c.description, c.link, c.category
@@ -888,24 +901,24 @@ sub get_vendor {
       if ($ref->{category} eq 'E') {
         $i++;
 
       if ($ref->{category} eq 'E') {
         $i++;
 
-        if ($form->{initial_transdate}) {
+        if ($params->{initial_transdate}) {
           my $tax_query = qq|SELECT tk.tax_id, t.rate FROM taxkeys tk
                              LEFT JOIN tax t ON (tk.tax_id = t.id)
                              WHERE (tk.chart_id = ?) AND (startdate <= ?)
                              ORDER BY tk.startdate DESC
                              LIMIT 1|;
           my $tax_query = qq|SELECT tk.tax_id, t.rate FROM taxkeys tk
                              LEFT JOIN tax t ON (tk.tax_id = t.id)
                              WHERE (tk.chart_id = ?) AND (startdate <= ?)
                              ORDER BY tk.startdate DESC
                              LIMIT 1|;
-          my ($tax_id, $rate) = selectrow_query($form, $dbh, $tax_query, $ref->{id}, $form->{initial_transdate});
-          $form->{"taxchart_$i"} = "${tax_id}--${rate}";
+          my ($tax_id, $rate) = selectrow_query($form, $dbh, $tax_query, $ref->{id}, $params->{initial_transdate});
+          $params->{"taxchart_$i"} = "${tax_id}--${rate}";
         }
 
         }
 
-        $form->{"AP_amount_$i"} = "$ref->{accno}--$tax_id";
+        $params->{"AP_amount_$i"} = "$ref->{accno}--$tax_id";
       }
 
       if ($ref->{category} eq 'L') {
       }
 
       if ($ref->{category} eq 'L') {
-        $form->{APselected} = $form->{AP_1} = $ref->{accno};
+        $params->{APselected} = $params->{AP_1} = $ref->{accno};
       }
     }
       }
     }
-    $form->{rowcount} = $i if ($i && !$form->{type});
+    $params->{rowcount} = $i if ($i && !$params->{type});
   }
 
   $dbh->disconnect();
   }
 
   $dbh->disconnect();
index 7bea468e7003662786f1d31778261383efa7787d..2e7a6bebb10562e14b87ed62af63944313165d32 100644 (file)
--- a/SL/OE.pm
+++ b/SL/OE.pm
@@ -244,8 +244,7 @@ sub save {
 
   for my $i (1 .. $form->{rowcount}) {
 
 
   for my $i (1 .. $form->{rowcount}) {
 
-    map({ $form->{"${_}_$i"} =
-            $form->parse_amount($myconfig, $form->{"${_}_$i"}) } qw(qty ship));
+    map({ $form->{"${_}_$i"} = $form->parse_amount($myconfig, $form->{"${_}_$i"}) } qw(qty ship));
 
     if ($form->{"id_$i"}) {
 
 
     if ($form->{"id_$i"}) {
 
@@ -256,8 +255,7 @@ sub save {
       my $basefactor = 1;
       if (defined($all_units->{$item_unit}->{factor}) &&
           (($all_units->{$item_unit}->{factor} * 1) != 0)) {
       my $basefactor = 1;
       if (defined($all_units->{$item_unit}->{factor}) &&
           (($all_units->{$item_unit}->{factor} * 1) != 0)) {
-        $basefactor = $all_units->{$form->{"unit_$i"}}->{factor} /
-          $all_units->{$item_unit}->{factor};
+        $basefactor = $all_units->{$form->{"unit_$i"}}->{factor} / $all_units->{$item_unit}->{factor};
       }
       my $baseqty = $form->{"qty_$i"} * $basefactor;
 
       }
       my $baseqty = $form->{"qty_$i"} * $basefactor;
 
@@ -266,23 +264,17 @@ sub save {
       $form->{"lastcost_$i"} = $form->{"lastcost_$i"} * 1;
 
       # set values to 0 if nothing entered
       $form->{"lastcost_$i"} = $form->{"lastcost_$i"} * 1;
 
       # set values to 0 if nothing entered
-      $form->{"discount_$i"} =
-        $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100;
+      $form->{"discount_$i"} = $form->parse_amount($myconfig, $form->{"discount_$i"}) / 100;
 
 
-      $form->{"sellprice_$i"} =
-        $form->parse_amount($myconfig, $form->{"sellprice_$i"});
+      $form->{"sellprice_$i"} = $form->parse_amount($myconfig, $form->{"sellprice_$i"});
       $fxsellprice = $form->{"sellprice_$i"};
 
       my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
       $dec = length($dec);
       my $decimalplaces = ($dec > 2) ? $dec : 2;
 
       $fxsellprice = $form->{"sellprice_$i"};
 
       my ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
       $dec = length($dec);
       my $decimalplaces = ($dec > 2) ? $dec : 2;
 
-      $discount =
-        $form->round_amount($form->{"sellprice_$i"} * $form->{"discount_$i"},
-                            $decimalplaces);
-      $form->{"sellprice_$i"} =
-        $form->round_amount($form->{"sellprice_$i"} - $discount,
-                            $decimalplaces);
+      $discount = $form->round_amount($form->{"sellprice_$i"} * $form->{"discount_$i"}, $decimalplaces);
+      $form->{"sellprice_$i"} = $form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces);
 
       $form->{"inventory_accno_$i"} *= 1;
       $form->{"expense_accno_$i"}   *= 1;
 
       $form->{"inventory_accno_$i"} *= 1;
       $form->{"expense_accno_$i"}   *= 1;
@@ -311,15 +303,10 @@ sub save {
       if ($form->round_amount($taxrate, 7) == 0) {
         if ($form->{taxincluded}) {
           foreach $item (@taxaccounts) {
       if ($form->round_amount($taxrate, 7) == 0) {
         if ($form->{taxincluded}) {
           foreach $item (@taxaccounts) {
-            $taxamount =
-              $form->round_amount($linetotal * $form->{"${item}_rate"} /
-                                    (1 + abs($form->{"${item}_rate"})),
-                                  2);
-
+            $taxamount = $form->round_amount($linetotal * $form->{"${item}_rate"} / (1 + abs($form->{"${item}_rate"})), 2);
             $taxaccounts{$item} += $taxamount;
             $taxdiff            += $taxamount;
             $taxaccounts{$item} += $taxamount;
             $taxdiff            += $taxamount;
-
-            $taxbase{$item} += $taxbase;
+            $taxbase{$item}     += $taxbase;
           }
           $taxaccounts{ $taxaccounts[0] } += $taxdiff;
         } else {
           }
           $taxaccounts{ $taxaccounts[0] } += $taxdiff;
         } else {
@@ -330,16 +317,14 @@ sub save {
         }
       } else {
         foreach $item (@taxaccounts) {
         }
       } else {
         foreach $item (@taxaccounts) {
-          $taxaccounts{$item} +=
-            $taxamount * $form->{"${item}_rate"} / $taxrate;
+          $taxaccounts{$item} += $taxamount * $form->{"${item}_rate"} / $taxrate;
           $taxbase{$item} += $taxbase;
         }
       }
 
       $netamount += $form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor;
 
           $taxbase{$item} += $taxbase;
         }
       }
 
       $netamount += $form->{"sellprice_$i"} * $form->{"qty_$i"} / $price_factor;
 
-      $reqdate =
-        ($form->{"reqdate_$i"}) ? $form->{"reqdate_$i"} : undef;
+      $reqdate = ($form->{"reqdate_$i"}) ? $form->{"reqdate_$i"} : undef;
 
       # get pricegroup_id and save ist
       ($null, my $pricegroup_id) = split(/--/, $form->{"sellprice_pg_$i"});
 
       # get pricegroup_id and save ist
       ($null, my $pricegroup_id) = split(/--/, $form->{"sellprice_pg_$i"});
@@ -362,7 +347,7 @@ sub save {
       }
       $query .= qq|?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
                    (SELECT factor FROM price_factors WHERE id = ?), ?)|;
       }
       $query .= qq|?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
                    (SELECT factor FROM price_factors WHERE id = ?), ?)|;
-                 push(@values,
+        push(@values,
            conv_i($form->{id}), conv_i($form->{"id_$i"}),
            $form->{"description_$i"}, $form->{"longdescription_$i"},
            $form->{"qty_$i"}, $baseqty,
            conv_i($form->{id}), conv_i($form->{"id_$i"}),
            $form->{"description_$i"}, $form->{"longdescription_$i"},
            $form->{"qty_$i"}, $baseqty,
@@ -394,17 +379,10 @@ sub save {
   if ($form->{currency} eq $form->{defaultcurrency}) {
     $form->{exchangerate} = 1;
   } else {
   if ($form->{currency} eq $form->{defaultcurrency}) {
     $form->{exchangerate} = 1;
   } else {
-    $exchangerate =
-      $form->check_exchangerate($myconfig,
-                                $form->{currency},
-                                $form->{transdate},
-                                ($form->{vc} eq 'customer') ? 'buy' : 'sell');
+    $exchangerate = $form->check_exchangerate($myconfig, $form->{currency}, $form->{transdate}, ($form->{vc} eq 'customer') ? 'buy' : 'sell');
   }
 
   }
 
-  $form->{exchangerate} =
-    ($exchangerate)
-    ? $exchangerate
-    : $form->parse_amount($myconfig, $form->{exchangerate});
+  $form->{exchangerate} = ($exchangerate) ? $exchangerate : $form->parse_amount($myconfig, $form->{exchangerate});
 
   my $quotation = $form->{type} =~ /_order$/ ? 'f' : 't';
 
 
   my $quotation = $form->{type} =~ /_order$/ ? 'f' : 't';
 
@@ -456,12 +434,10 @@ sub save {
 
   if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
     if ($form->{vc} eq 'customer') {
 
   if (($form->{currency} ne $form->{defaultcurrency}) && !$exchangerate) {
     if ($form->{vc} eq 'customer') {
-      $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate},
-                                 $form->{exchangerate}, 0);
+      $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, $form->{exchangerate}, 0);
     }
     if ($form->{vc} eq 'vendor') {
     }
     if ($form->{vc} eq 'vendor') {
-      $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate},
-                                 0, $form->{exchangerate});
+      $form->update_exchangerate($dbh, $form->{currency}, $form->{transdate}, 0, $form->{exchangerate});
     }
   }
 
     }
   }
 
@@ -471,14 +447,14 @@ sub save {
     &adj_onhand($dbh, $form, $ml * -1);
   }
 
     &adj_onhand($dbh, $form, $ml * -1);
   }
 
-  my $rc = $dbh->commit;
-  $dbh->disconnect;
-
   $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ?
                                        "quonumber" : "ordnumber"};
 
   Common::webdav_folder($form) if ($main::webdav);
 
   $form->{saved_xyznumber} = $form->{$form->{type} =~ /_quotation$/ ?
                                        "quonumber" : "ordnumber"};
 
   Common::webdav_folder($form) if ($main::webdav);
 
+  my $rc = $dbh->commit;
+  $dbh->disconnect;
+
   $main::lxdebug->leave_sub();
 
   return $rc;
   $main::lxdebug->leave_sub();
 
   return $rc;
@@ -918,8 +894,7 @@ sub order_details {
     $sth->finish();
   }
 
     $sth->finish();
   }
 
-  $form->{"globalprojectnumber"} =
-    $projectnumbers{$form->{"globalproject_id"}};
+  $form->{"globalprojectnumber"} = $projectnumbers{$form->{"globalproject_id"}};
 
   my @arrays =
     qw(runningnumber number description longdescription qty ship unit bin
 
   my @arrays =
     qw(runningnumber number description longdescription qty ship unit bin
@@ -1041,9 +1016,8 @@ sub order_details {
 
       if ($taxamount != 0) {
         foreach my $item (split / /, $form->{"taxaccounts_$i"}) {
 
       if ($taxamount != 0) {
         foreach my $item (split / /, $form->{"taxaccounts_$i"}) {
-          $taxaccounts{$item} +=
-            $taxamount * $form->{"${item}_rate"} / $taxrate;
-          $taxbase{$item} += $taxbase;
+          $taxaccounts{$item} += $taxamount * $form->{"${item}_rate"} / $taxrate;
+          $taxbase{$item}     += $taxbase;
         }
       }
 
         }
       }
 
@@ -1056,8 +1030,7 @@ sub order_details {
         # get parts and push them onto the stack
         my $sortorder = "";
         if ($form->{groupitems}) {
         # get parts and push them onto the stack
         my $sortorder = "";
         if ($form->{groupitems}) {
-          $sortorder =
-            qq|ORDER BY pg.partsgroup, a.$oid{$myconfig->{dbdriver}}|;
+          $sortorder = qq|ORDER BY pg.partsgroup, a.$oid{$myconfig->{dbdriver}}|;
         } else {
           $sortorder = qq|ORDER BY a.$oid{$myconfig->{dbdriver}}|;
         }
         } else {
           $sortorder = qq|ORDER BY a.$oid{$myconfig->{dbdriver}}|;
         }
@@ -1075,19 +1048,13 @@ sub order_details {
 
         while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
           if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) {
 
         while (my $ref = $sth->fetchrow_hashref(NAME_lc)) {
           if ($form->{groupitems} && $ref->{partsgroup} ne $sameitem) {
-            map({ push(@{ $form->{$_} }, "") }
-                grep({ $_ ne "description" } @arrays));
+            map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays));
             $sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--";
             push(@{ $form->{description} }, $sameitem);
           }
 
             $sameitem = ($ref->{partsgroup}) ? $ref->{partsgroup} : "--";
             push(@{ $form->{description} }, $sameitem);
           }
 
-          push(@{ $form->{description} },
-               $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}
-                 )
-                 . qq|, $ref->{partnumber}, $ref->{description}|);
-
-          map({ push(@{ $form->{$_} }, "") }
-              grep({ $_ ne "description" } @arrays));
+          push(@{ $form->{description} }, $form->format_amount($myconfig, $ref->{qty} * $form->{"qty_$i"}) . qq|, $ref->{partnumber}, $ref->{description}|); 
+          map({ push(@{ $form->{$_} }, "") } grep({ $_ ne "description" } @arrays));
         }
         $sth->finish;
       }
         }
         $sth->finish;
       }
@@ -1195,17 +1162,13 @@ sub adj_onhand {
       my ($item_unit) = selectrow_query($form, $dbh, $query, $ref->{parts_id});
 
       my $basefactor = 1;
       my ($item_unit) = selectrow_query($form, $dbh, $query, $ref->{parts_id});
 
       my $basefactor = 1;
-      if (defined($all_units->{$item_unit}->{factor}) &&
-          (($all_units->{$item_unit}->{factor} * 1) != 0)) {
-        $basefactor = $all_units->{$ref->{unit}}->{factor} /
-          $all_units->{$item_unit}->{factor};
+      if (defined($all_units->{$item_unit}->{factor}) && (($all_units->{$item_unit}->{factor} * 1) != 0)) {
+        $basefactor = $all_units->{$ref->{unit}}->{factor} / $all_units->{$item_unit}->{factor};
       }
       my $baseqty = $ref->{ship} * $basefactor;
 
       # adjust onhand in parts table
       }
       my $baseqty = $ref->{ship} * $basefactor;
 
       # adjust onhand in parts table
-      $form->update_balance($dbh, "parts", "onhand",
-                            qq|id = $ref->{parts_id}|,
-                            $baseqty * $ml);
+      $form->update_balance($dbh, "parts", "onhand", qq|id = $ref->{parts_id}|, $baseqty * $ml);
     }
   }
 
     }
   }
 
diff --git a/am.pl b/am.pl
index ac0a98a58fe6bf88f74751e83b7e44ce689d2f0e..d35b4a90004f1c866b11f75be680f330294ad63e 100755 (executable)
--- a/am.pl
+++ b/am.pl
@@ -47,7 +47,7 @@ $| = 1;
 use SL::LXDebug;
 $lxdebug = LXDebug->new();
 
 use SL::LXDebug;
 $lxdebug = LXDebug->new();
 
-use CGI;
+use CGI qw( -no_xhtml);
 use SL::Form;
 use SL::Locale;
 
 use SL::Form;
 use SL::Locale;
 
@@ -64,6 +64,11 @@ if (defined($latex) && !defined($latex_templates)) {
 $form = new Form;
 $cgi = new CGI('');
 
 $form = new Form;
 $cgi = new CGI('');
 
+# this prevents most of the tabindexes being created by CGI.
+# note: most. popup menus and selecttables will still have tabindexes
+# use common.pl's NTI function to get rid of those
+local $CGI::TABINDEX = 0;
+
 # name of this script
 $0 =~ tr/\\/\//;
 $pos = rindex $0, '/';
 # name of this script
 $0 =~ tr/\\/\//;
 $pos = rindex $0, '/';
index 3a73d421d07e1c5d9de4cd80ee35a63e581372b6..fc0da269e7d0244cf5f3961d3f312a7cd4363d7e 100644 (file)
@@ -46,6 +46,7 @@ use SL::ReportGenerator;
 our ($form, $locale, %myconfig, $lxdebug);
 
 require "bin/mozilla/io.pl";
 our ($form, $locale, %myconfig, $lxdebug);
 
 require "bin/mozilla/io.pl";
+require "bin/mozilla/invoice_io.pl";
 require "bin/mozilla/common.pl";
 require "bin/mozilla/reportgenerator.pl";
 
 require "bin/mozilla/common.pl";
 require "bin/mozilla/reportgenerator.pl";
 
@@ -109,44 +110,33 @@ sub search {
      |;
 
     #write Trigger
      |;
 
     #write Trigger
-    $jsscript =
-      Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1",
-                          "transdateto", "BL", "trigger2");
+    $jsscript = Form->write_trigger(\%myconfig, "2", "transdatefrom", "BL", "trigger1", "transdateto", "BL", "trigger2");
   } else {
 
     # without JavaScript Calendar
   } else {
 
     # without JavaScript Calendar
-    $button1 = qq|
-                              <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
-    $button2 = qq|
-                              <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
+    $button1 = qq| <td><input name=transdatefrom id=transdatefrom size=11 title="$myconfig{dateformat}"></td>|;
+    $button2 = qq| <td><input name=transdateto id=transdateto size=11 title="$myconfig{dateformat}"></td>|;
   }
 
   unless ($form->{searchitems} eq 'service') {
 
   }
 
   unless ($form->{searchitems} eq 'service') {
 
-    $onhand = qq|
-            <input name=itemstatus class=radio type=radio value=onhand>&nbsp;|
-      . $locale->text('On Hand') . qq|
-            <input name=itemstatus class=radio type=radio value=short>&nbsp;|
-      . $locale->text('Short') . qq|
+    $onhand = qq| <input name=itemstatus class=radio type=radio value=onhand>&nbsp;| . $locale->text('On Hand') . qq|
+                  <input name=itemstatus class=radio type=radio value=short>&nbsp;| . $locale->text('Short') . qq|
 |;
 
     $makemodel = qq|
         <tr>
 |;
 
     $makemodel = qq|
         <tr>
-          <th align=right nowrap>| . $locale->text('Make') . qq|</th>
-          <td><input name=make size=20></td>
-          <th align=right nowrap>| . $locale->text('Model') . qq|</th>
-          <td><input name=model size=20></td>
+          <th align=right nowrap>| . $locale->text('Make') . qq|</th> <td><input name=make size=20></td>
+          <th align=right nowrap>| . $locale->text('Model') . qq|</th> <td><input name=model size=20></td>
         </tr>
 |;
 
     $serialnumber = qq|
         </tr>
 |;
 
     $serialnumber = qq|
-          <th align=right nowrap>| . $locale->text('Serial Number') . qq|</th>
-          <td><input name=serialnumber size=20></td>
+          <th align=right nowrap>| . $locale->text('Serial Number') . qq|</th> <td><input name=serialnumber size=20></td>
 |;
 
     $l_serialnumber = qq|
 |;
 
     $l_serialnumber = qq|
-        <td><input name=l_serialnumber class=checkbox type=checkbox value=Y>&nbsp;|
-      . $locale->text('Serial Number') . qq|</td>
+        <td><input name=l_serialnumber class=checkbox type=checkbox value=Y>&nbsp;| . $locale->text('Serial Number') . qq|</td>
 |;
 
   }
 |;
 
   }
index 9820f8b300fcd08fea6734868265e847ab00e6c6..a24c0e232f60c574562639f8b6588b7d94e618cf 100644 (file)
@@ -90,509 +90,6 @@ use Data::Dumper;
 # Eintrag fuer Version 2.2.0 geaendert #
 # neue Optik im Rechnungsformular      #
 ########################################
 # Eintrag fuer Version 2.2.0 geaendert #
 # neue Optik im Rechnungsformular      #
 ########################################
-sub display_row {
-  $lxdebug->enter_sub();
-  my $numrows = shift;
-
-  my $is_sales =
-    (substr($form->{type}, 0, 6) eq "sales_")
-    || (($form->{type} eq "invoice") && ($form->{script} eq "is.pl"))
-    || ($form->{type} eq 'credit_note');
-
-  if ($lizenzen && $form->{vc} eq "customer") {
-    if ($form->{type} =~ /sales_order/) {
-      @column_index = (runningnumber, partnumber, description, ship, qty);
-    } elsif ($form->{type} =~ /sales_quotation/) {
-      @column_index = (runningnumber, partnumber, description, qty);
-    } else {
-      @column_index = (runningnumber, partnumber, description, qty);
-    }
-  } else {
-    if (   ($form->{type} =~ /purchase_order/)
-        || ($form->{type} =~ /sales_order/)) {
-      @column_index = (runningnumber, partnumber, description, ship, qty);
-        } else {
-      @column_index = (runningnumber, partnumber, description, qty);
-    }
-  }
-############## ENDE Neueintrag ##################
-
-  my $dimension_units = AM->retrieve_units(\%myconfig, $form, "dimension");
-  my $service_units = AM->retrieve_units(\%myconfig, $form, "service");
-  my $all_units = AM->retrieve_units(\%myconfig, $form);
-
-  my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} };
-
-  push @column_index, qw(unit);
-
-  #for pricegroups column
-  if (   $form->{type} =~ (/sales_quotation/)
-      or (($form->{level} =~ /Sales/) and ($form->{type} =~ /invoice/))
-      or (($form->{level} eq undef) and ($form->{type} =~ /invoice/))
-      or ($form->{type} =~ /sales_order/)) {
-    push @column_index, qw(sellprice_pg);
-  }
-
-  push @column_index, qw(sellprice);
-
-  if ($form->{vc} eq 'customer') {
-    push @column_index, qw(discount);
-  }
-
-  push @column_index, "linetotal";
-
-  my $colspan = $#column_index + 1;
-
-  $form->{invsubtotal} = 0;
-  map { $form->{"${_}_base"} = 0 } (split(/ /, $form->{taxaccounts}));
-
-########################################
-  # Eintrag fuer Version 2.2.0 geaendert #
-  # neue Optik im Rechnungsformular      #
-########################################
-  $column_data{runningnumber} =
-      qq|<th align="left" nowrap width="5" class="listheading">|
-    . $locale->text('No.')
-    . qq|</th>|;
-  $column_data{partnumber} =
-      qq|<th align="left" nowrap width="12" class="listheading">|
-    . $locale->text('Number')
-    . qq|</th>|;
-  $column_data{description} =
-      qq|<th align="left" nowrap width="30" class="listheading">|
-    . $locale->text('Part Description')
-    . qq|</th>|;
-  if ($form->{"type"} eq "purchase_order") {
-    $column_data{ship} =
-      qq|<th align="left" nowrap width="5" class="listheading">|
-      . $locale->text('Ship rcvd')
-      . qq|</th>|;
-  } else {
-    $column_data{ship} =
-      qq|<th align="left" nowrap width="5" class="listheading">|
-      . $locale->text('Ship')
-      . qq|</th>|;
-  }
-  $column_data{qty} =
-      qq|<th align="left" nowrap width="5" class="listheading">|
-    . $locale->text('Qty')
-    . qq|</th>|;
-  $column_data{unit} =
-      qq|<th align="left" nowrap width="5" class="listheading">|
-    . $locale->text('Unit')
-    . qq|</th>|;
-  $column_data{license} =
-      qq|<th align="left" nowrap width="10" class="listheading">|
-    . $locale->text('License')
-    . qq|</th>|;
-  $column_data{serialnr} =
-      qq|<th align="left" nowrap width="10" class="listheading">|
-    . $locale->text('Serial No.')
-    . qq|</th>|;
-  $column_data{projectnr} =
-      qq|<th align="left" nowrap width="10" class="listheading">|
-    . $locale->text('Project')
-    . qq|</th>|;
-  $column_data{sellprice} =
-      qq|<th align="left" nowrap width="15" class="listheading">|
-    . $locale->text('Price')
-    . qq|</th>|;
-  $column_data{sellprice_pg} =
-      qq|<th align="left" nowrap width="15" class="listheading">|
-    . $locale->text('Pricegroup')
-    . qq|</th>|;
-  $column_data{discount} =
-      qq|<th align="left" class="listheading">|
-    . $locale->text('Discount')
-    . qq|</th>|;
-  $column_data{linetotal} =
-      qq|<th align="left" nowrap width="10" class="listheading">|
-    . $locale->text('Extended')
-    . qq|</th>|;
-  $column_data{bin} =
-      qq|<th align="left" nowrap width="10" class="listheading">|
-    . $locale->text('Bin')
-    . qq|</th>|;
-############## ENDE Neueintrag ##################
-
-  $myconfig{"show_form_details"} = 1
-    unless (defined($myconfig{"show_form_details"}));
-  $form->{"show_details"} = $myconfig{"show_form_details"}
-    unless (defined($form->{"show_details"}));
-  $form->{"show_details"} = $form->{"show_details"} ? 1 : 0;
-  my $show_details_new = 1 - $form->{"show_details"};
-  my $show_details_checked = $form->{"show_details"} ? "checked" : "";
-
-  print qq|
-  <tr>
-    <td>| . $cgi->hidden("-name" => "show_details", "-value" => $form->{show_details}) . qq|
-      <input type="checkbox" id="cb_show_details" onclick="show_form_details($show_details_new);" $show_details_checked>
-      <label for="cb_show_details">| . $locale->text("Show details") . qq|</label><br>
-      <table width="100%">
-       <tr class="listheading">|;
-
-  map { print "\n$column_data{$_}" } @column_index;
-
-  print qq|
-        </tr>
-|;
-
-  $runningnumber = $locale->text('No.');
-  $deliverydate  = $locale->text('Delivery Date');
-  $serialnumber  = $locale->text('Serial No.');
-  $projectnumber = $locale->text('Project');
-  $partsgroup    = $locale->text('Group');
-  $reqdate       = $locale->text('Reqdate');
-
-  $delvar = 'deliverydate';
-
-  if ($form->{type} =~ /_order$/ || $form->{type} =~ /_quotation$/) {
-    $deliverydate = $locale->text('Required by');
-    $delvar       = 'reqdate';
-  }
-
-  $form->{marge_total} = 0;
-  $form->{sellprice_total} = 0;
-  $form->{lastcost_total} = 0;
-  my %projectnumber_labels = ();
-  my @projectnumber_values = ("");
-  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
-    push(@projectnumber_values, $item->{"id"});
-    $projectnumber_labels{$item->{"id"}} = $item->{"projectnumber"};
-  }
-
-  for $i (1 .. $numrows) {
-
-    # undo formatting
-    map {
-      $form->{"${_}_$i"} =
-        $form->parse_amount(\%myconfig, $form->{"${_}_$i"})
-    } qw(qty ship discount sellprice price_new price_old) unless ($form->{simple_save});
-
-    if (!$form->{"unit_old_$i"}) {
-      # Neue Ware aus der Datenbank. In diesem Fall ist unit_$i die
-      # Einheit, wie sie in den Stammdaten hinterlegt wurde.
-      # Es sollte also angenommen werden, dass diese ausgewaehlt war.
-      $form->{"unit_old_$i"} = $form->{"unit_$i"};
-    }
-
-    # Die zuletzt ausgewaehlte mit der aktuell ausgewaehlten Einheit
-    # vergleichen und bei Unterschied den Preis entsprechend umrechnen.
-    $form->{"selected_unit_$i"} = $form->{"unit_$i"} unless ($form->{"selected_unit_$i"});
-
-    my $check_units = $form->{"inventory_accno_$i"} ? $dimension_units : $service_units;
-    if (!$check_units->{$form->{"selected_unit_$i"}} ||
-        ($check_units->{$form->{"selected_unit_$i"}}->{"base_unit"} ne
-         $all_units->{$form->{"unit_old_$i"}}->{"base_unit"})) {
-      # Die ausgewaehlte Einheit ist fuer diesen Artikel nicht gueltig
-      # (z.B. Dimensionseinheit war ausgewaehlt, es handelt sich aber
-      # um eine Dienstleistung). Dann keinerlei Umrechnung vornehmen.
-      $form->{"unit_old_$i"} = $form->{"selected_unit_$i"} = $form->{"unit_$i"};
-    }
-    if ((!$form->{"prices_$i"}) || ($form->{"new_pricegroup_$i"} == $form->{"old_pricegroup_$i"})) {
-      if ($form->{"unit_old_$i"} ne $form->{"selected_unit_$i"}) {
-        my $basefactor = 1;
-        if (defined($all_units->{$form->{"unit_old_$i"}}->{"factor"}) &&
-            $all_units->{$form->{"unit_old_$i"}}->{"factor"}) {
-          $basefactor = $all_units->{$form->{"selected_unit_$i"}}->{"factor"} /
-            $all_units->{$form->{"unit_old_$i"}}->{"factor"};
-        }
-        $form->{"sellprice_$i"} *= $basefactor;
-        $form->{"unit_old_$i"} = $form->{"selected_unit_$i"};
-      }
-    }
-
-    ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
-    $decimalplaces = max length($dec), 2;
-
-    $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || 1;
-    $discount     = (100 - $form->{"discount_$i"} * 1) / 100;
-
-    $linetotal    = $form->round_amount($form->{"sellprice_$i"} * $form->{"qty_$i"} * $discount / $price_factor, $decimalplaces);
-
-    my $real_sellprice = $form->{"sellprice_$i"} * $discount / $price_factor;
-
-    # marge calculations
-    my ($marge_font_start, $marge_font_end);
-
-    $form->{"lastcost_$i"} *= 1;
-
-    $marge_price_factor = $form->{"marge_price_factor_$i"} * 1 || 1;
-
-    if ($real_sellprice && ($form->{"qty_$i"} * 1)) {
-      $form->{"marge_percent_$i"}     = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * 100 / $real_sellprice;
-      $myconfig{"marge_percent_warn"} = 15 unless (defined($myconfig{"marge_percent_warn"}));
-
-      if ($form->{"id_$i"} &&
-          ($form->{"marge_percent_$i"} < (1 * $myconfig{"marge_percent_warn"}))) {
-        $marge_font_start = "<font color=\"#ff0000\">";
-        $marge_font_end   = "</font>";
-      }
-
-    } else {
-      $form->{"marge_percent_$i"} = 0;
-    }
-
-    my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1;
-    $form->{"marge_total_$i"}  = ($real_sellprice - $form->{"lastcost_$i"} / $marge_price_factor) * $form->{"qty_$i"} * $marge_adjust_credit_note;
-    $form->{"marge_total"}      += $form->{"marge_total_$i"};
-    $form->{"lastcost_total"}   += $form->{"lastcost_$i"} * $form->{"qty_$i"} / $marge_price_factor;
-    $form->{"sellprice_total"}  += $real_sellprice * $form->{"qty_$i"};
-
-    map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_total marge_percent);
-
-    # convert " to &quot;
-    map { $form->{"${_}_$i"} =~ s/\"/&quot;/g }
-      qw(partnumber description unit unit_old);
-
-########################################
-    # Eintrag fuer Version 2.2.0 geaendert #
-    # neue Optik im Rechnungsformular      #
-########################################
-    $column_data{runningnumber} =
-      qq|<td><input name="runningnumber_$i" size="5" value="$i"></td>|;    # HuT
-############## ENDE Neueintrag ##################
-
-    $column_data{partnumber} =
-      qq|<td><input name="partnumber_$i" size=12 value="$form->{"partnumber_$i"}"></td>|;
-
-    if (($rows = $form->numtextrows($form->{"description_$i"}, 30, 6)) > 1) {
-      $column_data{description} =
-        qq|<td><textarea name="description_$i" rows="$rows" cols="30" wrap="soft">| . H($form->{"description_$i"}) . qq|</textarea><button type="button" onclick="set_longdescription_window('longdescription_$i')">| . $locale->text('L') . qq|</button></td>|;
-    } else {
-      $column_data{description} =
-        qq|<td><input name="description_$i" size="30" value="| . $form->quote($form->{"description_$i"}) . qq|"><button type="button" onclick="set_longdescription_window('longdescription_$i')">| . $locale->text('L') . qq|</button></td>|;
-    }
-
-    (my $qty_dec) = ($form->{"qty_$i"} =~ /\.(\d+)/);
-    $qty_dec = length $qty_dec;
-
-    $column_data{qty} =
-        qq|<td align="right"><input name="qty_$i" size="5" value="|
-      . $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec) .qq|">|;
-    if ($form->{"formel_$i"}) {
-      $column_data{qty} .= qq|<button type="button" onclick="calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)">| . $locale->text('*/') . qq|</button>|
-        . $cgi->hidden("-name" => "formel_$i", "-value" => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"});
-    }
-    $column_data{qty} .= qq|</td>|;
-    $column_data{ship} =
-        qq|<td align="right"><input name="ship_$i" size=5 value="|
-      . $form->format_amount(\%myconfig, $form->{"ship_$i"})
-      . qq|"></td>|;
-
-    my $is_part     = $form->{"inventory_accno_$i"};
-    my $is_assembly = $form->{"assembly_$i"};
-    my $is_assigned = $form->{"id_$i"};
-    my $this_unit = $form->{"unit_$i"};
-    if ($form->{"selected_unit_$i"} && $this_unit &&
-        $all_units->{$form->{"selected_unit_$i"}} && $all_units->{$this_unit} &&
-        ($all_units->{$form->{"selected_unit_$i"}}->{"base_unit"} eq $all_units->{$this_unit}->{"base_unit"})) {
-      $this_unit = $form->{"selected_unit_$i"};
-    } elsif (!$is_assigned ||
-             ($is_part && !$this_unit && ($all_units->{$this_unit} && ($all_units->{$this_unit}->{"base_unit"} eq $all_units->{"kg"}->{"base_unit"})))) {
-      $this_unit = "kg";
-    }
-
-    my $price_factor_select;
-    if (0 < scalar @{ $form->{ALL_PRICE_FACTORS} }) {
-      my @values = ('', map { $_->{id}                      } @{ $form->{ALL_PRICE_FACTORS} });
-      my %labels =      map { $_->{id} => $_->{description} } @{ $form->{ALL_PRICE_FACTORS} };
-
-      $price_factor_select =
-        NTI($cgi->popup_menu('-name'    => "price_factor_id_$i",
-                             '-default' => $form->{"price_factor_id_$i"},
-                             '-values'  => \@values,
-                             '-labels'  => \%labels,
-                             '-style'   => 'width:90px'))
-        . ' ';
-    }
-
-    $column_data{"unit"} = "<td>" .
-      $price_factor_select .
-       AM->unit_select_html($is_part || $is_assembly ? $dimension_units :
-                            $is_assigned ? $service_units : $all_units,
-                            "unit_$i", $this_unit,
-                            $is_assigned ? $form->{"unit_$i"} : undef)
-      . "</td>";
-
-    # build in drop down list for pricesgroups
-    if ($form->{"prices_$i"}) {
-      if  ($form->{"new_pricegroup_$i"} != $form->{"old_pricegroup_$i"}) {
-        $price_tmp = $form->format_amount(\%myconfig, $form->{"price_new_$i"}, $decimalplaces);
-      } else {
-        $price_tmp = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces);
-      }
-
-      $column_data{sellprice_pg} =
-      qq|<td align="right"><select name="sellprice_pg_$i">$form->{"prices_$i"}</select></td>|;
-      $column_data{sellprice} =
-      qq|<td><input name="sellprice_$i" size="10" value="$price_tmp" onBlur=\"check_right_number_format(this)\"></td>|;
-    } else {
-
-      # for last row and report
-      # set pricegroup drop down list from report menu
-      if ($form->{"sellprice_$i"} != 0) {
-        $prices =
-          qq|<option value="$form->{"sellprice_$i"}--$form->{"pricegroup_id_$i"}" selected>$form->{"pricegroup_$i"}</option>\n|;
-
-        $form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"};
-
-        $column_data{sellprice_pg} =
-          qq|<td align="right"><select name="sellprice_pg_$i">$prices</select></td>|;
-
-      } else {
-
-        # for last row
-        $column_data{sellprice_pg} = qq|<td align="right">&nbsp;</td>|;
-        }
-        
-      $column_data{sellprice} =
-      qq|<td><input name="sellprice_$i" size="10" onBlur=\"check_right_number_format(this)\" value="|
-        . $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
-                               $decimalplaces)
-        . qq|"></td>|;
-    }
-    $column_data{discount} =
-        qq|<td align="right"><input name="discount_$i" size=3 value="|
-      . $form->format_amount(\%myconfig, $form->{"discount_$i"})
-      . qq|"></td>|;
-    $column_data{linetotal} =
-        qq|<td align="right">|
-      . $form->format_amount(\%myconfig, $linetotal, 2)
-      . qq|</td>|;
-    $column_data{bin} = qq|<td>$form->{"bin_$i"}</td>|;
-
-########################################
-    # Eintrag fuer Version 2.2.0 geaendert #
-    # neue Optik im Rechnungsformular      #
-########################################
-    #     if ($lizenzen &&  $form->{type} eq "invoice" &&  $form->{vc} eq "customer") {
-    #     $column_data{license} = qq|<td><select name="licensenumber_$i">$form->{"lizenzen_$i"}></select></td>|;
-    #     }
-    #
-    #     if ($form->{type} !~ /_quotation/) {
-    #     $column_data{serialnr} = qq|<td><input name="serialnumber_$i" size=10 value="$form->{"serialnumber_$i"}"></td>|;
-    #     }
-    #
-    #     $column_data{projectnr} = qq|<td><input name="projectnumber_$i" size=10 value="$form->{"projectnumber_$i"}"></td>|;
-############## ENDE Neueintrag ##################
-    my $j = $i % 2;
-    print qq|
-
-        <tr valign="top" class="listrow$j">|;
-
-    map { print "\n$column_data{$_}" } @column_index;
-
-    print("</tr>\n" .
-          $cgi->hidden("-name" => "unit_old_$i",
-                       "-value" => $form->{"selected_unit_$i"})
-          . "\n" .
-          $cgi->hidden("-name" => "price_new_$i",
-                       "-value" => $form->format_amount(\%myconfig, $form->{"price_new_$i"}))
-          . "\n");
-    map({ print($cgi->hidden("-name" => $_, "-value" => $form->{$_}) . "\n"); }
-        ("orderitems_id_$i", "bo_$i", "pricegroup_old_$i", "price_old_$i",
-         "id_$i", "inventory_accno_$i", "bin_$i", "partsgroup_$i", "partnotes_$i",
-         "income_accno_$i", "expense_accno_$i", "listprice_$i", "assembly_$i",
-         "taxaccounts_$i", "ordnumber_$i", "transdate_$i", "cusordnumber_$i",
-         "longdescription_$i", "basefactor_$i", "marge_total_$i", "marge_percent_$i", "lastcost_$i",
-         "marge_price_factor_$i"));
-
-########################################
-    # Eintrag fuer Version 2.2.0 geaendert #
-    # neue Optik im Rechnungsformular      #
-########################################
-
-    my $row_style_attr =
-      'style="display:none;"' if (!$form->{"show_details"});
-
-    # print second row
-    print qq|
-        <tr  class="listrow$j" $row_style_attr>
-         <td colspan="$colspan">
-|;
-    if ($lizenzen && $form->{type} eq "invoice" && $form->{vc} eq "customer") {
-      my $selected = $form->{"licensenumber_$i"};
-      my $lizenzen_quoted;
-      $form->{"lizenzen_$i"} =~ s/ selected//g;
-      $form->{"lizenzen_$i"} =~
-        s/value="${selected}"\>/value="${selected}" selected\>/;
-      $lizenzen_quoted = $form->{"lizenzen_$i"};
-      $lizenzen_quoted =~ s/\"/&quot;/g;
-      print qq|
-       <b>Lizenz\#</b>&nbsp;<select name="licensenumber_$i" size="1">
-       $form->{"lizenzen_$i"}
-        </select>
-       <input type="hidden" name="lizenzen_$i" value="${lizenzen_quoted}">
-|;
-    }
-    if ($form->{type} !~ /_quotation/) {
-      print qq|
-          <b>$serialnumber</b>&nbsp;<input name="serialnumber_$i" size="15" value="$form->{"serialnumber_$i"}">|;
-    }
-
-    print qq|<b>$projectnumber</b>&nbsp;| .
-      NTI($cgi->popup_menu('-name' => "project_id_$i",
-                           '-values' => \@projectnumber_values,
-                           '-labels' => \%projectnumber_labels,
-                           '-default' => $form->{"project_id_$i"}));
-
-    if ($form->{type} eq 'invoice' or $form->{type} =~ /order/) {
-      my $reqdate_term =
-        ($form->{type} eq 'invoice')
-        ? 'deliverydate'
-        : 'reqdate';    # invoice uses a different term for the same thing.
-      print qq|
-        <b>${$reqdate_term}</b>&nbsp;<input name="${reqdate_term}_$i" size="11" onBlur="check_right_date_format(this)" value="$form->{"${reqdate_term}_$i"}">
-|;
-    }
-    my $subtotalchecked = ($form->{"subtotal_$i"}) ? "checked" : "";
-    print qq|
-          <b>|.$locale->text('Subtotal').qq|</b>&nbsp;<input type="checkbox" name="subtotal_$i" value="1" $subtotalchecked>
-|;
-
-    if ($form->{"id_$i"} && $is_sales) {
-      my $marge_price_factor;
-
-      $form->{"marge_price_factor_$i"} *= 1;
-
-      if ($form->{"marge_price_factor_$i"} && (1 != $form->{"marge_price_factor_$i"})) {
-        $marge_price_factor = '/' . $form->format_amount(\%myconfig, $form->{"marge_price_factor_$i"});
-      }
-
-      print qq|
-          ${marge_font_start}<b>| . $locale->text('Ertrag') . qq|</b>&nbsp;$form->{"marge_total_$i"}&nbsp;$form->{"marge_percent_$i"} % ${marge_font_end}|;
-   }
-   print qq|
-          &nbsp;<b>| . $locale->text('LP') . qq|</b>&nbsp;| . $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2) . qq|
-          &nbsp;<b>| . $locale->text('EK') . qq|</b>&nbsp;| . $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2) . $marge_price_factor;
-
-
-    print qq|
-         </td>
-       </tr>
-|;
-
-############## ENDE Neueintrag ##################
-
-    map { $form->{"${_}_base"} += $linetotal }
-      (split(/ /, $form->{"taxaccounts_$i"}));
-
-    $form->{invsubtotal} += $linetotal;
-  }
-
-  print qq|
-      </table>
-    </td>
-  </tr>
-|;
-
-  if (0 != ($form->{sellprice_total} * 1)) {
-    $form->{marge_percent} = ($form->{sellprice_total} - $form->{lastcost_total}) / $form->{sellprice_total} * 100;
-  }
-
-  $lxdebug->leave_sub();
-}
 
 ##################################################
 # build html-code for pricegroups in variable $form->{prices_$j}
 
 ##################################################
 # build html-code for pricegroups in variable $form->{prices_$j}
@@ -601,41 +98,17 @@ sub set_pricegroup {
   $lxdebug->enter_sub();
   my $rowcount = shift;
   for $j (1 .. $rowcount) {
   $lxdebug->enter_sub();
   my $rowcount = shift;
   for $j (1 .. $rowcount) {
-    my $pricegroup_old = $form->{"pricegroup_old_$i"};
-    if ($form->{PRICES}{$j}) {
-      $len    = 0;
-      $prices = '<option value="--">' . $locale->text("none (pricegroup)") . '</option>';
-      $price  = 0;
-      foreach $item (@{ $form->{PRICES}{$j} }) {
-
-        #$price = $form->round_amount($myconfig,  $item->{price}, 5);
-        #$price = $form->format_amount($myconfig, $item->{price}, 2);
-        $price         = $item->{price};
-        $pricegroup_id = $item->{pricegroup_id};
-        $pricegroup    = $item->{pricegroup};
-
-        # build drop down list for pricegroups
-        $prices .=
-          qq|<option value="$price--$pricegroup_id"$item->{selected}>$pricegroup</option>\n|;
-
-        $len += 1;
-
-        #        map {
-        #               $form->{"${_}_$j"} =
-        #               $form->format_amount(\%myconfig, $form->{"${_}_$j"})
-        #              } qw(sellprice price_new price_old);
-
-        # set new selectedpricegroup_id and prices for "Preis"
-        if ($item->{selected} && ($pricegroup_id != 0)) {
-          $form->{"pricegroup_old_$j"} = $pricegroup_id;
-          $form->{"price_new_$j"}      = $price;
-          $form->{"sellprice_$j"}      = $price;
-        }
-        if ($pricegroup_id == 0) {
-          $form->{"price_new_$j"} = $form->{"sellprice_$j"};
-        }
-      }
-      $form->{"prices_$j"} = $prices;
+    next unless $form->{PRICES}{$j};
+    # build drop down list for pricegroups
+    my $option_tmpl = qq|<option value="%s--%s" %s>%s</option>|;
+    $form->{"prices_$j"}  = join '', map { sprintf $option_tmpl, @$_{qw(price pricegroup_id selected pricegroup)} } 
+                                         (+{ pricegroup => $locale->text("none (pricegroup)") }, @{ $form->{PRICES}{$j} });
+
+    foreach $item (@{ $form->{PRICES}{$j} }) {
+      # set new selectedpricegroup_id and prices for "Preis"
+      $form->{"pricegroup_old_$j"} = $item->{pricegroup_id}   if $item->{selected} &&  $item->{pricegroup_id};
+      $form->{"sellprice_$j"}      = $item->{price}           if $item->{selected} &&  $item->{pricegroup_id};
+      $form->{"price_new_$j"}      = $form->{"sellprice_$j"}  if $item->{selected} || !$item->{pricegroup_id};
     }
   }
   $lxdebug->leave_sub();
     }
   }
   $lxdebug->leave_sub();
@@ -870,158 +343,21 @@ sub new_item {
 
   # change callback
   $form->{old_callback} = $form->escape($form->{callback}, 1);
 
   # change callback
   $form->{old_callback} = $form->escape($form->{callback}, 1);
-  $form->{callback} = $form->escape("$form->{script}?action=display_form", 1);
-
-  # delete action
-  delete $form->{action};
-
-  # save all other form variables in a previousform variable
-  foreach $key (keys %$form) {
+  $form->{callback}     = $form->escape("$form->{script}?action=display_form", 1);
 
 
-    # escape ampersands
-    $form->{$key} =~ s/&/%26/g;
-    $previousform .= qq|$key=$form->{$key}&|;
-  }
-  chop $previousform;
-  $previousform = $form->escape($previousform, 1);
+  # save all form variables except action in a previousform variable
+  my $previousform = join '&', map { $form->{$_} =~ s/&/%26/; "$_=$form->{$_}" } grep { !/action/ } keys %$form;
 
 
-  $i = $form->{rowcount};
-  map { $form->{"${_}_$i"} =~ s/\"/&quot;/g } qw(partnumber description);
+  map { $form->{"${_}_$form->{rowcount}"} =~ s/\"/&quot;/g } qw(partnumber description);
 
   $form->header;
 
 
   $form->header;
 
-  print qq|
-<body>
-
-<h4 class="error">| . $locale->text('Item not on file!') . qq|
-
-<p>
-| . $locale->text('What type of item is this?') . qq|</h4>
-
-<form method="post" action="ic.pl">
-
-<p>
-
-  <input class="radio" type="radio" name="item" value="part" checked>&nbsp;|
-    . $locale->text('Part') . qq|<br>
-  <input class="radio" type="radio" name="item" value="service">&nbsp;|
-    . $locale->text('Service');
-
-  print $cgi->hidden("-name" => "previousform", "-value" => $previousform);
-  map { print $cgi->hidden("-name" => $_, "-value" => $form->{$_}); }        qw(rowcount vc login password);
-  map { print $cgi->hidden("-name" => $_, "-value" => $form->{"${_}_$i"}); } qw(partnumber description unit sellprice price_factor_id);
-  print $cgi->hidden("-name" => "taxaccount2", "-value" => $form->{taxaccounts});
-
-print qq|
-<input type="hidden" name="nextsub" value="add">
-
-<p>
-<input class="submit" type="submit" name="action" value="|
-    . $locale->text('Continue') . qq|">
-</form>
-
-</body>
-</html>
-|;
-
-  $lxdebug->leave_sub();
-}
-
-sub display_form {
-  $lxdebug->enter_sub();
-
-  relink_accounts();
-
-  my $new_rowcount = $form->{"rowcount"} * 1 + 1;
-  $form->{"project_id_${new_rowcount}"} = $form->{"globalproject_id"};
-
-  $form->language_payment(\%myconfig);
-
-  # if we have a display_form
-  if ($form->{display_form}) {
-    call_sub($form->{"display_form"});
-    exit;
-  }
-
-  Common::webdav_folder($form) if ($webdav);
-
-  #   if (   $form->{print_and_post}
-  #       && $form->{second_run}
-  #       && ($form->{action} eq "display_form")) {
-  #     for (keys %$form) { $old_form->{$_} = $form->{$_} }
-  #     $old_form->{rowcount}++;
-  #
-  #     #$form->{rowcount}--;
-  #     #$form->{rowcount}--;
-  #
-  #     $form->{print_and_post} = 0;
-  #
-  #     &print_form($old_form);
-  #     exit;
-  #   }
-  #
-  #   $form->{action}   = "";
-  #   $form->{resubmit} = 0;
-  #
-  #   if ($form->{print_and_post} && !$form->{second_run}) {
-  #     $form->{second_run} = 1;
-  #     $form->{action}     = "display_form";
-  #     $form->{rowcount}--;
-  #     my $rowcount = $form->{rowcount};
-  #
-  #     # get pricegroups for parts
-  #     IS->get_pricegroups_for_parts(\%myconfig, \%$form);
-  #
-  #     # build up html code for prices_$i
-  #     set_pricegroup($rowcount);
-  #
-  #     $form->{resubmit} = 1;
-  #
-  #   }
-  &form_header;
-
-  $numrows    = ++$form->{rowcount};
-  $subroutine = "display_row";
-
-  if ($form->{item} eq 'part') {
-
-    #set preisgruppenanzahl
-    $numrows    = $form->{price_rows};
-    $subroutine = "price_row";
-
-    &{$subroutine}($numrows);
-
-    $numrows    = ++$form->{makemodel_rows};
-    $subroutine = "makemodel_row";
-  }
-  if ($form->{item} eq 'assembly') {
-    $numrows    = $form->{price_rows};
-    $subroutine = "price_row";
-
-    &{$subroutine}($numrows);
-
-    $numrows    = ++$form->{makemodel_rows};
-    $subroutine = "makemodel_row";
-
-    # create makemodel rows
-    &{$subroutine}($numrows);
-
-    $numrows    = ++$form->{assembly_rows};
-    $subroutine = "assembly_row";
-  }
-  if ($form->{item} eq 'service') {
-    $numrows    = $form->{price_rows};
-    $subroutine = "price_row";
-
-    &{$subroutine}($numrows);
-
-    $numrows = 0;
-  }
-
-  # create rows
-  &{$subroutine}($numrows) if $numrows;
+  push @HIDDENS, { value => $cgi->hidden("-name" => "previousform", "-value" => $form->escape($previousform, 1)) };
+  push @HIDDENS, map +{ value => $cgi->hidden("-name" => $_, "-value" => $form->{$_}) },                       qw(rowcount vc login password);
+  push @HIDDENS, map +{ value => $cgi->hidden("-name" => $_, "-value" => $form->{"${_}_$form->{rowcount}"}) }, qw(partnumber description unit sellprice);
+  push @HIDDENS, { value => $cgi->hidden("-name" => "taxaccount2", "-value" => $form->{taxaccounts}) };
 
 
-  &form_footer;
+  print $form->parse_html_template("generic/new_item", { HIDDENS => \@HIDDENS} );
 
   $lxdebug->leave_sub();
 }
 
   $lxdebug->leave_sub();
 }
@@ -1415,8 +751,8 @@ sub print_options {
   # note: "||"-selection is only correct for values where "0" is _not_ a correct entry
   $form->{sendmode}   = "attachment";
   $form->{format}     = $form->{format} || $myconfig{template_format} || "pdf";
   # note: "||"-selection is only correct for values where "0" is _not_ a correct entry
   $form->{sendmode}   = "attachment";
   $form->{format}     = $form->{format} || $myconfig{template_format} || "pdf";
-  $form->{copies}     = $form->{copies} || $myconfig{copies} || 3;
-  $form->{media}      = $form->{media} || $myconfig{default_media} || "screen";
+  $form->{copies}     = $form->{copies} || $myconfig{copies}          || 3;
+  $form->{media}      = $form->{media}  || $myconfig{default_media}   || "screen";
   $form->{printer_id} = defined $form->{printer_id}           ? $form->{printer_id} :
                         defined $myconfig{default_printer_id} ? $myconfig{default_printer_id} : "";
 
   $form->{printer_id} = defined $form->{printer_id}           ? $form->{printer_id} :
                         defined $myconfig{default_printer_id} ? $myconfig{default_printer_id} : "";
 
@@ -1427,56 +763,56 @@ sub print_options {
 
   push @FORMNAME, grep $_,
     ($form->{type} eq 'purchase_order') ? (
 
   push @FORMNAME, grep $_,
     ($form->{type} eq 'purchase_order') ? (
-      opthash("purchase_order", $form->{PD}{purchase_order}, $locale->text('Purchase Order')),
-      opthash("bin_list", $form->{PD}{bin_list}, $locale->text('Bin List')) 
+      opthash("purchase_order",      $form->{PD}{purchase_order},      $locale->text('Purchase Order')),
+      opthash("bin_list",            $form->{PD}{bin_list},            $locale->text('Bin List')) 
     ) : undef,
     ($form->{type} eq 'credit_note') ?
     ) : undef,
     ($form->{type} eq 'credit_note') ?
-      opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef,
+      opthash("credit_note",         $form->{PD}{credit_note},         $locale->text('Credit Note')) : undef,
     ($form->{type} eq 'sales_order') ? (
     ($form->{type} eq 'sales_order') ? (
-      opthash("sales_order", $form->{PD}{sales_order}, $locale->text('Confirmation')),
-      opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')),
-      opthash("pick_list", $form->{PD}{pick_list}, $locale->text('Pick List')),
-      opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List')) 
+      opthash("sales_order",         $form->{PD}{sales_order},         $locale->text('Confirmation')),
+      opthash("proforma",            $form->{PD}{proforma},            $locale->text('Proforma Invoice')),
+      opthash("pick_list",           $form->{PD}{pick_list},           $locale->text('Pick List')),
+      opthash("packing_list",        $form->{PD}{packing_list},        $locale->text('Packing List')) 
     ) : undef,
     ($form->{type} =~ /_quotation$/) ?
     ) : undef,
     ($form->{type} =~ /_quotation$/) ?
-      opthash("$`_quotation", $form->{PD}{"$`_quotation"}, $locale->text('Quotation')) : undef,
+      opthash("$`_quotation",        $form->{PD}{"$`_quotation"},      $locale->text('Quotation')) : undef,
     ($form->{type} eq 'invoice') ? (
     ($form->{type} eq 'invoice') ? (
-      opthash("invoice", $form->{PD}{invoice}, $locale->text('Invoice')),
-      opthash("proforma", $form->{PD}{proforma}, $locale->text('Proforma Invoice')),
-      opthash("packing_list", $form->{PD}{packing_list}, $locale->text('Packing List'))
+      opthash("invoice",             $form->{PD}{invoice},             $locale->text('Invoice')),
+      opthash("proforma",            $form->{PD}{proforma},            $locale->text('Proforma Invoice')),
+      opthash("packing_list",        $form->{PD}{packing_list},        $locale->text('Packing List'))
     ) : undef,
     ($form->{type} eq 'invoice' && $form->{storno}) ? (
     ) : undef,
     ($form->{type} eq 'invoice' && $form->{storno}) ? (
-      opthash("storno_invoice", $form->{PD}{storno_invoice}, $locale->text('Storno Invoice')),
+      opthash("storno_invoice",      $form->{PD}{storno_invoice},      $locale->text('Storno Invoice')),
       opthash("storno_packing_list", $form->{PD}{storno_packing_list}, $locale->text('Storno Packing List')) 
     ) : undef,
     ($form->{type} eq 'credit_note') ?
       opthash("storno_packing_list", $form->{PD}{storno_packing_list}, $locale->text('Storno Packing List')) 
     ) : undef,
     ($form->{type} eq 'credit_note') ?
-      opthash("credit_note", $form->{PD}{credit_note}, $locale->text('Credit Note')) : undef;
+      opthash("credit_note",         $form->{PD}{credit_note},         $locale->text('Credit Note')) : undef;
 
   push @SENDMODE, 
 
   push @SENDMODE, 
-    opthash("attachment", $form->{SM}{attachment}, $locale->text('Attachment')),
-    opthash("inline", $form->{SM}{inline}, $locale->text('In-line'))
+    opthash("attachment",            $form->{SM}{attachment},          $locale->text('Attachment')),
+    opthash("inline",                $form->{SM}{inline},              $locale->text('In-line'))
       if ($form->{media} eq 'email');
 
   push @MEDIA, grep $_,
       if ($form->{media} eq 'email');
 
   push @MEDIA, grep $_,
-      opthash("screen", $form->{OP}{screen}, $locale->text('Screen')),
+      opthash("screen",              $form->{OP}{screen},              $locale->text('Screen')),
     (scalar @{ $form->{printers} } && $latex_templates) ?
     (scalar @{ $form->{printers} } && $latex_templates) ?
-      opthash("printer", $form->{OP}{printer}, $locale->text('Printer')) : undef,
-    ($latex_templates && !$options{no_queue}) ?
-      opthash("queue", $form->{OP}{queue}, $locale->text('Queue')) : undef
+      opthash("printer",             $form->{OP}{printer},             $locale->text('Printer')) : undef,
+    ($latex_templates && !$options->{no_queue}) ?
+      opthash("queue",               $form->{OP}{queue},               $locale->text('Queue')) : undef
         if ($form->{media} ne 'email');
 
   push @FORMAT, grep $_,
     ($opendocument_templates && $openofficeorg_writer_bin && $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)
         if ($form->{media} ne 'email');
 
   push @FORMAT, grep $_,
     ($opendocument_templates && $openofficeorg_writer_bin && $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)
-     && !$options{no_opendocument_pdf}) ?
-      opthash("opendocument_pdf", $form->{DF}{"opendocument_pdf"}, $locale->text("PDF (OpenDocument/OASIS)")) : undef,
+     && !$options->{no_opendocument_pdf}) ?
+      opthash("opendocument_pdf",    $form->{DF}{"opendocument_pdf"},  $locale->text("PDF (OpenDocument/OASIS)")) : undef,
     ($latex_templates) ?
     ($latex_templates) ?
-      opthash("pdf", $form->{DF}{pdf}, $locale->text('PDF')) : undef,
-    ($latex_templates && !$options{no_postscript}) ?
-      opthash("postscript", $form->{DF}{postscript}, $locale->text('Postscript')) : undef,
-    (!$options{no_html}) ?
+      opthash("pdf",                 $form->{DF}{pdf},                 $locale->text('PDF')) : undef,
+    ($latex_templates && !$options->{no_postscript}) ?
+      opthash("postscript",          $form->{DF}{postscript},          $locale->text('Postscript')) : undef,
+    (!$options->{no_html}) ?
       opthash("html", $form->{DF}{html}, "HTML") : undef,
       opthash("html", $form->{DF}{html}, "HTML") : undef,
-    ($opendocument_templates && !$options{no_opendocument}) ?
-      opthash("opendocument", $form->{DF}{opendocument}, $locale->text("OpenDocument/OASIS")) : undef;
+    ($opendocument_templates && !$options->{no_opendocument}) ?
+      opthash("opendocument",        $form->{DF}{opendocument},        $locale->text("OpenDocument/OASIS")) : undef;
 
   push @LANGUAGE_ID, 
     map { opthash($_->{id}, ($_->{id} eq $form->{language_id} ? 'selected' : ''), $_->{description}) } +{}, @{ $form->{languages} }
 
   push @LANGUAGE_ID, 
     map { opthash($_->{id}, ($_->{id} eq $form->{language_id} ? 'selected' : ''), $_->{description}) } +{}, @{ $form->{languages} }
index aa61bb07b23e8203bc451e4fd5a533e109db365c..f4345c1fe1cf3dc549a6531fee8638aae2b47e7b 100644 (file)
@@ -37,6 +37,7 @@ use SL::PE;
 use List::Util qw(max);
 
 require "bin/mozilla/io.pl";
 use List::Util qw(max);
 
 require "bin/mozilla/io.pl";
+require "bin/mozilla/invoice_io.pl";
 require "bin/mozilla/arap.pl";
 require "bin/mozilla/common.pl";
 require "bin/mozilla/drafts.pl";
 require "bin/mozilla/arap.pl";
 require "bin/mozilla/common.pl";
 require "bin/mozilla/drafts.pl";
index 3fc4b2caaa5f65783d18d595ec53fa25d48266fc..65cc0609d4788d7683d6494f260f99f4f0e6cd11 100644 (file)
@@ -37,6 +37,7 @@ use Data::Dumper;
 use List::Util qw(max);
 
 require "bin/mozilla/io.pl";
 use List::Util qw(max);
 
 require "bin/mozilla/io.pl";
+require "bin/mozilla/invoice_io.pl";
 require "bin/mozilla/arap.pl";
 require "bin/mozilla/drafts.pl";
 
 require "bin/mozilla/arap.pl";
 require "bin/mozilla/drafts.pl";
 
index e359b55067a6cdabfb72db79b445ad788016e78f..7b7fae9d9ce2e0c49cae380b13d7e8edb019b3c2 100644 (file)
@@ -1,4 +1,4 @@
-# #=====================================================================
+#=====================================================================
 # LX-Office ERP
 # Copyright (C) 2004
 # Based on SQL-Ledger Version 2.1.9
 # LX-Office ERP
 # Copyright (C) 2004
 # Based on SQL-Ledger Version 2.1.9
@@ -38,7 +38,7 @@ use SL::IR;
 use SL::IS;
 use SL::PE;
 use SL::ReportGenerator;
 use SL::IS;
 use SL::PE;
 use SL::ReportGenerator;
-use List::Util qw(max);
+use List::Util qw(max reduce);
 
 require "bin/mozilla/io.pl";
 require "bin/mozilla/arap.pl";
 
 require "bin/mozilla/io.pl";
 require "bin/mozilla/arap.pl";
@@ -162,8 +162,7 @@ sub edit {
 sub order_links {
   $lxdebug->enter_sub();
   # get customer/vendor
 sub order_links {
   $lxdebug->enter_sub();
   # get customer/vendor
-  $form->all_vc(\%myconfig, $form->{vc},
-                ($form->{vc} eq 'customer') ? "AR" : "AP");
+  $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
 
   # retrieve order/quotation
   $form->{webdav}   = $webdav;
 
   # retrieve order/quotation
   $form->{webdav}   = $webdav;
@@ -245,8 +244,7 @@ sub order_links {
   }
   $form->{intnotes} = $intnotes if $intnotes;
   ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
   }
   $form->{intnotes} = $intnotes if $intnotes;
   ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
-  $form->{"old$form->{vc}"} =
-    qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
+  $form->{"old$form->{vc}"} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
 
   # build the popup menus
   if (@{ $form->{"all_$form->{vc}"} }) {
 
   # build the popup menus
   if (@{ $form->{"all_$form->{vc}"} }) {
@@ -265,9 +263,8 @@ sub order_links {
     $form->{department}       = "$form->{department}--$form->{department_id}";
 
     map {
     $form->{department}       = "$form->{department}--$form->{department_id}";
 
     map {
-      $form->{selectdepartment} .=
-        "<option>$_->{description}--$_->{id}</option>\n"
-    } (@{ $form->{all_departments} });
+      $form->{selectdepartment} .= "<option>$_->{description}--$_->{id}</option>\n"
+    } @{ $form->{all_departments} };
   }
 
   $form->{employee} = "$form->{employee}--$form->{employee_id}";
   }
 
   $form->{employee} = "$form->{employee}--$form->{employee_id}";
@@ -287,36 +284,14 @@ sub prepare_order {
   my $i = 0;
   foreach $ref (@{ $form->{form_details} }) {
     $form->{rowcount} = ++$i;
   my $i = 0;
   foreach $ref (@{ $form->{form_details} }) {
     $form->{rowcount} = ++$i;
-
     map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
   }
   for my $i (1 .. $form->{rowcount}) {
     map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
   }
   for my $i (1 .. $form->{rowcount}) {
-    if ($form->{id}) {
-      $form->{"discount_$i"} =
-        $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
-    } else {
-      $form->{"discount_$i"} =
-        $form->format_amount(\%myconfig, $form->{"discount_$i"});
-    }
-    ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
-    $dec           = length $dec;
-    $decimalplaces = ($dec > 2) ? $dec : 2;
-
-    # copy reqdate from deliverydate for invoice -> order conversion
-    $form->{"reqdate_$i"} = $form->{"deliverydate_$i"}
-      unless $form->{"reqdate_$i"};
-
-    $form->{"sellprice_$i"} =
-      $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
-                           $decimalplaces);
-
-    (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
-    $dec_qty = length $dec_qty;
-    $form->{"qty_$i"} =
-      $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
-
-    map { $form->{"${_}_$i"} =~ s/\"/&quot;/g }
-      qw(partnumber description unit);
+    $form->{"reqdate_$i"}   = $form->{"deliverydate_$i"} unless $form->{"reqdate_$i"};
+    $form->{"discount_$i"}  = $form->format_amount(\%myconfig, $form->{"discount_$i"} * ($form->{id} ? 100 : 1));
+    $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"});
+    $form->{"qty_$i"}       = $form->format_amount(\%myconfig, $form->{"qty_$i"});
+    map { $form->{"${_}_$i"} =~ s/\"/&quot;/g } qw(partnumber description unit);
   }
 
   $lxdebug->leave_sub();
   }
 
   $lxdebug->leave_sub();
@@ -324,9 +299,8 @@ sub prepare_order {
 
 sub form_header {
   $lxdebug->enter_sub();
 
 sub form_header {
   $lxdebug->enter_sub();
-
-  my $checkedclosed    = $form->{"closed"}    ? "checked" : "";
-  my $checkeddelivered = $form->{"delivered"} ? "checked" : "";
+  my @custom_hiddens;
+  %TMPL_VAR = ();
 
   $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
   $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
 
   $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
   $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
@@ -340,47 +314,30 @@ sub form_header {
     qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname
        shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
        shiptophone shiptofax shiptodepartment_1 shiptodepartment_2);
     qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname
        shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
        shiptophone shiptofax shiptodepartment_1 shiptodepartment_2);
-
   # use JavaScript Calendar or not
   $form->{jsscript} = 1;
   # use JavaScript Calendar or not
   $form->{jsscript} = 1;
-  $jsscript = "";
-
-  $button1 = qq|
+  $TMPL_VAR{button1} = qq|
      <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\">
      <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value="$form->{transdate}" onBlur=\"check_right_date_format(this)\">
-      <input type=button name=transdate id="trigger1" value=|
-    . $locale->text('button') . qq|></td>
+      <input type=button name=transdate id="trigger1" value=| . $locale->text('button') . qq|></td>
     |;
     |;
-  $button2 = qq|
+  $TMPL_VAR{button2} = qq|
      <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value="$form->{reqdate}" onBlur=\"check_right_date_format(this)\">
      <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value="$form->{reqdate}" onBlur=\"check_right_date_format(this)\">
-      <input type=button name=reqdate name=reqdate id="trigger2" value=|
-    . $locale->text('button') . qq|></td>
+      <input type=button name=reqdate name=reqdate id="trigger2" value=| . $locale->text('button') . qq|></td>
    |;
    |;
-
   #write Trigger
   #write Trigger
-  $jsscript = Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", "reqdate", "BL", "trigger2");
+  $TMPL_VAR{jsscript} = Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1", "reqdate", "BL", "trigger2");
 
 
+  # openclosed checkboxes
   my @tmp;
   my @tmp;
-
-  if (($form->{"type"} eq "sales_order") ||
-      ($form->{"type"} eq "purchase_order")) {
-    push(@tmp, qq|<input name="delivered" id="delivered" type="checkbox" class="checkbox" value="1" $checkeddelivered>
-                  <label for="delivered">| . $locale->text('Delivered') . qq|</label>|);
-  }
-
-  if ($form->{id}) {
-    push(@tmp, qq|<input name="closed" id="closed" type="checkbox" class="checkbox" value="1" $checkedclosed>
-                  <label for="closed">| . $locale->text('Closed') . qq|</label>|);
-  }
-
-  if (@tmp) {
-    $openclosed .= qq|<tr>
-                        <td colspan=| . (2 * scalar(@tmp)) . qq| align=center>| . join("\n", @tmp) . qq|
-                        </td>
-                      </tr>\n|;
-  }
+  push @tmp, sprintf qq|<input name="delivered" id="delivered" type="checkbox" class="checkbox" value="1" %s><label for="delivered">%s</label>|,
+                        $form->{"delivered"} ? "checked" : "",  $locale->text('Delivered') if $form->{"type"} =~ /_order$/;
+  push @tmp, sprintf qq|<input name="closed" id="closed" type="checkbox" class="checkbox" value="1" %s><label for="closed">%s</label>|,
+                        $form->{"closed"}    ? "checked" : "",  $locale->text('Closed')    if $form->{id};
+  $TMPL_VAR{openclosed} = sprintf qq|<tr><td colspan=%d align=center>%s</td></tr>\n|, 2 * scalar @tmp, join "\n", @tmp if @tmp;
 
   # set option selected
 
   # set option selected
-  foreach $item ($form->{vc}, currency, department, ($form->{vc} eq "customer" ? customer : vendor)) {
+  foreach $item ($form->{vc}, 'currency', 'department', ($form->{vc} eq "customer" ? 'customer' : 'vendor')) {
     $form->{"select$item"} =~ s/ selected//;
     $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
   }
     $form->{"select$item"} =~ s/ selected//;
     $form->{"select$item"} =~ s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
   }
@@ -391,305 +348,98 @@ sub form_header {
   #substitute \n and \r to \s (bug 543)
   $form->{"select$form->{vc}"} =~ s/[\n\r]/&nbsp;/g;
   
   #substitute \n and \r to \s (bug 543)
   $form->{"select$form->{vc}"} =~ s/[\n\r]/&nbsp;/g;
   
-  my @old_project_ids = ($form->{"globalproject_id"});
-  map({ push(@old_project_ids, $form->{"project_id_$_"})
-          if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
+  my @old_project_ids = ($form->{"globalproject_id"}, grep { $_ } map { $form->{"project_id_$_"} } 1..$form->{"rowcount"});
 
   my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
 
   my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
-  $form->get_lists("contacts"   => "ALL_CONTACTS",
-                   "shipto"     => "ALL_SHIPTO",
-                   "projects"   => {
-                     "key"      => "ALL_PROJECTS",
-                     "all"      => 0,
-                     "old_id"   => \@old_project_ids
-                   },
+  $form->get_lists("contacts"      => "ALL_CONTACTS",
+                   "shipto"        => "ALL_SHIPTO",
+                   "projects"      => { "key"      => "ALL_PROJECTS",
+                                        "all"      => 0,
+                                        "old_id"   => \@old_project_ids },
                    "employees"     => "ALL_EMPLOYEES",
                    "salesmen"      => "ALL_SALESMEN",
                    "taxzones"      => "ALL_TAXZONES",
                    "payments"      => "ALL_PAYMENTS",
                    "currencies"    => "ALL_CURRENCIES",
                    "employees"     => "ALL_EMPLOYEES",
                    "salesmen"      => "ALL_SALESMEN",
                    "taxzones"      => "ALL_TAXZONES",
                    "payments"      => "ALL_PAYMENTS",
                    "currencies"    => "ALL_CURRENCIES",
-                   $vc             => "ALL_" . uc($vc),
+                   $vc             => { key   => "ALL_" . uc($vc),
+                                        limit => $myconfig{vclimit} + 1 },
                    "price_factors" => "ALL_PRICE_FACTORS");
 
                    "price_factors" => "ALL_PRICE_FACTORS");
 
-  my %labels;
-  my @values = (undef);
-  foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
-    push(@values, $item->{"cp_id"});
-    $labels{$item->{"cp_id"}} = $item->{"cp_name"} . ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
-  }
-
-  my $contact;
-  if (scalar @values > 1) {
-    $contact = qq|
-    <tr>
-      <th align="right">| . $locale->text('Contact Person') . qq|</th>
-      <td>| .
-      NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px',
-                           '-labels' => \%labels, '-default' => $form->{"cp_id"}))
-      . qq|
-      </td>
-    </tr>|;
-  }
-
-  %labels = ();
-  @values = ();
-
-  foreach my $item (@{ $form->{($form->{vc} eq "customer" ? "ALL_CUSTOMERS" : "ALL_VENDORS")}}) {
-    push(@values, $item->{"name"}.qq|--|.$item->{"id"});
-    $labels{$item->{"name"}.qq|--|.$item->{"id"}} = $item->{name};
-  }
-
-  $vc = qq|
-      <input type="hidden" name="$form->{vc}_id" value="| . H($form->{"$form->{vc}_id"}) . qq|">
-      <input type="hidden" name="old$form->{vc}" value="| . H($form->{"old$form->{vc}"}) . qq|">
-      <th align="right">| . $locale->text(ucfirst($form->{vc})) . qq|</th>
-      <td>| . 
-        (($myconfig{vclimit} <=  scalar(@values)) 
-              ? qq|<input type="text" value="| . H(($form->{"old$form->{vc}"} =~ /^(.*)\-\-.*$/)) . qq|" name="$form->{vc}">| 
-              : (NTI($cgi->popup_menu('-name' => "$form->{vc}", '-default' => $form->{"old$form->{vc}"}, 
-                             '-onChange' => 'document.getElementById(\'update_button\').click();',
-                             '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq|
-        <input type="button" value="?" onclick="show_vc_details('$form->{vc}')">
-      </td><input type=hidden name="select$form->{vc}" value="| .
-    Q($form->{"select$form->{vc}"}) . qq|">|;
-
-  if ($form->{vc} eq 'customer') {
-    $vc .= qq|<input type="hidden" name="customer_klass" value="$form->{customer_klass}">|;
-  }
-
-  %labels = ();
-  @values = ("");
-  foreach my $item (@{ $form->{"ALL_PAYMENTS"} }) {
-    push(@values, $item->{"id"});
-    $labels{$item->{"id"}} = $item->{"description"};
-  }
-  
-  $payments = qq|
-    <th align="right">| . $locale->text('Payment Terms') . qq|</th>
-    <td>| .
-    NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values, '-style' => 'width: 250px',
-                         '-labels' => \%labels, '-default' => $form->{payment_id}))
-    . qq|</td>|;
-
-  %labels = ();
-  @values = ("");
-  foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
-    push(@values, $item->{"shipto_id"});
-    $labels{$item->{"shipto_id"}} = join "; ", grep { $_ } map { $item->{"shipto${_}" } } qw(name department_1 street city);
-  }
-
-  my $shipto;
-  if (scalar @values > 1) {
-    $shipto = qq|
-    <tr>
-      <th align="right">| . $locale->text('Shipping Address') . qq|</th>
-      <td>| .
-      NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px',
-                           '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
-    . qq|</td>|;
-  }
-
-  %labels = ();
-  @values = ("");
-  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
-    push(@values, $item->{"id"});
-    $labels{$item->{"id"}} = $item->{"projectnumber"};
-  }
-  my $globalprojectnumber = NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
-                                                 '-labels' => \%labels,
-                                                 '-default' => $form->{"globalproject_id"}));
+  # contacts
+  @values = ("", map { $_->{cp_id} } @{ $form->{ALL_CONTACTS} });
+  %labels = map { $_->{cp_id} => $_->{"cp_name"} . ($_->{cp_abteilung} ? " ($_->{cp_abteilung})" : "") } @{ $form->{ALL_CONTACTS} };
+  $TMPL_VAR{contact} = NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px',
+                                            '-labels' => \%labels, '-default' => $form->{"cp_id"})) if scalar @values > 1;
+
+  # vendor/customer
+  @values = map { "$_->{name}--$_->{id}" } @{ $form->{uc "all_$form->{vc}s" } };
+  %labels = map { +"$_->{name}--$_->{id}" => $_->{name} } @{ $form->{uc "all_$form->{vc}s" } };
+  push @custom_hiddens, "$form->{vc}_id";
+  push @custom_hiddens, "old$form->{vc}";
+  push @custom_hiddens, "select$form->{vc}";
+  $TMPL_VAR{vc} = sprintf qq|<th align="right">%s</th><td>%s<input type="button" value="?" onclick="show_vc_details('$form->{vc}')"></td>|,
+       $locale->text(ucfirst $form->{vc}), 
+       ($myconfig{vclimit} <=  scalar(@values)) 
+        ? $cgi->textfield(-value => H($form->{"old$form->{vc}"} =~ /^(.*)\-\-.*$/), -name => $form->{vc}) 
+        : NTI($cgi->popup_menu('-name' => "$form->{vc}", '-default' => $form->{"old$form->{vc}"}, 
+                               '-onChange' => 'document.getElementById(\'update_button\').click();',
+                               '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px'));
+
+  # payments (for footer)
+  @values = ("", map { $_->{id} } @{ $form->{ALL_PAYMENTS} });
+  %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_PAYMENTS} };
+  $TMPL_VAR{payments} = NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values, '-style' => 'width: 250px',
+                                             '-labels' => \%labels, '-default' => $form->{payment_id}));
+
+  # shipto
+  @values = ("", map { $_->{shipto_id} } @{ $form->{ALL_SHIPTO} });
+  %labels = map { my $item=$_; $_->{shipto_id} => join "; ", grep { $_ } map { $item->{"shipto${_}" } } qw(name department_1 street city) } @{ $form->{ALL_SHIPTO} };
+  $TMPL_VAR{shipto} = NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px',
+                                           '-labels' => \%labels, '-default' => $form->{"shipto_id"})) if scalar @values > 1;
+
+  # projects
+  @values = ("", map { $_->{id} } @{ $form->{ALL_PROJECTS} });
+  %labels = map { $_->{id} => $_->{projectnumber} } @{ $form->{ALL_PROJECTS} };
+  $TMPL_VAR{globalprojectnumber} = NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
+                                                        '-labels' => \%labels, '-default' => $form->{"globalproject_id"}));
   
   
-  my $salesmen = "";
-  %labels = ();
-  @values = ();
-  if ($form->{type} =~ /^sales_/) {
-    foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
-      push(@values, $item->{"id"});
-      $labels{$item->{"id"}} = ($item->{"name"} ne "" ? $item->{"name"} : $item->{"login"});
-    }
-    $salesmen =
-      qq|<tr>
-          <th align="right">| . $locale->text('Salesman') . qq|</th>
-          <td>| .
-      NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{"salesman_id"} ? $form->{"salesman_id"} : $form->{"employee_id"},
-                           '-values' => \@values, '-labels' => \%labels))
-      . qq|</td>
-         </tr>|;
-  }
-
-  %labels = ();
-  @values = ();
-  foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) {
-    push(@values, $item->{"id"});
-    $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"};
-  }
-
-  my $employee = qq|
-    <tr>
-      <th align="right">| . $locale->text('Employee') . qq|</th>
-      <td>| .
-        NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
-                             '-values' => \@values, '-labels' => \%labels)) . qq|
-      </td>
-    </tr>|;
-
-  %labels = ();
-  @values = ();
-  foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
-    push(@values, $item->{"id"});
-    $labels{$item->{"id"}} = $item->{"description"};
-  }
-
-  $taxzone = qq|
-    <tr>
-      <th align="right">| . $locale->text('Steuersatz') . qq|</th>
-      <td>| .
-        NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
-                             '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq|
-      </td>
-    </tr>|;
-
-  %labels = ();
-  @values = ();
-  my $i = 0;
-  foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) {
-    push(@values, $item);
-    $labels{$item} = $item;
-  }
-
-  $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
-  my $currencies;
-  if (scalar @values) {
-    $currencies = qq|
-    <tr>
-      <th align="right">| . $locale->text('Currency') . qq|</th>
-      <td>| .
-        NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
-                             '-values' => \@values, '-labels' => \%labels)) . qq|
-      </td>
-    </tr>|;
-  }
-
-  $form->{exchangerate} = $form->format_amount(\%myconfig, $form->{exchangerate});
-  $form->{exchangerate} = "" unless $form->{exchangerate};
-
+  # salesmen
+  @values = map { $_->{id} } @{ $form->{ALL_SALESMEN} };
+  %labels = map { $_->{id} => ($_->{name} || $_->{login}) } @{ $form->{ALL_SALESMEN} };
+  $TMPL_VAR{salesmen} = NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{"salesman_id"} ? $form->{"salesman_id"} : $form->{"employee_id"},
+                                             '-values' => \@values, '-labels' => \%labels)) if $form->{type} =~ /^sales_/ && scalar @values;
+
+  # employees
+  @values = map { $_->{id} } @{ $form->{ALL_EMPLOYEES} };
+  %labels = map { $_->{id} => $_->{name} || $_->{login} } @{ $form->{ALL_EMPLOYEES} };
+  $TMPL_VAR{employee} = NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
+                                             '-values' => \@values, '-labels' => \%labels));
+
+  # taxzone
+  @values = map { $_->{id} } @{ $form->{ALL_TAXZONES} };
+  %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_TAXZONES} };
+  $TMPL_VAR{taxzone} = NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
+                                            '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px'));
+
+  # currencies and exchangerate
+  @values = map { $_ } @{ $form->{ALL_CURRENCIES} };
+  %labels = map { $_ => $_ } @{ $form->{ALL_CURRENCIES} };
+  $form->{currency}            = $form->{defaultcurrency} unless $form->{currency};
+  $TMPL_VAR{show_exchangerate} = $form->{currency} ne $form->{defaultcurrency} && $form->{exchangerate};
+  $TMPL_VAR{currencies}        = NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
+                                                      '-values' => \@values, '-labels' => \%labels)) if scalar @values;
+  push @custom_hiddens, "forex";
+  push @custom_hiddens, "exchangerate" if $form->{forex};
+
+  # credit remaining
   $creditwarning = (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) ? 1 : 0;
   $creditwarning = (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) ? 1 : 0;
+  $TMPL_VAR{is_credit_remaining_negativ} = ($form->{creditremaining} =~ /-/) ? "0" : "1";
+  
+  # business
+  $TMPL_VAR{business_label} = ($form->{vc} eq "customer" ? $locale->text('Customer type') : $locale->text('Vendor type'));
 
 
-  $form->{creditlimit}     = $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
-  $form->{creditremaining} = $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
-
-  $exchangerate = qq|\n<input type=hidden name=forex value=$form->{forex}>\n|;
-
-  if ($form->{currency} ne $form->{defaultcurrency}) {
-    if ($form->{forex}) {
-      $exchangerate .=
-          qq|<th align=right>| . $locale->text('Exchangerate')
-        . qq|</th><td>$form->{exchangerate}</td>
-      <input type=hidden name=exchangerate value=$form->{exchangerate}>
-|;
-    } else {
-      $exchangerate .=
-          qq|<th align=right>| . $locale->text('Exchangerate')
-        . qq|</th><td><input name=exchangerate size=10 value=$form->{exchangerate}></td>|;
-    }
-  }
-
-  if ($form->{business}) {
-    $business = qq|
-             <tr>
-          <th align="right">| . ($form->{vc} eq "customer" ? $locale->text('Customer type') : $locale->text('Vendor type')) . qq|</th>
-          <td>$form->{business}; | . $locale->text('Trade Discount') . qq| |
-      . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
-      . qq| %</td>
-        </tr>
-|;
-  }
-
-  if ($form->{max_dunning_level}) {
-    $dunning = qq|
-      <tr>
-        <th align="right">| . $locale->text('Max. Dunning Level') . qq|:</th>
-        <td>
-          <b>$form->{max_dunning_level}</b>;
-          | . $locale->text('Dunning Amount') . qq|: <b>|
-        . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
-        . qq|</b>
-        </td>
-      </tr>
-|;
-  }
-
-  if ($form->{type} !~ /_quotation$/) {
-    $ordnumber = qq|
-             <tr>
-               <th width=70% align=right nowrap>| . $locale->text('Order Number') . qq|</th>
-                <td><input name=ordnumber size=11 value="$form->{ordnumber}"></td>
-             </tr>
-             <tr>
-               <th width=70% align=right nowrap>|
-      . $locale->text('Quotation Number') . qq|</th>
-                <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
-             </tr>
-              <tr>
-               <th width=70% align=right nowrap>|
-      . $locale->text('Customer Order Number') . qq|</th>
-                <td><input name=cusordnumber size=11 value="$form->{cusordnumber}"></td>
-             </tr>
-             <tr>
-               <th align=right nowrap>| . $locale->text('Order Date') . qq|</th>
-                $button1
-
-             </tr>
-             <tr>
-               <th align=right nowrap=true>| . $locale->text('Required by') . qq|</th>
-                $button2
-             </tr>
-|;
-
-    $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
-
-    $creditremaining = qq|
-        $shipto
-        <tr>
-          <td align="right">| . $locale->text('Credit Limit') . qq|</td>
-          <td>$form->{creditlimit}; | . $locale->text('Remaining') . qq| <span class="plus$n">$form->{creditremaining}</span></td>
-        </tr>
-             </tr>
-|;
-  } else {
-    $reqlabel = ($form->{type} eq 'sales_quotation') ? $locale->text('Valid until') : $locale->text('Required by');
-    if ($form->{type} eq 'sales_quotation') {
-      $ordnumber = qq|
-             <tr>
-               <th width=70% align=right nowrap>|
-        . $locale->text('Quotation Number') . qq|</th>
-               <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
-               <input type=hidden name=ordnumber value="$form->{ordnumber}">
-             </tr>
-|;
-    } else {
-      $ordnumber = qq|
-             <tr>
-               <th width=70% align=right nowrap>| . $locale->text('RFQ Number') . qq|</th>
-               <td><input name=quonumber size=11 value="$form->{quonumber}"></td>
-               <input type=hidden name=ordnumber value="$form->{ordnumber}">
-             </tr>
-|;
-
-    }
-
-    $ordnumber      .= qq| <tr> <th align=right nowrap>| . $locale->text('Quotation Date') . qq|</th> $button1 </tr>
-                           <tr> <th align=right nowrap=true>$reqlabel</th> $button2 </tr>\n|;
-    $creditremaining = qq| <tr> <td colspan=4></td> $shipto </tr>|;
-  }
-
-  $department = qq|
-              <tr>
-               <th align="right" nowrap>| . $locale->text('Department') . qq|</th>
-               <td colspan=3><select name=department style="width: 250px">$form->{selectdepartment}</select>
-               <input type=hidden name=selectdepartment value="$form->{selectdepartment}">
-               </td>
-             </tr> | if $form->{selectdepartment};
+  push @custom_hiddens, "ordnumber"      if $form->{type} =~ /_quotation$/;
+  push @custom_hiddens, "customer_klass" if $form->{vc} eq 'customer';
 
   $credittext = $locale->text('Credit Limit exceeded!!!');
 
 
   $credittext = $locale->text('Credit Limit exceeded!!!');
 
@@ -700,6 +450,7 @@ sub form_header {
 
   $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
   $onload .= qq|;setupPoints('|.   $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
 
   $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
   $onload .= qq|;setupPoints('|.   $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
+  $TMPL_VAR{onload} = $onload;
   
   $form->{javascript} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
   $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
   
   $form->{javascript} .= qq|<script type="text/javascript" src="js/show_form_details.js"></script>|;
   $form->{javascript} .= qq|<script type="text/javascript" src="js/show_history.js"></script>|;
@@ -707,103 +458,27 @@ sub form_header {
 
   $form->header;
 
 
   $form->header;
 
-  print qq|
-<body onLoad="$onload">
-
-<form method=post name=oe action=$form->{script}>
-
- <script type="text/javascript" src="js/common.js"></script>
- <script type="text/javascript" src="js/delivery_customer_selection.js"></script>
- <script type="text/javascript" src="js/vendor_selection.js"></script>
- <script type="text/javascript" src="js/calculate_qty.js"></script>
-|;
-
-  $form->hide_form(qw(id action type vc formname media format proforma queued printed emailed
-                      title discount creditlimit creditremaining tradediscount business
-                      max_dunning_level dunning_amount shiptoname shiptostreet shiptozipcode
-                      shiptocity shiptocountry shiptocontact shiptophone shiptofax 
-                      shiptodepartment_1 shiptodepartment_2 shiptoemail 
-                      message email subject cc bcc taxpart taxservice taxaccounts), 
-                      map { $_.'_rate', $_.'_description' } split / /, $form->{taxaccounts} );
-  print qq|
-
-<table width=100%>
-  <tr class=listtop>
-    <th class=listtop>$form->{title}</th>
-  </tr>
-  <tr height="5"></tr>
-  <tr>
-    <td>
-      <table width="100%">
-        <tr valign=top>
-         <td>
-           <table width=100%>
-             <tr>
-        $vc
-        $contact
-             $creditremaining
-             $business
-              $dunning
-              $taxzone
-             $department
-             <tr>
-               $currencies
-               $exchangerate
-             </tr>
-             <tr>
-               <th align=right>| . $locale->text('Shipping Point') . qq|</th>
-               <td colspan=3><input name=shippingpoint size=35 value="$form->{shippingpoint}"></td>
-             </tr>
-             <tr>
-               <th align=right>| . $locale->text('Ship via') . qq|</th>
-               <td colspan=3><input name=shipvia size=35 value="$form->{shipvia}"></td>
-             </tr>
-              <tr>
-                <th align="right">| . $locale->text('Transaction description') . qq|</th>
-                <td colspan="3"><input name="transaction_description" size="35" value="| . H($form->{transaction_description}) . qq|"></td>
-              </tr>|;
-#              <tr>
-#                 <td colspan=4>
-#                   <table>
-#                     <tr>
-#                       <td colspan=2>
-#                         <button type="button" onclick="delivery_customer_selection_window('delivery_customer_string','delivery_customer_id')">| . $locale->text('Choose Customer') . qq|</button>
-#                       </td>
-#                       <td colspan=2><input type=hidden name=delivery_customer_id value="$form->{delivery_customer_id}">
-#                       <input size=45 id=delivery_customer_string name=delivery_customer_string value="$form->{delivery_customer_string}"></td>
-#                     </tr>
-#                     <tr>
-#                       <td colspan=2>
-#                         <button type="button" onclick="vendor_selection_window('delivery_vendor_string','delivery_vendor_id')">| . $locale->text('Choose Vendor') . qq|</button>
-#                       </td>
-#                       <td colspan=2><input type=hidden name=delivery_vendor_id value="$form->{delivery_vendor_id}">
-#                       <input size=45 id=vendor_string name=delivery_vendor_string value="$form->{delivery_vendor_string}"></td>
-#                     </tr>
-#                   </table>
-#                 </td>
-#               </tr>
-print qq|          </table>
-         </td>
-         <td align=right>
-           <table>
-             $openclosed
-             $employee
-        $salesmen
-             $ordnumber
-             <tr>
-          <th width="70%" align="right" nowrap>| . $locale->text('Project Number') . qq|</th>
-          <td>$globalprojectnumber</td>
-             </tr>
-           </table>
-         </td>
-       </tr>
-      </table>
-    </td>
-  </tr>
-
-$jsscript
+  $TMPL_VAR{HIDDENS} = [ map { name => $_, value => $form->{$_} },
+     qw(id action type vc formname media format proforma queued printed emailed
+        title creditlimit creditremaining tradediscount business
+        max_dunning_level dunning_amount shiptoname shiptostreet shiptozipcode
+        shiptocity shiptocountry shiptocontact shiptophone shiptofax
+        shiptodepartment_1 shiptodepartment_2 shiptoemail
+        message email subject cc bcc taxpart taxservice taxaccounts),
+        @custom_hiddens,
+        map { $_.'_rate', $_.'_description' } split / /, $form->{taxaccounts} ];  # deleted: discount
+
+  %TMPL_VAR = (
+     %TMPL_VAR,
+     is_sales        => scalar ($form->{type} =~ /^sales_/),              # these vars are exported, so that the template
+     is_order        => scalar ($form->{type} =~ /_order$/),              # may determine what to show
+     is_sales_quo    => scalar ($form->{type} =~ /sales_quotation$/),
+     is_req_quo      => scalar ($form->{type} =~ /request_quotation$/),
+     is_sales_ord    => scalar ($form->{type} =~ /sales_order$/),
+     is_pur_ord      => scalar ($form->{type} =~ /purchase_order$/),
+  );
 
 
-|;
+  print $form->parse_html_template2("oe/orders_header", { %TMPL_VAR });
 
   $lxdebug->leave_sub();
 }
 
   $lxdebug->leave_sub();
 }
@@ -813,289 +488,61 @@ sub form_footer {
 
   $form->{invtotal} = $form->{invsubtotal};
 
 
   $form->{invtotal} = $form->{invsubtotal};
 
-  if (($rows = $form->numtextrows($form->{notes}, 25, 8)) < 2) {
-    $rows = 2;
-  }
-  if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
-    $introws = 2;
-  }
-  $rows = ($rows > $introws) ? $rows : $introws;
-  $notes =
-    qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
-  $intnotes =
-    qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
-
-  $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
+  $rows    = max 2, $form->numtextrows($form->{notes}, 25, 8);
+  $introws = max 2, $form->numtextrows($form->{intnotes}, 35, 8);
+  $rows    = max $rows, $introws;
 
 
-  $taxincluded = "";
-  if ($form->{taxaccounts}) {
-    $taxincluded = qq|
-             <input name=taxincluded class=checkbox type=checkbox value=1 $form->{taxincluded}> <b>|
-      . $locale->text('Tax Included') . qq|</b><br><br>
-|;
-  }
+  $TMPL_VAR{notes} = qq|<textarea name=notes rows=$rows cols=25 wrap=soft>$form->{notes}</textarea>|;
+  $TMPL_VAR{intnotes} = qq|<textarea name=intnotes rows=$rows cols=35 wrap=soft>$form->{intnotes}</textarea>|;
 
   if (!$form->{taxincluded}) {
 
     foreach $item (split / /, $form->{taxaccounts}) {
       if ($form->{"${item}_base"}) {
 
   if (!$form->{taxincluded}) {
 
     foreach $item (split / /, $form->{taxaccounts}) {
       if ($form->{"${item}_base"}) {
-        $form->{invtotal} += $form->{"${item}_total"} =
-          $form->round_amount(
-                             $form->{"${item}_base"} * $form->{"${item}_rate"},
-                             2);
-        $form->{"${item}_total"} =
-          $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
-
-        $tax .= qq|
+        $form->{invtotal} += $form->{"${item}_total"} = $form->round_amount( $form->{"${item}_base"} * $form->{"${item}_rate"}, 2);
+        $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
+
+        $TMPL_VAR{tax} .= qq|
              <tr>
              <tr>
-               <th align=right>$form->{"${item}_description"}&nbsp;|
-                                   . $form->{"${item}_rate"} * 100 .qq|%</th>
+               <th align=right>$form->{"${item}_description"}&nbsp;| . $form->{"${item}_rate"} * 100 .qq|%</th>
                <td align=right>$form->{"${item}_total"}</td>
                <td align=right>$form->{"${item}_total"}</td>
-             </tr>
-|;
+             </tr> |;
       }
     }
 
       }
     }
 
-    $form->{invsubtotal} =
-      $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
-
-    $subtotal = qq|
-             <tr>
-               <th align=right>| . $locale->text('Subtotal') . qq|</th>
-               <td align=right>$form->{invsubtotal}</td>
-             </tr>
-|;
-
-  }
+    $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
 
 
-  if ($form->{taxincluded}) {
+  } else {
     foreach $item (split / /, $form->{taxaccounts}) {
       if ($form->{"${item}_base"}) {
     foreach $item (split / /, $form->{taxaccounts}) {
       if ($form->{"${item}_base"}) {
-        $form->{"${item}_total"} =
-          $form->round_amount(
-                           ($form->{"${item}_base"} * $form->{"${item}_rate"} /
-                              (1 + $form->{"${item}_rate"})
-                           ),
-                           2);
-        $form->{"${item}_netto"} =
-          $form->round_amount(
-                          ($form->{"${item}_base"} - $form->{"${item}_total"}),
-                          2);
-        $form->{"${item}_total"} =
-          $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
-        $form->{"${item}_netto"} =
-          $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
-
-        $tax .= qq|
+        $form->{"${item}_total"} = $form->round_amount( ($form->{"${item}_base"} * $form->{"${item}_rate"} / (1 + $form->{"${item}_rate"})), 2);
+        $form->{"${item}_netto"} = $form->round_amount( ($form->{"${item}_base"} - $form->{"${item}_total"}), 2);
+        $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2);
+        $form->{"${item}_netto"} = $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2);
+
+        $TMPL_VAR{tax} .= qq|
              <tr>
              <tr>
-               <th align=right>Enthaltene $form->{"${item}_description"}&nbsp;|
-                                   . $form->{"${item}_rate"} * 100 .qq|%</th>
+               <th align=right>Enthaltene $form->{"${item}_description"}&nbsp;| . $form->{"${item}_rate"} * 100 .qq|%</th>
                <td align=right>$form->{"${item}_total"}</td>
              </tr>
              <tr>
                <th align=right>Nettobetrag</th>
                <td align=right>$form->{"${item}_netto"}</td>
                <td align=right>$form->{"${item}_total"}</td>
              </tr>
              <tr>
                <th align=right>Nettobetrag</th>
                <td align=right>$form->{"${item}_netto"}</td>
-             </tr>
-|;
+             </tr> |;
       }
     }
       }
     }
-
   }
 
   $form->{oldinvtotal} = $form->{invtotal};
   }
 
   $form->{oldinvtotal} = $form->{invtotal};
-  $form->{invtotal}    =
-    $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
-
-  print qq|
-  <tr>
-    <td>
-      <table width=100%>
-       <tr valign=bottom>
-         <td>
-           <table>
-             <tr>
-               <th align=left>| . $locale->text('Notes') . qq|</th>
-               <th align=left>| . $locale->text('Internal Notes') . qq|</th>
-             </tr>
-             <tr valign=top>
-               <td>$notes</td>
-               <td>$intnotes</td>
-             </tr>
-         <tr>
-    $payments
-           </tr>
-      </table>
-         </td>
-          <td>
-            <table>
-|;
-
-  if ($form->{type} =~ /^sales_/) {
-    print qq|
-            <tr>
-              <th  align=left>| . $locale->text('Ertrag') . qq|</th>
-              <td>| .  $form->format_amount(\%myconfig, $form->{marge_total}, 2, 0) . qq|</td>
-            </tr>
-            <tr>
-              <th  align=left>| . $locale->text('Ertrag prozentual') . qq|</th>
-              <td>| .  $form->format_amount(\%myconfig, $form->{marge_percent}, 2, 0) . qq| %</td>
-            </tr>
-|;
-  }
-
-  print qq|
-            <input type=hidden name="marge_total" value="$form->{"marge_total"}">
-            <input type=hidden name="marge_percent" value="$form->{"marge_percent"}">
-            </table>
-          </td>
-         <td align=right>
-           $taxincluded
-           <table>
-             $subtotal
-             $tax
-             <tr>
-               <th align=right>| . $locale->text('Total') . qq|</th>
-               <td align=right>$form->{invtotal}</td>
-             </tr>
-           </table>
-         </td>
-       </tr>
-      </table>
-    </td>
-  </tr>
-<input type=hidden name=oldinvtotal value=$form->{oldinvtotal}>
-<input type=hidden name=oldtotalpaid value=$totalpaid>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-|;
-
-  if ($webdav) {
-    $webdav_list = qq|
-
-  <tr>
-    <th class=listtop align=left>Dokumente im Webdav-Repository</th>
-  </tr>
-    <table width=100%>
-      <td align=left width=30%><b>Dateiname</b></td>
-      <td align=left width=70%><b>Webdavlink</b></td>
-|;
-    foreach $file (@{ $form->{WEBDAV} }) {
-      $webdav_list .= qq|
-      <tr>
-        <td align="left">$file->{name}</td>
-        <td align="left"><a href="$file->{link}">$file->{type}</a></td>
-      </tr>
-|;
-    }
-    $webdav_list .= qq|
-    </table>
-  </tr>
-  <tr>
-    <td><hr size=3 noshade></td>
-  </tr>
-|;
-
-    print $webdav_list;
-  }
-
-  print qq|
-  <tr>
-    <td>
-|;
-  print_options();
 
 
-  print qq|
-    </td>
-  </tr>
-</table>
+  print $form->parse_html_template2("oe/orders_footer", {
+     %TMPL_VAR,
+     webdav          => $webdav,
+     print_options   => print_options(inline => 1),
+     label_edit      => $locale->text("Edit the $form->{type}"),
+     label_workflow  => $locale->text("Workflow $form->{type}"),
+  });
 
 
-| . $locale->text("Edit the $form->{type}") . qq|<br>
-<input class=submit type=submit name=action id=update_button value="|
-    . $locale->text('Update') . qq|">
-<input class=submit type=submit name=action value="|
-    . $locale->text('Ship to') . qq|">
-<input class=submit type=submit name=action value="|
-    . $locale->text('Print') . qq|">
-<input class=submit type=submit name=action value="|
-    . $locale->text('E-mail') . qq|">
-<input class=submit type=submit name=action value="|
-    . $locale->text('Save') . qq|">
-<input class=submit type=submit name=action value="|
-    . $locale->text('Save and Close') . qq|">
-|;
-
-  if (($form->{id})) {
-    print qq|
-       <input type="button" class="submit" onclick="set_history_window(|
-       . Q($form->{id})
-       . qq|);" name="history" id="history" value="|
-       . $locale->text('history')
-       . qq|">
-
-<br>| . $locale->text("Workflow $form->{type}") . qq|<br>
-<input class=submit type=submit name=action value="|
-      . $locale->text('Save as new') . qq|">
-<input class=submit type=submit name=action value="|
-      . $locale->text('Delete') . qq|">|;
-    if (($form->{type} =~ /sales_quotation$/)) {
-      print qq|
-<input class=submit type=submit name=action value="|
-        . $locale->text('Sales Order') . qq|">|;
-    }
-    if ($form->{type} =~ /request_quotation$/) {
-      print qq|
-<input class=submit type=submit name=action value="|
-        . $locale->text('Purchase Order') . qq|">|;
-    }
-    print qq|
-<input class=submit type=submit name=action value="|
-      . $locale->text('Invoice') . qq|">
-|;
-
-    if ($form->{type} =~ /sales_order$/) {
-      print qq|
-<br>$form->{heading} als neue Vorlage verwenden f&uuml;r<br>
-<input class=submit type=submit name=action value="|
-        . $locale->text('Purchase Order') . qq|">
-<input class=submit type=submit name=action value="|
-        . $locale->text('Quotation') . qq|">
-|;
-
-    } elsif ($form->{type} =~ /purchase_order$/) {
-      print qq|
-<br>$form->{heading} als neue Vorlage verwenden f&uuml;r<br>
-<input class=submit type=submit name=action value="|
-        . $locale->text('Sales Order') . qq|">
-<input class=submit type=submit name=action value="|
-        . $locale->text('Request for Quotation') . qq|">
-|;
-
-    } else {
-      print qq|
-<br>$form->{heading} als neue Vorlage verwenden f&uuml;r<br>
-<input class=submit type=submit name=action value="|
-        . $locale->text('Order') . qq|">
-|;
-    }
-  }
-
-  $form->hide_form("saved_xyznumber");
-
-  print qq|
-
-<input type=hidden name=rowcount value=$form->{rowcount}>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=login value=$form->{login}>
-<input type=hidden name=password value=$form->{password}>
-
-</form>
-
-</body>
-</html>
-|;
   $lxdebug->leave_sub();
 }
 
   $lxdebug->leave_sub();
 }
 
@@ -1120,11 +567,11 @@ sub update {
   $form->{exchangerate} = $exchangerate if 
     $form->{forex} = $exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, $buysell);
 
   $form->{exchangerate} = $exchangerate if 
     $form->{forex} = $exchangerate = $form->check_exchangerate(\%myconfig, $form->{currency}, $form->{transdate}, $buysell);
 
-  # for pricegroups
-  $i = $form->{rowcount};
-
   $exchangerate = $form->{exchangerate} || 1;
 
   $exchangerate = $form->{exchangerate} || 1;
 
+##################### process items ######################################
+  # for pricegroups
+  $i = $form->{rowcount};
   if (   ($form->{"partnumber_$i"} eq "")
       && ($form->{"description_$i"} eq "")
       && ($form->{"partsgroup_$i"}  eq "")) {
   if (   ($form->{"partnumber_$i"} eq "")
       && ($form->{"description_$i"} eq "")
       && ($form->{"partsgroup_$i"}  eq "")) {
@@ -1134,13 +581,10 @@ sub update {
 
   } else {
 
 
   } else {
 
-    if (   $form->{type} eq 'purchase_order'
-        || $form->{type} eq 'request_quotation') {
-      IR->retrieve_item(\%myconfig, \%$form);
-    }
-    if (   $form->{type} eq 'sales_order' 
-        || $form->{type} eq 'sales_quotation') {
+    if ($form->{type} =~ /^sales/) {
       IS->retrieve_item(\%myconfig, \%$form);
       IS->retrieve_item(\%myconfig, \%$form);
+    } else {
+      IR->retrieve_item(\%myconfig, \%$form);
     }
 
     my $rows = scalar @{ $form->{item_list} };
     }
 
     my $rows = scalar @{ $form->{item_list} };
@@ -1192,8 +636,7 @@ sub update {
         &set_pricegroup($i);
       }
 
         &set_pricegroup($i);
       }
 
-      &display_form;
-
+      display_form();
     } else {
 
       # ok, so this is a new part
     } else {
 
       # ok, so this is a new part
@@ -1204,14 +647,16 @@ sub update {
           && ($form->{"description_$i"} eq "")) {
         $form->{rowcount}--;
         $form->{"discount_$i"} = "";
           && ($form->{"description_$i"} eq "")) {
         $form->{rowcount}--;
         $form->{"discount_$i"} = "";
-        display_form();
 
 
+        display_form();
       } else {
         $form->{"id_$i"}   = 0;
         new_item();
       }
     }
   }
       } else {
         $form->{"id_$i"}   = 0;
         new_item();
       }
     }
   }
+##################### process items ######################################
+
 
   $lxdebug->leave_sub();
 }
 
   $lxdebug->leave_sub();
 }
@@ -1343,11 +788,7 @@ sub search {
   my $employee_block = qq|
     <tr>
       <th align="right">| . $locale->text('Employee') . qq|</th>
   my $employee_block = qq|
     <tr>
       <th align="right">| . $locale->text('Employee') . qq|</th>
-      <td>| .
-        NTI($cgi->popup_menu('-name'   => 'employee_id',
-                             '-values' => \@values,
-                             '-labels' => \%labels)) . qq|
-      </td>
+      <td>| .  NTI($cgi->popup_menu('-name'   => 'employee_id', '-values' => \@values, '-labels' => \%labels)) . qq|</td>
     </tr>
     <tr>
       <th align="right">| . $locale->text('Salesman') . qq|</th>
     </tr>
     <tr>
       <th align="right">| . $locale->text('Salesman') . qq|</th>
@@ -1394,12 +835,12 @@ sub search {
           <th align=right>$vc_label</th>
           <td colspan=3>$vc</td>
         </tr>
           <th align=right>$vc_label</th>
           <td colspan=3>$vc</td>
         </tr>
-       $department
+$department
         <tr>
           <th align=right>$ordlabel</th>
           <td colspan=3><input name="$ordnumber" size=20></td>
         </tr>
         <tr>
           <th align=right>$ordlabel</th>
           <td colspan=3><input name="$ordnumber" size=20></td>
         </tr>
-  $employee_block
+$employee_block
         <tr>
           <th align="right">| . $locale->text('Transaction description') . qq|</th>
           <td colspan="3"><input name="transaction_description" size=20></td>
         <tr>
           <th align="right">| . $locale->text('Transaction description') . qq|</th>
           <td colspan="3"><input name="transaction_description" size=20></td>
@@ -1409,10 +850,8 @@ sub search {
           <td colspan="3">$projectnumber</td>
         </tr>
         <tr>
           <td colspan="3">$projectnumber</td>
         </tr>
         <tr>
-          <th align=right>| . $locale->text('From') . qq|</th>
-          $button1
-          <th align=right>| . $locale->text('Bis') . qq|</th>
-          $button2
+          <th align=right>| . $locale->text('From') . qq|</th> $button1
+          <th align=right>| . $locale->text('Bis') . qq|</th> $button2
         </tr>
         <input type=hidden name=sort value=transdate>
         <tr>
         </tr>
         <input type=hidden name=sort value=transdate>
         <tr>
@@ -1420,53 +859,38 @@ sub search {
           <td colspan=5>
            <table>
         <tr>
           <td colspan=5>
            <table>
         <tr>
-          <td><input type="checkbox" name="open" value="1" id="open" checked>
-            <label for="open">| . $locale->text("Open") . qq|</td>
-          <td><input type="checkbox" name="closed" value="1" id="closed">
-            <label for="closed">| . $locale->text("Closed") . qq|</td>
+          <td><input type="checkbox" name="open" value="1" id="open" checked> <label for="open">| . $locale->text("Open") . qq|</td>
+          <td><input type="checkbox" name="closed" value="1" id="closed"> <label for="closed">| . $locale->text("Closed") . qq|</td>
         </tr>
         $delivered
              <tr>
         </tr>
         $delivered
              <tr>
-               <td><input name="l_id" class=checkbox type=checkbox value=Y>
-               | . $locale->text('ID') . qq|</td>
+               <td><input name="l_id" class=checkbox type=checkbox value=Y> | . $locale->text('ID') . qq|</td>
                <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
                <td><input name="l_$ordnumber" class=checkbox type=checkbox value=Y checked> $ordlabel</td>
-               <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> |
-    . $locale->text('Date') . qq|</td>
-               <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> |
-    . $locale->text('Required by') . qq|</td>
+               <td><input name="l_transdate" class=checkbox type=checkbox value=Y checked> | . $locale->text('Date') . qq|</td>
+               <td><input name="l_reqdate" class=checkbox type=checkbox value=Y checked> | . $locale->text('Required by') . qq|</td>
              </tr>
              <tr>
                <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vc_label</td>
                <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
                
              </tr>
              <tr>
                <td><input name="l_name" class=checkbox type=checkbox value=Y checked> $vc_label</td>
                <td><input name="l_employee" class=checkbox type=checkbox value=Y checked> $employee</td>
                
-               <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> |
-    . $locale->text('Ship via') . qq|</td>
+               <td><input name="l_shipvia" class=checkbox type=checkbox value=Y> | . $locale->text('Ship via') . qq|</td>
              </tr>
              <tr>
              </tr>
              <tr>
-               <td><input name="l_netamount" class=checkbox type=checkbox value=Y> |
-    . $locale->text('Amount') . qq|</td>
-               <td><input name="l_tax" class=checkbox type=checkbox value=Y> |
-    . $locale->text('Tax') . qq|</td>
-               <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> |
-    . $locale->text('Total') . qq|</td>
+               <td><input name="l_netamount" class=checkbox type=checkbox value=Y> | . $locale->text('Amount') . qq|</td>
+               <td><input name="l_tax" class=checkbox type=checkbox value=Y> | . $locale->text('Tax') . qq|</td>
+               <td><input name="l_amount" class=checkbox type=checkbox value=Y checked> | . $locale->text('Total') . qq|</td>
              </tr>
              <tr>
              </tr>
              <tr>
-               <td><input name="l_marge_total" class=checkbox type=checkbox value=Y> |
-    .             $locale->text('Ertrag') . qq|</td>
-               <td><input name="l_marge_percent" class=checkbox type=checkbox value=Y> |
-    .             $locale->text('Ertrag prozentual') . qq|</td>
+               <td><input name="l_marge_total" class=checkbox type=checkbox value=Y> | .             $locale->text('Ertrag') . qq|</td>
+               <td><input name="l_marge_percent" class=checkbox type=checkbox value=Y> | .             $locale->text('Ertrag prozentual') . qq|</td>
              </tr>
              <tr>
              </tr>
              <tr>
-          <td><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y> |
-          . $locale->text('Project Number') . qq|</td>
-          <td><input name="l_transaction_description" class=checkbox type=checkbox value=Y> |
-          . $locale->text('Transaction description') . qq|</td>
+          <td><input name="l_globalprojectnumber" class=checkbox type=checkbox value=Y> | . $locale->text('Project Number') . qq|</td>
+          <td><input name="l_transaction_description" class=checkbox type=checkbox value=Y> | . $locale->text('Transaction description') . qq|</td>
              </tr>
              <tr>
              </tr>
              <tr>
-               <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> |
-    . $locale->text('Subtotal') . qq|</td>
-                <td><input name="l_salesman" class="checkbox" type="checkbox" value="Y"> |
-    . $locale->text('Salesman') . qq|</td>
+               <td><input name="l_subtotal" class=checkbox type=checkbox value=Y> | . $locale->text('Subtotal') . qq|</td>
+                <td><input name="l_salesman" class="checkbox" type="checkbox" value="Y"> | . $locale->text('Salesman') . qq|</td>
              </tr>
            </table>
           </td>
              </tr>
            </table>
           </td>
@@ -2535,3 +1959,249 @@ sub yes {
 sub no {
   call_sub($form->{no_nextsub});
 }
 sub no {
   call_sub($form->{no_nextsub});
 }
+
+######################################################################################################
+# IO ENTKOPPLUNG
+# ###############################################################################################
+sub display_form {
+  $lxdebug->enter_sub();
+
+  $form->{"taxaccounts"} =~ s/\s*$//;
+  $form->{"taxaccounts"} =~ s/^\s*//;
+  foreach my $accno (split(/\s*/, $form->{"taxaccounts"})) {
+    map({ delete($form->{"${accno}_${_}"}); } qw(rate description taxnumber));
+  }
+  $form->{"taxaccounts"} = "";
+
+  for my $i (1 .. $form->{"rowcount"}) {
+    IC->retrieve_accounts(\%myconfig, $form, $form->{"id_$i"}, $i, 1) if $form->{"id_$i"};
+  }
+
+  $form->{rowcount}++;
+  $form->{"project_id_$form->{rowcount}"} = $form->{globalproject_id};
+
+  $form->language_payment(\%myconfig);
+
+  Common::webdav_folder($form) if ($webdav);
+
+  &form_header;
+
+  # create rows
+  display_row($form->{rowcount}) if $form->{rowcount};
+
+  &form_footer;
+
+  $lxdebug->leave_sub();
+}
+
+sub display_row {
+  $lxdebug->enter_sub();
+  my $numrows = shift;
+
+  # column_index
+  my @header_sort = qw(runningnumber partnumber description ship qty unit sellprice_pg sellprice discount linetotal);
+  my @HEADER = (
+    {  id => 'runningnumber', width => 5,     value => $locale->text('No.'),                  display => 1, },
+    {  id => 'partnumber',    width => 12,    value => $locale->text('Number'),               display => 1, },
+    {  id => 'description',   width => 30,    value => $locale->text('Part Description'),     display => 1, },
+    {  id => 'ship',          width => 5,     value => ($form->{type} eq 'purchase_order' ? $locale->text('Ship rcvd') : $locale->text('Ship')),                 
+       display => $form->{type} =~ /sales_order/ || ($form->{type} =~ /purchase_order/ && !($lizenzen && $form->{vc} eq "customer")) , },
+    {  id => 'qty',           width => 5,     value => $locale->text('Qty'),                  display => 1, },
+    {  id => 'unit',          width => 5,     value => $locale->text('Unit'),                 display => 1, },
+    {  id => 'license',       width => 10,    value => $locale->text('License'),              display => 0, },
+    {  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 => 1, },
+    {  id => 'sellprice_pg',  width => 15,    value => $locale->text('Pricegroup'),           display => $form->{type} =~ /^sales_/,  },
+    {  id => 'discount',      width => undef, value => $locale->text('Discount'),             display => $form->{vc} eq 'customer', },
+    {  id => 'linetotal',     width => 10,    value => $locale->text('Extended'),             display => 1, },
+    {  id => 'bin',           width => 10,    value => $locale->text('Bin'),                  display => 0, },
+  ); 
+  my @column_index = map { $_->{id} } grep { $_->{display} } @HEADER;
+
+  # cache units
+  my $dimension_units = AM->retrieve_units(\%myconfig, $form, "dimension");
+  my $service_units   = AM->retrieve_units(\%myconfig, $form, "service");
+  my $all_units       = AM->retrieve_units(\%myconfig, $form);
+
+  my $colspan = scalar @column_index;
+
+  $form->{invsubtotal} = 0;
+  map { $form->{"${_}_base"} = 0 } (split(/ /, $form->{taxaccounts}));
+
+  # about details 
+  $myconfig{show_form_details} = 1                            unless (defined($myconfig{show_form_details}));
+  $form->{show_details}        = $myconfig{show_form_details} unless (defined($form->{show_details}));
+  # /about details
+
+  # translations, unused commented out
+#  $runningnumber = $locale->text('No.');
+  $deliverydate  = $locale->text('Delivery Date');
+  $serialnumber  = $locale->text('Serial No.');
+  $projectnumber = $locale->text('Project');
+#  $partsgroup    = $locale->text('Group');
+  $reqdate       = $locale->text('Reqdate');
+  $deliverydate  = $locale->text('Required by');
+
+  # special alignings
+  my %align = map { $_ => 'right' } qw(qty ship right sellprice_pg discount linetotal);
+
+  $form->{marge_total}           = 0;
+  $form->{sellprice_total}       = 0;
+  $form->{lastcost_total}        = 0;
+  my %projectnumber_labels = ();
+  my @projectnumber_values = ("");
+
+  foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
+    push(@projectnumber_values, $item->{"id"});
+    $projectnumber_labels{$item->{"id"}} = $item->{"projectnumber"};
+  }
+
+  # rows
+  for $i (1 .. $numrows) {
+
+    # undo formatting
+    map { $form->{"${_}_$i"} = $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) } qw(qty ship discount sellprice price_new price_old) unless ($form->{simple_save});
+
+# unit begin
+    $form->{"unit_old_$i"}      ||= $form->{"unit_$i"};
+    $form->{"selected_unit_$i"} ||= $form->{"unit_$i"};
+
+    my $local_units = $form->{"inventory_accno_$i"} || $form->{"assembly_$i"} ? $dimension_units 
+                    : $form->{"id_$i"}                                        ? $service_units 
+                    :                                                           $all_units;
+    if (   !$local_units->{$form->{"selected_unit_$i"}}                                          # Die ausgewaehlte Einheit ist fuer diesen Artikel nicht gueltig
+        || !AM->convert_unit($form->{"selected_unit_$i"}, $form->{"unit_old_$i"}, $all_units)) { # (z.B. Dimensionseinheit war ausgewaehlt, es handelt sich aber
+      $form->{"unit_old_$i"} = $form->{"selected_unit_$i"} = $form->{"unit_$i"};                 # um eine Dienstleistung). Dann keinerlei Umrechnung vornehmen.
+    }
+    # adjust prices by unit, ignore if pricegroup changed
+    if ((!$form->{"prices_$i"}) || ($form->{"new_pricegroup_$i"} == $form->{"old_pricegroup_$i"})) {
+        $form->{"sellprice_$i"} *= AM->convert_unit($form->{"selected_unit_$i"}, $form->{"unit_old_$i"}, $all_units) || 1;
+        $form->{"unit_old_$i"}   = $form->{"selected_unit_$i"};
+    }
+    my $this_unit = $form->{"unit_$i"};
+    $this_unit    = $form->{"selected_unit_$i"} if AM->convert_unit($this_unit, $form->{"selected_unit_$i"}, $all_units);
+    $this_unit  ||= "kg";
+
+    $column_data{"unit"} = AM->unit_select_html($local_units, "unit_$i", $this_unit, $form->{"id_$i"} ? $form->{"unit_$i"} : undef);
+# / unit ending
+
+    $form->{"sellprice_$i"} =~ /\.(\d+)/;
+    $decimalplaces = max 2, length $1;
+
+    $discount  = $form->round_amount($form->{"sellprice_$i"} * $form->{"discount_$i"} / 100, $decimalplaces);
+    $linetotal = $form->round_amount($form->{"sellprice_$i"} - $discount, $decimalplaces);
+    $linetotal = $form->round_amount($linetotal * $form->{"qty_$i"}, 2);
+
+    # convert " to &quot;
+    map { $form->{"${_}_$i"} =~ s/\"/&quot;/g } qw(partnumber description unit unit_old);
+
+    $column_data{runningnumber} = $cgi->textfield(-name => "runningnumber_$i", -size => 5,  -value => $i);    # HuT
+    $column_data{partnumber}    = $cgi->textfield(-name => "partnumber_$i",    -size => 12, -value => $form->{"partnumber_$i"});
+    $column_data{description} = ((($rows = $form->numtextrows($form->{"description_$i"}, 30, 6)) > 1) # if description is too large, use a textbox instead
+                                ? $cgi->textarea( -name => "description_$i", -default => H($form->{"description_$i"}), -rows => $rows, -columns => 30)
+                                : $cgi->textfield(-name => "description_$i",   -size => 30, -value => $form->quote($form->{"description_$i"})))
+                                . $cgi->button(-value => $locale->text('L'), -onClick => "set_longdescription_window('longdescription_$i')");
+
+    $form->{"qty_$i"} =~ /\.(\d+)/;
+    my $qty_dec = length $1;
+
+    $column_data{qty}  = $cgi->textfield(-name => "qty_$i", -size => 5, -value => $form->format_amount(\%myconfig, $form->{"qty_$i"}, $qty_dec));
+    $column_data{qty} .= $cgi->button(-onclick => "calculate_qty_selection_window('qty_$i','alu_$i', 'formel_$i', $i)", -value => $locale->text('*/'))
+                       . $cgi->hidden(-name => "formel_$i", -value => $form->{"formel_$i"}) . $cgi->hidden("-name" => "alu_$i", "-value" => $form->{"alu_$i"})
+      if $form->{"formel_$i"};
+    $column_data{ship} = $cgi->textfield(-name => "ship_$i", -size => 5, -value => $form->format_amount(\%myconfig, $form->{"ship_$i"}));
+
+    # build in drop down list for pricesgroups
+    if ($form->{"prices_$i"}) {
+      $column_data{sellprice_pg} = qq|<select name="sellprice_pg_$i">$form->{"prices_$i"}</select>|;
+      $column_data{sellprice}    = $cgi->textfield(-name => "sellprice_$i", -size => 10, -onBlur => 'check_right_number_format(this)', -value =>
+                                   (($form->{"new_pricegroup_$i"} != $form->{"old_pricegroup_$i"})
+                                      ? $form->format_amount(\%myconfig, $form->{"price_new_$i"}, $decimalplaces)
+                                      : $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces)));
+    } else {
+      # for last row and report
+      # set pricegroup drop down list from report menu
+      if ($form->{"sellprice_$i"} != 0) {
+        $form->{"pricegroup_old_$i"} = $form->{"pricegroup_id_$i"};
+        my $default_option           = $form->{"sellprice_$i"}.'--'.$form->{"pricegroup_id_$i"};
+        $column_data{sellprice_pg}   = NTI($cgi->popup_menu("sellpricepg_$i", [ $default_option ], $default_option, { $default_option => $form->{"pricegroup_$i"} || '' }));
+      } else {
+        $column_data{sellprice_pg} = qq|&nbsp;|;
+      }
+      $column_data{sellprice} = $cgi->textfield(-name => "sellprice_$i", -size => 10, -onBlur => "check_right_number_format(this)", -value =>
+                                                $form->format_amount(\%myconfig, $form->{"sellprice_$i"}, $decimalplaces));
+    }
+    $column_data{discount}    = $cgi->textfield(-name => "discount_$i", -size => 3, -value => $form->format_amount(\%myconfig, $form->{"discount_$i"}));
+    $column_data{linetotal}   = $form->format_amount(\%myconfig, $linetotal, 2);
+    $column_data{bin}         = $form->{"bin_$i"};
+
+    my @ROW1 = map { value => $column_data{$_}, align => $align{$_} }, @column_index;
+
+    # second row
+    my @ROW2 = ();
+    push @ROW2, { value => qq|<b>$serialnumber</b> <input name="serialnumber_$i" size="15" value="$form->{"serialnumber_$i"}">| } 
+      if $form->{type} !~ /_quotation/;
+    push @ROW2, { value => qq|<b>$projectnumber</b> | . NTI($cgi->popup_menu('-name'  => "project_id_$i",        '-values'  => \@projectnumber_values,
+                                                                             '-labels' => \%projectnumber_labels, '-default' => $form->{"project_id_$i"})) };
+    push @ROW2, { value => qq|<b>$reqdate</b> <input name="reqdate_$i" size="11" onBlur="check_right_date_format(this)" value="$form->{"reqdate_$i"}">| }
+      if $form->{type} =~ /order/;
+    push @ROW2, { value => sprintf qq|<b>%s</b>&nbsp;<input type="checkbox" name="subtotal_$i" value="1" %s>|, 
+                   $locale->text('Subtotal'), $form->{"subtotal_$i"} ? 'checked' : '' };
+
+# begin marge calculations
+    my $marge_color;
+    my $real_sellprice = $form->{"sellprice_$i"} - $discount;
+
+    $form->{"lastcost_$i"} *= 1;
+    $form->{"marge_percent_$i"} = 0;
+
+    if ($real_sellprice && ($form->{"qty_$i"} * 1)) {
+      $form->{"marge_percent_$i"}     = ($real_sellprice - $form->{"lastcost_$i"}) * 100 / $real_sellprice;
+      $myconfig{marge_percent_warn} ||= 15;
+      $marge_color                    = 'color="#ff0000"' if $form->{"id_$i"} && ($form->{"marge_percent_$i"} < (1 * $myconfig{marge_percent_warn}));
+    }
+
+    my $marge_adjust_credit_note = $form->{type} eq 'credit_note' ? -1 : 1;
+    $form->{"marge_absolut_$i"}  = ($real_sellprice - $form->{"lastcost_$i"}) * $form->{"qty_$i"} * $marge_adjust_credit_note;
+    $form->{"marge_total"}      += $form->{"marge_absolut_$i"};
+    $form->{"lastcost_total"}   += $form->{"lastcost_$i"} * $form->{"qty_$i"};
+    $form->{"sellprice_total"}  += $real_sellprice * $form->{"qty_$i"};
+
+    map { $form->{"${_}_$i"} = $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) } qw(marge_absolut marge_percent);
+
+    push @ROW2, { value => sprintf qq|<font %s><b>%s</b> %s &nbsp;%s%% </font> &nbsp;<b>%s</b> %s &nbsp;<b>%s</b> %s|,
+                   $marge_color, $locale->text('Ertrag'),$form->{"marge_absolut_$i"}, $form->{"marge_percent_$i"},
+                   $locale->text('LP'), $form->format_amount(\%myconfig, $form->{"listprice_$i"}, 2),
+                   $locale->text('EK'), $form->format_amount(\%myconfig, $form->{"lastcost_$i"}, 2) }
+      if $form->{"id_$i"} && $form->{type} =~ /^sales_/;
+# / marge calculations ending
+
+    my @HIDDENS = map { value => $_}, (
+          $cgi->hidden("-name" => "unit_old_$i", "-value" => $form->{"selected_unit_$i"}),
+          $cgi->hidden("-name" => "price_new_$i", "-value" => $form->format_amount(\%myconfig, $form->{"price_new_$i"})),
+          map { ($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } map { $_."_$i" } 
+            qw(orderitems_id bo pricegroup_old price_old id inventory_accno bin partsgroup partnotes
+               income_accno expense_accno listprice assembly taxaccounts ordnumber transdate cusordnumber
+               longdescription basefactor marge_absolut marge_percent lastcost)
+    );
+
+    map { $form->{"${_}_base"} += $linetotal } (split(/ /, $form->{"taxaccounts_$i"}));
+
+    $form->{invsubtotal} += $linetotal;
+
+    push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, };
+  }
+
+  print $form->parse_html_template('oe/sales_order', { ROWS   => \@ROWS, 
+                                                       HEADER => \@HEADER,
+                                                       show_details_checked => ($form->{show_details} ? "checked" : ""),
+                                                       show_details_new     => !$form->{show_details},
+                                                     });
+
+  if (0 != ($form->{sellprice_total} * 1)) {
+    $form->{marge_percent} = ($form->{sellprice_total} - $form->{lastcost_total}) / $form->{sellprice_total} * 100;
+  }
+
+  $lxdebug->leave_sub();
+}
index 731c3cbcf20e5f523a8a5a58d480daf251d37dd5..1a2999bdee34f2c07d8ed48b74bfdeb90d23ffa5 100644 (file)
@@ -1443,7 +1443,7 @@ sub aging {
   if ($form->{arap} eq 'ar') {
     $raw_top_info_text    = $form->parse_html_template('rp/aging_ar_top');
     $raw_bottom_info_text = $form->parse_html_template('rp/aging_ar_bottom', { 'row_idx' => $row_idx,
   if ($form->{arap} eq 'ar') {
     $raw_top_info_text    = $form->parse_html_template('rp/aging_ar_top');
     $raw_bottom_info_text = $form->parse_html_template('rp/aging_ar_bottom', { 'row_idx' => $row_idx,
-                                                                               'PRINT_OPTIONS' => print_options(1), });
+                                                                               'PRINT_OPTIONS' => print_options(inline => 1), });
     $report->set_options('raw_top_info_text'    => $raw_top_info_text,
                          'raw_bottom_info_text' => $raw_bottom_info_text);
   }
     $report->set_options('raw_top_info_text'    => $raw_top_info_text,
                          'raw_bottom_info_text' => $raw_bottom_info_text);
   }
index 20100dea13393291e1ab3e2a4681e6b02bfd6a9b..89c61e21d4faee7af2dc1ca52fb458e3492ebd12 100644 (file)
@@ -725,6 +725,7 @@ aktualisieren wollen?',
   'Monat'                       => 'Monat',
   'Monthly'                     => 'monatlich',
   'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
   'Monat'                       => 'Monat',
   'Monthly'                     => 'monatlich',
   'More than one control file with the tag \'%s\' exist.' => 'Es gibt mehr als eine Kontrolldatei mit dem Tag \'%s\'.',
+  'Motiv'                       => 'Motiv',
   'Multibyte Encoding'          => 'Schriftsatz',
   'MwSt. inkl.'                 => 'MwSt. inkl.',
   'Name'                        => 'Name',
   'Multibyte Encoding'          => 'Schriftsatz',
   'MwSt. inkl.'                 => 'MwSt. inkl.',
   'Name'                        => 'Name',
index b91132790dc68e0d4f26dba593e9e25f92be560a..96e9e0b2eab3d1d9720b52bd0729bdb71551a593 100644 (file)
@@ -1,6 +1,5 @@
 $self->{texts} = {
   ' Date missing!'              => ' Datum fehlt!',
 $self->{texts} = {
   ' Date missing!'              => ' Datum fehlt!',
-  '*/'                          => '*/',
   'ADDED'                       => 'Hinzugefügt',
   'Add Purchase Order'          => 'Lieferantenauftrag erfassen',
   'Add Quotation'               => 'Angebot erfassen',
   'ADDED'                       => 'Hinzugefügt',
   'Add Purchase Order'          => 'Lieferantenauftrag erfassen',
   'Add Quotation'               => 'Angebot erfassen',
@@ -17,7 +16,6 @@ $self->{texts} = {
   'Automatically created invoice for fee and interest for dunning %s' => 'Automatisch erzeugte Rechnung für Gebühren und Zinsen zu Mahnung %s',
   'Bcc'                         => 'Bcc',
   'Billing Address'             => 'Rechnungsadresse',
   'Automatically created invoice for fee and interest for dunning %s' => 'Automatisch erzeugte Rechnung für Gebühren und Zinsen zu Mahnung %s',
   'Bcc'                         => 'Bcc',
   'Billing Address'             => 'Rechnungsadresse',
-  'Bin'                         => 'Lagerplatz',
   'Bin List'                    => 'Lagerliste',
   'CANCELED'                    => 'Storniert',
   'CSV export -- options'       => 'CSV-Export -- Optionen',
   'Bin List'                    => 'Lagerliste',
   'CANCELED'                    => 'Storniert',
   'CSV export -- options'       => 'CSV-Export -- Optionen',
@@ -46,12 +44,10 @@ $self->{texts} = {
   'Date'                        => 'Datum',
   'Dec'                         => 'Dez',
   'December'                    => 'Dezember',
   'Date'                        => 'Datum',
   'Dec'                         => 'Dez',
   'December'                    => 'Dezember',
-  'Delivery Date'               => 'Lieferdatum',
   'Department'                  => 'Abteilung',
   'Dependency loop detected:'   => 'Schleife in den Abh&auml;ngigkeiten entdeckt:',
   'Description'                 => 'Beschreibung',
   'Directory'                   => 'Verzeichnis',
   'Department'                  => 'Abteilung',
   'Dependency loop detected:'   => 'Schleife in den Abh&auml;ngigkeiten entdeckt:',
   'Description'                 => 'Beschreibung',
   'Directory'                   => 'Verzeichnis',
-  'Discount'                    => 'Rabatt',
   'Dunning Date'                => 'Mahndatum',
   'Dunning Description missing in row ' => 'Mahnstufenbeschreibung fehlt in Zeile ',
   'Dunning Duedate'             => 'Zahlbar bis',
   'Dunning Date'                => 'Mahndatum',
   'Dunning Description missing in row ' => 'Mahnstufenbeschreibung fehlt in Zeile ',
   'Dunning Duedate'             => 'Zahlbar bis',
@@ -62,19 +58,15 @@ $self->{texts} = {
   'Dunning overview'            => 'Mahnungsübersicht',
   'E-mail'                      => 'eMail',
   'E-mail address missing!'     => 'E-Mail-Adresse fehlt!',
   'Dunning overview'            => 'Mahnungsübersicht',
   'E-mail'                      => 'eMail',
   'E-mail address missing!'     => 'E-Mail-Adresse fehlt!',
-  'EK'                          => 'EK',
   'ELSE'                        => 'Zusatz',
   'Edit Dunning Process Config' => 'Mahnwesenkonfiguration bearbeiten',
   'Enter longdescription'       => 'Langtext eingeben',
   'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
   'ELSE'                        => 'Zusatz',
   'Edit Dunning Process Config' => 'Mahnwesenkonfiguration bearbeiten',
   'Enter longdescription'       => 'Langtext eingeben',
   'Error in database control file \'%s\': %s' => 'Fehler in Datenbankupgradekontrolldatei \'%s\': %s',
-  'Ertrag'                      => 'Ertrag',
-  'Extended'                    => 'Gesamt',
   'Falsches Datumsformat!'      => 'Falsches Datumsformat!',
   'Fax'                         => 'Fax',
   'Feb'                         => 'Feb',
   'February'                    => 'Februar',
   'File'                        => 'Datei',
   'Falsches Datumsformat!'      => 'Falsches Datumsformat!',
   'Fax'                         => 'Fax',
   'Feb'                         => 'Feb',
   'February'                    => 'Februar',
   'File'                        => 'Datei',
-  'Group'                       => 'Warengruppe',
   'History'                     => 'Historie',
   'In-line'                     => 'im Text',
   'Interest'                    => 'Zinsen',
   'History'                     => 'Historie',
   'In-line'                     => 'im Text',
   'Interest'                    => 'Zinsen',
@@ -84,16 +76,12 @@ $self->{texts} = {
   'Invoice Date missing!'       => 'Rechnungsdatum fehlt!',
   'Invoice Duedate'             => 'Fälligkeitsdatum',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
   'Invoice Date missing!'       => 'Rechnungsdatum fehlt!',
   'Invoice Duedate'             => 'Fälligkeitsdatum',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
-  'Item not on file!'           => 'Dieser Artikel ist nicht in der Datenbank!',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
   'July'                        => 'Juli',
   'Jun'                         => 'Jun',
   'June'                        => 'Juni',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
   'July'                        => 'Juli',
   'Jun'                         => 'Jun',
   'June'                        => 'Juni',
-  'L'                           => 'L',
-  'LP'                          => 'LP',
-  'License'                     => 'Lizenz',
   'MAILED'                      => 'Gesendet',
   'Mar'                         => 'März',
   'March'                       => 'März',
   'MAILED'                      => 'Gesendet',
   'Mar'                         => 'März',
   'March'                       => 'März',
@@ -115,7 +103,6 @@ $self->{texts} = {
   'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
   'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
   'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
   'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
   'No project was found matching the search parameters.' => 'Es wurde kein Projekt gefunden, auf das die Suchparameter zutreffen.',
   'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
-  'No.'                         => 'Position',
   'Nov'                         => 'Nov',
   'November'                    => 'November',
   'Number'                      => 'Nummer',
   'Nov'                         => 'Nov',
   'November'                    => 'November',
   'Number'                      => 'Nummer',
@@ -135,7 +122,6 @@ $self->{texts} = {
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
-  'Part'                        => 'Ware',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
@@ -145,11 +131,9 @@ $self->{texts} = {
   'Please enter values'         => 'Bitte Werte eingeben',
   'Postscript'                  => 'Postscript',
   'Price'                       => 'Preis',
   'Please enter values'         => 'Bitte Werte eingeben',
   'Postscript'                  => 'Postscript',
   'Price'                       => 'Preis',
-  'Pricegroup'                  => 'Preisgruppe',
   'Print dunnings'              => 'Mahnungen drucken',
   'Printer'                     => 'Drucker',
   'Proforma Invoice'            => 'Proformarechnung',
   'Print dunnings'              => 'Mahnungen drucken',
   'Printer'                     => 'Drucker',
   'Proforma Invoice'            => 'Proformarechnung',
-  'Project'                     => 'Projekt',
   'Project Number'              => 'Projektnummer',
   'Project description'         => 'Projektbeschreibung',
   'Project not on file!'        => 'Dieses Projekt ist nicht in der Datenbank!',
   'Project Number'              => 'Projektnummer',
   'Project description'         => 'Projektbeschreibung',
   'Project not on file!'        => 'Dieses Projekt ist nicht in der Datenbank!',
@@ -160,8 +144,6 @@ $self->{texts} = {
   'Quotation Date missing!'     => 'Angebotsdatum fehlt!',
   'Quotation Number missing!'   => 'Angebotsnummer fehlt!',
   'RFQ'                         => 'Anfrage',
   'Quotation Date missing!'     => 'Angebotsdatum fehlt!',
   'Quotation Number missing!'   => 'Angebotsnummer fehlt!',
   'RFQ'                         => 'Anfrage',
-  'Reqdate'                     => 'Lieferdatum',
-  'Required by'                 => 'Lieferdatum',
   'SAVED'                       => 'Gespeichert',
   'SAVED FOR DUNNING'           => 'Gespeichert',
   'SCREENED'                    => 'Angezeigt',
   'SAVED'                       => 'Gespeichert',
   'SAVED FOR DUNNING'           => 'Gespeichert',
   'SCREENED'                    => 'Angezeigt',
@@ -177,20 +159,14 @@ $self->{texts} = {
   'Select postscript or PDF!'   => 'Postscript oder PDF auswählen!',
   'Sep'                         => 'Sep',
   'September'                   => 'September',
   'Select postscript or PDF!'   => 'Postscript oder PDF auswählen!',
   'Sep'                         => 'Sep',
   'September'                   => 'September',
-  'Serial No.'                  => 'Seriennummer',
-  'Service'                     => 'Dienstleistung',
   'Set eMail text'              => 'eMail Text eingeben',
   'Set eMail text'              => 'eMail Text eingeben',
-  'Ship'                        => 'Lagerausgang',
-  'Ship rcvd'                   => 'Lagereingang',
   'Ship to'                     => 'Lieferadresse',
   'Shipping Address'            => 'Lieferadresse',
   'Ship to'                     => 'Lieferadresse',
   'Shipping Address'            => 'Lieferadresse',
-  'Show details'                => 'Details anzeigen',
   'Start Dunning Process'       => 'Mahnprozess starten',
   'Storno Invoice'              => 'Stornorechnung',
   'Storno Packing List'         => 'Stornolieferschein',
   'Street'                      => 'Straße',
   'Subject'                     => 'Betreff',
   'Start Dunning Process'       => 'Mahnprozess starten',
   'Storno Invoice'              => 'Stornorechnung',
   'Storno Packing List'         => 'Stornolieferschein',
   'Street'                      => 'Straße',
   'Subject'                     => 'Betreff',
-  'Subtotal'                    => 'Zwischensumme',
   'Terms missing in row '       => '+Tage fehlen in Zeile ',
   'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
   'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.',
   'Terms missing in row '       => '+Tage fehlen in Zeile ',
   'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
   'The dunnings have been printed.' => 'Die Mahnung(en) wurden gedruckt.',
@@ -206,7 +182,6 @@ $self->{texts} = {
   'Vendor details'              => 'Lieferantendetails',
   'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
   'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
   'Vendor details'              => 'Lieferantendetails',
   'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
   'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
-  'What type of item is this?'  => 'Was ist dieser Artikel?',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
   'bin_list'                    => 'Lagerliste',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
   'bin_list'                    => 'Lagerliste',
@@ -248,8 +223,6 @@ $self->{subs} = {
   'continue'                    => 'continue',
   'customer_details'            => 'customer_details',
   'delivery_customer_selection' => 'delivery_customer_selection',
   'continue'                    => 'continue',
   'customer_details'            => 'customer_details',
   'delivery_customer_selection' => 'delivery_customer_selection',
-  'display_form'                => 'display_form',
-  'display_row'                 => 'display_row',
   'edit_config'                 => 'edit_config',
   'edit_e_mail'                 => 'edit_e_mail',
   'employee_selection_internal' => 'employee_selection_internal',
   'edit_config'                 => 'edit_config',
   'edit_e_mail'                 => 'edit_e_mail',
   'employee_selection_internal' => 'employee_selection_internal',
index 4e1d08e6df98cb62cae0bb570c735ae07b7d69f8..2234ef27652ea3d49972c8065a11cd7ed01f24df 100644 (file)
@@ -101,7 +101,6 @@ aktualisieren wollen?',
   'Invoice Number'              => 'Rechnungsnummer',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
   'Item deleted!'               => 'Artikel gelöscht!',
   'Invoice Number'              => 'Rechnungsnummer',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
   'Item deleted!'               => 'Artikel gelöscht!',
-  'Item not on file!'           => 'Dieser Artikel ist nicht in der Datenbank!',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
@@ -168,7 +167,6 @@ aktualisieren wollen?',
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
-  'Part'                        => 'Ware',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Description missing!'   => 'Artikelbezeichnung fehlt!',
   'Part Number'                 => 'Artikelnummer',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Description missing!'   => 'Artikelbezeichnung fehlt!',
   'Part Number'                 => 'Artikelnummer',
@@ -223,7 +221,6 @@ aktualisieren wollen?',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
   'Serial Number'               => 'Seriennummer',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
   'Serial Number'               => 'Seriennummer',
-  'Service'                     => 'Dienstleistung',
   'Service Number missing!'     => 'Dienstleistungsnummer fehlt!',
   'Services'                    => 'Dienstleistungen',
   'Set Language Values'         => 'Spracheinstellungen',
   'Service Number missing!'     => 'Dienstleistungsnummer fehlt!',
   'Services'                    => 'Dienstleistungen',
   'Set Language Values'         => 'Spracheinstellungen',
@@ -265,7 +262,6 @@ aktualisieren wollen?',
   'Vendor details'              => 'Lieferantendetails',
   'Verrechnungseinheit'         => 'Verrechnungseinheit',
   'Weight'                      => 'Gewicht',
   'Vendor details'              => 'Lieferantendetails',
   'Verrechnungseinheit'         => 'Verrechnungseinheit',
   'Weight'                      => 'Gewicht',
-  'What type of item is this?'  => 'Was ist dieser Artikel?',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
   'assembly_list'               => 'erzeugnisliste',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
   'assembly_list'               => 'erzeugnisliste',
index 9ae0591222f3657a8a23ee592ddc9ed565528e6b..418d1c34a56be5db3e6682a53ac97f3a2f6cb05d 100644 (file)
@@ -57,7 +57,6 @@ $self->{texts} = {
   'Invoice'                     => 'Rechnung',
   'Invoice Date missing!'       => 'Rechnungsdatum fehlt!',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
   'Invoice'                     => 'Rechnung',
   'Invoice Date missing!'       => 'Rechnungsdatum fehlt!',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
-  'Item not on file!'           => 'Dieser Artikel ist nicht in der Datenbank!',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
@@ -106,7 +105,6 @@ $self->{texts} = {
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
-  'Part'                        => 'Ware',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
@@ -143,7 +141,6 @@ $self->{texts} = {
   'Sep'                         => 'Sep',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
   'Sep'                         => 'Sep',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
-  'Service'                     => 'Dienstleistung',
   'Ship'                        => 'Lagerausgang',
   'Ship rcvd'                   => 'Lagereingang',
   'Ship to'                     => 'Lieferadresse',
   'Ship'                        => 'Lagerausgang',
   'Ship rcvd'                   => 'Lagereingang',
   'Ship to'                     => 'Lieferadresse',
@@ -163,7 +160,6 @@ $self->{texts} = {
   'Variable'                    => 'Variable',
   'Vendor Number'               => 'Lieferantennummer',
   'Vendor details'              => 'Lieferantendetails',
   'Variable'                    => 'Variable',
   'Vendor Number'               => 'Lieferantennummer',
   'Vendor details'              => 'Lieferantendetails',
-  'What type of item is this?'  => 'Was ist dieser Artikel?',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
   'bin_list'                    => 'Lagerliste',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
   'bin_list'                    => 'Lagerliste',
index b94aa8d08b1db42cf5d1e47ed47d8189f03da07a..48a51d4081b59e7f454efaeab68ac12168e7c250 100644 (file)
@@ -90,7 +90,6 @@ $self->{texts} = {
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
   'Invoice deleted!'            => 'Rechnung gelöscht!',
   'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
   'Invoice deleted!'            => 'Rechnung gelöscht!',
   'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.',
-  'Item not on file!'           => 'Dieser Artikel ist nicht in der Datenbank!',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
@@ -144,7 +143,6 @@ $self->{texts} = {
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
-  'Part'                        => 'Ware',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
@@ -194,7 +192,6 @@ $self->{texts} = {
   'Sep'                         => 'Sep',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
   'Sep'                         => 'Sep',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
-  'Service'                     => 'Dienstleistung',
   'Ship'                        => 'Lagerausgang',
   'Ship rcvd'                   => 'Lagereingang',
   'Ship to'                     => 'Lieferadresse',
   'Ship'                        => 'Lagerausgang',
   'Ship rcvd'                   => 'Lagereingang',
   'Ship to'                     => 'Lieferadresse',
@@ -226,7 +223,6 @@ $self->{texts} = {
   'Vendor missing!'             => 'Lieferant fehlt!',
   'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
   'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
   'Vendor missing!'             => 'Lieferant fehlt!',
   'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
   'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
-  'What type of item is this?'  => 'Was ist dieser Artikel?',
   'Yes'                         => 'Ja',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
   'Yes'                         => 'Ja',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
index 1dda438cfeeff2f92bb35c6d82cfcdf211ec75fa..c7b78c293cb62a5cc485094dddd1d9b6c878dc8d 100644 (file)
@@ -107,7 +107,6 @@ $self->{texts} = {
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
   'Invoice deleted!'            => 'Rechnung gelöscht!',
   'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
   'Invoice deleted!'            => 'Rechnung gelöscht!',
   'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.',
-  'Item not on file!'           => 'Dieser Artikel ist nicht in der Datenbank!',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
@@ -163,7 +162,6 @@ $self->{texts} = {
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
-  'Part'                        => 'Ware',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
@@ -218,7 +216,6 @@ $self->{texts} = {
   'Sep'                         => 'Sep',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
   'Sep'                         => 'Sep',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
-  'Service'                     => 'Dienstleistung',
   'Ship'                        => 'Lagerausgang',
   'Ship rcvd'                   => 'Lagereingang',
   'Ship to'                     => 'Lieferadresse',
   'Ship'                        => 'Lagerausgang',
   'Ship rcvd'                   => 'Lagereingang',
   'Ship to'                     => 'Lieferadresse',
@@ -252,7 +249,6 @@ $self->{texts} = {
   'Vendor details'              => 'Lieferantendetails',
   'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
   'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
   'Vendor details'              => 'Lieferantendetails',
   'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
   'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
-  'What type of item is this?'  => 'Was ist dieser Artikel?',
   'Yes'                         => 'Ja',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
   'Yes'                         => 'Ja',
   'Zipcode'                     => 'PLZ',
   '[email]'                     => '[email]',
index 0c2393c0fc4d624b9706789ff37a4d2d67314600..11035288875d00a932ce834b2cdc581b99033b08 100644 (file)
@@ -32,8 +32,6 @@ $self->{texts} = {
   'Cannot save order!'          => 'Auftrag kann nicht gespeichert werden!',
   'Cannot save quotation!'      => 'Angebot kann nicht gespeichert werden!',
   'Cc'                          => 'Cc',
   'Cannot save order!'          => 'Auftrag kann nicht gespeichert werden!',
   'Cannot save quotation!'      => 'Angebot kann nicht gespeichert werden!',
   'Cc'                          => 'Cc',
-  'Choose Customer'             => 'Endkunde wählen:',
-  'Choose Vendor'               => 'Händler wählen',
   'City'                        => 'Stadt',
   'Closed'                      => 'Geschlossen',
   'Collective Orders only work for orders from one customer!' => 'Sammelaufträge funktionieren nur für Aufträge von einem Kunden!',
   'City'                        => 'Stadt',
   'Closed'                      => 'Geschlossen',
   'Collective Orders only work for orders from one customer!' => 'Sammelaufträge funktionieren nur für Aufträge von einem Kunden!',
@@ -41,21 +39,18 @@ $self->{texts} = {
   'Confirm!'                    => 'Bestätigen Sie!',
   'Confirmation'                => 'Auftragsbestätigung',
   'Contact'                     => 'Kontakt',
   'Confirm!'                    => 'Bestätigen Sie!',
   'Confirmation'                => 'Auftragsbestätigung',
   'Contact'                     => 'Kontakt',
-  'Contact Person'              => 'Ansprechpartner',
   'Continue'                    => 'Weiter',
   'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
   'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
   'Could not write the html2ps config file.' => 'Die tempor&auml;re html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
   'Could not write the temporary HTML file.' => 'Eine tempor&auml;re HTML-Datei konnte nicht geschrieben werden.',
   'Country'                     => 'Land',
   'Continue'                    => 'Weiter',
   'Could not spawn html2ps or GhostScript.' => 'html2ps oder GhostScript konnte nicht gestartet werden.',
   'Could not spawn the printer command.' => 'Die Druckanwendung konnte nicht gestartet werden.',
   'Could not write the html2ps config file.' => 'Die tempor&auml;re html2ps-Konfigurationsdatei konnte nicht geschrieben werden.',
   'Could not write the temporary HTML file.' => 'Eine tempor&auml;re HTML-Datei konnte nicht geschrieben werden.',
   'Country'                     => 'Land',
-  'Credit Limit'                => 'Kreditlimit',
   'Credit Limit exceeded!!!'    => 'Kreditlimit überschritten!',
   'Credit Note'                 => 'Gutschrift',
   'Curr'                        => 'Währung',
   'Currency'                    => 'Währung',
   'Customer'                    => 'Kunde',
   'Customer Number'             => 'Kundennummer',
   'Credit Limit exceeded!!!'    => 'Kreditlimit überschritten!',
   'Credit Note'                 => 'Gutschrift',
   'Curr'                        => 'Währung',
   'Currency'                    => 'Währung',
   'Customer'                    => 'Kunde',
   'Customer Number'             => 'Kundennummer',
-  'Customer Order Number'       => 'Bestellnummer des Kunden',
   'Customer details'            => 'Kundendetails',
   'Customer missing!'           => 'Kundenname fehlt!',
   'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
   'Customer details'            => 'Kundendetails',
   'Customer missing!'           => 'Kundenname fehlt!',
   'Customer not on file or locked!' => 'Dieser Kunde existiert nicht oder ist gesperrt.',
@@ -67,7 +62,6 @@ $self->{texts} = {
   'Date'                        => 'Datum',
   'Dec'                         => 'Dez',
   'December'                    => 'Dezember',
   'Date'                        => 'Datum',
   'Dec'                         => 'Dez',
   'December'                    => 'Dezember',
-  'Delete'                      => 'Löschen',
   'Delivered'                   => 'Geliefert',
   'Delivery Date'               => 'Lieferdatum',
   'Department'                  => 'Abteilung',
   'Delivered'                   => 'Geliefert',
   'Delivery Date'               => 'Lieferdatum',
   'Department'                  => 'Abteilung',
@@ -75,7 +69,6 @@ $self->{texts} = {
   'Description'                 => 'Beschreibung',
   'Directory'                   => 'Verzeichnis',
   'Discount'                    => 'Rabatt',
   'Description'                 => 'Beschreibung',
   'Directory'                   => 'Verzeichnis',
   'Discount'                    => 'Rabatt',
-  'Dunning Amount'              => 'gemahnter Betrag',
   'E-mail'                      => 'eMail',
   'E-mail address missing!'     => 'E-Mail-Adresse fehlt!',
   'EK'                          => 'EK',
   'E-mail'                      => 'eMail',
   'E-mail address missing!'     => 'E-Mail-Adresse fehlt!',
   'EK'                          => 'EK',
@@ -107,11 +100,9 @@ $self->{texts} = {
   'ID'                          => 'Buchungsnummer',
   'In-line'                     => 'im Text',
   'Include in Report'           => 'In Bericht aufnehmen',
   'ID'                          => 'Buchungsnummer',
   'In-line'                     => 'im Text',
   'Include in Report'           => 'In Bericht aufnehmen',
-  'Internal Notes'              => 'interne Bemerkungen',
   'Invoice'                     => 'Rechnung',
   'Invoice Date missing!'       => 'Rechnungsdatum fehlt!',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
   'Invoice'                     => 'Rechnung',
   'Invoice Date missing!'       => 'Rechnungsdatum fehlt!',
   'Invoice Number missing!'     => 'Rechnungsnummer fehlt!',
-  'Item not on file!'           => 'Dieser Artikel ist nicht in der Datenbank!',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
   'Jan'                         => 'Jan',
   'January'                     => 'Januar',
   'Jul'                         => 'Jul',
@@ -126,7 +117,6 @@ $self->{texts} = {
   'March'                       => 'März',
   'Mark as paid?'               => 'Als bezahlt markieren?',
   'Marked as paid'              => 'Als bezahlt markiert',
   'March'                       => 'März',
   'Mark as paid?'               => 'Als bezahlt markieren?',
   'Marked as paid'              => 'Als bezahlt markiert',
-  'Max. Dunning Level'          => 'höchste Mahnstufe',
   'May'                         => 'Mai',
   'May '                        => 'Mai',
   'Message'                     => 'Nachricht',
   'May'                         => 'Mai',
   'May '                        => 'Mai',
   'Message'                     => 'Nachricht',
@@ -155,7 +145,6 @@ $self->{texts} = {
   'Open'                        => 'Offen',
   'OpenDocument/OASIS'          => 'OpenDocument/OASIS',
   'Order'                       => 'Auftrag',
   'Open'                        => 'Offen',
   'OpenDocument/OASIS'          => 'OpenDocument/OASIS',
   'Order'                       => 'Auftrag',
-  'Order Date'                  => 'Auftragsdatum',
   'Order Date missing!'         => 'Auftragsdatum fehlt!',
   'Order Number'                => 'Auftragsnummer',
   'Order Number missing!'       => 'Auftragsnummer fehlt!',
   'Order Date missing!'         => 'Auftragsdatum fehlt!',
   'Order Number'                => 'Auftragsnummer',
   'Order Number missing!'       => 'Auftragsnummer fehlt!',
@@ -170,18 +159,15 @@ $self->{texts} = {
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
   'Packing List'                => 'Lieferschein',
   'Packing List Date missing!'  => 'Datum für Verpackungsliste fehlt!',
   'Packing List Number missing!' => 'Verpackungslistennummer fehlt!',
-  'Part'                        => 'Ware',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
   'Part Description'            => 'Artikelbeschreibung',
   'Part Number'                 => 'Artikelnummer',
   'Part description'            => 'Artikelbeschreibung',
-  'Payment Terms'               => 'Zahlungskonditionen',
   'Phone'                       => 'Telefon',
   'Pick List'                   => 'Sammelliste',
   'Please enter values'         => 'Bitte Werte eingeben',
   'Postscript'                  => 'Postscript',
   'Price'                       => 'Preis',
   'Pricegroup'                  => 'Preisgruppe',
   'Phone'                       => 'Telefon',
   'Pick List'                   => 'Sammelliste',
   'Please enter values'         => 'Bitte Werte eingeben',
   'Postscript'                  => 'Postscript',
   'Price'                       => 'Preis',
   'Pricegroup'                  => 'Preisgruppe',
-  'Print'                       => 'Drucken',
   'Printer'                     => 'Drucker',
   'Proforma Invoice'            => 'Proformarechnung',
   'Project'                     => 'Projekt',
   'Printer'                     => 'Drucker',
   'Proforma Invoice'            => 'Proformarechnung',
   'Project'                     => 'Projekt',
@@ -193,7 +179,6 @@ $self->{texts} = {
   'Qty'                         => 'Menge',
   'Queue'                       => 'Warteschlange',
   'Quotation'                   => 'Angebot',
   'Qty'                         => 'Menge',
   'Queue'                       => 'Warteschlange',
   'Quotation'                   => 'Angebot',
-  'Quotation Date'              => 'Angebotsdatum',
   'Quotation Date missing!'     => 'Angebotsdatum fehlt!',
   'Quotation Number'            => 'Angebotsnummer',
   'Quotation Number missing!'   => 'Angebotsnummer fehlt!',
   'Quotation Date missing!'     => 'Angebotsdatum fehlt!',
   'Quotation Number'            => 'Angebotsnummer',
   'Quotation Number missing!'   => 'Angebotsnummer fehlt!',
@@ -201,7 +186,6 @@ $self->{texts} = {
   'Quotations'                  => 'Angebote',
   'RFQ'                         => 'Anfrage',
   'RFQ Number'                  => 'Anfragenummer',
   'Quotations'                  => 'Angebote',
   'RFQ'                         => 'Anfrage',
   'RFQ Number'                  => 'Anfragenummer',
-  'Remaining'                   => 'Rest',
   'Reqdate'                     => 'Lieferdatum',
   'Request for Quotation'       => 'Anfrage',
   'Request for Quotations'      => 'Anfragen',
   'Reqdate'                     => 'Lieferdatum',
   'Request for Quotation'       => 'Anfrage',
   'Request for Quotations'      => 'Anfragen',
@@ -212,10 +196,6 @@ $self->{texts} = {
   'Sales Order'                 => 'Kundenauftrag',
   'Sales Orders'                => 'Aufträge',
   'Salesman'                    => 'Verkäufer/in',
   'Sales Order'                 => 'Kundenauftrag',
   'Sales Orders'                => 'Aufträge',
   'Salesman'                    => 'Verkäufer/in',
-  'Salesperson'                 => 'Verkäufer',
-  'Save'                        => 'Speichern',
-  'Save and Close'              => 'Speichern und schließen',
-  'Save as new'                 => 'als neu speichern',
   'Screen'                      => 'Bildschirm',
   'Select a Customer'           => 'Endkunde auswählen',
   'Select a part'               => 'Artikel ausw&auml;hlen',
   'Screen'                      => 'Bildschirm',
   'Select a Customer'           => 'Endkunde auswählen',
   'Select a part'               => 'Artikel ausw&auml;hlen',
@@ -228,33 +208,25 @@ $self->{texts} = {
   'Sep'                         => 'Sep',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
   'Sep'                         => 'Sep',
   'September'                   => 'September',
   'Serial No.'                  => 'Seriennummer',
-  'Service'                     => 'Dienstleistung',
   'Ship'                        => 'Lagerausgang',
   'Ship rcvd'                   => 'Lagereingang',
   'Ship to'                     => 'Lieferadresse',
   'Ship via'                    => 'Transportmittel',
   'Shipping Address'            => 'Lieferadresse',
   'Ship'                        => 'Lagerausgang',
   'Ship rcvd'                   => 'Lagereingang',
   'Ship to'                     => 'Lieferadresse',
   'Ship via'                    => 'Transportmittel',
   'Shipping Address'            => 'Lieferadresse',
-  'Shipping Point'              => 'Versandort',
-  'Show details'                => 'Details anzeigen',
-  'Steuersatz'                  => 'Steuersatz',
   'Storno Invoice'              => 'Stornorechnung',
   'Storno Packing List'         => 'Stornolieferschein',
   'Street'                      => 'Straße',
   'Subject'                     => 'Betreff',
   'Subtotal'                    => 'Zwischensumme',
   'Tax'                         => 'Steuer',
   'Storno Invoice'              => 'Stornorechnung',
   'Storno Packing List'         => 'Stornolieferschein',
   'Street'                      => 'Straße',
   'Subject'                     => 'Betreff',
   'Subtotal'                    => 'Zwischensumme',
   'Tax'                         => 'Steuer',
-  'Tax Included'                => 'Steuer im Preis inbegriffen',
   'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
   'The list has been printed.'  => 'Die Liste wurde ausgedruckt.',
   'To (email)'                  => 'An',
   'Total'                       => 'Summe',
   'The \'tag\' field must only consist of alphanumeric characters or the carachters - _ ( )' => 'Das Feld \'tag\' darf nur aus alphanumerischen Zeichen und den Zeichen - _ ( ) bestehen.',
   'The list has been printed.'  => 'Die Liste wurde ausgedruckt.',
   'To (email)'                  => 'An',
   'Total'                       => 'Summe',
-  'Trade Discount'              => 'Rabatt',
   'Transaction description'     => 'Vorgangsbezeichnung',
   'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
   'Unit'                        => 'Einheit',
   'Unknown dependency \'%s\'.'  => 'Unbekannte Abh&auml;ngigkeit \'%s\'.',
   'Transaction description'     => 'Vorgangsbezeichnung',
   'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
   'Unit'                        => 'Einheit',
   'Unknown dependency \'%s\'.'  => 'Unbekannte Abh&auml;ngigkeit \'%s\'.',
-  'Update'                      => 'Erneuern',
-  'Valid until'                 => 'gültig bis',
   'Value'                       => 'Wert',
   'Variable'                    => 'Variable',
   'Vendor'                      => 'Lieferant',
   'Value'                       => 'Wert',
   'Variable'                    => 'Variable',
   'Vendor'                      => 'Lieferant',
@@ -264,7 +236,6 @@ $self->{texts} = {
   'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
   'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
   'Vendor type'                 => 'Lieferantentyp',
   'Vendor not on file or locked!' => 'Dieser Lieferant existiert nicht oder ist gesperrt.',
   'Vendor not on file!'         => 'Lieferant ist nicht in der Datenbank!',
   'Vendor type'                 => 'Lieferantentyp',
-  'What type of item is this?'  => 'Was ist dieser Artikel?',
   'Workflow purchase_order'     => 'Workflow Lieferantenauftrag',
   'Workflow request_quotation'  => 'Workflow Preisanfrage',
   'Workflow sales_order'        => 'Workflow Auftrag',
   'Workflow purchase_order'     => 'Workflow Lieferantenauftrag',
   'Workflow request_quotation'  => 'Workflow Preisanfrage',
   'Workflow sales_order'        => 'Workflow Auftrag',
@@ -275,7 +246,6 @@ $self->{texts} = {
   'bin_list'                    => 'Lagerliste',
   'button'                      => '?',
   'emailed to'                  => 'gemailt an',
   'bin_list'                    => 'Lagerliste',
   'button'                      => '?',
   'emailed to'                  => 'gemailt an',
-  'history'                     => 'Historie',
   'invoice'                     => 'Rechnung',
   'no'                          => 'nein',
   'none (pricegroup)'           => 'keine',
   'invoice'                     => 'Rechnung',
   'no'                          => 'nein',
   'none (pricegroup)'           => 'keine',