--- /dev/null
+package SL::Controller::YearEndTransactions;
+
+use strict;
+
+use parent qw(SL::Controller::Base);
+
+use DateTime;
+use SL::Locale::String qw(t8);
+use SL::ReportGenerator;
+use SL::Helper::Flash;
+use SL::DBUtils;
+
+use SL::DB::Chart;
+use SL::DB::GLTransaction;
+use SL::DB::AccTransaction;
+use SL::DB::Helper::AccountingPeriod qw(get_balance_starting_date);
+
+use Rose::Object::MakeMethods::Generic (
+ 'scalar --get_set_init' => [ qw(charts charts9000 cbob_chart cb_date cb_startdate ob_date cb_reference ob_reference cb_description ob_description) ],
+);
+
+__PACKAGE__->run_before('check_auth');
+
+sub action_filter {
+ my ($self) = @_;
+
+ $self->ob_date(DateTime->today->truncate(to => 'year')) if !$self->ob_date;
+ $self->cb_date(DateTime->today->truncate(to => 'year')->add(days => -1)) if !$self->cb_date;
+ $self->ob_reference(t8('OB Transaction')) if !$self->ob_reference;
+ $self->cb_reference(t8('CB Transaction')) if !$self->cb_reference;
+ $self->ob_description(t8('OB Transaction')) if !$self->ob_description;
+ $self->cb_description(t8('CB Transaction')) if !$self->cb_description;
+ $self->render('gl/yearend_filter',
+ title => t8('CB/OB Transactions'),
+ make_title_of_chart => sub { $_[0]->accno.' '.$_[0]->description }
+ );
+
+}
+
+sub action_list {
+ my ($self) = @_;
+ $main::lxdebug->enter_sub();
+
+ my $report = SL::ReportGenerator->new(\%::myconfig, $::form);
+
+ $self->prepare_report($report);
+
+ $report->set_options(
+ output_format => 'HTML',
+ raw_top_info_text => $::form->parse_html_template('gl/yearend_top', { SELF => $self }),
+ raw_bottom_info_text => $::form->parse_html_template('gl/yearend_bottom', { SELF => $self }),
+ allow_pdf_export => 0,
+ allow_csv_export => 0,
+ title => $::locale->text('CB/OB Transactions'),
+ );
+ $report->generate_with_headers();
+ $main::lxdebug->leave_sub();
+}
+
+sub action_generate {
+ my ($self) = @_;
+
+ my $cnt = $self->make_booking();
+
+ flash('info', $::locale->text('#1 CB transactions and #1 OB transactions generated.',$cnt)) if $cnt > 0;
+
+ $self->action_list;
+}
+
+sub check_auth {
+ $::auth->assert('general_ledger');
+}
+
+#
+# helpers
+#
+
+sub make_booking {
+ my ($self) = @_;
+ $main::lxdebug->enter_sub();
+ my @ids = map { $::form->{"trans_id_$_"} } grep { $::form->{"multi_id_$_"} } (1..$::form->{rowcount});
+ my $cnt = 0;
+ $main::lxdebug->message(LXDebug->DEBUG2(),"generate for ".$::form->{cbob_chart}." # ".scalar(@ids)." charts");
+ if (scalar(@ids) && $::form->{cbob_chart}) {
+ my $carryoverchart = SL::DB::Manager::Chart->get_first( query => [ id => $::form->{cbob_chart} ] );
+ my $charts = SL::DB::Manager::Chart->get_all( query => [ id => \@ids ] );
+ foreach my $chart (@{ $charts }) {
+ $main::lxdebug->message(LXDebug->DEBUG2(),"chart_id=".$chart->id." accno=".$chart->accno);
+ my $balance = $self->get_balance($chart);
+ if ( $balance != 0 ) {
+ # SB
+ $self->gl_booking($balance,$self->cb_date,$::form->{cb_reference},$::form->{cb_description},$chart,$carryoverchart,0,1);
+ # EB
+ $self->gl_booking($balance,$self->ob_date,$::form->{ob_reference},$::form->{ob_description},$carryoverchart,$chart,1,0);
+ $cnt++;
+ }
+ }
+ }
+ $main::lxdebug->leave_sub();
+ return $cnt;
+}
+
+
+sub prepare_report {
+ my ($self,$report) = @_;
+ $main::lxdebug->enter_sub();
+ my $idx = 1;
+ my $cgi = $::request->{cgi};
+
+ my %column_defs = (
+ 'ids' => { 'text' => '<input type="checkbox" id="multi_all" value="1">', 'align' => 'center' },
+ 'chart' => { 'text' => $::locale->text('Account'), },
+ 'description' => { 'text' => $::locale->text('Description'), },
+ 'saldo' => { 'text' => $::locale->text('Saldo'), 'align' => 'right'},
+ 'sum_cb' => { 'text' => $::locale->text('Sum CB Transactions'), 'align' => 'right'}, ##close == Schluss
+ 'sum_ob' => { 'text' => $::locale->text('Sum OB Transactions'), 'align' => 'right'}, ##open == Eingang
+ );
+ my @columns = qw(ids chart description saldo sum_cb sum_ob);
+ map { $column_defs{$_}->{visible} = 1 } @columns;
+ my $ob_next_date = $::locale->parse_date_to_object($self->ob_date)->add(years => 1)->add(days => -1)->to_kivitendo;
+
+ $self->cb_startdate($self->get_balance_starting_date($self->cb_date));
+
+ my @custom_headers = ();
+ # Zeile 1:
+ push @custom_headers, [
+ { 'text' => ' ', 'colspan' => 3 },
+ { 'text' => $::locale->text("Timerange")."<br />".$self->cb_startdate." - ".$self->cb_date, 'colspan' => 2, 'align' => 'center'},
+ { 'text' => $::locale->text("Timerange")."<br />".$self->ob_date." - ".$ob_next_date, 'align' => 'center'},
+ ];
+
+ # Zeile 2:
+ my @line_2 = ();
+ map { push @line_2 , $column_defs{$_} } grep { $column_defs{$_}->{visible} } @columns;
+ push @custom_headers, [ @line_2 ];
+
+ $report->set_custom_headers(@custom_headers);
+ $report->set_columns(%column_defs);
+ $report->set_column_order(@columns);
+
+ my $chart9actual = SL::DB::Manager::Chart->get_first( query => [ id => $self->cbob_chart ] );
+ $self->{cbob_chartaccno} = $chart9actual->accno.' '.$chart9actual->description;
+
+ foreach my $chart (@{ $self->charts }) {
+ my $balance = $self->get_balance($chart);
+ if ( $balance != 0 ) {
+ my $chart_id = $chart->id;
+ my $row = { map { $_ => { 'data' => '' } } @columns };
+ $row->{ids} = {
+ 'raw_data' => $cgi->hidden('-name' => "trans_id_${idx}", '-value' => $chart_id)
+ . $cgi->checkbox('-name' => "multi_id_${idx}",' id' => "multi_id_id_".$chart_id, '-value' => 1, '-label' => ''),
+ 'valign' => 'center',
+ 'align' => 'center',
+ };
+ $row->{chart}->{data} = $chart->accno;
+ $row->{description}->{data} = $chart->description;
+ if ( $balance > 0 ) {
+ $row->{saldo}->{data} = $::form->format_amount(\%::myconfig, $balance, 2)." H";
+ } elsif ( $balance < 0 ) {
+ $row->{saldo}->{data} = $::form->format_amount(\%::myconfig,-$balance, 2)." S";
+ } else {
+ $row->{saldo}->{data} = $::form->format_amount(\%::myconfig,0, 2)." ";
+ }
+ my $sum_cb = 0;
+ foreach my $acc ( @{ SL::DB::Manager::AccTransaction->get_all(where => [ chart_id => $chart->id, cb_transaction => 't',
+ transdate => { ge => $self->cb_startdate},
+ transdate => { le => $self->cb_date }]) }) {
+ $sum_cb += $acc->amount;
+ }
+ my $sum_ob = 0;
+ foreach my $acc ( @{ SL::DB::Manager::AccTransaction->get_all(where => [ chart_id => $chart->id, ob_transaction => 't',
+ transdate => { ge => $self->ob_date},
+ transdate => { le => $ob_next_date }]) }) {
+ $sum_ob += $acc->amount;
+ }
+ if ( $sum_cb > 0 ) {
+ $row->{sum_cb}->{data} = $::form->format_amount(\%::myconfig, $sum_cb, 2)." H";
+ } elsif ( $sum_cb < 0 ) {
+ $row->{sum_cb}->{data} = $::form->format_amount(\%::myconfig,-$sum_cb, 2)." S";
+ } else {
+ $row->{sum_cb}->{data} = $::form->format_amount(\%::myconfig,0, 2)." ";
+ }
+ if ( $sum_ob > 0 ) {
+ $row->{sum_ob}->{data} = $::form->format_amount(\%::myconfig, $sum_ob, 2)." H";
+ } elsif ( $sum_ob < 0 ) {
+ $row->{sum_ob}->{data} = $::form->format_amount(\%::myconfig,-$sum_ob, 2)." S";
+ } else {
+ $row->{sum_ob}->{data} = $::form->format_amount(\%::myconfig,0, 2)." ";
+ }
+ $report->add_data($row);
+ }
+ $idx++;
+ }
+
+ $self->{row_count} = $idx;
+ $main::lxdebug->leave_sub();
+}
+
+sub get_balance {
+ $main::lxdebug->enter_sub();
+ my ($self,$chart) = @_;
+
+## eigene Abfrage da SL:DB:Chart->get_balance keine cb_transactions mitzählt
+## Alternative in Chart cb_transaction abfrage per neuem Parameter 'with_cb' disablen:
+# my %balance_params = ( fromdate => $self->startdate,
+# todate => $self->cb_date,
+# accounting_method => 'accrual',
+# with_cb => 1, ## in Chart cb_transaction abfrage disablen
+# );
+# return $chart->get_balance(%balance_params);
+
+ $main::lxdebug->message(LXDebug->DEBUG2(),"get_balance from=".$self->cb_startdate." to=".$self->cb_date);
+ my $query = qq|SELECT SUM(amount) AS sum FROM acc_trans WHERE chart_id = ? | .
+ qq| AND transdate >= ? AND transdate <= ? |;
+ my @query_args = ( $chart->id, $self->cb_startdate, $self->cb_date);
+ my ($balance) = selectfirst_array_query($::form, $chart->db->dbh, $query, @query_args);
+
+ $main::lxdebug->leave_sub();
+ return 0 unless $balance != 0;
+ return $balance;
+}
+
+sub gl_booking {
+ my ($self, $amount, $transdate, $reference, $description, $konto, $gegenkonto, $ob, $cb) = @_;
+ $::form->get_employee();
+ my $employee_id = $::form->{employee_id};
+ $main::lxdebug->message(LXDebug->DEBUG2(),"employee_id=".$employee_id." ob=".$ob." cb=".$cb);
+ my $gl_entry = SL::DB::GLTransaction->new();
+ $gl_entry->assign_attributes(
+ employee_id => $employee_id,
+ transdate => $transdate,
+ reference => $reference,
+ description => $description,
+ ob_transaction => $ob,
+ cb_transaction => $cb,
+ );
+ $gl_entry->save;
+ my $kto_trans1 = SL::DB::AccTransaction->new();
+ $kto_trans1->assign_attributes(
+ trans_id => $gl_entry->id,
+ transdate => $transdate,
+ ob_transaction => $ob,
+ cb_transaction => $cb,
+ chart_id => $gegenkonto->id,
+ chart_link => $konto->link,
+ tax_id => 0,
+ taxkey => 0,
+ amount => $amount,
+ );
+ $kto_trans1->save;
+ my $kto_trans2 = SL::DB::AccTransaction->new();
+ $kto_trans2->assign_attributes(
+ trans_id => $gl_entry->id,
+ transdate => $transdate,
+ ob_transaction => $ob,
+ cb_transaction => $cb,
+ chart_id => $konto->id,
+ chart_link => $konto->link,
+ tax_id => 0,
+ taxkey => 0,
+ amount => -$amount,
+ );
+ $kto_trans2->save;
+}
+
+sub init_cbob_chart { $::form->{cbob_chart} }
+sub init_ob_date { $::form->{ob_date} }
+sub init_ob_reference { $::form->{ob_reference} }
+sub init_ob_description { $::form->{ob_description} }
+sub init_cb_startdate { $::form->{cb_startdate} }
+sub init_cb_date { $::form->{cb_date} }
+sub init_cb_reference { $::form->{cb_reference} }
+sub init_cb_description { $::form->{cb_description} }
+
+sub init_charts9000 {
+ # wie geht prüfen von länge auf 4 in rose ?
+ SL::DB::Manager::Chart->get_all( query => [ \ "accno like '9%' and length(accno) = 4"] );
+ #SL::DB::Manager::Chart->get_all( query => [ accno => { like => '9%'}] );
+}
+
+sub init_charts {
+ # wie geht 'not like' in rose ?
+ SL::DB::Manager::Chart->get_all( query => [ \ "accno not like '9%'"], sort_by => 'accno ASC' );
+}
+
+1;
+++ /dev/null
-package SL::Controller::YearlyTransactions;
-
-use strict;
-
-use parent qw(SL::Controller::Base);
-
-use DateTime;
-use SL::Locale::String qw(t8);
-use SL::ReportGenerator;
-use SL::Helper::Flash;
-use SL::DBUtils;
-
-use SL::DB::Chart;
-use SL::DB::GLTransaction;
-use SL::DB::AccTransaction;
-use SL::DB::Helper::AccountingPeriod qw(get_balance_starting_date);
-
-use Rose::Object::MakeMethods::Generic (
- 'scalar --get_set_init' => [ qw(charts charts9000 cbob_chart cb_date cb_startdate ob_date cb_reference ob_reference cb_description ob_description) ],
-);
-
-__PACKAGE__->run_before('check_auth');
-
-sub action_filter {
- my ($self) = @_;
-
- $self->ob_date(DateTime->today->truncate(to => 'year')) if !$self->ob_date;
- $self->cb_date(DateTime->today->truncate(to => 'year')->add(days => -1)) if !$self->cb_date;
- $self->ob_reference(t8('OB Transaction')) if !$self->ob_reference;
- $self->cb_reference(t8('CB Transaction')) if !$self->cb_reference;
- $self->ob_description(t8('OB Transaction')) if !$self->ob_description;
- $self->cb_description(t8('CB Transaction')) if !$self->cb_description;
- $self->render('gl/yearly_filter',
- title => t8('CB/OB Transactions'),
- make_title_of_chart => sub { $_[0]->accno.' '.$_[0]->description }
- );
-
-}
-
-sub action_list {
- my ($self) = @_;
- $main::lxdebug->enter_sub();
-
- my $report = SL::ReportGenerator->new(\%::myconfig, $::form);
-
- $self->prepare_report($report);
-
- $report->set_options(
- output_format => 'HTML',
- raw_top_info_text => $::form->parse_html_template('gl/yearly_top', { SELF => $self }),
- raw_bottom_info_text => $::form->parse_html_template('gl/yearly_bottom', { SELF => $self }),
- allow_pdf_export => 0,
- allow_csv_export => 0,
- title => $::locale->text('CB/OB Transactions'),
- );
- $report->generate_with_headers();
- $main::lxdebug->leave_sub();
-}
-
-sub action_generate {
- my ($self) = @_;
-
- my $cnt = $self->make_booking();
-
- flash('info', $::locale->text('#1 CB transactions and #1 OB transactions generated.',$cnt)) if $cnt > 0;
-
- $self->action_list;
-}
-
-sub check_auth {
- $::auth->assert('general_ledger');
-}
-
-#
-# helpers
-#
-
-sub make_booking {
- my ($self) = @_;
- $main::lxdebug->enter_sub();
- my @ids = map { $::form->{"trans_id_$_"} } grep { $::form->{"multi_id_$_"} } (1..$::form->{rowcount});
- my $cnt = 0;
- $main::lxdebug->message(LXDebug->DEBUG2(),"generate for ".$::form->{cbob_chart}." # ".scalar(@ids)." charts");
- if (scalar(@ids) && $::form->{cbob_chart}) {
- my $carryoverchart = SL::DB::Manager::Chart->get_first( query => [ id => $::form->{cbob_chart} ] );
- my $charts = SL::DB::Manager::Chart->get_all( query => [ id => \@ids ] );
- foreach my $chart (@{ $charts }) {
- $main::lxdebug->message(LXDebug->DEBUG2(),"chart_id=".$chart->id." accno=".$chart->accno);
- my $balance = $self->get_balance($chart);
- if ( $balance != 0 ) {
- # SB
- $self->gl_booking($balance,$self->cb_date,$::form->{cb_reference},$::form->{cb_description},$chart,$carryoverchart,0,1);
- # EB
- $self->gl_booking($balance,$self->ob_date,$::form->{ob_reference},$::form->{ob_description},$carryoverchart,$chart,1,0);
- $cnt++;
- }
- }
- }
- $main::lxdebug->leave_sub();
- return $cnt;
-}
-
-
-sub prepare_report {
- my ($self,$report) = @_;
- $main::lxdebug->enter_sub();
- my $idx = 1;
- my $cgi = $::request->{cgi};
-
- my %column_defs = (
- 'ids' => { 'text' => '<input type="checkbox" id="multi_all" value="1">', 'align' => 'center' },
- 'chart' => { 'text' => $::locale->text('Account'), },
- 'description' => { 'text' => $::locale->text('Description'), },
- 'saldo' => { 'text' => $::locale->text('Saldo'), 'align' => 'right'},
- 'sum_cb' => { 'text' => $::locale->text('Sum CB Transactions'), 'align' => 'right'}, ##close == Schluss
- 'sum_ob' => { 'text' => $::locale->text('Sum OB Transactions'), 'align' => 'right'}, ##open == Eingang
- );
- my @columns = qw(ids chart description saldo sum_cb sum_ob);
- map { $column_defs{$_}->{visible} = 1 } @columns;
- my $ob_next_date = $::locale->parse_date_to_object($self->ob_date)->add(years => 1)->add(days => -1)->to_kivitendo;
-
- $self->cb_startdate($self->get_balance_starting_date($self->cb_date));
-
- my @custom_headers = ();
- # Zeile 1:
- push @custom_headers, [
- { 'text' => ' ', 'colspan' => 3 },
- { 'text' => $::locale->text("Timerange")."<br />".$self->cb_startdate." - ".$self->cb_date, 'colspan' => 2, 'align' => 'center'},
- { 'text' => $::locale->text("Timerange")."<br />".$self->ob_date." - ".$ob_next_date, 'align' => 'center'},
- ];
-
- # Zeile 2:
- my @line_2 = ();
- map { push @line_2 , $column_defs{$_} } grep { $column_defs{$_}->{visible} } @columns;
- push @custom_headers, [ @line_2 ];
-
- $report->set_custom_headers(@custom_headers);
- $report->set_columns(%column_defs);
- $report->set_column_order(@columns);
-
- my $chart9actual = SL::DB::Manager::Chart->get_first( query => [ id => $self->cbob_chart ] );
- $self->{cbob_chartaccno} = $chart9actual->accno.' '.$chart9actual->description;
-
- foreach my $chart (@{ $self->charts }) {
- my $balance = $self->get_balance($chart);
- if ( $balance != 0 ) {
- my $chart_id = $chart->id;
- my $row = { map { $_ => { 'data' => '' } } @columns };
- $row->{ids} = {
- 'raw_data' => $cgi->hidden('-name' => "trans_id_${idx}", '-value' => $chart_id)
- . $cgi->checkbox('-name' => "multi_id_${idx}",' id' => "multi_id_id_".$chart_id, '-value' => 1, '-label' => ''),
- 'valign' => 'center',
- 'align' => 'center',
- };
- $row->{chart}->{data} = $chart->accno;
- $row->{description}->{data} = $chart->description;
- if ( $balance > 0 ) {
- $row->{saldo}->{data} = $::form->format_amount(\%::myconfig, $balance, 2)." H";
- } elsif ( $balance < 0 ) {
- $row->{saldo}->{data} = $::form->format_amount(\%::myconfig,-$balance, 2)." S";
- } else {
- $row->{saldo}->{data} = $::form->format_amount(\%::myconfig,0, 2)." ";
- }
- my $sum_cb = 0;
- foreach my $acc ( @{ SL::DB::Manager::AccTransaction->get_all(where => [ chart_id => $chart->id, cb_transaction => 't',
- transdate => { ge => $self->cb_startdate},
- transdate => { le => $self->cb_date }]) }) {
- $sum_cb += $acc->amount;
- }
- my $sum_ob = 0;
- foreach my $acc ( @{ SL::DB::Manager::AccTransaction->get_all(where => [ chart_id => $chart->id, ob_transaction => 't',
- transdate => { ge => $self->ob_date},
- transdate => { le => $ob_next_date }]) }) {
- $sum_ob += $acc->amount;
- }
- if ( $sum_cb > 0 ) {
- $row->{sum_cb}->{data} = $::form->format_amount(\%::myconfig, $sum_cb, 2)." H";
- } elsif ( $sum_cb < 0 ) {
- $row->{sum_cb}->{data} = $::form->format_amount(\%::myconfig,-$sum_cb, 2)." S";
- } else {
- $row->{sum_cb}->{data} = $::form->format_amount(\%::myconfig,0, 2)." ";
- }
- if ( $sum_ob > 0 ) {
- $row->{sum_ob}->{data} = $::form->format_amount(\%::myconfig, $sum_ob, 2)." H";
- } elsif ( $sum_ob < 0 ) {
- $row->{sum_ob}->{data} = $::form->format_amount(\%::myconfig,-$sum_ob, 2)." S";
- } else {
- $row->{sum_ob}->{data} = $::form->format_amount(\%::myconfig,0, 2)." ";
- }
- $report->add_data($row);
- }
- $idx++;
- }
-
- $self->{row_count} = $idx;
- $main::lxdebug->leave_sub();
-}
-
-sub get_balance {
- $main::lxdebug->enter_sub();
- my ($self,$chart) = @_;
-
-## eigene Abfrage da SL:DB:Chart->get_balance keine cb_transactions mitzählt
-## Alternative in Chart cb_transaction abfrage per neuem Parameter 'with_cb' disablen:
-# my %balance_params = ( fromdate => $self->startdate,
-# todate => $self->cb_date,
-# accounting_method => 'accrual',
-# with_cb => 1, ## in Chart cb_transaction abfrage disablen
-# );
-# return $chart->get_balance(%balance_params);
-
- $main::lxdebug->message(LXDebug->DEBUG2(),"get_balance from=".$self->cb_startdate." to=".$self->cb_date);
- my $query = qq|SELECT SUM(amount) AS sum FROM acc_trans WHERE chart_id = ? | .
- qq| AND transdate >= ? AND transdate <= ? |;
- my @query_args = ( $chart->id, $self->cb_startdate, $self->cb_date);
- my ($balance) = selectfirst_array_query($::form, $chart->db->dbh, $query, @query_args);
-
- $main::lxdebug->leave_sub();
- return 0 unless $balance != 0;
- return $balance;
-}
-
-sub gl_booking {
- my ($self, $amount, $transdate, $reference, $description, $konto, $gegenkonto, $ob, $cb) = @_;
- $::form->get_employee();
- my $employee_id = $::form->{employee_id};
- $main::lxdebug->message(LXDebug->DEBUG2(),"employee_id=".$employee_id." ob=".$ob." cb=".$cb);
- my $gl_entry = SL::DB::GLTransaction->new();
- $gl_entry->assign_attributes(
- employee_id => $employee_id,
- transdate => $transdate,
- reference => $reference,
- description => $description,
- ob_transaction => $ob,
- cb_transaction => $cb,
- );
- $gl_entry->save;
- my $kto_trans1 = SL::DB::AccTransaction->new();
- $kto_trans1->assign_attributes(
- trans_id => $gl_entry->id,
- transdate => $transdate,
- ob_transaction => $ob,
- cb_transaction => $cb,
- chart_id => $gegenkonto->id,
- chart_link => $konto->link,
- tax_id => 0,
- taxkey => 0,
- amount => $amount,
- );
- $kto_trans1->save;
- my $kto_trans2 = SL::DB::AccTransaction->new();
- $kto_trans2->assign_attributes(
- trans_id => $gl_entry->id,
- transdate => $transdate,
- ob_transaction => $ob,
- cb_transaction => $cb,
- chart_id => $konto->id,
- chart_link => $konto->link,
- tax_id => 0,
- taxkey => 0,
- amount => -$amount,
- );
- $kto_trans2->save;
-}
-
-sub init_cbob_chart { $::form->{cbob_chart} }
-sub init_ob_date { $::form->{ob_date} }
-sub init_ob_reference { $::form->{ob_reference} }
-sub init_ob_description { $::form->{ob_description} }
-sub init_cb_startdate { $::form->{cb_startdate} }
-sub init_cb_date { $::form->{cb_date} }
-sub init_cb_reference { $::form->{cb_reference} }
-sub init_cb_description { $::form->{cb_description} }
-
-sub init_charts9000 {
- # wie geht prüfen von länge auf 4 in rose ?
- SL::DB::Manager::Chart->get_all( query => [ \ "accno like '9%' and length(accno) = 4"] );
- #SL::DB::Manager::Chart->get_all( query => [ accno => { like => '9%'}] );
-}
-
-sub init_charts {
- # wie geht 'not like' in rose ?
- SL::DB::Manager::Chart->get_all( query => [ \ "accno not like '9%'"], sort_by => 'accno ASC' );
-}
-
-1;
--- /dev/null
+# This is the main menu config file for user space menu entries.
+#
+# opendynamic features
+#
+---
+#
+# SB/EB-Buchungen
+#
+- parent: general_ledger
+ id: general_ledger_cbob_transactions
+ name: CB/OB Transactions
+ icon: cbob
+ order: 470
+ access: general_ledger
+ params:
+ action: YearEndTransactions/filter
+++ /dev/null
-# This is the main menu config file for user space menu entries.
-#
-# opendynamic features
-#
----
-#
-# SB/EB-Buchungen
-#
-- parent: general_ledger
- id: general_ledger_cbob_transactions
- name: CB/OB Transactions
- icon: cbob
- order: 470
- access: general_ledger
- params:
- action: YearlyTransactions/filter
use SL::DB::PurchaseInvoice;
use SL::DB::BankTransaction;
use SL::DB::AccTransaction;
-use SL::Controller::YearlyTransactions;
+use SL::Controller::YearEndTransactions;
use Data::Dumper;
my ($customer, $vendor, $currency_id, @parts, $unit, $employee, $tax, $tax7, $tax_9, $taxzone, $payment_terms, $bank_account);
$ap_transaction = test_ap_transaction(invnumber => 'purchaseinv1');
my $ar_transaction_2 = test_ar_transaction(invnumber => 'salesinv_2');
- my $yt_controller = SL::Controller::YearlyTransactions->new;
+ my $yt_controller = SL::Controller::YearEndTransactions->new;
my $report = SL::ReportGenerator->new(\%::myconfig, $::form);
$::form->{"ob_date"} = DateTime->today->truncate(to => 'year')->add(years => 1)->to_kivitendo;
--- /dev/null
+[%- USE L %]
+[%- USE LxERP %]
+<table width="100%">
+ <tr><td>
+ [%- L.hidden_tag("action","YearlyTransactions/dispatch") %]
+ [%- L.hidden_tag("cb_date",SELF.cb_date) %]
+ [%- L.hidden_tag("cb_startdate",SELF.cb_startdate) %]
+ [%- L.hidden_tag("cb_reference",SELF.cb_reference) %]
+ [%- L.hidden_tag("cb_description",SELF.cb_description) %]
+ [%- L.hidden_tag("ob_date",SELF.ob_date) %]
+ [%- L.hidden_tag("ob_reference",SELF.ob_reference) %]
+ [%- L.hidden_tag("ob_description",SELF.ob_description) %]
+ [%- L.hidden_tag("cbob_chart",SELF.cbob_chart) %]
+ [%- L.hidden_tag("rowcount",SELF.row_count) %]
+ [%- L.submit_tag("action_generate", LxERP.t8('generate cb/ob transactions for selected charts'),
+ confirm=LxERP.t8('Are you sure to generate cb/ob transactions?')) %]
+ [%- L.submit_tag("action_filter", LxERP.t8('back')) %]
+ </td>
+ </tr>
+</table></form>
+<script type='text/javascript'>
+$(function(){
+ $('#multi_all').checkall("input[name^='multi_id']");
+});
+</script>
--- /dev/null
+[%- USE HTML %]
+[%- USE T8 %]
+[%- USE L %]
+[%- USE LxERP %]
+
+<h1>[% title | html %]</h1>
+
+[%- PROCESS 'common/flash.html' %]
+
+<form id='filter_form'>
+
+<table>
+ <tr>
+ <td width="20px"></td>
+ <td align="left" colspan="5">[% 'Attention: Here will be generated a lot of CB/OB transactions.' | $T8 %]</td>
+ </tr>
+ <tr>
+ <td><p></p></td>
+ </tr>
+ <tr>
+ <th></th>
+ <th width="400px" colspan="2" align="center">[% 'CB Transactions' | $T8 %]</th>
+ <th width="400px"colspan="2" align="center">[% 'OB Transactions' | $T8 %]</th>
+ <th> </th>
+ </tr>
+ <tr>
+ <td></td>
+ <td align="right">[% 'Date' | $T8 %]</td>
+ <td>[% L.date_tag('cb_date', SELF.cb_date) %]</td>
+ <td align="right">[% 'Date' | $T8 %]</td>
+ <td>[% L.date_tag('ob_date', SELF.ob_date) %]</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td align="right">[% 'Reference' | $T8 %]</td>
+ <td>[% L.input_tag('cb_reference', SELF.cb_reference) %]</td>
+ <td align="right">[% 'Reference' | $T8 %]</td>
+ <td>[% L.input_tag('ob_reference', SELF.ob_reference) %]</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td align="right">[% 'Description' | $T8 %]</td>
+ <td>[% L.input_tag('cb_description', SELF.cb_description) %]</td>
+ <td align="right">[% 'Description' | $T8 %]</td>
+ <td>[% L.input_tag('ob_description', SELF.ob_description) %]</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><p></p></td>
+ </tr>
+ <tr>
+ <th colspan="2"></th>
+ <th align=right>[% 'close chart' | $T8 %]</th>
+ <td colspan="3">[% L.select_tag('cbob_chart', SELF.charts9000, title_sub=\make_title_of_chart, default=SELF.cbob_chart, style="width: 400px") %]</td>
+ </tr>
+</table>
+
+[% L.hidden_tag('action', 'YearlyTransactions/dispatch') %]
+<hr size=3 noshade><br>
+[% L.submit_tag('action_list', LxERP.t8('Continue')) %]
+
+</form>
--- /dev/null
+[%- USE LxERP %]
+[%- INCLUDE 'common/flash.html' %]
+<form method="post" action="controller.pl">
+<table>
+ <tr>
+ <td width="20px"></td>
+ <td colspan="6" align="left">
+ [%- LxERP.t8('Select charts for which the CB/OB transactions want to be posted.') %]<br>
+ [%- LxERP.t8('There will be two transactions done:') %]<br>
+ - [%- LxERP.t8('One SB-transaction') %] ( [% SELF.cb_date %], [% SELF.cb_reference %], [% SELF.cb_description %], [% SELF.cbob_chartaccno %] )<br>
+ - [%- LxERP.t8('One OB-transaction') %] ( [% SELF.ob_date %], [% SELF.ob_reference %], [% SELF.ob_description %], [% SELF.cbob_chartaccno %] )<br>
+ [%- LxERP.t8('No revert available.') %]
+ </td>
+ </tr>
+ <tr>
+ <td><p></p></td>
+ </tr>
+ <tr>
+ <th></th>
+ <th align="right">[% LxERP.t8('close chart') %]</th>
+ <td>[% SELF.cbob_chartaccno %]</td>
+ </tr>
+</table>
+++ /dev/null
-[%- USE L %]
-[%- USE LxERP %]
-<table width="100%">
- <tr><td>
- [%- L.hidden_tag("action","YearlyTransactions/dispatch") %]
- [%- L.hidden_tag("cb_date",SELF.cb_date) %]
- [%- L.hidden_tag("cb_startdate",SELF.cb_startdate) %]
- [%- L.hidden_tag("cb_reference",SELF.cb_reference) %]
- [%- L.hidden_tag("cb_description",SELF.cb_description) %]
- [%- L.hidden_tag("ob_date",SELF.ob_date) %]
- [%- L.hidden_tag("ob_reference",SELF.ob_reference) %]
- [%- L.hidden_tag("ob_description",SELF.ob_description) %]
- [%- L.hidden_tag("cbob_chart",SELF.cbob_chart) %]
- [%- L.hidden_tag("rowcount",SELF.row_count) %]
- [%- L.submit_tag("action_generate", LxERP.t8('generate cb/ob transactions for selected charts'),
- confirm=LxERP.t8('Are you sure to generate cb/ob transactions?')) %]
- [%- L.submit_tag("action_filter", LxERP.t8('back')) %]
- </td>
- </tr>
-</table></form>
-<script type='text/javascript'>
-$(function(){
- $('#multi_all').checkall("input[name^='multi_id']");
-});
-</script>
+++ /dev/null
-[%- USE HTML %]
-[%- USE T8 %]
-[%- USE L %]
-[%- USE LxERP %]
-
-<h1>[% title | html %]</h1>
-
-[%- PROCESS 'common/flash.html' %]
-
-<form id='filter_form'>
-
-<table>
- <tr>
- <td width="20px"></td>
- <td align="left" colspan="5">[% 'Attention: Here will be generated a lot of CB/OB transactions.' | $T8 %]</td>
- </tr>
- <tr>
- <td><p></p></td>
- </tr>
- <tr>
- <th></th>
- <th width="400px" colspan="2" align="center">[% 'CB Transactions' | $T8 %]</th>
- <th width="400px"colspan="2" align="center">[% 'OB Transactions' | $T8 %]</th>
- <th> </th>
- </tr>
- <tr>
- <td></td>
- <td align="right">[% 'Date' | $T8 %]</td>
- <td>[% L.date_tag('cb_date', SELF.cb_date) %]</td>
- <td align="right">[% 'Date' | $T8 %]</td>
- <td>[% L.date_tag('ob_date', SELF.ob_date) %]</td>
- <td></td>
- </tr>
- <tr>
- <td></td>
- <td align="right">[% 'Reference' | $T8 %]</td>
- <td>[% L.input_tag('cb_reference', SELF.cb_reference) %]</td>
- <td align="right">[% 'Reference' | $T8 %]</td>
- <td>[% L.input_tag('ob_reference', SELF.ob_reference) %]</td>
- <td></td>
- </tr>
- <tr>
- <td></td>
- <td align="right">[% 'Description' | $T8 %]</td>
- <td>[% L.input_tag('cb_description', SELF.cb_description) %]</td>
- <td align="right">[% 'Description' | $T8 %]</td>
- <td>[% L.input_tag('ob_description', SELF.ob_description) %]</td>
- <td></td>
- </tr>
- <tr>
- <td><p></p></td>
- </tr>
- <tr>
- <th colspan="2"></th>
- <th align=right>[% 'close chart' | $T8 %]</th>
- <td colspan="3">[% L.select_tag('cbob_chart', SELF.charts9000, title_sub=\make_title_of_chart, default=SELF.cbob_chart, style="width: 400px") %]</td>
- </tr>
-</table>
-
-[% L.hidden_tag('action', 'YearlyTransactions/dispatch') %]
-<hr size=3 noshade><br>
-[% L.submit_tag('action_list', LxERP.t8('Continue')) %]
-
-</form>
+++ /dev/null
-[%- USE LxERP %]
-[%- INCLUDE 'common/flash.html' %]
-<form method="post" action="controller.pl">
-<table>
- <tr>
- <td width="20px"></td>
- <td colspan="6" align="left">
- [%- LxERP.t8('Select charts for which the CB/OB transactions want to be posted.') %]<br>
- [%- LxERP.t8('There will be two transactions done:') %]<br>
- - [%- LxERP.t8('One SB-transaction') %] ( [% SELF.cb_date %], [% SELF.cb_reference %], [% SELF.cb_description %], [% SELF.cbob_chartaccno %] )<br>
- - [%- LxERP.t8('One OB-transaction') %] ( [% SELF.ob_date %], [% SELF.ob_reference %], [% SELF.ob_description %], [% SELF.cbob_chartaccno %] )<br>
- [%- LxERP.t8('No revert available.') %]
- </td>
- </tr>
- <tr>
- <td><p></p></td>
- </tr>
- <tr>
- <th></th>
- <th align="right">[% LxERP.t8('close chart') %]</th>
- <td>[% SELF.cbob_chartaccno %]</td>
- </tr>
-</table>