+ 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');
+ }
+ }
+ }
+
+ $form->{radier} =
+ ($form->current_date(\%myconfig) eq $form->{gldate}) ? 1 : 0;
+
+ $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>|;
+ }
+ }
+
+ my $set_duedate_url =
+ "$form->{script}?login=$form->{login}&path=$form->{path}&password=$form->{password}&action=set_duedate";
+
+ my $pjx = new CGI::Ajax( 'set_duedate' => $set_duedate_url );
+ push(@ { $form->{AJAX} }, $pjx);
+
+ if (@{ $form->{TAXZONE} }) {
+ $form->{selecttaxzone} = "";
+ foreach $item (@{ $form->{TAXZONE} }) {
+ if ($item->{id} == $form->{taxzone_id}) {
+ $form->{selecttaxzone} .=
+ "<option value=$item->{id} selected>" . H($item->{description}) .
+ "</option>";
+ } else {
+ $form->{selecttaxzone} .=
+ "<option value=$item->{id}>" . H($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/;
+ }
+ }
+
+ $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->{shipto_id} == $form->{shipto_id}) {
+ $form->{selectshipto} .=
+ "<option value=$item->{shipto_id} selected>$item->{shiptoname} $item->{shiptodepartment_1}</option>";
+ } else {
+ $form->{selectshipto} .=
+ "<option value=$item->{shipto_id}>$item->{shiptoname} $item->{shiptodepartment}</option>";
+ }
+
+ }
+ } else {
+ $form->{selectshipto} = $form->unquote($form->{selectshipto});
+ $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 style="width:200px;">$form->{selectshipto}</select></td>|;
+ $form->{selectshipto} = $form->quote($form->{selectshipto});
+ $shipto .= qq| <input type=hidden name=selectshipto value="$form->{selectshipto}">|;
+
+
+