use CGI::Ajax;
use CGI;
-use Data::Dumper;
-
require "bin/mozilla/common.pl";
use strict;
}
my $ChartTypeIsAccount = ($form->{charttype} eq "A") ? "1":"";
+ my $AccountIsPosted = ($form->{orphaned} ) ? "":"1";
$form->header();
my $parameters_ref = {
ChartTypeIsAccount => $ChartTypeIsAccount,
+ AccountIsPosted => $AccountIsPosted,
select_category => $select_category,
select_charttype => $select_charttype,
select_bwa => $select_bwa,
$main::lxdebug->leave_sub();
}
-sub add_department {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
-
- $main::auth->assert('config');
-
- $form->{title} = "Add";
- $form->{role} = "P";
-
- $form->{callback} = "am.pl?action=add_department" unless $form->{callback};
-
- &department_header;
- &form_footer;
-
- $main::lxdebug->leave_sub();
-}
-
-sub edit_department {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- $main::auth->assert('config');
-
- $form->{title} = "Edit";
-
- AM->get_department(\%myconfig, \%$form);
-
- &department_header;
- &form_footer;
-
- $main::lxdebug->leave_sub();
-}
-
-sub list_department {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- AM->departments(\%myconfig, \%$form);
-
- $form->{callback} = "am.pl?action=list_department";
-
- my $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Departments');
-
- my @column_index = qw(description cost profit);
- my %column_header;
- $column_header{description} =
- qq|<th class=listheading width=90%>|
- . $locale->text('Description')
- . qq|</th>|;
- $column_header{cost} =
- qq|<th class=listheading nowrap>|
- . $locale->text('Cost Center')
- . qq|</th>|;
- $column_header{profit} =
- qq|<th class=listheading nowrap>|
- . $locale->text('Profit Center')
- . qq|</th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
-
- my ($i, %column_data);
- foreach my $ref (@{ $form->{ALL} }) {
-
- $i++;
- $i %= 2;
-
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- my $costcenter = ($ref->{role} eq "C") ? "X" : "";
- my $profitcenter = ($ref->{role} eq "P") ? "X" : "";
-
- $column_data{description} =
- qq|<td><a href="am.pl?action=edit_department&id=$ref->{id}&callback=$callback">$ref->{description}</td>|;
- $column_data{cost} = qq|<td align=center>$costcenter</td>|;
- $column_data{profit} = qq|<td align=center>$profitcenter</td>|;
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=am.pl>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=type value=department>
-
-<input class=submit type=submit name=action value="|
- . $locale->text('Add') . qq|">
-
- </form>
-
- </body>
- </html>
-|;
-
- $main::lxdebug->leave_sub();
-}
-
-sub department_header {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- $form->{title} = $locale->text("$form->{title} Department");
-
- # $locale->text('Add Department')
- # $locale->text('Edit Department')
-
- $form->{description} =~ s/\"/"/g;
-
- my ($rows, $description);
- if (($rows = $form->numtextrows($form->{description}, 60)) > 1) {
- $description =
- qq|<textarea name="description" rows=$rows cols=60 wrap=soft>$form->{description}</textarea>|;
- } else {
- $description =
- qq|<input name=description size=60 value="$form->{description}">|;
- }
-
- my $costcenter = "checked" if $form->{role} eq "C";
- my $profitcenter = "checked" if $form->{role} eq "P";
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=am.pl>
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=department>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=2>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align=right>| . $locale->text('Description') . qq|</th>
- <td>$description</td>
- </tr>
- <tr>
- <td></td>
- <td><input type=radio style=radio name=role value="C" $costcenter> |
- . $locale->text('Cost Center') . qq|
- <input type=radio style=radio name=role value="P" $profitcenter> |
- . $locale->text('Profit Center') . qq|
- </td>
- <tr>
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $main::lxdebug->leave_sub();
-}
-
-sub save_department {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- $form->isblank("description", $locale->text('Description missing!'));
- AM->save_department(\%myconfig, \%$form);
- $form->redirect($locale->text('Department saved!'));
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_department {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- AM->delete_department(\%myconfig, \%$form);
- $form->redirect($locale->text('Department deleted!'));
-
- $main::lxdebug->leave_sub();
-}
-
sub add_lead {
$main::lxdebug->enter_sub();
$main::lxdebug->leave_sub();
}
-sub add_business {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
-
- $main::auth->assert('config');
-
- $form->{title} = "Add";
-
- $form->{callback} = "am.pl?action=add_business" unless $form->{callback};
-
- &business_header;
- &form_footer;
-
- $main::lxdebug->leave_sub();
-}
-
-sub edit_business {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- $form->{title} = "Edit";
-
- AM->get_business(\%myconfig, \%$form);
-
- &business_header;
-
- $form->{orphaned} = 1;
- &form_footer;
-
- $main::lxdebug->leave_sub();
-}
-
-sub list_business {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- AM->business(\%myconfig, \%$form);
-
- $form->{callback} = "am.pl?action=list_business";
-
- my $callback = $form->escape($form->{callback});
-
- $form->{title} = $locale->text('Type of Business');
-
- my @column_index = qw(description discount customernumberinit);
- push @column_index, 'salesman' if $::lx_office_conf{features}->{vertreter};
- my %column_header;
- $column_header{description} =
- qq|<th class=listheading width=60%>|
- . $locale->text('Description')
- . qq|</th>|;
- $column_header{discount} =
- qq|<th class=listheading width=10%>|
- . $locale->text('Discount')
- . qq| %</th>|;
- $column_header{customernumberinit} =
- qq|<th class=listheading>|
- . $locale->text('Customernumberinit')
- . qq|</th>|;
- $column_header{salesman} =
- qq|<th class=listheading>|
- . $locale->text('Representative')
- . qq|</th>|;
-
- $form->header;
-
- print qq|
-<body>
-
-<table width=100%>
- <tr>
- <th class=listtop>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <td>
- <table width=100%>
- <tr class=listheading>
-|;
-
- map { print "$column_header{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
-
- my ($i, %column_data);
- foreach my $ref (@{ $form->{ALL} }) {
-
- $i++;
- $i %= 2;
-
- print qq|
- <tr valign=top class=listrow$i>
-|;
-
- my $discount = $form->format_amount(\%myconfig, $ref->{discount} * 100);
- my $description = $ref->{description};
- $column_data{description} = qq|<td><a href="am.pl?action=edit_business&id=$ref->{id}&callback=$callback">$description</td>|;
- $column_data{discount} = qq|<td align=right>$discount</td>|;
- $column_data{customernumberinit} =
- qq|<td align=right>$ref->{customernumberinit}</td>|;
- $column_data{salesman} = '<td>' . ($ref->{salesman} ? $::locale->text('Yes') : $::locale->text('No')) . '</td>';
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
- </tr>
-|;
- }
-
- print qq|
- </table>
- </td>
- </tr>
- <tr>
- <td><hr size=3 noshade></td>
- </tr>
-</table>
-
-<br>
-<form method=post action=am.pl>
-
-<input name=callback type=hidden value="$form->{callback}">
-
-<input type=hidden name=type value=business>
-
-<input class=submit type=submit name=action value="|
- . $locale->text('Add') . qq|">
-
- </form>
-
- </body>
- </html>
-|;
-
- $main::lxdebug->leave_sub();
-}
-
-sub business_header {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- $form->{title} = $locale->text("$form->{title} Business");
-
- # $locale->text('Add Business')
- # $locale->text('Edit Business')
-
- $form->{description} =~ s/\"/"/g;
- $form->{discount} =
- $form->format_amount(\%myconfig, $form->{discount} * 100);
-
- my $salesman_code;
- if ($::lx_office_conf{features}->{vertreter}) {
- $salesman_code = qq|
- <tr>
- <th align="right">| . $locale->text('Representative') . qq|</th>
- <td>| . $::cgi->checkbox(-name => "salesman", -value => 1, -label => '', 'checked' => $form->{salesman} ? 1 : 0) . qq|</td>
- </tr>
-|;
- } else {
- $salesman_code = $::cgi->hidden(-name => 'salesman', -value => $form->{salesman} ? 1 : 0);
- }
-
- $form->header;
-
- print qq|
-<body>
-
-<form method=post action=am.pl>
-
-<input type=hidden name=id value=$form->{id}>
-<input type=hidden name=type value=business>
-
-<table width=100%>
- <tr>
- <th class=listtop colspan=2>$form->{title}</th>
- </tr>
- <tr height="5"></tr>
- <tr>
- <th align=right>| . $locale->text('Type of Business') . qq|</th>
- <td><input name=description size=30 value="$form->{description}"></td>
- <tr>
- <tr>
- <th align=right>| . $locale->text('Discount') . qq| %</th>
- <td><input name=discount size=5 value=$form->{discount}></td>
- </tr>
- <tr>
- <th align=right>| . $locale->text('Customernumberinit') . qq|</th>
- <td><input name=customernumberinit size=10 value=$form->{customernumberinit}></td>
- </tr>
-$salesman_code
- <td colspan=2><hr size=3 noshade></td>
- </tr>
-</table>
-|;
-
- $main::lxdebug->leave_sub();
-}
-
-sub save_business {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- $form->isblank("description", $locale->text('Description missing!'));
- $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100;
- AM->save_business(\%myconfig, \%$form);
- $form->redirect($locale->text('Business saved!'));
-
- $main::lxdebug->leave_sub();
-}
-
-sub delete_business {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- $main::auth->assert('config');
-
- AM->delete_business(\%myconfig, \%$form);
- $form->redirect($locale->text('Business deleted!'));
-
- $main::lxdebug->leave_sub();
-}
-
sub add_language {
$main::lxdebug->enter_sub();
}
my $linkaccounts;
- if (!$::lx_office_conf{system}->{eur}) {
+ if ( $::instance_conf->get_inventory_system eq 'perpetual' ) { # was !$::lx_office_conf{system}->{eur}) {
$linkaccounts = qq|
<tr>
<th align=right>| . $locale->text('Inventory') . qq|</th>
<td><select name=inventory_accno_id>$form->{selectIC}</select></td>
<input name=selectIC type=hidden value="$form->{selectIC}">
</tr>|;
- } else {
+ } elsif ( $::instance_conf->get_inventory_system eq 'periodic' ) {
+ # don't allow choice of inventory accno and don't show that line
$linkaccounts = qq|
<input type=hidden name=inventory_accno_id value=$form->{inventory_accno_id}>|;
- }
+ };
$linkaccounts .= qq|
map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} };
+ # default language
+ my $all_languages = SL::DB::Manager::Language->get_all;
+
+# EÜR = cash, Bilanzierung = accrual
+
foreach my $key (keys %{ $form->{IC} }) {
foreach my $accno (sort keys %{ $form->{IC}->{$key} }) {
my $array = "ACCNOS_" . uc($key);
$form->{title} = $locale->text('Ranges of numbers and default accounts');
$form->header();
- print $form->parse_html_template('am/edit_defaults');
+ print $form->parse_html_template('am/edit_defaults',
+ { ALL_LANGUAGES => $all_languages, });
$main::lxdebug->leave_sub();
}
{ 'name' => $locale->text('Queue'), 'value' => 'queue', 'selected' => $selected{queue}, },
];
- $form->{PRINTERS} = [];
- foreach my $printer (SL::Printer->all_printers(%::myconfig)) {
- push @{ $form->{PRINTERS} }, {
- 'name' => $printer->{printer_description},
- 'value' => $printer->{id},
- 'selected' => $printer->{id} == $myconfig{default_printer_id},
- };
- }
+ $form->{PRINTERS} = [ SL::Printer->all_printers(%::myconfig) ];
my %countrycodes = User->country_codes;