+  if ($edit) {
+
+    if ($form->{type} eq "credit_note") {
+      $form->{title} = $locale->text('Edit Credit Note');
+    
+      if ($form->{storno}) {
+        $form->{title} = $locale->text('Edit Storno Credit Note');
+      }
+    } else {
+      $form->{title} = $locale->text('Edit Sales Invoice');
+    
+      if ($form->{storno}) {
+        $form->{title} = $locale->text('Edit Storno Invoice');
+      }
+    }
+  }
+
+  $payment = qq|<option value=""></option>|;
+  foreach $item (@{ $form->{payment_terms} }) {
+    if ($form->{payment_id} eq $item->{id}) {
+      $payment .= qq|<option value="$item->{id}" selected>$item->{description}</option>|;
+    } else {
+      $payment .= qq|<option value="$item->{id}">$item->{description}</option>|;
+    }
+  }
+
+
+  if (@{ $form->{TAXZONE} }) {
+    $form->{selecttaxzone} = "";
+    foreach $item (@{ $form->{TAXZONE} }) {
+      if ($item->{id} == $form->{taxzone_id}) {
+        $form->{selecttaxzone} .=
+          "<option value=$item->{id} selected>$item->{description}</option>";
+      } else {
+        $form->{selecttaxzone} .=
+          "<option value=$item->{id}>$item->{description}</option>";
+      }
+
+    }
+  } else {
+    $form->{selecttaxzone} =~ s/ selected//g;
+    if ($form->{taxzone_id} ne "") {
+      $form->{selecttaxzone} =~ s/value=$form->{taxzone_id}/value=$form->{taxzone_id} selected/;
+    }
+  }
+  if ($form->{rowcount} >0) {
+    $form->{selecttaxzone} =~ /<option value=\d+ selected>.*?<\/option>/;
+    $form->{selecttaxzone} = $&;
+  }
+  
+
+  $taxzone = qq|
+             <tr>
+               <th align=right>| . $locale->text('Steuersatz') . qq|</th>
+               <td><select name=taxzone_id>$form->{selecttaxzone}</select></td>
+               <input type=hidden name=selecttaxzone value="$form->{selecttaxzone}">
+             </tr>|;
+
+
+  if (@{ $form->{SHIPTO} }) {
+    $form->{selectshipto} = "<option value=0></option>";
+    foreach $item (@{ $form->{SHIPTO} }) {
+      if ($item->{id} == $form->{shipto_id}) {
+        $form->{selectshipto} .=
+          "<option value=$item->{id} selected>$item->{shiptoname}</option>";
+      } else {
+        $form->{selectshipto} .=
+          "<option value=$item->{id}>$item->{shiptoname}</option>";
+      }
+
+    }
+  } else {
+    $form->{selectshipto} =~ s/ selected//g;
+    if ($form->{shipto_id} ne "") {
+      $form->{selectshipto} =~ s/value=$form->{shipto_id}/value=$form->{shipto_id} selected/;
+    }
+  }
+
+  $shipto = qq|
+               <th align=right>| . $locale->text('Shipping Address') . qq|</th>
+               <td><select name=shipto_id>$form->{selectshipto}</select></td>
+               <input type=hidden name=selectshipto value="$form->{selectshipto}">|;
+
+
+