- print qq|
- <tr>
- <th align=right>| . $locale->text('Netto Terms') . qq|</th>
- <td><input name=terms_netto size=10 value="$form->{terms_netto}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Skonto Terms') . qq|</th>
- <td><input name=terms_skonto size=10 value="$form->{terms_skonto}"></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Skonto') . qq| %</th>
- <td><input name=percent_skonto size=10 value="$form->{percent_skonto}"></td>
- </tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-
-<p>| . $locale->text("You can use the following strings in the long " .
- "description and all translations. They will be " .
- "replaced by their actual values by Lx-Office " .
- "before they're output.")
-. qq|</p>
-
-<ul>
- <li>| . $locale->text("<%netto_date%> -- Date the payment is due in " .
- "full")
-. qq|</li>
- <li>| . $locale->text("<%skonto_date%> -- Date the payment is due " .
- "with discount")
-. qq|</li>
- <li>| . $locale->text("<%skonto_amount%> -- The deductible amount")
-. qq|</li>
- <li>| . $locale->text("<%total%> -- Amount payable")
-. qq|</li>
- <li>| . $locale->text("<%total_wo_skonto%> -- Amount payable less discount")
-. qq|</li>
- <li>| . $locale->text("<%invtotal%> -- Invoice total")
-. qq|</li>
- <li>| . $locale->text("<%invtotal_wo_skonto%> -- Invoice total less discount")
-. qq|</li>
- <li>| . $locale->text("<%currency%> -- The selected currency")
-. qq|</li>
- <li>| . $locale->text("<%terms_netto%> -- The number of days for " .
- "full payment")
-. qq|</li>
- <li>| . $locale->text("<%account_number%> -- Your account number")
-. qq|</li>
- <li>| . $locale->text("<%bank%> -- Your bank")
-. qq|</li>
- <li>| . $locale->text("<%bank_code%> -- Your bank code")
-. qq|</li>
-</ul>|;
-
- $lxdebug->leave_sub();
-}
-
-sub save_payment {
- $lxdebug->enter_sub();
-
- $auth->assert('config');
-
- $form->isblank("description", $locale->text('Description missing!'));
- $form->{"percent_skonto"} =
- $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100;
- AM->save_payment(\%myconfig, \%$form);
- $form->redirect($locale->text('Payment Terms saved!'));
-
- $lxdebug->leave_sub();
-}
-
-sub delete_payment {
- $lxdebug->enter_sub();
-
- $auth->assert('config');
-
- AM->delete_payment(\%myconfig, \%$form);
- $form->redirect($locale->text('Payment terms deleted!'));
-
- $lxdebug->leave_sub();
-}
-
-sub swap_payment_terms {
- $lxdebug->enter_sub();
-
- $auth->assert('config');
-
- AM->swap_sortkeys(\%myconfig, $form, "payment_terms");
- list_payment();
-
- $lxdebug->leave_sub();
-}
-
-sub edit_defaults {
- $lxdebug->enter_sub();
-
- # get defaults for account numbers and last numbers
- AM->defaultaccounts(\%myconfig, \%$form);
-
- map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} };
-
- foreach $key (keys %{ $form->{IC} }) {
- foreach $accno (sort keys %{ $form->{IC}->{$key} }) {
- my $array = "ACCNOS_" . uc($key);
- $form->{$array} ||= [];
-
- my $value = "${accno}--" . $form->{IC}->{$key}->{$accno}->{description};
- push @{ $form->{$array} }, {
- 'name' => $value,
- 'value' => $value,
- 'selected' => $form->{IC}->{$key}->{$accno}->{id} == $form->{defaults}->{$key},
- };
- }
- }
-
- $form->{title} = $locale->text('Ranges of numbers and default accounts');
-
- $form->header();
- print $form->parse_html_template('am/edit_defaults');
-
- $lxdebug->leave_sub();
-}
-
-sub save_defaults {
- $lxdebug->enter_sub();
-
- AM->save_defaults();
-
- $form->redirect($locale->text('Defaults saved.'));
-
- $lxdebug->leave_sub();
-}
-
-sub _build_cfg_options {
- my $idx = shift;
- my $array = uc($idx) . 'S';
-
- $form->{$array} = [];
- foreach my $item (@_) {
- push @{ $form->{$array} }, {
- 'name' => $item,
- 'value' => $item,
- 'selected' => $item eq $myconfig{$idx},
- };
- }
-}
-
-sub config {
- $lxdebug->enter_sub();
-
- _build_cfg_options('dateformat', qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd));
- _build_cfg_options('numberformat', qw(1,000.00 1000.00 1.000,00 1000,00));
-
- @formats = ();
- if ($opendocument_templates && $openofficeorg_writer_bin &&
- $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) {
- push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"),
- "value" => "opendocument_pdf" });
- }
- if ($latex_templates) {
- push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" });
- }
- push(@formats, { "name" => "HTML", "value" => "html" });
- if ($latex_templates) {
- push(@formats, { "name" => $locale->text("Postscript"),
- "value" => "postscript" });
- }
- if ($opendocument_templates) {
- push(@formats, { "name" => $locale->text("OpenDocument/OASIS"),
- "value" => "opendocument" });
- }
-
- if (!$myconfig{"template_format"}) {
- $myconfig{"template_format"} = "pdf";
- }
- $form->{TEMPLATE_FORMATS} = [];
- foreach $item (@formats) {
- push @{ $form->{TEMPLATE_FORMATS} }, {
- 'name' => $item->{name},
- 'value' => $item->{value},
- 'selected' => $item->{value} eq $myconfig{template_format},
- };
- }
-
- if (!$myconfig{"default_media"}) {
- $myconfig{"default_media"} = "screen";
- }
-
- my %selected = ($myconfig{"default_media"} => "selected");
- $form->{MEDIA} = [
- { 'name' => $locale->text('Screen'), 'value' => 'screen', 'selected' => $selected{screen}, },
- { 'name' => $locale->text('Printer'), 'value' => 'printer', 'selected' => $selected{printer}, },
- { 'name' => $locale->text('Queue'), 'value' => 'queue', 'selected' => $selected{queue}, },
- ];
-
- AM->printer(\%myconfig, $form);
-
- $form->{PRINTERS} = [];
- foreach my $printer (@{$form->{"ALL"}}) {
- push @{ $form->{PRINTERS} }, {
- 'name' => $printer->{printer_description},
- 'value' => $printer->{id},
- 'selected' => $printer->{id} == $myconfig{default_printer_id},
- };
- }
-
- %countrycodes = User->country_codes;
-
- $countrycodes{""} = "American English";
- $form->{COUNTRYCODES} = [];
- foreach $countrycode (sort { $countrycodes{$a} cmp $countrycodes{$b} } keys %countrycodes) {
- push @{ $form->{COUNTRYCODES} }, {
- 'name' => $countrycodes{$countrycode},
- 'value' => $countrycode,
- 'selected' => $countrycode eq $myconfig{countrycode},
- };
- }
-
- $form->{STYLESHEETS} = [];
- foreach $item (qw(lx-office-erp.css Win2000.css)) {
- push @{ $form->{STYLESHEETS} }, {
- 'name' => $item,
- 'value' => $item,
- 'selected' => $item eq $myconfig{stylesheet},
- };
- }
-
- $myconfig{show_form_details} = 1 unless (defined($myconfig{show_form_details}));
- $form->{"menustyle_$myconfig{menustyle}"} = 1;
- $form->{CAN_CHANGE_PASSWORD} = $auth->can_change_password();
-
- $form->{title} = $locale->text('Edit Preferences for #1', $form->{login});
-
- $form->header();
- print $form->parse_html_template('am/config');
-
- $lxdebug->leave_sub();
-}
-
-sub save_preferences {
- $lxdebug->enter_sub();
-
- $form->{stylesheet} = $form->{usestylesheet};
-
- $form->redirect($locale->text('Preferences saved!')) if (AM->save_preferences(\%myconfig, \%$form, $webdav));