use SL::DBUtils;
use SL::DB::AccTransaction;
use SL::DB::Invoice;
+use SL::DB;
__PACKAGE__->run_before('check_auth');
sub action_list_turnover {
my ($self) = @_;
-
+
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id};
my $cv = $::form->{id} || {};
my $open_invoices;
$open_invoices = SL::DB::Manager::Invoice->get_all(
query => [customer_id => $cv,
- paid => {lt_sql => 'amount'},
+ paid => {lt_sql => 'amount'},
],
with_objects => ['dunnings'],
);
my ($self) = @_;
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id};
- my $dbh = $::form->get_standard_dbh();
+ my $dbh = SL::DB->client->dbh()
my $cv = $::form->{id} || {};
ORDER BY date_part DESC";
$self->{dun_statistic} = selectall_hashref_query($::form, $dbh, $query);
- $self->render('customer_vendor_turnover/count_open_items_by_year', { layout => 0 });
+ $self->render('customer_vendor_turnover/count_open_items_by_year', { layout => 0 });
}
sub action_count_open_items_by_month {
my ($self) = @_;
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id};
- my $dbh = $::form->get_standard_dbh();
+ my $dbh = SL::DB->client->dbh()
my $cv = $::form->{id} || {};
ORDER BY EXTRACT (YEAR FROM d.transdate) DESC";
$self->{dun_statistic} = selectall_hashref_query($::form, $dbh, $query);
- $self->render('customer_vendor_turnover/count_open_items_by_year', { layout => 0 });
+ $self->render('customer_vendor_turnover/count_open_items_by_year', { layout => 0 });
}
sub action_turnover_by_month {
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id};
- my $dbh = $::form->get_standard_dbh();
+ my $dbh = SL::DB->client->dbh()
my $cv = $::form->{id} || {};
my $query = "SELECT CONCAT(EXTRACT (MONTH FROM transdate),'/',EXTRACT (YEAR FROM transdate)) AS date_part,
count(id) as count,
ORDER BY EXTRACT (YEAR FROM transdate) DESC, EXTRACT (MONTH FROM transdate) DESC";
$self->{turnover_statistic} = selectall_hashref_query($::form, $dbh, $query);
- $self->render('customer_vendor_turnover/count_turnover', { layout => 0 });
+ $self->render('customer_vendor_turnover/count_turnover', { layout => 0 });
}
sub action_turnover_by_year {
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id};
- my $dbh = $::form->get_standard_dbh();
+ my $dbh = SL::DB->client->dbh()
my $cv = $::form->{id} || {};
my $query = "SELECT EXTRACT (YEAR FROM transdate) as date_part,
count(id) as count,
ORDER BY date_part DESC";
$self->{turnover_statistic} = selectall_hashref_query($::form, $dbh, $query);
- $self->render('customer_vendor_turnover/count_turnover', { layout => 0 });
+ $self->render('customer_vendor_turnover/count_turnover', { layout => 0 });
}
sub action_get_invoices {
my ($self) = @_;
-
+
return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id};
my $cv = $::form->{id} || {};