use SL::DB::Customer;
use SL::RP;
use SL::Iconv;
+use SL::Locale::String qw(t8);
use SL::ReportGenerator;
use Data::Dumper;
use List::MoreUtils qw(any);
my $is_trial_balance = $::form->{report} eq "trial_balance";
my $is_aging = $::form->{report} =~ /^a[rp]_aging$/;
my $is_payments = $::form->{report} =~ /(receipts|payments)$/;
+ my $format = 'html';
my ($label, $nextsub, $vc);
if ($is_aging) {
$nextsub = "generate_$::form->{report}";
$vc = qq|<input name=$::form->{vc} size=35 class="initial_focus">|;
+
+ $format = 'pdf';
}
my ($selection, $paymentaccounts);
}
}
+ setup_rp_report_action_bar();
+
$::form->header;
print $::form->parse_html_template('rp/report', {
paymentaccounts => $paymentaccounts,
is_income_statement => $is_income_statement,
is_erfolgsrechnung => $is_erfolgsrechnung,
is_projects => $is_projects,
+ format => $format,
});
$::lxdebug->leave_sub;
my @columns = qw(statement ct invnumber transdate duedate amount open);
my %column_defs = (
- 'statement' => { 'text' => '', 'visible' => $form->{ct} eq 'customer' ? 'HTML' : 0, },
+ 'statement' => { raw_header_data => $::request->presenter->checkbox_tag("checkall", checkall => '[name^=statement_]'), 'visible' => $form->{ct} eq 'customer' ? 'HTML' : 0, align => "center" },
'ct' => { 'text' => $form->{ct} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), },
'invnumber' => { 'text' => $locale->text('Invoice'), },
'transdate' => { 'text' => $locale->text('Date'), },
'raw_bottom_info_text' => $raw_bottom_info_text);
}
+ setup_rp_aging_action_bar(arap => $form->{arap});
$report->generate_with_headers();
$main::lxdebug->leave_sub();
}
-sub select_all {
- $main::lxdebug->enter_sub();
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
- my $locale = $main::locale;
-
- RP->aging(\%myconfig, \%$form);
-
- map { $_->{checked} = "checked" } @{ $form->{AG} };
-
- &aging;
-
- $main::lxdebug->leave_sub();
-}
-
-sub e_mail {
- $::lxdebug->enter_sub;
- $::auth->assert('general_ledger');
-
- # get name and email addresses
- my $selected = 0;
- for my $i (1 .. $::form->{rowcount}) {
- next unless $::form->{"statement_$i"};
- $::form->{"$::form->{ct}_id"} = $::form->{"$::form->{ct}_id_$i"};
- RP->get_customer(\%::myconfig, $::form);
- $selected = 1;
- last;
- }
-
- $::form->error($::locale->text('Nothing selected!')) unless $selected;
-
- $::form->{media} = "email";
-
- # save all other variables
- my @hidden_values;
- for my $key (keys %$::form) {
- next if any { $key eq $_ } qw(login password action email cc bcc subject message type sendmode format header);
- next unless '' eq ref $::form->{$key};
- push @hidden_values, $key;
- }
-
- $::form->header;
- print $::form->parse_html_template('rp/e_mail', {
- print_options => print_options(inline => 1),
- hidden_values => \@hidden_values,
- });
-
- $::lxdebug->leave_sub;
-}
-
sub send_email {
$main::lxdebug->enter_sub();
$form->{"statement_1"} = 1;
+ my $email_form = delete $form->{email_form};
+ my %field_names = (to => 'email');
+
+ $form->{ $field_names{$_} // $_ } = $email_form->{$_} for keys %{ $email_form };
+
$form->{media} = 'email';
print_form();
$main::lxdebug->leave_sub();
}
+
+sub setup_rp_aging_action_bar {
+ my %params = @_;
+
+ return unless $params{arap} eq 'ar';
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ combobox => [
+ action => [
+ t8('Print'),
+ call => [ 'kivi.SalesPurchase.show_print_dialog' ],
+ checks => [ [ 'kivi.check_if_entries_selected', '[name^=statement_]' ] ],
+ ],
+ action => [
+ t8('E Mail'),
+ call => [ 'kivi.SalesPurchase.show_email_dialog', 'send_email' ],
+ checks => [ [ 'kivi.check_if_entries_selected', '[name^=statement_]' ] ],
+ ],
+ ],
+ );
+ }
+}
+
+sub setup_rp_report_action_bar {
+ my %params = @_;
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add(
+ action => [
+ t8('Continue'),
+ submit => [ '#form', { action => 'continue' } ],
+ accesskey => 'enter',
+ ],
+ );
+ }
+}
+
1;
'E-Mail' => 'E-Mail',
'E-Mail-Journal' => 'E-Mail-Journal',
'E-mail' => 'E-Mail',
- 'E-mail Statement to' => 'Fälligkeitsabrechnung als E-Mail an',
'E-mail address missing!' => 'E-Mail-Adresse fehlt!',
'EAN' => 'EAN',
'EAN-Code' => 'EAN-Code',
'Select a customer' => 'Einen Kunden auswählen',
'Select a period' => 'Bitte Zeitraum auswählen',
'Select a vendor' => 'Einen Lieferanten auswählen',
- 'Select all' => 'Alle auswählen',
'Select charts for which the CB/OB transactions want to be posted.' => 'Wählen Sie Konten aus, zu welchen SB/EB-Buchungen erstellt werden sollen.',
'Select federal state...' => 'Bundesland auswählen...',
'Select file to upload' => 'Datei zum Hochladen auswählen',
[%- USE T8 %]
-[% USE HTML %] <input type="hidden" name="rowcount" value="[% HTML.escape(row_idx) %]">
-
- [% PRINT_OPTIONS %]
+[% USE HTML %][%- USE L -%] <input type="hidden" name="rowcount" value="[% HTML.escape(row_idx) %]">
<input type="hidden" name="todate" value="[% HTML.escape(todate) %]">
<input type="hidden" name="title" value="[% HTML.escape(title) %]">
<input type="hidden" name="customer" value="[% HTML.escape(customer) %]">
<input type="hidden" name="vendor" value="[% HTML.escape(vendor) %]">
<input type="hidden" name="department" value="[% HTML.escape(department) %]">
+ [% L.hidden_tag("formname", "statement") %]
- [% 'Statement' | $T8 %]
- <br>
- <input class="submit" type="submit" name="action" value="[% 'Select all' | $T8 %]">
- <input class="submit" type="submit" name="action" value="[% 'Print' | $T8 %]">
- <input class="submit" type="submit" name="action" value="[% 'E-mail' | $T8 %]">
+<div id="email_inputs" class="hidden"></div>
+<div id="print_options" class="hidden">
+ [% PRINT_OPTIONS %]
+</div>
+</form>
</form>
+<div id="print_dialog" class="hidden">
+ [%- PROCESS 'common/_print_dialog.html' %]
+</div>
+++ /dev/null
-[%- USE HTML %]
-[%- USE L %]
-[%- USE LxERP %]
-[%- USE T8 %]
-
-<h1>[% 'E-mail Statement to' | $T8 %] [% $ct %]</h1>
-
-<form method=post action='[% script %]'>
-
-<table>
- <tr>
- <th align=right nowrap>[% 'E-mail' | $T8 %]</th>
- <td><input name=email size=30 value="[% email %]"></td>
- <th align=right nowrap>[% 'Cc' | $T8 %]</th>
- <td><input name=cc size=30 value="[% cc %]"></td>
- </tr>
- <tr>
- <th align=right nowrap>[% 'Subject' | $T8 %]</th>
- <td><input name=subject size=30 value="[% subject %]"></td>
-[% IF AUTH.assert('email_bcc', 'may_fail') %]
- <th align=right nowrap=true>[% 'Bcc' | $T8 %]</th>
- <td><input name=bcc size=30 value="[% bcc | $T8 %]"></td>
-[%- END %]
- </tr>
-</table>
-<table width=100%>
- <tr>
- <th align=left nowrap>[% 'Message' | $T8 %]</th>
- </tr>
- <tr>
- <td><textarea name=message rows=15 cols=60 wrap=soft>[% message %]</textarea></td>
- </tr>
-</table>
-[% print_options %]
-<hr size=3 noshade>
-
-<input type=hidden name=nextsub value=send_email>
-[%- FOREACH var = hidden_values %]
-[% L.hidden_tag(var, $var) %]
-[%- END %]
-
-<br>
-<input name=action class=submit type=submit value="[% 'Continue' | $T8 %]">
-</form>
-