- my $checkedclosed = $form->{"closed"} ? "checked" : "";
- my $checkeddelivered = $form->{"delivered"} ? "checked" : "";
-
- map { $form->{$_} =~ s/\"/"/g }
- 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} = $form->{jscalendar};
- $jsscript = "";
-
- $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->{jsscript}) {
-
- # with JavaScript Calendar
- $button1 = qq|
- <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>
- <td><input type=button name=transdate id="trigger1" value=|
- . $locale->text('button') . qq|></td>
- |;
- $button2 = qq|
- <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>
- <td width="4"><input type=button name=reqdate name=reqdate id="trigger2" value=|
- . $locale->text('button') . qq|></td>
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
- "reqdate", "BL", "trigger2");
-
- } else {
-
- # without JavaScript Calendar
- $button1 = qq|
- <td><input name=transdate id=transdate size=11 title="$myconfig{dateformat}" value=$form->{transdate}></td>|;
- $button2 = qq|
- <td width="13"><input name=reqdate id=reqdate size=11 title="$myconfig{dateformat}" value=$form->{reqdate}></td>|;
- }
-
- if ($form->{id}) {
- $openclosed = qq|
- <tr>
- <td colspan=2 align=center>
- <input name="closed" id="closed" type="checkbox" class="checkbox" value="1" $checkedclosed>
- <label for="closed">| . $locale->text('Closed') . qq|</label>
-|;
-
- if (($form->{"type"} eq "sales_order") ||
- ($form->{"type"} eq "purchase_order")) {
- $openclosed .= qq|
- <input name="delivered" id="delivered" type="checkbox" class="checkbox" value="1" $checkeddelivered>
- <label for="delivered">| . $locale->text('Delivered') . qq|</label>
-|;
- }
-
- $openclosed .= qq|
- </td>
- </tr>
-|;
- }
-
- # set option selected
- foreach $item ($form->{vc}, currency, department, employee) {
- $form->{"select$item"} =~ s/ selected//;
- $form->{"select$item"} =~
- s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
- }
-
- #quote select[customer|vendor] Bug 133
- $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
-
- my @old_project_ids = ($form->{"globalproject_id"});
- map({ push(@old_project_ids, $form->{"project_id_$_"})
- if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
-
- $form->get_lists("contacts" => "ALL_CONTACTS",
- "shipto" => "ALL_SHIPTO",
- "projects" => { "key" => "ALL_PROJECTS",
- "all" => 0,
- "old_id" => \@old_project_ids },
- "employees" => "ALL_SALESMEN");
-
- my (%labels, @values);
- 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 =
- NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values,
- '-labels' => \%labels, '-default' => $form->{"cp_id"}));
-
- %labels = ();
- @values = ("");
- foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
- push(@values, $item->{"shipto_id"});
- $labels{$item->{"shipto_id"}} =
- $item->{"shiptoname"} . " " . $item->{"shiptodepartment_1"};
- }
-
- my $shipto = qq|
- <th align=right>| . $locale->text('Shipping Address') . qq|</th>
- <td>| .
- NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values,
- '-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"}));
-
- $salesman = "";
- if ($form->{type} =~ /^sales_/) {
- %labels = ();
- @values = ("");
- foreach my $item (@{ $form->{ALL_SALESMEN} }) {
- push(@values, $item->{id});
- $labels{$item->{id}} = $item->{name} ne "" ? $item->{name} : $item->{login};
- }
-
- $salesman =
- qq|<tr>
- <th align="right">| . $locale->text('Salesman') . qq|</th>
- <td>| .
- NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{salesman_id},
- '-values' => \@values, '-labels' => \%labels))
- . qq|</td>
- </tr>|;
- }
-
- $form->{exchangerate} =
- $form->format_amount(\%myconfig, $form->{exchangerate});
-
- if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
- $creditwarning = 1;
- } else {
- $creditwarning = 0;
- }
-
- $form->{creditlimit} =
- $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
- $form->{creditremaining} =
- $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
-
- $exchangerate = qq|
-<input type=hidden name=forex value=$form->{forex}>
-|;